[handbyhand] MMPOSE
太变态了~
方案集合:Awesome Hand Pose Estimation
Ref: https://mmpose.readthedocs.io/en/latest/install.html
1 2 3 4 5 | conda create -n open -mmlab python=3.7 -y conda activate open -mmlab conda install pytorch==1.8.0 torchvision==0.9.0 cudatoolkit=10.0 -c pytorch pip install mmcv-full -f https: //download .openmmlab.com /mmcv/dist/cu100/torch1 .8.0 /index .html |
动物行为检测
人体行为检测
https://colab.research.google.com/github/open-mmlab/mmpose/blob/master/demo/MMPose_Tutorial.ipynb
Tutorial
https://www.kaggle.com/code/rkuo2000/mmpose/notebook 【非常好】
安装过程中可能面临的糟心事的解决办法:
https://github.com/SeanChenxy/HandMesh
https://github.com/MPI-IS/mesh【先安装,再cmd test】
ImportError: No module named 'pycocotools'
(handmesh) jeffrey@unsw$ pip install -U cython Collecting cython Using cached Cython-0.29.28-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB) Installing collected packages: cython Successfully installed cython-0.29.28 (handmesh) jeffrey@unsw$ pip install pycocotools
https://github.com/gulvarol/smplpytorch
$ pip install smplpytorch
ModuleNotFoundError: No module named 'tensorboardX'
$ conda install -c conda-forge tensorboardx
看上去成功了!
(handmesh) jeffrey@unsw-ThinkPad-T490:HandMesh$ ./scripts/demo_cmr.sh Downloading: "https://download.pytorch.org/models/resnet18-5c106cde.pth" to /home/jeffrey/.cache/torch/hub/checkpoints/resnet18-5c106cde.pth 100%|█████████████████████████████████████████████████████████████████████████████████████| 44.7M/44.7M [00:07<00:00, 6.35MB/s] Load checkpoint /root/HandMesh/out/FreiHAND/cmr_pg/checkpoints/cmr_pg_res18_freihand.pt DEMO |################################| (20/20) (handmesh) jeffrey@unsw-ThinkPad-T490:HandMesh$
In [1]:
!git clone https://github.com/open-mmlab/mmpose
%cd mmpose
Cloning into 'mmpose'... remote: Enumerating objects: 14772, done. remote: Counting objects: 100% (442/442), done. remote: Compressing objects: 100% (276/276), done. remote: Total 14772 (delta 252), reused 270 (delta 156), pack-reused 14330 Receiving objects: 100% (14772/14772), 22.72 MiB | 11.08 MiB/s, done. Resolving deltas: 100% (10301/10301), done. /kaggle/working/mmpose
Install MMDetection (MMdet)
MMDetection is an open source object detection toolbox based on PyTorch
In [2]:
# Install mmdet
!pip install -q openmim
!mim install mmdet
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
installing mmdet from https://github.com/open-mmlab/mmdetection.git.
Cloning into '/tmp/tmpr3_ujzrd/mmdetection'...
remote: Enumerating objects: 21762, done.
remote: Total 21762 (delta 0), reused 0 (delta 0), pack-reused 21762
Receiving objects: 100% (21762/21762), 25.18 MiB | 9.55 MiB/s, done.
Resolving deltas: 100% (15294/15294), done.
Note: checking out 'c76ab0eb3c637b86c343d8454e07e00cfecc1b78'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
installing dependency: mmcv-full
installing mmcv-full from wheel.
Looking in links: https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html
Collecting mmcv-full==1.3.17
Downloading https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/mmcv_full-1.3.17-cp37-cp37m-manylinux1_x86_64.whl (28.5 MB)
|████████████████████████████████| 28.5 MB 8.4 MB/s
Requirement already satisfied: numpy in /opt/conda/lib/python3.7/site-packages (from mmcv-full==1.3.17) (1.19.5)
Collecting yapf
Downloading yapf-0.31.0-py2.py3-none-any.whl (185 kB)
|████████████████████████████████| 185 kB 290 kB/s
Requirement already satisfied: Pillow in /opt/conda/lib/python3.7/site-packages (from mmcv-full==1.3.17) (8.2.0)
Requirement already satisfied: packaging in /opt/conda/lib/python3.7/site-packages (from mmcv-full==1.3.17) (21.0)
Requirement already satisfied: pyyaml in /opt/conda/lib/python3.7/site-packages (from mmcv-full==1.3.17) (5.4.1)
Collecting addict
Downloading addict-2.4.0-py3-none-any.whl (3.8 kB)
Requirement already satisfied: opencv-python>=3 in /opt/conda/lib/python3.7/site-packages (from mmcv-full==1.3.17) (4.5.4.58)
Requirement already satisfied: pyparsing>=2.0.2 in /opt/conda/lib/python3.7/site-packages (from packaging->mmcv-full==1.3.17) (2.4.7)
Installing collected packages: yapf, addict, mmcv-full
Successfully installed addict-2.4.0 mmcv-full-1.3.17 yapf-0.31.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Successfully installed mmcv-full.
Successfully installed dependencies.
Requirement already satisfied: cython in /opt/conda/lib/python3.7/site-packages (from -r /tmp/tmpr3_ujzrd/mmdetection/requirements/build.txt (line 2)) (0.29.24)
Requirement already satisfied: numpy in /opt/conda/lib/python3.7/site-packages (from -r /tmp/tmpr3_ujzrd/mmdetection/requirements/build.txt (line 3)) (1.19.5)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Processing /tmp/tmpr3_ujzrd/mmdetection
Requirement already satisfied: matplotlib in /opt/conda/lib/python3.7/site-packages (from mmdet==2.18.1) (3.4.3)
Requirement already satisfied: numpy in /opt/conda/lib/python3.7/site-packages (from mmdet==2.18.1) (1.19.5)
Requirement already satisfied: six in /opt/conda/lib/python3.7/site-packages (from mmdet==2.18.1) (1.16.0)
Collecting terminaltables
Downloading terminaltables-3.1.0.tar.gz (12 kB)
Collecting pycocotools
Downloading pycocotools-2.0.2.tar.gz (23 kB)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/conda/lib/python3.7/site-packages (from matplotlib->mmdet==2.18.1) (1.3.2)
Requirement already satisfied: pillow>=6.2.0 in /opt/conda/lib/python3.7/site-packages (from matplotlib->mmdet==2.18.1) (8.2.0)
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.7/site-packages (from matplotlib->mmdet==2.18.1) (0.10.0)
Requirement already satisfied: pyparsing>=2.2.1 in /opt/conda/lib/python3.7/site-packages (from matplotlib->mmdet==2.18.1) (2.4.7)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.7/site-packages (from matplotlib->mmdet==2.18.1) (2.8.0)
Requirement already satisfied: setuptools>=18.0 in /opt/conda/lib/python3.7/site-packages (from pycocotools->mmdet==2.18.1) (58.0.4)
Requirement already satisfied: cython>=0.27.3 in /opt/conda/lib/python3.7/site-packages (from pycocotools->mmdet==2.18.1) (0.29.24)
Building wheels for collected packages: mmdet, pycocotools, terminaltables
Building wheel for mmdet (setup.py) ... - \ | / - \ | / - done
Created wheel for mmdet: filename=mmdet-2.18.1-py3-none-any.whl size=1229748 sha256=bc3820b64de4666f5189f79f6de7c3222c7b87002c24f6d3161ea3a032b17bbd
Stored in directory: /tmp/pip-ephem-wheel-cache-oqgxn3mq/wheels/0d/b1/27/03a7cfc792c3e14740e6ba11bc8fdcbb905bc0d44c49704b66
Building wheel for pycocotools (setup.py) ... - \ | / - \ | / done
Created wheel for pycocotools: filename=pycocotools-2.0.2-cp37-cp37m-linux_x86_64.whl size=272255 sha256=c55a1e082429ac03a92dcf1c068fcc624c1dc79bff863f580311f99910fce99c
Stored in directory: /root/.cache/pip/wheels/bc/cf/1b/e95c99c5f9d1648be3f500ca55e7ce55f24818b0f48336adaf
Building wheel for terminaltables (setup.py) ... - done
Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15354 sha256=5e2ef0828de26264aebdb48040e7a8354b114232b09411ef760473fe2597d420
Stored in directory: /root/.cache/pip/wheels/ba/ad/c8/2d98360791161cd3db6daf6b5e730f34021fc9367d5879f497
Successfully built mmdet pycocotools terminaltables
Installing collected packages: terminaltables, pycocotools, mmdet
Successfully installed mmdet-2.18.1 pycocotools-2.0.2 terminaltables-3.1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Successfully installed mmdet.
In [3]:
!pip install -q chumpy json_tricks munkres xtcocotools
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-io 0.18.0 requires tensorflow-io-gcs-filesystem==0.18.0, which is not installed.
explainable-ai-sdk 1.3.2 requires xai-image-widget, which is not installed.
beatrix-jupyterlab 3.1.1 requires google-cloud-bigquery-storage, which is not installed.
yellowbrick 1.3.post1 requires numpy<1.20,>=1.16.0, but you have numpy 1.21.4 which is incompatible.
tfx-bsl 1.3.0 requires absl-py<0.13,>=0.9, but you have absl-py 0.14.0 which is incompatible.
tfx-bsl 1.3.0 requires numpy<1.20,>=1.16, but you have numpy 1.21.4 which is incompatible.
tfx-bsl 1.3.0 requires pyarrow<3,>=1, but you have pyarrow 5.0.0 which is incompatible.
tensorflow 2.6.0 requires numpy~=1.19.2, but you have numpy 1.21.4 which is incompatible.
tensorflow 2.6.0 requires six~=1.15.0, but you have six 1.16.0 which is incompatible.
tensorflow 2.6.0 requires tensorboard~=2.6, but you have tensorboard 2.5.0 which is incompatible.
tensorflow 2.6.0 requires typing-extensions~=3.7.4, but you have typing-extensions 3.10.0.2 which is incompatible.
tensorflow-transform 1.3.0 requires absl-py<0.13,>=0.9, but you have absl-py 0.14.0 which is incompatible.
tensorflow-transform 1.3.0 requires numpy<1.20,>=1.16, but you have numpy 1.21.4 which is incompatible.
tensorflow-transform 1.3.0 requires pyarrow<3,>=1, but you have pyarrow 5.0.0 which is incompatible.
tensorflow-io 0.18.0 requires tensorflow<2.6.0,>=2.5.0, but you have tensorflow 2.6.0 which is incompatible.
pdpbox 0.2.1 requires matplotlib==3.1.1, but you have matplotlib 3.4.3 which is incompatible.
numba 0.54.0 requires numpy<1.21,>=1.17, but you have numpy 1.21.4 which is incompatible.
matrixprofile 1.1.10 requires protobuf==3.11.2, but you have protobuf 3.19.0 which is incompatible.
imbalanced-learn 0.8.1 requires scikit-learn>=0.24, but you have scikit-learn 0.23.2 which is incompatible.
apache-beam 2.32.0 requires dill<0.3.2,>=0.3.1.1, but you have dill 0.3.4 which is incompatible.
apache-beam 2.32.0 requires numpy<1.21.0,>=1.14.3, but you have numpy 1.21.4 which is incompatible.
apache-beam 2.32.0 requires pyarrow<5.0.0,>=0.15.1, but you have pyarrow 5.0.0 which is incompatible.
apache-beam 2.32.0 requires typing-extensions<3.8.0,>=3.7.0, but you have typing-extensions 3.10.0.2 which is incompatible.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
2D Human Pose
In [4]:
!cp demo/top_down_img_demo.py .
!python top_down_img_demo.py \
configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/hrnet_w48_coco_256x192.py \
https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_256x192-b9e0b3ab_20200708.pth \
--img-root tests/data/coco/ --json-file tests/data/coco/test_coco.json \
--out-img-root results --device=cpu
loading annotations into memory... Done (t=0.00s) creating index... index created! load checkpoint from http path: https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_256x192-b9e0b3ab_20200708.pth Downloading: "https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_256x192-b9e0b3ab_20200708.pth" to /root/.cache/torch/hub/checkpoints/hrnet_w48_coco_256x192-b9e0b3ab_20200708.pth 100%|████████████████████████████████████████| 243M/243M [00:27<00:00, 9.20MB/s]
In [5]:
!ls -l results
total 496 -rw-r--r-- 1 root root 107904 Nov 24 10:36 vis_0.jpg -rw-r--r-- 1 root root 112984 Nov 24 10:36 vis_1.jpg -rw-r--r-- 1 root root 153376 Nov 24 10:36 vis_2.jpg -rw-r--r-- 1 root root 124085 Nov 24 10:36 vis_3.jpg
In [6]:
from IPython.display import Image
In [7]:
Image('results/vis_0.jpg')
Out[7]:

