This sample provides reference for you to learn the Ascend AI Software Stack and cannot be used for commercial purposes.
This sample works with CANN 3.0.0 and later versions, and supports Atlas 200 DK and Atlas 300.
Function: tracks multiple pedestrians in a scene with the mot_v2.om model.
Input: a source image
Output: the result image
Before deploying this sample, ensure that:
- The environment has been set up by referring to Environment Preparation and Dependency Installation.
- The development environment and operating environment of the corresponding product have been set up.
-
Make sure you log in to the operating environment (HwHiAiUser)
Replace xxx.xxx.xxx.xxx with the IP address of the operating environment. The IP address of Atlas 200 DK is 192.168.1.2 when it is connected over the USB port, and that of Atlas 300 is the corresponding public network IP address.
cd $HOME
git clone https://github.com/Ascend/samples.git
2. Obtain the Offline Model (om) or Convert pb to om in Step 3.
Ensure you are in the project directory (head_pose_picture/
) and run one of the following commands in the table to obtain the pedestrian tracking model used in the application.
cd $HOME/samples/python/contrib/head_pose_picture/
Model | How to Obtain |
---|---|
WHENet_b2_a1_modified.om | wget -nc --no-check-certificate 'https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/head_pose_picture/moWHENet_b2_a1_modifiedt_v2.om' -O model/moWHENet_b2_a1_modifiedt_v2.om |
yolo_model.om | wget -nc --no-check-certificate 'https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/head_pose_picture/yolo_model.om' -O model/yolo_model.om |
WHENet_b2_a1_modified.pb | wget -nc --no-check-certificate 'https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/head_pose_picture/WHENet_b2_a1_modified.pb' -O model/WHENet_b2_a1_modified.pb |
yolo_model.pb | wget -nc --no-check-certificate 'https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/head_pose_picture/yolo_model.pb' -O model/yolo_model.pb |
WHENet_b2_a1_modified.om
andyolo_model.om
offline models you can use out-of-the-box without model conversion. If you use this then you can skip the next step on model conversion.WHENet_b2_a1_modified.pb
andyolo_model.pb
pb models for those that want to configure the model conversion process.
Note: Ensure that the environment variables have been configured in Environment Preparation and Dependency Installation.
-
Set the LD_LIBRARY_PATH environment variable.
The LD_LIBRARY_PATH environment variable conflicts with the sample when Ascend Tensor Compiler (ATC) is used. Therefore, you need to set this environment variable separately in the command line to facilitate modification.
export LD_LIBRARY_PATH=${install_path}/compiler/lib64
For CANN 3.0.0 and later:
-
Go to the project directory (head_pose_picture) and run the model conversion command to convert the model:
cd $HOME/samples/python/contrib/head_pose_picture/ atc --framework=3 --model=model/yolo_model.pb --input_shape="input_1:1,416,416,3" --input_format=NHWC --output=model/yolo_model --output_type=FP32 --soc_version=Ascend310 atc --framework=3 --model=model/WHENet_b2_a1_modified.pb --input_shape="input_1:1,224,224,3" --input_format=NHWC --output=model/WHENet_b2_a1_modified --output_type=FP32 --soc_version=Ascend310
-
cd $HOME/samples/python/contrib/head_pose_picture/ wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/head_pose_picture/test.jpg -O data/test.jpg
-
cd $HOME/samples/python/contrib/head_pose_picture/src python3 main.py