This case is only used for learning. It is not responsible for the effect and does not support commercial use.
This application can run on the Atlas 200 DK or the AI acceleration cloud server to implement inference on a common classification network and output the first n inference results.
The applications in the current version branch adapt to DDK&RunTime 126.96.36.199 and later.
Before deploying this sample, ensure that:
You can use either of the following methods:
Quick deployment: visit https://gitee.com/Atlas200DK/faster-deploy.
- The quick deployment script can be used to deploy multiple samples rapidly. Select classification.
- The quick deployment script automatically completes code download, model conversion, and environment variable configuration. To learn about the detailed deployment process, select the common deployment mode. Go to 2. Common deployment.
Common deployment: visit https://gitee.com/Atlas200DK/sample-README/tree/master/sample-classification.
- In this deployment mode, you need to manually download code, convert models, and configure environment variables. After that, you will have a better understanding of the process.
Open the project.
Go to the directory that stores the decompressed installation package as the Mind Studio installation user in CLI mode, for example, $HOME/MindStudio-ubuntu/bin. Run the following command to start Mind Studio:
Open the sample-classification project, as shown in Figure 1.
Configure project information in the src/param_configure.conf file.
The default configurations of the configuration file are as follows:
- All the three parameters must be set. Otherwise, the build fails.
- Do not use double quotation marks ("") during parameter settings.
- You can type only one model name in the configuration file. In this example, the AlexNet model is used as an example. You can replace it with a model listed in the common deployment by referring to the operation procedure.
- Modify the default configurations as required.
Run the deploy.sh script to adjust configuration parameters and download and compile the third-party library. Open the Terminal window of Mind Studio. By default, the home directory of the code is used. Run the deploy.sh script in the background to deploy the environment, as shown in Figure 3.
- During the first deployment, if no third-party library is used, the system automatically downloads and builds the third-party library, which may take a long time. The third-party library can be directly used for the subsequent build.
- During deployment, select the IP address of the host that communicates with the developer board. Generally, the IP address is the IP address configured for the virtual NIC. If the IP address is in the same network segment as the IP address of the developer board, it is automatically selected for deployment. If they are not in the same network segment, you need to manually type the IP address of the host that communicates with the Atlas DK to complete the deployment.
Start building. Open Mind Studio and choose Build > Build > Build-Configuration from the main menu. The build and run folders are generated in the directory, as shown in Figure 4.
When you build a project for the first time, Build > Build is unavailable. You need to choose Build > Edit Build Configuration to set parameters before the build.
Upload the images to be inferred to any directory of the HwHiAiUser user on the host side.
The image requirements are as follows:
On the toolbar of Mind Studio, click Run and choose Run > Run 'sample-classification'. As shown in Figure 5, the executable application is running on the developer board.
You can ignore the error information reported during the execution because Mind Studio cannot transfer parameters for an executable application. In the preceding steps, the executable application and dependent library files are deployed to the developer board. You need to log in to the developer board in SSH mode and manually execute the files in the corresponding directory. For details, see the following steps.
Log in to the host side as the HwHiAiUser user in SSH mode on Ubuntu Server where Mind Studio is located.
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 files of the classification network application.
- In this path, _XXXXX _in sample-classification_XXXXX is a combination of letters and digits generated randomly each time the application is built.
Run the application.
Run the run_classification.py script to print the inference result on the execution terminal.
python3 run_classification.py -w 227 -h 227 -i ./example.jpg -n 10
For other parameters, run the python3 run_classification.py --help command to check help information.