South Koreadqj5182/HACO_RELEASE
[NeurIPS 2025] This repo is official PyTorch implementation of the paper "Learning Dense Hand Contact Estimation from Imbalanced Data".
Featured achievements
The project's latest awards
#1 Repository of the week
#1 Repository of the week
#1 Repository of the week
HACO: Learning Dense Hand Contact Estimation
from Imbalanced Data
Daniel Sungho Jung, Kyoung Mu Lee
Seoul National University
NeurIPS 2025
HACO is a framework for dense hand contact estimation that addresses class and spatial imbalance issues in training on large-scale datasets. Based on 14 datasets that span hand-object, hand-hand, hand-scene, and hand-body interaction, we build a powerful model that learns dense hand contact in diverse scenarios.
Installation
- We recommend you to use an Anaconda virtual environment. Install PyTorch >=1.11.0 and Python >= 3.8.0. Our latest HACO model is tested on Python 3.8.20, PyTorch 1.11.0, CUDA 11.3.
- Setup the environment.
# Initialize conda environment
conda create -n haco python=3.8 -y
conda activate haco
# Install PyTorch
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
# Install all remaining packages
pip install -r requirements.txt
Data
You need to follow our directory structure of the data.
- For quick demo: See
docs/data_demo.md. - For evaluation: See
docs/data_eval.md. - For training: See
docs/data_train.md.
Then, download the official checkpoints and place them in the release_checkpoint from HuggingFace by running:
bash scripts/download_haco_checkpoints.sh
Quick demo (Image)
To run HACO on demo images using the WiLoR or Mediapipe hand detector, please run:
python demo.py --backbone {BACKBONE_TYPE} --detector {DETECTOR_TYPE} --checkpoint {CKPT_PATH} --input_path {INPUT_PATH}
For example,
# ViT-H (Default, HaMeR initialized) backbone
python demo.py --backbone hamer --detector wilor --checkpoint release_checkpoint/haco_neurips_hamer_checkpoint.ckpt --input_path asset/example_images
# ViT-B (ImageNet initialized) backbone
python demo.py --backbone vit-b-16 --detector wilor --checkpoint release_checkpoint/haco_neurips_vit_b_checkpoint.ckpt --input_path asset/example_images
Note: The demo includes post-processing to reduce noise in small or sparse contact areas.
Quick demo (Video)
Before the video demo, please download example videos from HuggingFace and save at asset/example_videos by running:
bash scripts/download_demo_example_videos.sh
To run HACO on demo videos using the WiLoR or Mediapipe hand detector, please run:
python demo_video.py --backbone {BACKBONE_TYPE} --checkpoint {CKPT_PATH} --input_path {INPUT_PATH}
For example,
# ViT-H (Default, HaMeR initialized) backbone
python demo_video.py --backbone hamer --checkpoint release_checkpoint/haco_neurips_hamer_checkpoint.ckpt --input_path asset/example_videos
# ViT-B (ImageNet initialized) backbone
python demo_video.py --backbone vit-b-16 --checkpoint release_checkpoint/haco_neurips_vit_b_checkpoint.ckpt --input_path asset/example_videos
Note: The demo includes post-processing for both spatial smoothing of small contact areas and temporal smoothing across frames to ensure stable contact predictions and hand detections.
Running HACO
Train
To train HACO, please run:
python train.py --backbone {BACKBONE_TYPE}
For example,
# ViT-H (Default, HaMeR initialized) backbone
python train.py --backbone hamer
# ViT-B (ImageNet initialized) backbone
python train.py --backbone vit-b-16
Test
To evaluate HACO, please run:
python test.py --backbone {BACKBONE_TYPE} --checkpoint {CKPT_PATH} --test_name {DATASET_NAME}
For example,
# ViT-H (Default, HaMeR initialized) backbone
python test.py --backbone hamer --checkpoint release_checkpoint/haco_neurips_hamer_checkpoint.ckpt --test_name MOW
# FPN (HandOccNet initialized) backbone
python test.py --backbone handoccnet --checkpoint release_checkpoint/haco_neurips_handoccnet_checkpoint.ckpt --test_name MOW
# ViT-L (ImageNet initialized) backbone
python test.py --backbone vit-l-16 --checkpoint release_checkpoint/haco_neurips_vit_l_checkpoint.ckpt --test_name MOW
# ViT-B (ImageNet initialized) backbone
python test.py --backbone vit-b-16 --checkpoint release_checkpoint/haco_neurips_vit_b_checkpoint.ckpt --test_name MOW
# ViT-S (ImageNet initialized) backbone
python test.py --backbone vit-s-16 --checkpoint release_checkpoint/haco_neurips_vit_s_checkpoint.ckpt --test_name MOW
# HRNet-W48 (ImageNet initialized) backbone
python test.py --backbone hrnet-w48 --checkpoint release_checkpoint/haco_neurips_hrnet_w48_checkpoint.ckpt --test_name MOW
# HRNet-W32 (ImageNet initialized) backbone
python test.py --backbone hrnet-w32 --checkpoint release_checkpoint/haco_neurips_hrnet_w32_checkpoint.ckpt --test_name MOW
# ResNet-152 (ImageNet initialized) backbone
python test.py --backbone resnet-152 --checkpoint release_checkpoint/haco_neurips_resnet_152_checkpoint.ckpt --test_name MOW
# ResNet-101 (ImageNet initialized) backbone
python test.py --backbone resnet-101 --checkpoint release_checkpoint/haco_neurips_resnet_101_checkpoint.ckpt --test_name MOW
# ResNet-50 (ImageNet initialized) backbone
python test.py --backbone resnet-50 --checkpoint release_checkpoint/haco_neurips_resnet_50_checkpoint.ckpt --test_name MOW
# ResNet-34 (ImageNet initialized) backbone
python test.py --backbone resnet-34 --checkpoint release_checkpoint/haco_neurips_resnet_34_checkpoint.ckpt --test_name MOW
# ResNet-18 (ImageNet initialized) backbone
python test.py --backbone resnet-18 --checkpoint release_checkpoint/haco_neurips_resnet_18_checkpoint.ckpt --test_name MOW
Technical Q&A
ImportError: cannot import name 'bool' from 'numpy': Please just comment out the linefrom numpy import bool, int, float, complex, object, unicode, str, nan, inf.np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information: Please refer to here.
Acknowledgement
We thank:
- DECO for human-scene contact estimation.
- CB Loss for inspiration on VCB Loss.
- HaMeR for Transformer-based regression architecture.
Reference
@article{jung2025haco,
title = {Learning Dense Hand Contact Estimation from Imbalanced Data},
author = {Jung, Daniel Sungho and Lee, Kyoung Mu},
journal = {Advances in Neural Information Processing Systems},
year = {2025}
}
Similar Projects
Discover other similar projects and AI models.
[NeurIPS'25]🛠️Class-imbalanced Ensemble Learning Toolbox. | 类别不平衡/长尾机器学习库
Parametric Contrastive Learning (ICCV2021) & GPaCo (TPAMI 2023)
Cost-Sensitive Learning / ReSampling / Weighting / Thresholding / BorderlineSMOTE / AdaCost / etc.
[NeurIPS 25'] A Python package that provides evaluation and visualization tools for the HO-Cap dataset
Firecrawl is the knowledge infrastructure to make your agents smarter. It connects your agents to the web, and to Alexandria, our library of everything else.
all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
😎 Everything about class-imbalanced/long-tail learning: papers, codes, frameworks, and libraries | 有关类别不平衡/长尾学习的一切:论文、代码、框架与库
Reverse engineer anything with agents, from app behavior down to native binaries.