In [8]:
Image('results/vis_1.jpg')
Out[8]:

In [9]:
Image('results/vis_2.jpg')
Out[9]:

In [10]:
Image('results/vis_3.jpg')
Out[10]:

2D Human Whole-Body
In [11]:
!cp demo/top_down_img_demo_with_mmdet.py .
!python top_down_img_demo_with_mmdet.py \
demo/mmdetection_cfg/faster_rcnn_r50_fpn_coco.py \
https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
configs/wholebody/2d_kpt_sview_rgb_img/topdown_heatmap/coco-wholebody/hrnet_w48_coco_wholebody_384x288_dark_plus.py \
https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918.pth \
--img-root tests/data/coco/ \
--img 000000196141.jpg \
--out-img-root results --device=cpu
load checkpoint from http path: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth Downloading: "https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth" to /root/.cache/torch/hub/checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth 100%|████████████████████████████████████████| 160M/160M [00:19<00:00, 8.49MB/s] load checkpoint from http path: https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918.pth Downloading: "https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918.pth" to /root/.cache/torch/hub/checkpoints/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918.pth 100%|████████████████████████████████████████| 243M/243M [00:28<00:00, 8.90MB/s]
In [12]:
Image('results/vis_000000196141.jpg')
Out[12]:

2D Hand Pose
In [13]:
!python top_down_img_demo_with_mmdet.py demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_1class.py \
https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth \
configs/hand/2d_kpt_sview_rgb_img/topdown_heatmap/onehand10k/res50_onehand10k_256x256.py \
https://download.openmmlab.com/mmpose/top_down/resnet/res50_onehand10k_256x256-e67998f6_20200813.pth \
--img-root tests/data/onehand10k/ \
--img 9.jpg \
--out-img-root results --device=cpu
load checkpoint from http path: https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth Downloading: "https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth" to /root/.cache/torch/hub/checkpoints/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth 100%|████████████████████████████████████████| 486M/486M [00:58<00:00, 8.74MB/s] load checkpoint from http path: https://download.openmmlab.com/mmpose/top_down/resnet/res50_onehand10k_256x256-e67998f6_20200813.pth Downloading: "https://download.openmmlab.com/mmpose/top_down/resnet/res50_onehand10k_256x256-e67998f6_20200813.pth" to /root/.cache/torch/hub/checkpoints/res50_onehand10k_256x256-e67998f6_20200813.pth 100%|████████████████████████████████████████| 130M/130M [00:15<00:00, 8.54MB/s]
In [14]:
Image('results/vis_9.jpg')
Out[14]:

