{"id":18638835,"url":"https://github.com/stefanopini/simple-higherhrnet","last_synced_at":"2025-04-11T10:32:00.945Z","repository":{"id":37695853,"uuid":"248863090","full_name":"stefanopini/simple-HigherHRNet","owner":"stefanopini","description":"Multi-person Human Pose Estimation with HigherHRNet in Pytorch, with TensorRT support","archived":false,"fork":false,"pushed_at":"2022-12-28T23:23:58.000Z","size":15957,"stargazers_count":144,"open_issues_count":2,"forks_count":18,"subscribers_count":8,"default_branch":"master","last_synced_at":"2023-11-07T18:03:36.362Z","etag":null,"topics":["coco-dataset","deep-learning","higher-hrnet","hrnet","human-pose-estimation","keypoint-detection","mscoco-keypoint","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefanopini.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}},"created_at":"2020-03-20T22:22:05.000Z","updated_at":"2023-09-07T07:39:01.000Z","dependencies_parsed_at":"2023-01-31T07:46:04.028Z","dependency_job_id":null,"html_url":"https://github.com/stefanopini/simple-HigherHRNet","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanopini%2Fsimple-HigherHRNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanopini%2Fsimple-HigherHRNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanopini%2Fsimple-HigherHRNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanopini%2Fsimple-HigherHRNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanopini","download_url":"https://codeload.github.com/stefanopini/simple-HigherHRNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223466502,"owners_count":17149770,"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-dataset","deep-learning","higher-hrnet","hrnet","human-pose-estimation","keypoint-detection","mscoco-keypoint","pytorch"],"created_at":"2024-11-07T05:43:55.790Z","updated_at":"2024-11-07T05:43:56.318Z","avatar_url":"https://github.com/stefanopini.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multi-person Human Pose Estimation with HigherHRNet in PyTorch\n\nThis is an unofficial implementation of the paper\n[*HigherHRNet: Scale-Aware Representation Learning for Bottom-Up Human Pose Estimation*](https://openaccess.thecvf.com/content_CVPR_2020/papers/Cheng_HigherHRNet_Scale-Aware_Representation_Learning_for_Bottom-Up_Human_Pose_Estimation_CVPR_2020_paper.pdf).  \nThe code is a simplified version of the [official code](https://github.com/HRNet/HigherHRNet-Human-Pose-Estimation)\n with the ease-of-use in mind.\n\nThe code is fully compatible with the\n [official pre-trained weights](https://github.com/HRNet/HigherHRNet-Human-Pose-Estimation).\n It supports both Windows and Linux.\n\nThis repository currently provides:\n- A slightly simpler implementation of ``HigherHRNet`` in PyTorch (\u003e=1.0) - compatible with official weights \n(``pose_higher_hrnet_*``).\n- A simple class (``SimpleHigherHRNet``) that loads the HigherHRNet network for the bottom-up human pose \nestimation, loads the pre-trained weights, and make human predictions on a single image or a batch of images.\n- Support for multi-GPU inference.\n- Multi-person support by design (HigherHRNet is a bottom-up approach).\n- A reference code that runs a live demo reading frames from a webcam or a video file.\n- **NEW** Support for TensorRT (thanks to [@gpastal24](https://github.com/gpastal24), see [#14](https://github.com/stefanopini/simple-HigherHRNet/pull/14) and [#15](https://github.com/stefanopini/simple-HigherHRNet/pull/15)).\n- **NEW** A [Jupyter Notebook](https://github.com/stefanopini/simple-HigherHRNet/blob/master/SimpleHigherHRNet_notebook.ipynb) compatible with Google Colab showcasing how to use this repository.\n    - \u003ca href=\"https://colab.research.google.com/github/stefanopini/simple-HigherHRNet/blob/master/SimpleHigherHRNet_notebook.ipynb\"\u003e\u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"\u003e\u003c/a\u003e [Click here](https://colab.research.google.com/github/stefanopini/simple-HigherHRNet/blob/master/SimpleHigherHRNet_notebook.ipynb) to open the notebook on Colab!\n\nThis repository is built along the lines of the repository\n[*simple-HRNet*](https://github.com/stefanopini/simple-HRNet).  \nUnfortunately, compared to HRNet, results and performance of HigherHRNet are somewhat disappointing: the network and \nthe required post-processing are slower and the predictions does not look more precise. \nMoreover, multiple skeletons are often predicted for the same person, requiring additional steps to filter out the\nredundant poses.  \nOn the other hand, being a bottom-up approach, HigherHRNet does not rely on any person detection algorithm like Yolo-v3\nand can be used for person detection too.\n \n### Examples\n\n\u003ctable\u003e\n \u003ctr\u003e\n  \u003ctd align=\"center\"\u003e\u003cimg src=\"./gifs/gif-01-output.gif\" width=\"100%\" height=\"auto\" /\u003e\u003c/td\u003e\n  \u003ctd align=\"center\"\u003e\u003cimg src=\"./gifs/gif-02-output.gif\" width=\"100%\" height=\"auto\" /\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/table\u003e\n\n### Class usage\n\n```\nimport cv2\nfrom SimpleHigherHRNet import SimpleHigherHRNet\n\nmodel = SimpleHigherHRNet(32, 17, \"./weights/pose_higher_hrnet_w32_512.pth\")\nimage = cv2.imread(\"image.png\", cv2.IMREAD_COLOR)\n\njoints = model.predict(image)\n```\n\nThe most useful parameters of the `__init__` function are:\n\u003ctable\u003e\n \u003ctr\u003e\n  \u003ctd\u003ec\u003c/td\u003e\u003ctd\u003enumber of channels (HRNet: 32, 48)\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003enof_joints\u003c/td\u003e\u003ctd\u003enumber of joints (COCO: 17, CrowdPose: 14)\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003echeckpoint_path\u003c/td\u003e\u003ctd\u003epath of the (official) weights to be loaded\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003eresolution\u003c/td\u003e\u003ctd\u003eimage resolution (min side), it depends on the loaded weights\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003ereturn_heatmaps\u003c/td\u003e\u003ctd\u003ethe `predict` method returns also the heatmaps\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003ereturn_bounding_boxes\u003c/td\u003e\u003ctd\u003ethe `predict` method returns also the bounding boxes\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003efilter_redundant_poses\u003c/td\u003e\u003ctd\u003eredundant poses (poses being almost identical) are filtered out\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003emax_nof_people\u003c/td\u003e\u003ctd\u003emaximum number of people in the scene\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003emax_batch_size\u003c/td\u003e\u003ctd\u003emaximum batch size used in hrnet inference\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003edevice\u003c/td\u003e\u003ctd\u003edevice (cpu or cuda)\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/table\u003e\n\n### Running the live demo\n\nFrom a connected camera:\n```\npython scripts/live-demo.py --camera_id 0\n```\nFrom a saved video:\n```\npython scripts/live-demo.py --filename video.mp4\n```\n\nFor help:\n```\npython scripts/live-demo.py --help\n```\n\n### Extracting keypoints:\n\nFrom a saved video:\n```\npython scripts/extract-keypoints.py --format csv --filename video.mp4\n```\n\nFor help:\n```\npython scripts/extract-keypoints.py --help\n```\n\n### Converting the model to TensorRT:\n\nWarning: require the installation of TensorRT (see Nvidia website) and onnx.\nOn some platforms, they can be installed with\n```\npip install tensorrt onnx\n```\n\nConverting in FP16:\n```\npython scripts/export-tensorrt-model.py --device 0 --half\n```\n\nFor help:\n```\npython scripts/export-tensorrt-model.py --help\n```\n\n### Installation instructions\n\n- Clone the repository  \n ``git clone https://github.com/stefanopini/simple-HigherHRNet.git``\n- Install the required packages  \n ``pip install -r requirements.txt``\n- Download the official pre-trained weights from \n[https://github.com/HRNet/HigherHRNet-Human-Pose-Estimation](https://github.com/HRNet/HigherHRNet-Human-Pose-Estimation)\n  \n  Direct links, COCO ([official Drive folder](https://drive.google.com/drive/folders/1X9-TzWpwbX2zQf2To8lB-ZQHMYviYYh6)):\n  - w48 640 (more accurate, but slower)   \n    [pose_higher_hrnet_w48_640.pth.tar](https://drive.google.com/file/d/10j9Wx_I2H6qaw-prAdlJ44fLryDtA-ah/view)\n  - w32 640 (less accurate, but faster)  \n    [pose_higher_hrnet_w32_640.pth.tar](https://drive.google.com/file/d/1uEcQlm1rjV-JRgVbaP79Y5sMLqUX2ciD/view)\n  - w32 512 (even less accurate, but even faster) - Used as default in `live_demo.py`  \n    [pose_higher_hrnet_w32_512.pth](https://drive.google.com/file/d/1V9Iz0ZYy9m8VeaspfKECDW0NKlGsYmO1/view)\n  \n  Remember to set the parameters of SimpleHigherHRNet accordingly (in particular `c` and `resolution`).\n- Your folders should look like:\n    ```\n    simple-HigherHRNet\n    ├── gifs                    (preview in README.md)\n    ├── misc                    (misc)\n    ├── models                  (pytorch models)\n    ├── scripts                 (scripts)\n    └── weights                 (HigherHRnet weights)\n    ```\n\n### ToDos\n- [x] Add keypoint extraction script (thanks to [@wuyenlin](https://github.com/wuyenlin))\n- [ ] Optimize the post-processing steps\n- [ ] Add COCO dataset and evaluation\n- [ ] Add Train/Test scripts\n- [x] Add TensorRT support\n- [x] Add notebook compatible with Colab\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanopini%2Fsimple-higherhrnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanopini%2Fsimple-higherhrnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanopini%2Fsimple-higherhrnet/lists"}