If your business involves human body detection, you can use the pose detection component to build pose models for inference. This topic describes how to configure the pose detection component and demonstrates how to use the component.
Prerequisites
OSS is activated, and Machine Learning Studio is authorized to access OSS. For more information, see Activate OSS and Grant the permissions that are required to use Machine Learning Designer.
Limits
The pose detection component is available only in Machine Learning Designer of Machine Learning Platform for AI (PAI).
The pose detection component can only be used with the computing resources of Deep Learning Containers (DLC) of PAI.
Introduction
Pose detection provides mainstream top-down algorithms. The algorithms can be classified into the following categories: object detection and single-pose detection. Single-pose detection relies on proposals of detection algorithms and supports the HRNet and Lite-HRNet models.
You can find the pose detection component in the Offline Training subfolder under the Video Algorithm folder of the component library.
Component configuration in the PAI console
Input ports
Input port (left-to-right)
Data type
Recommended upstream component
Required
data for training
OSS
No
data annotation path for training
OSS
No
data for evaluation
OSS
No
data annotation path for evaluation
OSS
No
data keypoints info path
OSS
No
Component parameters
Tab
Parameter
Required
Description
Default value
Fields Setting
model type
Yes
The algorithm type used for model training. Only TopDown is supported.
TopDown
oss dir to save model
No
The Object Storage Service (OSS) directory in which training models are stored. Example: oss://examplebucket/output_dir/ckpt/.
None
oss data path to training
No
If you did not specify the training data for this component by using the data for training input port, you must set this parameter.
The OSS directory in which the training data is stored. Example: oss://examplebucket/data/train_images/.
NoteIf you use both an input port and this parameter to specify the training data, the value specified by using the input port takes precedence.
None
oss annotation path for training data
No
If you did not specify the labeled training data by using the data annotation path for training input port, you must set this parameter.
The OSS directory in which the labeled training data is stored. Example: oss://examplebucket/data/annotations/train.json.
NoteIf you use both an input port and this parameter to specify the labeled training data, the value specified by using the input port takes precedence.
None
oss data path to evaluation
No
If you did not specify the evaluation data by using the data for evaluation input port, you must set this parameter.
The OSS directory in which the evaluation data is stored. Example: oss://examplebucket/data/val_images/.
NoteIf you use both an input port and this parameter to specify the evaluation data, the value specified by using the input port takes precedence.
None
oss annotation path for evaluation data
No
If you did not specify the labeled evaluation data by using the data annotation path for evaluation input port, you must set this parameter.
The OSS directory in which the labeled evaluation data is stored. Example: oss://examplebucket/data/annotations/val.json.
NoteIf you use both an input port and this parameter to specify the labeled evaluation data, the value specified by using the input port takes precedence.
None
oss path to dataset info file
No
If you did not specify the dataset info file by using the data keypoints info path input port, you must set this parameter.
The OSS directory in which the dataset info file is stored. Example: oss://examplebucke/data/annotations/dataset_info.py.
NoteIf you use both an input port and this parameter to specify the dataset info file, the value specified by using the input port takes precedence.
None
Data Source Type
Yes
The format of input data. Only DetSourceCOCO is supported.
DetSourceCOCO
oss path to pretrained model
No
The OSS directory in which your pre-trained model is stored. If you have a pre-trained model, set this parameter to the OSS directory of your pre-trained model. If you do not set this parameter, the corresponding default pre-trained model provided by PAI is used.
None
Parameters Setting
backbone
Yes
The backbone model that you want to use. The following mainstream models are supported:
hrnet
lite_hrnet
hrnet
num keypoints
Yes
The number of categories in the data.
None
image size after resizing
Yes
The fixed size of an image after resizing. Separate the width and height with a comma (,).
192,256
initial learning rate
Yes
The initial learning rate.
0.01
learning rate policy
Yes
The policy that is used to adjust the learning rate. Only step is supported. A value of step indicates that the learning rate is manually adjusted at specified epochs.
step
Ir step
Yes
The epochs at which the learning rate is adjusted. Separate multiple values with commas (,). If the number of epochs reaches the values specified in this parameter, the learning rate decays by 90%.
For example, assume that the initial learning rate is set to 0.1, the total number of epochs is set to 20, and the lr step parameter is set to 5,10. In this case, when the training is in epoch 1 to 5, the learning rate is 0.1. When the training enters epoch 6, the learning rate decays to 0.01 and continues until epoch 10 ends. When the training enters epoch 11, the learning rate decays to 0.001 and continues until the end of all epochs.
170,200
train batch size
Yes
The size of a training batch, which indicates the number of data samples used for model training in a single iteration.
32
eval batch size
Yes
The size of an evaluation batch, which indicates the number of data samples used for model evaluation in a single iteration.
32
total train epochs
Yes
The total number of epochs. An epoch ends when a round of training is complete on all data samples. The total number of epochs indicates the total number of training rounds conducted on data samples.
200
save checkpoint epoch
No
The frequency at which a checkpoint is saved. A value of 1 indicates that a checkpoint is saved each time an epoch ends.
1
Tuning
optimizer
Yes
The optimization method for model training. Valid values:
SGD
Adam
SGD
number process of reading data per gpu
No
The number of threads used to read the training data for each GPU.
2
evtorch model with fp16
No
Specifies whether to enable FP16 to reduce memory usage during model training.
None
single worker or distributed on DLC
Yes
The compute engine that is used to run the component. You can select a computing engine based on your business requirements. Valid values:
single_on_dlc
distribute_on_dlc
single_on_dlc
number of worker
No
If you select distribute_on_dlc for the single worker or distributed on DLC parameter, you must set this parameter.
The number of concurrent work nodes used for computation.
1
cpu machine type
No
If you select distribute_on_dlc for the single worker or distributed on DLC parameter, you must set this parameter.
The CPU specifications that you want to use.
16vCPU+64GB Mem-ecs.g6.4xlarge
gpu machine type
Yes
The GPU specifications that you want to use.
8vCPU+60GB Mem+1xp100-ecs.gn5-c8g1.2xlarge
Output ports
Output port
Data type
Downstream component
output model
The OSS directory in which the output model is stored. The value is the same as that you specified for the oss dir to save model parameter on the Fields Setting tab.
Examples
The following figure shows a sample pipeline in which the pose detection component is used. In this example, components are configured as shown in the preceding figure by performing the following steps:
Prepare data. Label images by using iTAG provided by PAI. For more information, see iTAG.
Use the Read File Data-1, Read File Data-2, Read File Data-3, Read File Data-4, and Read File Data-5 components to read the training data, labeled training data, evaluation data, labeled evaluation data, and dataset info file. To do so, set the OSS Data Path parameter of each component to the OSS directory in which the data that you want to retrieve is stored.
Draw lines from the preceding five components to the pose detection component and configure the parameters for the pose detection component. For more information, see the "Component configuration in the PAI console" section of this topic.
Use the image prediction component to conduct offline inference. To do so, configure the following parameters for the image prediction component. For more information, see image prediction.
model type: Select pose_predictor.
oss path for model: Select the value configured for the oss dir to save model parameter of the pose detection component.
oss path of detection model for pose: Select the OSS directory in which the pose detection model is stored.
NoteA human body must be detected before a pose can be detected. This is because only the TopDown algorithm type is supported. If you use the object detection component to connect to the pose detection component, the detection model exported by the object detection component is used by the pose detection component and this parameter can be ignored. Otherwise, you must configure this parameter.
detection model type for pose: The type of the pose detection model that is used. This parameter is required. Only yolox_predictor is supported.