Creating an Application Project
Creating an Application Project
- Navigate to the project creation window.
- On the MindStudio welcome page, click New Project.
- On the MindStudio project page, choose from the top menu bar.
- In the New Project window, select Ascend App and specify the project type. See Figure 1. Then click Next to enter the project configuration page. (If the project type name is not completely displayed, hover the cursor on the name to display the complete name.)
CANN Version: indicates the activated CANN version. You can click Change on the right to change the CANN version. For details, see Switching/Activating a CANN Package.
If CANN is not configured in MindStudio, some application projects may not be properly displayed.
- ACL Project is an empty project of AscendCL, containing only the development framework but no specific code logic.
- ACL ResNet-50 is a sample project of AscendCL, which uses the acl_resnet50 sample as the template.
The acl_resnet50 sample shows how to classify images based on the Caffe ResNet-50 network (single input with batch size = 1). Convert the model file of the Caffe ResNet-50 network to an offline model adapted to the Ascend AI Processor (.om). In the sample, load the .om file, decode, resize, and run synchronous inference of the two .jpg images, process the obtained inference results, and output the class indexes with the top 5 confidence values of each image.
If this is your first time to obtain the ACL ResNet-50 sample project, ensure that the development environment has been connected to the Internet, so that you can obtain the sample project from the following link and decompress it to the ./MindStudio/plugins/ascend-foundation/samples/inference/ directory:
Figure 2 Sample diagram
- Access the project configuration page and set project parameters listed in Table 1.
Table 1 Project parameters Parameter
Description
Project name
Project name (user-defined).
The name contains a maximum of 64 characters and must start and end with a digit or letter. Only letters, digits, hyphens (-), and underscores (_) are allowed.
Project location
Default path for saving a project (user-defined). (For users who use MindStudio for the first time, the default value is $HOME/MindstudioProjects)
More Settings
Module name: module name, same as the Project name.
Content root: path in the root directory.
Module file location: module file path.
Click the check box on the right of Project format. A drop-down list is displayed.- .idea (directory-based) (default option): During project creation, an .idea option is created to save the project information.
- .ipr (file-based): project configuration file used to save the project configuration information.
- Click Finish. The directory of a created project is organized as follows (for reference only).
- ACL Project(C/C++):
├── ProjectName │ ├── build │ │ ├──cmake // Directory of CMake dependencies. │ ├── out // Directory of executable files generated after build. │ ├── src │ │ ├── CMakeLists.txt // Build script. │ │ ├── main.cpp // Implementation file of the main function, which does not have code logic. │ ├── CMakeLists.txt // Build script that calls the CMakeLists file in the src directory.
- ACL Project(Python): No code directory is available.
- ACL ResNet-50(C++):
├── ProjectName │ ├── build │ │ ├──cmake // Directory of CMake dependencies. │ ├── data │ ├── model │ ├── inc │ │ ├── model_process.h // Header file that declares functions related to model processing. │ │ ├── sample_process.h // Header file that declares functions related to resource initialization/destruction. │ │ ├── utils.h // Header file that declares common functions (such as the file reading function). │ ├── out // Directory of executable files generated after build. │ ├── script │ │ ├── transferPic.py // Code file used to convert a .jpg image to a .bin file and resize the image from 1024 x 683 to 224 x 224. │ ├── src │ │ ├── acl.json // Configuration file for system initialization. │ │ ├── CMakeLists.txt // Build script. │ │ ├── main.cpp // Main function, which is the implementation file of image classification. │ │ ├── model_process.cpp // Implementation file of model processing functions. │ │ ├── sample_process.cpp // Implementation file of functions related to resource initialization/destruction. │ │ ├── utils.cpp // Implementation file of common functions (such as the file reading function). │ ├── CMakeLists.txt // Build script that calls the CMakeLists file in the src directory.
- ACL ResNet-50(Python):
├── ProjectName │ ├── data │ ├── model │ ├── src │ │ ├── acl_net.py // Run file. │ │ ├── constant.py // Constant definition.
- ACL Project(C/C++):
Importing an Application Project
- You can import a project file in either of the following ways:
- On the MindStudio welcome page, click Open, select the project to be imported, and click OK.
- On the MindStudio project page, choose from the top menu bar or click
on the menu bar to select an existing project and open it.
If a project has code risks, the trust window is displayed when you open the project.
- If the project source code is trusted and secure, click Trust Project. (You can select Trust projects in <workspace_directory> to trust all projects in the directory.)
- If the project is not trusted and you only want to view the source code, click Preview in Safe Mode to preview the project in safe mode.
- To cancel opening the project, click Don't Open.
- If there is already an active project in the window, a confirmation message is displayed.
- Click This Window to open the created project in the current window.
- Click New Window to open the created project in a new window.
- After a project is imported, the project directory is displayed in a tree structure (subject to the actual result).
