Code Monkey home page Code Monkey logo

mmpose-skeleton-visualization's Introduction

Prerequisites

Step 0. Download and install Miniconda from the official website.

Step 1. Create a conda environment and activate it.

conda create --name openmmlab python=3.8 -y
conda activate openmmlab

Step 2. Install PyTorch following official instructions, e.g.

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

Installation

Step 0. Install MMCV using MIM.

pip install -U openmim
mim install mmcv-full

Step 1. Install MMPose.

pip install mmpose

Verify the installation

To verify that MMPose is installed correctly, you can run an inference demo with the following steps.

Step 1. We need to download config and checkpoint files.

mim download mmpose --config associative_embedding_hrnet_w32_coco_512x512  --dest .

Step 2. Verify the inference demo.

from mmpose.apis import (init_pose_model, inference_bottom_up_pose_model, vis_pose_result)

config_file = 'associative_embedding_hrnet_w32_coco_512x512.py'
checkpoint_file = 'hrnet_w32_coco_512x512-bcb8c247_20200816.pth'
pose_model = init_pose_model(config_file, checkpoint_file, device='cpu')  # or device='cuda:0'

image_name = 'demo/persons.jpg'
# test a single image
pose_results, _ = inference_bottom_up_pose_model(pose_model, image_name)

# show the results
vis_pose_result(pose_model, image_name, pose_results, out_file='demo/vis_persons.jpg')

Download mmdet and pretrained

Download mmdet:

pip install mmdet

Pretrain:

  • Pretrain cho mmdet

    wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
  • Pretrain cho mmpose

    wget https://download.openmmlab.com/mmpose/top_down/resnet/res50_coco_256x192-ec54d7f3_20200709.pth
    wget https://download.openmmlab.com/mmpose/top_down/resnet/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918.pth

Other package:

pip install einops

Inference

Example:

python skeleton_pose.py mmdet_cfg.py /data/pill/emotion/mmpose/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth mmpose_cfg.py /data/pill/emotion/mmpose/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918.pth  --video-path /data/baby/Workspace/tungch/dnp/00_poc/data/output.mp4 --out-video-root vis_results/o --out-video-bg

mmdet_cfg.py:

  • filepath to the pretrained
  • meaning: file config for mmdetection
  • default: faster_rcnn_r50_fpn_coco

mmpose_cfg.py:

  • filepath to the pretrained
  • meaning: file config for mmpose
  • default: hrnet_w48_coco_wholebody_384x288_dark

video-path:

  • filepath to the video
  • type: str

out-video-root:

  • target path

out-video-bg:

  • action=’store_true’
  • default: False

bg-img:

  • Must enable the out-video-bg option to use this feature
  • default: white color backgroundSource code

frame-skip:

  • type: int
  • Number of frames to skip each loop

mmpose-skeleton-visualization's People

Contributors

huyenbui117 avatar phamgialinhlx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.