{"id":20780729,"url":"https://github.com/farrajota/human_pose_estimation_torch","last_synced_at":"2026-04-18T21:32:44.793Z","repository":{"id":202488798,"uuid":"92418033","full_name":"farrajota/human_pose_estimation_torch","owner":"farrajota","description":"Human Body Joints estimation for torch7","archived":false,"fork":false,"pushed_at":"2017-10-01T21:31:28.000Z","size":15494,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T08:46:37.015Z","etag":null,"topics":["coco","flic","human-pose-estimation","leeds-sports","mpii","torch7"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farrajota.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-05-25T15:35:45.000Z","updated_at":"2018-07-15T06:33:42.000Z","dependencies_parsed_at":"2024-05-10T23:00:57.993Z","dependency_job_id":null,"html_url":"https://github.com/farrajota/human_pose_estimation_torch","commit_stats":null,"previous_names":["farrajota/human_pose_estimation_torch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Fhuman_pose_estimation_torch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Fhuman_pose_estimation_torch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Fhuman_pose_estimation_torch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farrajota%2Fhuman_pose_estimation_torch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farrajota","download_url":"https://codeload.github.com/farrajota/human_pose_estimation_torch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243125152,"owners_count":20240263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coco","flic","human-pose-estimation","leeds-sports","mpii","torch7"],"created_at":"2024-11-17T13:39:00.161Z","updated_at":"2025-12-12T00:08:10.698Z","avatar_url":"https://github.com/farrajota.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Human Body Joints estimation for torch7\n\nTrain and test a human body joints estimator network using Lua/Torch7 for single humans on a single image. This method is a modified version of the original [hourglass networks](https://github.com/anewell/pose-hg-train). For more information see our [paper](https://link.springer.com/chapter/10.1007/978-3-319-58838-4_15).\n\nThis code provides an easy way to train a network on a variety of datasets, all available through the `dbcollection` package. The available datasets for train/test/benchmark are the following:\n\n| Dataset | Train | Test | Benchmark |\n| --- | --- | --- | --- |\n| [Frames Labeled In Cinema (FLIC)](http://bensapp.github.io/flic-dataset.html) | Yes | Yes | Yes |\n| [Leeds Sports Pose (LSP)](http://www.comp.leeds.ac.uk/mat4saj/lspet.html) | Yes | Yes | Yes |\n| [MPII](http://human-pose.mpi-inf.mpg.de/) | Yes | Yes | **No**** |\n| [COCO](http://mscoco.org/) | Yes | Yes | **No**** |\n\n\u003e Note**: Only the FLIC and LSP datasets are evaluated/benchmarked here. The MPII and COCO datasets have dedicated servers for this purpose on their websites.\n\n\n##  Network architecture\n\nThe network model used here for human body joint estimation is an enhanced version of [Newell's](https://github.com/anewell/pose-hg-train) method described in [his paper](http://arxiv.org/abs/1603.06937) with several modifications:\n\n- replaced ReLUs with [RReLUs](https://github.com/torch/nn/blob/master/doc/transfer.md#rrelu)\n- use of [spatialdropout](https://github.com/torch/nn/blob/master/doc/simple.md#spatialdropout) between convolutions\n- more data augmentation (more rotation, scaling, colour jittering)\n- use of wider feature maps (more kernels) as the image resolution decreases\n- replaced rmsprop optimization with [adam](https://arxiv.org/abs/1412.6980)\n- additional tweaks to the basic auto-encoder network\n\n\n\n## Results\n\n### FLIC dataset results\n\n#### PCK(0.2) - Observer Centric\n\n| Method | Elbow | Wrist | Total |\n| --- | --- | --- | --- |\n| Sapp et al., CVPR'13  | 72.5 | 54.5 | 63.5 |\n| Chen et al., NIPS'14  | 89.8 | 86.8 | 88.3 |\n| Yang et al., CVPR'16  | 91.6 | 88.8 | 90.2 |\n| Wei et al., CVPR'16  | 92.5 | 90.0 | 91.3 |\n| Newell et al., arXiv'16  | 98.0 | 95.5 | 96.8 |\n| *Ours*  | **98.3** | **96.0** | **97.2** |\n\n\n### LSP dataset\n\n#### PCK(0.2) - Person Centric\n\n| Method | Head | Shoulder | Elbow | Wrist | Hip | Knee  | Ankle | Total |\n| --- | --- | --- | --- | --- | --- | ---  | --- | --- |\n| Wang et al., CVPR'13  | 84.7 | 57.1  | 43.7  | 36.7  | 56.7  | 52.4 | 50.8 | 54.6 |\n| Pishchulin et al., ICCV' 13  | 87.2 | 56.7  | 46.7  | 38.0  | 61.0  | 57.5 | 52.7 | 57.1 |\n| Tompson et al., NIPS'14  | 90.6 | 79.2  | 67.9  | 63.4  | 69.5  | 71.0 | 64.2 | 72.3 |\n| Fan et al., CVPR'15  | 92.4 | 75.2  | 65.3  | 64.0  | 75.7  | 68.3 | 70.4 | 73.0 |\n| Chen et al., NIPS'14  | 91.8 | 78.2  | 71.8  | 65.5  | 73.3  | 70.2 | 63.4 | 73.4 |\n| Yang et al., CVPR'16  | 90.6 | 78.1  | 73.8  | 68.8  | 74.8  | 69.9 | 58.9 | 73.6 |\n| Rafi et al., BMVC'16  | 95.8 | 86.2  | 79.3  | 75.0  | 86.6  | 83.8 | 79.8 | 83.8 |\n| Yu et al., ECCV'16  | 87.2 | 88.2  | 82.4  | 76.3  | 91.4  | 85.8 | 78.7 | 84.3 |\n| Belagiannis et al., arXiv'16  | 95.2 | 89.0  | 81.5  | 77.0  | 83.7  | 87.0 | 82.8 | 85.2 |\n| Lifshitz et al., ECCV'16  | 96.8 | 89.0  | 82.7  | 79.1  | 90.9  | 86.0 | 82.5 | 86.7 |\n| Pishchulin et al., CVPR'16  | 97.0 | 91.0  | 83.8  | 78.1  | 91.0  | 86.7 | 82.0 | 87.1 |\n| Insafutdinov et al., ECCV'16  | 97.4 | 92.7  | 87.5  | 84.4  | 91.5  | 89.9 | 87.2 | 90.1 |\n| Wei et al., CVPR'16  | **97.8** | 92.5  | 87.0  | 83.9  | 91.5  | 90.8 | 89.9 | 90.5 |\n| Bulat et al., ECCV'16  | 97.2 | 92.1  | 88.1  | 85.2  | **92.2**  | 91.4 | 88.7 | 90.7 |\n| *Ours*  | 97.7 | **93.0**  | **88.9**  | **85.5**  | 91.5  | **92.0** | **92.1** | **91.5** |\n\n\n\u003e Note: The network was trained with data from the MPII and LSPe datasets just like most of the methods on the benchmark.\n\n## Installation\n\n### Requirements\n\nTo run the code in this repository you'll need the following resources:\n\n- [Torch7](http://torch.ch/docs/getting-started.html)\n- Matlab \u003e= 2012a (for running the benchmark code)\n- Python \u003e= 2.7 or \u003e= 3.5 (for [dbcollection](https://github.com/farrajota/dbcollection))\n- NVIDIA GPU with compute capability 3.5+ (12GB+ ram or two 6GB+ ram GPUs)\n\n\u003e Note: Here we used two 6GB GPUs to train the network. We recommend, at least, one GPU with 6GB ram for inference and one 12GB ram GPU for training the model.\n\nAlso, you'll need to install the following packages:\n\n```lua\nluarocks install display\nluarocks install cudnn\nluarocks install inn\nluarocks install matio\nluarocks install tds\nluarocks install torchnet\n```\n\n\n### dbcollection\n\nTo install the dbcollection package do the following:\n\n- install the Python module (Python\u003e=2.7 and \u003e=3.5).\n\n    ```\n    pip install dbcollection==0.1.7\n    ```\n\n    or\n\n    ```\n    conda install -c farrajota dbcollection==0.1.7\n    ```\n\n- install the Lua/Torch7 dbcollection wrapper:\n\n    1. download the Lua/Torch7 git repo to disk.\n\n    ```\n    git clone https://github.com/dbcollection/dbcollection-torch7\n    ```\n\n    2. install the package.\n    ```\n    cd dbcollection-torch7 \u0026\u0026 luarocks make\n    ```\n\n\u003e For more information about the dbcollection package see [here](https://github.com/dbcollection/dbcollection-torch7).\n\n\n\n#### Data setup\n\n`dbcollection` contains the data annotations necessary to run this code. If the data is not setup, this package will download, extract and preprocess the data annotations and store them to disk. To specify where to store the downloaded/extracted data use the `-data_dir=\u003cpath\u003e`. If left empty, and the data will be stored in `~/dbcollection/\u003cdataset\u003e/data/`.\n\nFor more information on how to setup a dataset see the [dbcollection](https://github.com/dbcollection/dbcollection) repo.\n\n\n## Getting started\n\nAfter installing the necessary requirements, it is advised to setup the necessary data before proceeding. Since the code uses `dbcollection` for managing datasets, downloading/setting up the data folders first is best if you desire to specify the dataset's directory manually. Then, to start training a network simply do `th train.lua -expID \u003cnet_name\u003e`. To use a specific dataset, for example FLIC, specify the `-dataset` input arg when running the script `th train.lua -expID \u003cnet_name\u003e -dataset flic`.\n\nMost of the command line options are pretty self-explanatory, and can be found in `options.lua`. The `-expID` option will be used to save important information in a directory like `pose-torchnet/exp/\u003cdataset\u003e/\u003cexpID\u003e/`. This directory will include snapshots of the trained model, training/validations logs with loss and accuracy information, and other details of the options set for that particular experiment.\n\n\n### Download/Setting up this repo\n\nTo use this code, clone the repo into your home directory:\n\n```\ngit clone --recursive https://github.com/farrajota/human_pose_estimation_torch\n```\n\nIf you clone the repo into a different directory, please make sure you modify `projectdir.lua` and point to the new path before using the code.\n\n\n### Training a model\n\nTo train a network you simply need to do `th train.lua`. This will train a network with the default parameters. To train a network with other options please see the `options.lua` file or look in `tests/` for some scripts that contain training procedures.\n\n\n### Testing a model\n\nWhen training a network, a small sample of the overall dataset is used to compute the current accuracy. To use the entire dataset to compute the total accuracy of a network, run `th test.lua -expID \u003cname_exp\u003e -dataset \u003cname_exp\u003e`. For the MPII dataset, the training set is split into two (train + val) and the evaluation is performed on the `val` set.\n\n\n### Benchmarking against other methods\n\nTo benchmark a trained model on the FLIC or LSP datasets run `th benchmark.lua  -expID \u003cname_exp\u003e -dataset \u003cname_exp\u003e`. This will process predictions of all body joints for all images of the selected dataset and store them to disk into two files (`Predictions.t7` + `Predictions.mat`) inside the folder of the experiment.\n\nFurthermore, for the FLIC and LSP datasets, this repo provides a comparison with other methods for body joint prediction whose predictions are made available online ([lsp results are available here](http://human-pose.mpi-inf.mpg.de/#related_benchmarks); for FLIC results I had to manually search some of them on github). To evaluate on the MPII and COCO datasets you will need to use their evaluation servers if you want to compare the results with other methods.\n\n\n### Additional information\n\n#### Accuracy metric\n\nFor convenience during training, the accuracy function evaluates the PCK metric by comparing the output heatmap of the network to the ground truth heatmap. This should provide a good enough performance measure when training a network on any dataset.\n\n\n#### Additional notes\n\nDue to problems in cleaning temporary buffers (grad/output buffers) with `:clearState()`, in order to store models to disk, this option is hidden behind an input flag. For our setup, using `:clearState()` with the GPUs memory almost maxed out, this would cause crashes due to insufficient memory when re-populating the buffers. In case of training networks that are smaller or have less parameters this should not be an issue (or if you have a GPU with 12GB+ ram).\n\n\n## Cite this paper\n\n```\n@Inbook{Farrajota2017,\n    author=\"Farrajota, M.\n    and Rodrigues, Jo{\\~a}o M. F.\n    and du Buf, J. M. H.\",\n    editor=\"Alexandre, Lu{\\'i}s A.\n    and Salvador S{\\'a}nchez, Jos{\\'e}\n    and Rodrigues, Jo{\\~a}o M. F.\",\n    title=\"Human Pose Estimation by a Series of Residual Auto-Encoders\",\n    bookTitle=\"Pattern Recognition and Image Analysis: 8th Iberian Conference, IbPRIA 2017,  Faro, Portugal, June 20-23, 2017, Proceedings\",\n    year=\"2017\",\n    publisher=\"Springer International Publishing\",\n    address=\"Cham\",\n    pages=\"131--139\",\n    isbn=\"978-3-319-58838-4\",\n    doi=\"10.1007/978-3-319-58838-4_15\",\n    url=\"https://doi.org/10.1007/978-3-319-58838-4_15\"\n}\n```\n\n## License\n\nMIT license (see the [LICENSE](LICENSE.md) file)\n\n\n## Acknowledgements\n\nThis repo is based on [Newell's](https://github.com/anewell/pose-hg-train) code for training a human pose detector.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarrajota%2Fhuman_pose_estimation_torch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarrajota%2Fhuman_pose_estimation_torch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarrajota%2Fhuman_pose_estimation_torch/lists"}