pose detection

更新时间:
复制 MD 格式

The pose detection component trains top-down pose estimation models using HRNet or Lite-HRNet backbones. Use it in Machine Learning Designer pipelines to detect human body keypoints from images.

Prerequisites

Before you begin, make sure you have:

Limitations

  • The component is available only in Machine Learning Designer of Machine Learning Platform for AI (PAI).

  • It requires Deep Learning Containers (DLC) compute resources.

  • Only the TopDown algorithm type is supported. TopDown first detects persons with an object detector, then estimates keypoints for each detected person. This approach is more accurate but slows down as the number of people in the image increases — it is best suited for scenes with a small, fixed number of people. Because human body detection must precede pose detection, connect the object detection component upstream or configure the detection model path manually in the image prediction component.

How it works

Find the component in the component library under Video Algorithm > Offline Training.

The component accepts training data, annotation files, evaluation data, and a dataset info file through five input ports. It trains a top-down pose model and outputs the trained model to an OSS directory, which the downstream image prediction component uses for offline inference.

Configure the component

Input ports

Connect Read File Data components to each port. All ports are optional — if you leave a port unconnected, set the corresponding OSS path parameter instead.

Port (left to right)Data typeRequired
data for trainingOSSNo
data annotation path for trainingOSSNo
data for evaluationOSSNo
data annotation path for evaluationOSSNo
data keypoints info pathOSSNo
When both an input port and its corresponding parameter are set, the input port value takes precedence.

Fields setting

ParameterRequiredDefaultDescription
model typeYesTopDownAlgorithm type. Only TopDown is supported.
oss dir to save modelNoNoneOSS directory for saving the trained model. Example: oss://examplebucket/output_dir/ckpt/
oss data path to trainingNoNoneOSS path to training images. Required if the training input port is not connected. Example: oss://examplebucket/data/train_images/
oss annotation path for training dataNoNoneOSS path to the training annotation file. Required if the training annotation port is not connected. Example: oss://examplebucket/data/annotations/train.json
oss data path to evaluationNoNoneOSS path to evaluation images. Required if the evaluation input port is not connected. Example: oss://examplebucket/data/val_images/
oss annotation path for evaluation dataNoNoneOSS path to the evaluation annotation file. Required if the evaluation annotation port is not connected. Example: oss://examplebucket/data/annotations/val.json
oss path to dataset info fileNoNoneOSS path to the dataset info file. Required if the dataset info port is not connected. Example: oss://examplebucket/data/annotations/dataset_info.py
Data Source TypeYesDetSourceCOCOInput data format. Only DetSourceCOCO is supported.
oss path to pretrained modelNoNoneOSS path to a custom pre-trained model. If blank, PAI uses its default pre-trained model.

Parameters setting

ParameterRequiredDefaultDescription
backboneYeshrnetBackbone model. Valid values: hrnet, lite_hrnet.
num keypointsYesNoneNumber of keypoint categories in the dataset.
image size after resizingYes192,256Fixed input image size (width,height). Separate values with a comma.
initial learning rateYes0.01Starting learning rate for training.
learning rate policyYesstepLearning rate schedule. Only step is supported: the rate decays at the epochs specified in lr step.
lr stepYes170,200Epochs at which the learning rate decays by 90%. Separate multiple values with commas. For example, with an initial rate of 0.1 and lr step set to 5,10: epochs 1–5 use 0.1, epoch 6 onward uses 0.01, epoch 11 onward uses 0.001.
train batch sizeYes32Number of samples per training iteration.
eval batch sizeYes32Number of samples per evaluation iteration.
total train epochsYes200Total number of passes over the training data.
save checkpoint epochNo1Checkpoint save frequency. 1 saves a checkpoint after every epoch.

Tuning

ParameterRequiredDefaultDescription
optimizerYesSGDOptimizer for model training. Valid values: SGD, Adam.
number process of reading data per gpuNo2Number of data-loading threads per GPU.
evtorch model with fp16NoNoneEnable FP16 mixed precision to reduce GPU memory usage.
single worker or distributed on DLCYessingle_on_dlcCompute mode. Valid values: single_on_dlc, distribute_on_dlc.
number of workerNo1Number of worker nodes. Required when distribute_on_dlc is selected.
cpu machine typeNo16vCPU+64GB Mem-ecs.g6.4xlargeCPU instance type. Required when distribute_on_dlc is selected.
gpu machine typeYes8vCPU+60GB Mem+1xp100-ecs.gn5-c8g1.2xlargeGPU instance type.

Output ports

PortData typeDownstream component
output modelOSS directory (same as oss dir to save model)image prediction

Build a pose detection pipeline

The following steps describe a complete training and inference pipeline. Pipeline

  1. Label your data. Use iTAG to annotate images. See iTAG.

  2. Load data. Add five Read File Data components (Read File Data-1 through Read File Data-5). Set the OSS Data Path parameter for each to the following paths in order: training images, training annotations, evaluation images, evaluation annotations, and dataset info file.

  3. Connect and configure. Draw connections from all five Read File Data components to the pose detection component. Configure the parameters described in the Configure the component section.

  4. Add inference. Connect the output of the pose detection component to the image prediction component. Set the following parameters on image prediction:

    ParameterValue
    model typepose_predictor
    oss path for modelThe same path set in oss dir to save model on the pose detection component
    oss path of detection model for poseOSS path to the object detection model. Required unless the object detection component is already connected upstream — in that case the detection model is inherited automatically.
    detection model type for poseyolox_predictor (required)

What's next