Home

Awesome

Ego2Hands

<img src="imgs/00198_gt_vis_seq2.png" width="320"> <img src="imgs/00198_gt_vis_seq4.png" width="320">

<img src="imgs/00198_gt_vis_seq5.png" width="320"> <img src="imgs/00198_gt_vis_seq7.png" width="320">

Ego2Hands is a large-scale dataset for the task of color-based two-hand segmentation/detection in unconstrained environments. The training set provides images of only the right hands from 22 subjects with segmentation and hand energy ground truth annotation, allowing compositing-based data generation for unlimited training data with segmentation and detection ground truth. The evaluation set provides 8 sequences from 4 subjects, covering different scenes, skin tones and various level of illumination. This dataset is introduced by our paper Ego2Hands: A Dataset for Egocentric Two-hand Segmentation and Detection.

We recently added pose annotation for the Ego2Hands. For more details please check out 3D Hands For All.

See our Youtube Demo for a sample application in color-based gesture control. <img src="imgs/demo.webp" width="480">

Convolutional Segmentation Machine

We introduce a well-balanced architecture with compact model size, fast inference speed and high accuracy for real-time two-hand segmentation/detection. The implementation for training and testing is provided using Pytorch.

To run the script, please follow the instructions below:

  1. Download the repository
  2. Download the Ego2Hands dataset
  1. Download the pretrained models (Optional) We provide pretrained models with input edge channel and energy output channel as well as the scene-adapted models for the 8 evaluation sequences. You can test the models' performance by copying the provided models into the correct directory and following the instructions for testing below.

  2. Environment Setup We used the following steps to set up the proper environment in Anaconda on a Windows machine:

conda create --name ego2hands_env python=3.7
conda activate ego2hands_env
conda install -c anaconda numpy
conda install -c conda-forge opencv
conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch (see https://pytorch.org/ for a proper setting specific for your machine)
conda install -c conda-forge easydict
conda install -c intel pyyaml

  1. Usage:
    Run the following code for testing different functionalities using the arguments below:

Gesture Control

We collected a small gesture dataset (2 subjects, 5 static gestures). The "gesture_annotations.txt" file consists of all the bounding box, label, image path info needed to extract the squared bounding boxes for creating input images.

We trained a very simple classifier (Resnet with only 2 downsampling layers each with 1 block followed by fully connected layer) to classify 5 classes given a cropped hand segmentation image (64x64, binary input). Feel free to train your classifier using our gesture dataset for real-time gesture control.

For overwriting the keyboard keys with python control, please keep in mind that games that use DirectX need "PyDirectInput" for key controls and mouse clicks. To simulate mouse movement (with speed instead of instant location change), try this solution. Remember that both the operating command prompt and the game need to be opened with administrator priviledges to enable python control.

License

This dataset can only be used for scientific/non-commercial purposes. If you use this dataset in your research, please cite the corresponding paper.