diff --git a/README.md b/README.md index d1cc34b..d48830f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ # Body Pose Detection \(Python) -This application runs on Atlas 200 DK, to infer human body poses. The model used is modified from Lightweight OpenPose [Osokin, Daniil. "Real-time 2d multi-person pose estimation on CPU: Lightweight OpenPose." arXiv preprint arXiv:1811.12004 (2018)], an open-source pose detection network. This application can be run on various input formats, namely image input, video input as well as live camera input. +This application runs on Atlas 200 DK, to infer human body poses. For more information on the original Lightweight OpenPose model, please refer to [link](https://github.com/Daniil-Osokin/lightweight-human-pose-estimation.pytorch), an open-source pose detection network. This application can be run on various input formats, namely image input, video input as well as live camera input. -The pose detection network originates from [Cao, Zhe, et al. "OpenPose: realtime multi-person 2D pose estimation using Part Affinity Fields." arXiv preprint arXiv:1812.08008 (2018)], where the network provides two outputs: heatmaps and PAF maps for each frame. In the post-processing of the model, both heatmaps and PAF maps are used to obtain multi-persion pose estimation. - -In this repository, the post-processing a simplied version for edge computing, where only the heatmap is used to calculate the predicted locations of the human body joints. A set of 14 detected joints are grouped, connected to form limbs and associated to a person. The diagram below represents connection scheme: +In this repository, the model is a simplied version for edge computing, and it directly outputs the predicted locations of the human body joints. The set of 14 detected joints are shown in the diagram below: 12 12: head, 13: neck | @@ -26,34 +24,38 @@ The figure below shows the sample output on a single image input. The detected p **Figure** OpenPose detection result ![](figures/pose_detected.jpg "pose-detected") +**Performance:** The inference time of running the model on Atlas 200 DK is about 17 ms per image/frame . +**Limitation:** The model works well when there is only one persion and with whole body clearly shown in the view. + ## Software Preparation -Clone or download the project repository: +**Note,** The following setup is for the scenario where you have a ubuntu server/PC and Atlas 200 DK setup as [official guide](https://support.huaweicloud.com/intl/en-us/productdesc-A200dk_3000/atlas200_DK_pdes_19_0007.html), and Atlas 200 DK is connected directly with the server/PC with USB or network cable. + +In the server/PC, clone or download the project repository: **mkdir -p $HOME/AscendProjects** + **cd $HOME/AscendProjects** -**git clone ssh://git@rnd-gitlab-ca-g.huawei.com:2222/hispark/openpose-pythonc73.git** + +**git clone https://github.com/Atlas200dk/sample_bodypose.git** + OR -**wget https://rnd-gitlab-ca-g.huawei.com/hispark/openpose-pythonc73.git** -Then, unzip the downloaded file: - -**unzip openpose-pythonC73.zip** +**wget https://github.com/Atlas200dk/sample_bodypose.git** ## Environment Preparation -Install required libraries for Python3 environment (OpenCV, PresentAgent and Python3env) - -Please refer to https://github.com/Huawei-Ascend/samples/tree/master/common +Make sure required libraries for Python3 environment (OpenCV, Numpy, PresentAgent and other dependencies) have been installed on Atlas 200 DK. +You may first run the application, if there is any error about missing dependency, please refer to https://github.com/Huawei-Ascend/samples/tree/master/common and install. ## Environment Deployment -1. Go to the root directory where the application code is located, such as: $HOME/AscendProjects/openpose-pythonC73/. +1. Go to the directory where the application code is located, such as: $HOME/AscendProjects/sample_bodypose/. - **cd $HOME/AscendProjects/openpose-pythonC73/** + **cd $HOME/AscendProjects/sample_bodypose/** -2. Modify the configuration file. +2. Modify the configuration file, if you need to view the detection results using presenter server for the live input or video source. Modify **presenter\_server\_ip** and **presenter\_view\_ip** in **script/body\_pose.conf** to the current ubuntu server and atlas200dk development board network port ip, **presenter \_agent\_ip** is the ip of the network port connected to the ubuntu server on the development board. @@ -70,15 +72,11 @@ Please refer to https://github.com/Huawei-Ascend/samples/tree/master/common 3. Copy the application code to the development board. - Navigate to the root directory where the openpose-pythonC73 application code is located, such as: AscendProjects/openpose-pythonC73, execute the following command to copy the application code to the development board. If the copy fails, please check if there is a directory HIAI\_PROJECTS on the development board, and if not, create it. + Navigate to the directory where the sample_bodypose application code is located, such as: AscendProjects/sample_bodypose, execute the following command to copy the application code to the development board. If the copy fails, please check if there is a directory HIAI\_PROJECTS on the development board, and if not, create it. - **scp -r ~/AscendProjects/openpose-pythonC73 HwHiAiUser@192.168.1.2:/home/HwHiAiUser/HIAI\_PROJECTS** - - Enter the development board password when prompted for password. The default password of the development board is **Mind@123**, as shown below: - - - ![](figures/files_copy.png) + **scp -r ~/AscendProjects/sample_bodypose HwHiAiUser@192.168.1.2:/home/HwHiAiUser/HIAI\_PROJECTS** + Enter the development board password when prompted for password. The default password of the development board is **Mind@123** 4. Start Presenter Server. @@ -87,7 +85,7 @@ Please refer to https://github.com/Huawei-Ascend/samples/tree/master/common Execute the following command to start the Presenter Server in the background. - **bash $HOME/AscendProjects/openpose-pythonC73/script/run_presenter_server.sh &** + **bash $HOME/AscendProjects/sample_bodypose/script/run_presenter_server.sh &** Log in to the Presenter Server using the prompted URL. The figure below shows that the Presenter Server has started successfully. @@ -108,7 +106,7 @@ Please refer to https://github.com/Huawei-Ascend/samples/tree/master/common - This example of the IP address for accessing Presenter Server through a browser is 10.10.0.1. Since Presenter Server and Mind Studio are deployed on the same server, this IP address is also the IP for accessing Mind Studio through a browser. -5. Copy acl.so to the development board. Please skip this step if it is already done in other projects. +5. Copy acl.so to the development board. Please skip this step if the file already availabe on Atlas 200 DK directory **/home/HwHiAiUser/Ascend/**. **scp ~/Ascend/ascend-toolkit/20.0.RC1/arm64-linux_gcc7.3.0/pyACL/python/site-packages/acl/acl.so HwHiAiUser@192.168.1.2:/home/HwHiAiUser/Ascend/** @@ -130,11 +128,8 @@ Please refer to https://github.com/Huawei-Ascend/samples/tree/master/common ## Running the Application -1. Check whether the "CAMERA0" camera is used. - The "CAMERA0" camera is used by default in the code. Please refer to the link below for the viewing method. - https://support.huaweicloud.com/usermanual-A200dk_3000/atlas200dk_02_0051.html -2. Log in to the development board. Navigate to the code directory corresponding to the required input source format (image, video or live camera), and execute one of the following commands to run the application according to the input source format. +1. Log in to the development board. Navigate to the code directory corresponding to the required input source format (image, video or live camera), and execute one of the following commands to run the application according to the input source format. **NOTE**: To execute it, you could use the default input (just run **python3 main.py** without parameter), or input parameters as below for input/output paths and model path as indicated in **main.py**. For the video input, you also have the option to save the output as a video or display to presenter server, with the value in parameter 'is_presenter_server' set to False or True, respectively . @@ -157,8 +152,11 @@ Please refer to https://github.com/Huawei-Ascend/samples/tree/master/common **cd ~/HIAI_PROJECTS/openpose-pythonC73/code_live** **python3 main.py --model='model/body_pose.om'** + + **Note**, for the live camera case, the "CAMERA0" camera is used by default. Please refer to the link below for the viewing method. + https://support.huaweicloud.com/usermanual-A200dk_3000/atlas200dk_02_0051.html -3. If you need to view the detection results using presenter server for the live input or video source, log in to the Presenter Server website using the URL that was prompted when the Presenter Server service was started. Otherwise, skip this step. +2. If you need to view the detection results using presenter server for the live input or video source, log in to the Presenter Server website using the URL that was prompted when the Presenter Server service was started. Otherwise, skip this step. Wait for the Presenter Agent to transmit data to the server, and click "Refresh" to refresh. When there is data, the status of the corresponding Channel turns green, as shown in the figure below.