EN|CN
The object detection application runs on the Atlas 200 DK and implements the inference function by using Faster R-CNN object detection network.
Before using an open source application, ensure that:
- Mind Studio has been installed.
- The Atlas 200 DK developer board has been connected to Mind Studio, the cross compiler has been installed, the SD card has been prepared, and basic information has been configured.
Before running the application, obtain the source code package and configure the environment as follows.
-
Obtain the source code package.
Download all the code in the objDetection repository at https://github.com/Ascend/objDetection to any directory on Ubuntu Server where Mind Studio is located as the Mind Studio installation user, for example, /home/ascend/objdDetection.
-
Obtain the source network model required by the application.
Obtain the source network model and its weight file used in the application by referring to Table 1, and save them to any directory on the Ubuntu server where Mind Studio is located (for example, $HOME/ascend/models/faster_rcnn).
Table 1 Models used in the detection network application
Download the source network model file and its weight file by referring to README.md in https://github.com/Ascend/models/tree/master/computer_vision/object_detect/faster_rcnn.
-
Convert the source network model to a Da Vinci model.
-
Choose Tool > Convert Model from the main menu of Mind Studio. The Convert Model page is displayed.
-
On the Convert Model page, set Model File and Weight File to the model file and weight file downloaded in 2, respectively.
-
Set Model Name to the model name in Table 1: faster_rcnn.
-
Retain default values for other parameters.
-
-
Click OK to start model conversion.
After successful conversion, a .om Da Vinci model file is generated in the $HOME/tools/che/model-zoo/my-model/fast_rcnn directory.
-
-
Log in to Ubuntu Server where Mind Studio is located as the Mind Studio installation user and set the environment variable DDK_HOME.
vim ~/.bashrc
Run the following commands to add the environment variables DDK_HOME and LD_LIBRARY_PATH to the last line:
export DDK_HOME=/home/XXX/tools/che/ddk/ddk
export LD_LIBRARY_PATH=$DDK_HOME/uihost/lib
NOTE:
- XXX indicates the Mind Studio installation user, and /home/XXX/tools indicates the default installation path of the DDK.
- If the environment variables have been added, skip this step.
Enter :wq! to save and exit.
Run the following command for the environment variable to take effect:
**source \~/.bashrc**
-
Access the root directory where the cvnetworkverify application code is located as the Mind Studio installation user, for example, /home/ascend/objDetection.
-
Run the deployment script to prepare the project environment, including compiling and deploying the ascenddk public library and application.
bash deploy.sh host_ip model_mode
- host_ip: For the Atlas 200 DK developer board, this parameter indicates the IP address of the developer board.
- model_mode indicates the deployment mode of the model file. The default setting is internet.
- local: If the Ubuntu system where Mind Studio is located is not connected to the network, use the local mode. In this case, download the dependent common code library ezdvpp to the objDetection/script directory by referring to the Downloading Dependent Code Library.
- internet: Indicates the online deployment mode. If the Ubuntu system where Mind Studio is located is connected to the network, use the Internet mode. In this case, download the dependent code library ezdvpp online.
Example command:
bash deploy.sh 192.168.1.2
-
Upload the generated Da Vinci offline model faster_rcnn.om to the directory of the HwHiAiUser user on the host.
scp faster_rcnn.om HwHiAiUser@host_ip:/home/HwHiAiUser/HIAI_PROJECTS/ascend_workspace/objDetection/out/faster_rcnn.om ```
For the Atlas 200 DK, the default value of _**host\_ip**_ is **192.168.1.2** \(USB connection mode\) or **192.168.0.2** \(NIC connection mode\).
-
run server on the host
python3 run_server.py ```
-
Log in to the Host as the HwHiAiUser user in SSH mode on Ubuntu Server where Mind Studio is located.
ssh HwHiAiUser@host_ip
For the Atlas 200 DK, the default value of host_ip is 192.168.1.2 (USB connection mode) or 192.168.0.2 (NIC connection mode).
-
Go to the path of the executable file of road segmentation application.
cd ~/HIAI_PROJECTS/ascend_workspace/objDetection/out
-
Run the application.
Camera Test
-
Picture Test
./ascend_segmentation 1
Download the dependent software libraries to the objDetection/script directory.
Table 2 Download the dependent software library
Encapsulates the DVPP interface and provides image and video processing capabilities, such as color gamut conversion and image / video conversion |