2D Face Keypoints
In [15]:
#Using face bounding box detectors
!pip install face_recognition
Collecting face_recognition
Downloading face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: Click>=6.0 in /opt/conda/lib/python3.7/site-packages (from face_recognition) (7.1.2)
Requirement already satisfied: numpy in /opt/conda/lib/python3.7/site-packages (from face_recognition) (1.21.4)
Requirement already satisfied: Pillow in /opt/conda/lib/python3.7/site-packages (from face_recognition) (8.2.0)
Requirement already satisfied: dlib>=19.7 in /opt/conda/lib/python3.7/site-packages (from face_recognition) (19.22.1)
Collecting face-recognition-models>=0.3.0
Downloading face_recognition_models-0.3.0.tar.gz (100.1 MB)
|████████████████████████████████| 100.1 MB 1.6 MB/s
Building wheels for collected packages: face-recognition-models
Building wheel for face-recognition-models (setup.py) ... - \ | / - \ | done
Created wheel for face-recognition-models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566185 sha256=0531389270068094388a73929a8e41e0c40450e1b2b1a4da10a954ab452db9ec
Stored in directory: /root/.cache/pip/wheels/d6/81/3c/884bcd5e1c120ff548d57c2ecc9ebf3281c9a6f7c0e7e7947a
Successfully built face-recognition-models
Installing collected packages: face-recognition-models, face-recognition
Successfully installed face-recognition-1.3.0 face-recognition-models-0.3.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
In [16]:
!cp demo/face_img_demo.py .
!python face_img_demo.py \
configs/face/2d_kpt_sview_rgb_img/topdown_heatmap/aflw/hrnetv2_w18_aflw_256x256.py \
https://download.openmmlab.com/mmpose/face/hrnetv2/hrnetv2_w18_aflw_256x256-f2bbc62b_20210125.pth \
--img-root tests/data/aflw/ \
--img image04476.jpg \
--out-img-root results --device=cpu
load checkpoint from http path: https://download.openmmlab.com/mmpose/face/hrnetv2/hrnetv2_w18_aflw_256x256-f2bbc62b_20210125.pth Downloading: "https://download.openmmlab.com/mmpose/face/hrnetv2/hrnetv2_w18_aflw_256x256-f2bbc62b_20210125.pth" to /root/.cache/torch/hub/checkpoints/hrnetv2_w18_aflw_256x256-f2bbc62b_20210125.pth 100%|██████████████████████████████████████| 37.2M/37.2M [00:04<00:00, 8.48MB/s]
In [17]:
Image('results/vis_image04476.jpg')
Out[17]:

