Implementation of OpenPose MobileNet architecture using PyTorch. 😎 😎
This implementation is inspired from the paper "Real-time 2D Multi-Person Pose Estimation on CPU:
Lightweight OpenPose".
I have used "Hands from Synthetic Data" published by CMU which has 21 keypoints for every hand image.
I have removed the paf maps from the architecture and have just trained the model on keypoint maps. I will try to add it in the subsequent commits 😉.
If you would like to contribute, please feel free to do so.
- torch>=1.2.0
- torchvision>=0.3.0
- opencv>=4.2.0
- Download the "Hands from Synthetic Data" from this link and keep the folder "hand_labels_synth" in the main directory. Final directory structure below 👇 👇
$(ROOT)
|__ hand_labels_synth
|__synth1
|__ 000000.jpg
|__ 000000.json
...
|__synth2
|__ 000000.jpg
|__ 000000.json
...
|__synth3
|__ 000000.jpg
|__ 000000.json
...
|__synth4
|__ 000000.jpg
|__ 000000.json
...
|__ _checkpoints
|__ checkpoint_best.pth
|__ val.py
|__ train.py
...
- (Optional 😀) Edit the filenames in config.py files according to your requirement. Download the checkpoint file from here, place it in "_checkpoints" folder and edit the checkpoint_path file in config.py accordingly. 👍
- To prepared the dataset for training, run:
python scripts/prepare_train_labels.pyThis create a pickle file named "synth2-synth3" (according to my config.py file 😇) which can be used for training.
- To start the training process, run:
python train.pyThis will train the model and after every 1000 iterations, uses one image to predict the hand points using the trained network and stores it in "outputs" folder.
- To validate on an entire folder of images, edit the checkpoint_path variable in config.py to point the required checkpoint file,run:
python val.pyThis predicts hand points for all the images in the folder and stores the result in "_checkpoint/outputs" folder (again, according to my config.py!! 😆).
Number of Stages: 2 ; Batch Size: 8
The outputs are fairly accurate, but there are a couple of keypoints which are slightly off place. Guess it needs more training. 😁
Go ahead..pull it, train it and have fun. And don't forget to ⭐star⭐ the repo, if you like it. 😄
🌟 Happiness should be a function without any parameters 🌟
Happy Coding ❗ ❗