Performing Model Conversion
Creating an Application Project
- Choose on the menu bar. The New Project window is displayed, on which choose the Ascend App > Samples > ACL ResNet-50(C++) project type and click Change to configure the CANN version. See Figure 1.Figure 1 Project creation
- CANN Version: CANN software package version. If the version is not identified or you want to change the version, click Change and select the Ascend-CANN-Toolkit installation path (to the version number or latest level) in the dialog box displayed.
- Samples: sample project. Select ACL ResNet-50(C++).
- Click Next to enter the project parameter configuration page and configure the project name and directory. See Figure 2.
- Click Finish.
Figure 3 shows the generated application project directory.
Obtaining and Converting a Model
- Obtain the third-party model file.
Click here to download the ResNet-50 network model file (.onnx), click here to download the ResNet-50 network model code package, and upload the downloaded files to the MindStudio installation server as the MindStudio installation user.
- Convert the model.
Convert the third-party model into an offline model (.om file) that adapts to Ascend AI Processors.
- Choose on the menu bar to go to the model conversion page, and configure the model file on the Model Information tab page. See Figure 4. The actual page may vary depending on the version.
- Click Next, moving on to the Data Pre-Processing tab page to configure data preprocessing (FP32 data does not need to be preprocessed). See Figure 5.
- Click Next, moving on to the Advanced Options Preview tab page to configure advanced options. See Figure 6.
MindStudio Advisor requires that the following API configuration be added under Additional Argument during model conversion:
--debug_dir=${HOME}/MindstudioProjects/MyApp/debug # Configure the directory of the output debugging information file. ${HOME} indicates the home directory of the project. If the debug directory does not exist, create it manually. --op_debug_level=4 # Generate the TBE instruction mapping file (operator CCE file). The file is stored in the kernel_meta_* directory generated in the --debug_dir directory, for example, ${HOME}/MindstudioProjects/MyApp/debug/kernel_meta_*. --enable_small_channel=1 --insert_op_conf=${HOME}/MindstudioProjects/resnet50/model/ResNet50_for_PyTorch_1.4_code/infer/convert/aipp_resnet50.aippconfig # --enable_small_channel and --insert_op_conf are used together to enable operator fusion. You can obtain aipp_resnet50.aippconfig by clicking Download Script Model on the ResNet-50 model page at the ModelZoo website. - Click Finish to start model conversion.
The model conversion log records are printed to the Output window in the lower part of MindStudio. If the message "Model converted successfully" is displayed, the model conversion is complete. The Output window also displays the model conversion commands, environment variables, model conversion result, model output path, and model conversion log path.
After the model conversion is complete, an .om model file that can be executed in the operating environment is generated in the Output Path on the server.




