Sign inSign up

humanoidsctu/hrnet

By humanoidsctu

•Updated almost 3 years ago

Image
0

178

humanoidsctu/hrnet repository overview

This image has been used for the paper: https://link.springer.com/article/10.3758/s13428-025-02816-x⁠ (free access to the pdf: https://rdcu.be/eFwac⁠) The Dockerfile is available in the osf repository: https://osf.io/rswvn/⁠

⁠0. Prerequisite

The host computer must have the appropriate packages installed to allow GPUs to be used by the Docker containers, e.g., for Nvidia GPUs, it requires to install the Nvidia container toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html⁠

All ready-to-use Docker containers (including this one), are constrained to the dependencies software versions they had when built. The main cause for compatibility issues and the container not working properly comes from the graphic card and the versions of CUDA/cudnn/Pytorch. In particular, any recent enough GPU that is not handled by the pre-installed version would lead to errors, or the images/videos not being processed. In such a case, the fix is to use the Dockerfile shared on our osf and modify the appropriate lines to use versions of the software. For example, using an Nvidia GPU RTX A4000 or A5000 requires to modify the Dockerfile to use CUDA version 11.3, and cudnn 8; then to rebuild a docker container using the updated Dockerfile.

⁠1. Docker build

Dockerfile based on the official Dockerfile from ~July-August 2022 https://github.com/open-mmlab/mmpose/tree/master/docker⁠ with added MMDetection installation

Also see: https://mmdetection.readthedocs.io/en/stable/get_started.html⁠ https://mmpose.readthedocs.io/en/v0.28.0/install.html⁠

docker build -t hrnet:paper .

⁠2. Docker startup

Default command: sudo docker run --rm --gpus all -it -e="DISPLAY" -v=/tmp/.X11-unix:/tmp/.X11-unix:rw -v /home/$user:/home/$user hrnet:paper /bin/bash

Replace $user by the session's username.

Add -v /media:/media to give access to external hard drives.

If needed, limit the amount of RAM shared with docker with the parameter: --shm-size=8gb

⁠3. Processing commands for HRNet through MMPose:

Replace $data_path by the path to the data folder and $result_path by the path to the result folder. Note that both folders should created before the script is run.

Memory profiling can be done by adding the following command before the processing commands described below: mprof run --include-children --multiprocess --output $result_path/mmpose_td/mprofile.dat mprof run --include-children --multiprocess --output $result_path/mmpose_bu/mprofile.dat

⁠3.1 HRNet Top-Down (w48) through MMPose Top-down:

Add the following to output images with keypoints and skeleton --out-img-root $result_path/mmpose_td/vis

⁠3.1.1 Processing images in a folder inside the Docker without visualisating

About script top_down_img_demo_with_mmdet.py:

  • Rows 66-73 added option to specify export path
  • Rows 79-80 commented asserts for visualization
  • Row 100-101 added to loop through all pictures
  • Rows 129-130 added to export detections

python demo/top_down_img_demo_with_mmdet.py ../mmdetection/configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py mmpose_topdown_configs/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco-5324cff8.pth configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/hrnet_w48_coco_384x288_dark.py mmpose_topdown_configs/hrnet_w48_coco_384x288_dark-e881a4b6_20210203.pth --img-root $data_path/images/ --img "$i" --export $result_path/mmpose_td/keypoints_raw

⁠3.1.2 Processing a video inside Docker without visualisation

About script top_down_video_demo_with_mmdet.py:

  • Row 22 variable initialization
  • Rows 81-84 added option to specify export path
  • Row 90 commented assert for visualization

python demo/top_down_video_demo_with_mmdet.py ../mmdetection/configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py mmpose_topdown_configs/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco-5324cff8.pth configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/hrnet_w48_coco_384x288_dark.py mmpose_topdown_configs/hrnet_w48_coco_384x288_dark-e881a4b6_20210203.pth --video-path $data_path/$video --export $result_path/mmpose_td/keypoints_raw

$video should be the name of the video.

To avoid potential changes or unavailability of the files, and ensure reproduction of results, the configuration files were downloaded on 2023.01.11 from:

  1. https://download.openmmlab.com/mmdetection/v2.0/benchmark/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco-5324cff8.pthlas file mmpose_topdown_configs/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco-5324cff8.pth
  2. https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_384x288_dark-e881a4b6_20210203.pthas file mmpose_topdown_configs/hrnet_w48_coco_384x288_dark-e881a4b6_20210203.pth

⁠3.2 HRNet Bottom-Up (w32) through MMPose Bottom-Up:

Add the following to output images with keypoints and skeleton: --out-img-root $result_path/mmpose_bu/vis

⁠3.2.1 Processing images in a folder inside the Docker without visualisating

About script bottom_up_img_demo.py:

  • Rows 53-57 added option to specify export path
  • Row 59 commented assert for visualisation
  • Rows 107-108 added to export detections

python demo/bottom_up_img_demo.py configs/body/2d_kpt_sview_rgb_img/associative_embedding/coco/hrnet_w32_coco_512x512.py mmpose_bottomup_configs/hrnet_w32_coco_512x512-bcb8c247_20200816.pth --img-path $data_path/images/ --export $result_path/mmpose_bu/keypoints_raw

⁠3.2.2 Processing a video inside Docker without visualisation

About script bottom_up_video_demo.py:

  • Row 15 variable initialization
  • Rows 50-53 added option to specify export path
  • Row 56 commented assert for visualisation
  • Rows 109-111 added to export detections

python demo/bottom_up_video_demo.py configs/body/2d_kpt_sview_rgb_img/associative_embedding/coco/hrnet_w32_coco_512x512.py mmpose_bottomup_configs/hrnet_w32_coco_512x512-bcb8c247_20200816.pth --video-path $data_path/$video --export $result_path/mmpose_bu/keypoints_raw

$video should be the name of the video.

To avoid potential changes or unavailability of the file, and ensure reproduction of results even without an internet connection, the model weights were downloaded on 2023.01.11 from https://download.openmmlab.com/mmpose/bottom_up/hrnet_w32_coco_512x512-bcb8c247_20200816.pth as file mmpose_bottomup_configs/hrnet_w32_coco_512x512-bcb8c247_20200816.pth, added to the gitlab repository, and the local version is used to run MMPose Bottom Up, rather than being always downloaded from openmmlab servers.

Tag summary

Content type

Image

Digest

sha256:623f26a80…

Size

4.3 GB

Last updated

almost 3 years ago

docker pull humanoidsctu/hrnet:paper