3D Human Pose
In [18]:
!rm results/*
In [19]:
!cp demo/body3d_two_stage_img_demo.py .
!python body3d_two_stage_img_demo.py \
configs/body/3d_kpt_sview_rgb_img/pose_lift/h36m/simplebaseline3d_h36m.py \
https://download.openmmlab.com/mmpose/body3d/simple_baseline/simple3Dbaseline_h36m-f0ad73a4_20210419.pth \
--json-file tests/data/h36m/h36m_coco.json \
--img-root tests/data/h36m \
--camera-param-file tests/data/h36m/cameras.pkl \
--only-second-stage \
--out-img-root results \
--rebase-keypoint-height \
--show-ground-truth --device=cpu
loading annotations into memory... Done (t=0.00s) creating index... index created! Stage 1: load 2D pose results from Json file. Stage 2: 2D-to-3D pose lifting. load checkpoint from http path: https://download.openmmlab.com/mmpose/body3d/simple_baseline/simple3Dbaseline_h36m-f0ad73a4_20210419.pth Downloading: "https://download.openmmlab.com/mmpose/body3d/simple_baseline/simple3Dbaseline_h36m-f0ad73a4_20210419.pth" to /root/.cache/torch/hub/checkpoints/simple3Dbaseline_h36m-f0ad73a4_20210419.pth 100%|██████████████████████████████████████| 16.4M/16.4M [00:02<00:00, 7.74MB/s] [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 4/4, 3.0 task/s, elapsed: 1s, ETA: 0s
In [20]:
!ls -l results
total 264 -rw-r--r-- 1 root root 65691 Nov 24 10:41 vis_0.jpg -rw-r--r-- 1 root root 64557 Nov 24 10:41 vis_1.jpg -rw-r--r-- 1 root root 64984 Nov 24 10:41 vis_2.jpg -rw-r--r-- 1 root root 67409 Nov 24 10:41 vis_3.jpg
In [21]:
Image('results/vis_0.jpg')
Out[21]:

In [22]:
Image('results/vis_1.jpg')
Out[22]:

In [23]:
Image('results/vis_2.jpg')
Out[23]:

In [24]:
Image('results/vis_3.jpg')
Out[24]:

2D Pose Tracking
In [25]:
!rm results/*
In [26]:
!cp demo/top_down_pose_tracking_demo_with_mmdet.py .
!python top_down_pose_tracking_demo_with_mmdet.py \
demo/mmdetection_cfg/faster_rcnn_r50_fpn_coco.py \
https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/res50_coco_256x192.py \
https://download.openmmlab.com/mmpose/top_down/resnet/res50_coco_256x192-ec54d7f3_20200709.pth \
--video-path demo/resources/demo.mp4 \
--out-video-root results --device=cpu
load checkpoint from http path: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth load checkpoint from http path: https://download.openmmlab.com/mmpose/top_down/resnet/res50_coco_256x192-ec54d7f3_20200709.pth Downloading: "https://download.openmmlab.com/mmpose/top_down/resnet/res50_coco_256x192-ec54d7f3_20200709.pth" to /root/.cache/torch/hub/checkpoints/res50_coco_256x192-ec54d7f3_20200709.pth 100%|████████████████████████████████████████| 130M/130M [00:16<00:00, 8.49MB/s] Traceback (most recent call last): File "top_down_pose_tracking_demo_with_mmdet.py", line 189, in <module> main() File "top_down_pose_tracking_demo_with_mmdet.py", line 179, in main if cv2.waitKey(1) & 0xFF == ord('q'): cv2.error: OpenCV(4.5.4-dev) /tmp/pip-req-build-0culq997/opencv/modules/highgui/src/window.cpp:1340: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'
In [27]:
!mv results/vis_demo.mp4 .
# download vis_demo.mp4 to see it on PC
2D Animal Pose
In [28]:
!python top_down_img_demo.py \
configs/animal/2d_kpt_sview_rgb_img/topdown_heatmap/macaque/res50_macaque_256x192.py \
https://download.openmmlab.com/mmpose/animal/resnet/res50_macaque_256x192-98f1dd3a_20210407.pth \
--img-root tests/data/macaque/ --json-file tests/data/macaque/test_macaque.json \
--out-img-root results --device=cpu
loading annotations into memory... Done (t=0.00s) creating index... index created! load checkpoint from http path: https://download.openmmlab.com/mmpose/animal/resnet/res50_macaque_256x192-98f1dd3a_20210407.pth Downloading: "https://download.openmmlab.com/mmpose/animal/resnet/res50_macaque_256x192-98f1dd3a_20210407.pth" to /root/.cache/torch/hub/checkpoints/res50_macaque_256x192-98f1dd3a_20210407.pth 100%|████████████████████████████████████████| 130M/130M [00:15<00:00, 8.79MB/s]
In [29]:
!ls -l results
total 576 -rw-r--r-- 1 root root 157240 Nov 24 10:42 vis_0.jpg -rw-r--r-- 1 root root 428286 Nov 24 10:42 vis_1.jpg
In [30]:
Image('results/vis_0.jpg')
Out[30]:

In [31]:
Image('results/vis_1.jpg')
Out[31]:

3D Hand Pose
In [32]:
!cp demo/interhand3d_img_demo.py .
!python interhand3d_img_demo.py \
configs/hand/3d_kpt_sview_rgb_img/internet/interhand3d/res50_interhand3d_all_256x256.py \
https://download.openmmlab.com/mmpose/hand3d/internet/res50_intehand3d_all_256x256-b9c1cf4c_20210506.pth \
--json-file tests/data/interhand2.6m/test_interhand2.6m_data.json \
--img-root tests/data/interhand2.6m \
--out-img-root results \
--rebase-keypoint-height --device=cpu
loading annotations into memory... Done (t=0.00s) creating index... index created! load checkpoint from http path: https://download.openmmlab.com/mmpose/hand3d/internet/res50_intehand3d_all_256x256-b9c1cf4c_20210506.pth Downloading: "https://download.openmmlab.com/mmpose/hand3d/internet/res50_intehand3d_all_256x256-b9c1cf4c_20210506.pth" to /root/.cache/torch/hub/checkpoints/res50_intehand3d_all_256x256-b9c1cf4c_20210506.pth 100%|████████████████████████████████████████| 181M/181M [00:21<00:00, 8.88MB/s] [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 4/4, 1.7 task/s, elapsed: 2s, ETA: 0s
In [33]:
!ls -l results
total 160 -rw-r--r-- 1 root root 36012 Nov 24 10:43 vis_0.jpg -rw-r--r-- 1 root root 36428 Nov 24 10:43 vis_1.jpg -rw-r--r-- 1 root root 37773 Nov 24 10:43 vis_2.jpg -rw-r--r-- 1 root root 46163 Nov 24 10:43 vis_3.jpg
In [34]:
Image('results/vis_0.jpg')
Out[34]:

In [35]:
Image('results/vis_1.jpg')
Out[35]:

In [36]:
Image('results/vis_2.jpg')
Out[36]:

In [37]:
Image('results/vis_3.jpg')
Out[37]:

WebCam Demo
!cp demo/webcam_demo.py
!python webcam_demo.py
In [ ]:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律