mind studio basic operations - huawei cloud

126
Ascend 310 Mind Studio Basic Operations Issue 01 Date 2020-05-30 HUAWEI TECHNOLOGIES CO., LTD.

Upload: others

Post on 09-Apr-2022

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mind Studio Basic Operations - HUAWEI CLOUD

Ascend 310

Mind Studio Basic Operations

Issue 01

Date 2020-05-30

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: Mind Studio Basic Operations - HUAWEI CLOUD

Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. i

Page 3: Mind Studio Basic Operations - HUAWEI CLOUD

Contents

1 Introduction.............................................................................................................................. 11.1 Statement.................................................................................................................................................................................. 11.2 Overview.................................................................................................................................................................................... 11.3 Function Description.............................................................................................................................................................. 2

2 User Management...................................................................................................................42.1 Logging In.................................................................................................................................................................................. 42.2 Resetting the Password......................................................................................................................................................... 62.3 Changing the Password.........................................................................................................................................................62.4 Logging Out.............................................................................................................................................................................. 72.5 Querying Security Logs......................................................................................................................................................... 8

3 Project Management.............................................................................................................. 93.1 Project Introduction................................................................................................................................................................ 93.2 Basic Project Operations....................................................................................................................................................... 93.2.1 Creating/Deleting a Project............................................................................................................................................103.2.2 Uploading/Downloading a Project.............................................................................................................................. 113.2.3 Creating/Deleting a File.................................................................................................................................................. 123.2.4 Uploading a File/Folder................................................................................................................................................... 123.2.5 Opening a Project..............................................................................................................................................................143.2.6 Closing a Project................................................................................................................................................................ 173.2.7 Compiling a Project...........................................................................................................................................................173.2.8 Running a Project.............................................................................................................................................................. 283.2.9 Supported File Formats................................................................................................................................................... 293.3 Basic Node Operations........................................................................................................................................................303.3.1 Service Node Overview....................................................................................................................................................303.3.2 Placing a Node................................................................................................................................................................... 343.3.3 Deleting a Node................................................................................................................................................................. 353.3.4 Copying and Pasting a Node......................................................................................................................................... 373.3.5 Setting the Properties of a Node................................................................................................................................. 393.3.6 Establishing a Connection.............................................................................................................................................. 443.3.7 Saving Nodes...................................................................................................................................................................... 453.3.8 Generating a .cpp File...................................................................................................................................................... 46

4 Dataset Management...........................................................................................................47

Ascend 310Mind Studio Basic Operations Contents

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: Mind Studio Basic Operations - HUAWEI CLOUD

4.1 Overview.................................................................................................................................................................................. 474.2 Dataset Management in the Projects Explorer Window......................................................................................... 484.2.1 Viewing the Datasets....................................................................................................................................................... 484.2.2 Importing a Dataset......................................................................................................................................................... 494.2.3 Viewing the Dataset Properties.................................................................................................................................... 654.2.4 Generating a .cpp File...................................................................................................................................................... 674.2.5 Selecting Images................................................................................................................................................................ 684.2.6 Deleting a Custom Dataset............................................................................................................................................ 694.3 Dataset Management in the Datasets Explorer Window....................................................................................... 704.3.1 Viewing the Datasets....................................................................................................................................................... 714.3.2 Copying a Path................................................................................................................................................................... 714.3.3 Refreshing............................................................................................................................................................................ 72

5 Model Management............................................................................................................. 745.1 Overview.................................................................................................................................................................................. 745.2 Model Conversion................................................................................................................................................................. 745.2.1 Model Conversion Modes............................................................................................................................................... 755.2.2 Adding a Custom Model Component......................................................................................................................... 755.2.3 Encrypting a Custom Model.......................................................................................................................................... 895.2.4 Decrypting a Custom Model..........................................................................................................................................915.3 Model Management in the Projects Explorer Window............................................................................................915.3.1 Viewing the Models.......................................................................................................................................................... 915.3.2 Adding a Caffe Model Component............................................................................................................................. 925.3.3 Viewing Model Properties.............................................................................................................................................. 955.3.4 Viewing the Network Structure of a Model............................................................................................................. 965.3.5 Deleting a Model Component.......................................................................................................................................995.4 Model Management in the Model Zoo Explorer Window................................................................................... 1005.4.1 Viewing the Models........................................................................................................................................................1005.4.2 Adding a Custom Model Component...................................................................................................................... 1015.4.3 Copying a Path................................................................................................................................................................. 1015.4.4 Refreshing a Folder........................................................................................................................................................ 1025.4.5 Importing an Offline Model ....................................................................................................................................... 103

6 Publish Mode Management............................................................................................. 1056.1 Overview................................................................................................................................................................................1056.2 Function Description......................................................................................................................................................... 1056.2.1 Node Display.................................................................................................................................................................... 1056.2.2 Mode Switching............................................................................................................................................................... 1076.2.3 Node Placement and Connection..............................................................................................................................1086.2.4 Packaging and Publishing............................................................................................................................................ 111

7 System Configuration Management.............................................................................. 1127.1 Tool Settings......................................................................................................................................................................... 1127.2 Assistant Tool....................................................................................................................................................................... 117

Ascend 310Mind Studio Basic Operations Contents

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. iii

Page 5: Mind Studio Basic Operations - HUAWEI CLOUD

7.2.1 Overview............................................................................................................................................................................ 1177.2.2 Querying a Shortcut Key.............................................................................................................................................. 117

A Change History....................................................................................................................121

Ascend 310Mind Studio Basic Operations Contents

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. iv

Page 6: Mind Studio Basic Operations - HUAWEI CLOUD

1 Introduction

1.1 Statement1.2 Overview1.3 Function Description

1.1 StatementIn this document, $HOME indicates the home directory of the Mind Studioinstallation user.

1.2 OverviewMind Studio is an AI full-stack development platform developed based onHuawei's Ascend AI processor, which allows development of chip-based operatorsand custom operators. It also provides network migration, optimization, andanalysis at the network layer and a set of visualized AI engine drag-and-dropprogramming services at the service engine layer, greatly simplifying AI enginedevelopment. The entire platform offers the following four services for developersusing web pages.

● For operator development:Mind Studio allows development of a full set of operators, running in a realenvironment, visualized debugging of heterogeneous programs that aredynamically scheduled, and third-party operator development, greatlyreducing the operator development difficulty based on Huawei-developedNPUs and improving the efficiency of operator development as well asproduct competitiveness.

● For development at the network layer:Mind Studio integrates the offline model generator (OMG), modelquantization tool, model precision comparison tool, model running profilingtool, and log analysis tool, greatly improving the efficiency of migration,analysis, and optimization of network models.

● For AI engine development:Mind Studio provides AI engines that support visualized drag-and-dropprogramming as well as a large number of technologies on automatic

Ascend 310Mind Studio Basic Operations 1 Introduction

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 1

Page 7: Mind Studio Basic Operations - HUAWEI CLOUD

algorithm code generation, dramatically reducing the development difficultyfor developers. Equipped with various algorithm engines, such as ResNet-18,Mind Studio enhances the development and migration efficiency of the AIalgorithm engine.

● For application development:Mind Studio provides developers with a graphically integrated developmentenvironment by integrating various tools, such as Profiler and Compiler,allowing them to perform full-process development across projectmanagement, compilation, commissioning, simulation, and performanceanalysis, and therefore greatly enhancing the development efficiency.

1.3 Function Description

Overall Architecture

Figure 1-1 shows the overall architecture of Mind Studio.

Figure 1-1 Overall framework of Mind Studio

Function Description

Mind Studio provides the following features:

● User-friendly NPU-based programming GUIOperator developers can customize CCE development on Mind Studio basedon the CCE programming depth to implement functions such as in-depthintegration, highlight of the keywords of the extended CCE language, and fastcompilation of heterogeneous hybrid codes.

● NPU-based graphical debuggingFor the development of the operator acceleration library on an NPU, MindStudio provides a graphical GUI for users to track the running status of theacceleration operators on the AI core and AI CPU in real time.

● Automatic offline model management

Ascend 310Mind Studio Basic Operations 1 Introduction

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 2

Page 8: Mind Studio Basic Operations - HUAWEI CLOUD

Trained third-party models, such as Caffe and TensorFlow models, can beimported to Mind Studio and converted into system-supported models. Modelinterfaces are generated automatically in one-click mode, facilitatinginterface-based model programming. For details, see 5.2 Model Conversion.

● "Zero" programming for service process orchestrationFor service process developers, Mind Studio provides the drag-and-dropprogramming mode based on service nodes, implementing serviceorchestration by simply dragging and connecting service nodes. The one-stopservice after orchestration, ranging from compilation and running to resultdisplay, makes process development smarter and achieves "zero"programming. In this way, you can get started quickly without extra learningcosts. For details, see Building the First Machine Learning Application in theAscend 310 Mind Studio Quick Start.

● Graphical TE programmingBuilt on the TVM-based Tensor Engine (TE) for programming development,Mind Studio provides the industry's first integrated development environmentthat allows operators to be transplanted quickly across platforms, enablinginstant NPU adaption.

● Log analysisMind Studio provides a system-wide log collection and analysis solution forthe NPU platform, improving the efficiency of locating algorithm problems atruntime. A unified log format is adopted. Mind Studio also offers visualizedanalysis of cross-platform logs and runtime diagnosis in web mode, improvingthe usability of the log analysis system.

● Performance analysisMind Studio provides graphical user interfaces (GUIs) and command-lineinterfaces (CLIs) to implement efficient, easy-to-use, and flexible performanceanalysis on the multi-node and multi-module heterogeneous system on thehost and device as well as synchronous analysis of performance and powerconsumption of the NPU device, meeting the requirements of algorithmoptimization for system performance analysis.

● SimulationFunction-level simulation execution libraries for Caffe models are provided.You can call AI core simulation by using the program.

Ascend 310Mind Studio Basic Operations 1 Introduction

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 3

Page 9: Mind Studio Basic Operations - HUAWEI CLOUD

2 User Management

2.1 Logging In

2.2 Resetting the Password

2.3 Changing the Password

2.4 Logging Out

2.5 Querying Security Logs

2.1 Logging InFigure 2-1 shows the login page.

Figure 2-1 Login page

Table 2-1 describes the parameters on the login page.

Ascend 310Mind Studio Basic Operations 2 User Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 4

Page 10: Mind Studio Basic Operations - HUAWEI CLOUD

Table 2-1 Parameters on the login page

Parameter Description

User Name Login user name. The default value isMindStudioAdmin. You cannot change it or createone.

Password Login password. The initial password is [email protected] requirements:● The password contains 8 to 16 characters.● The password contains at least one uppercase or

lowercase letter.● The password contains at least one digit.● The password contains at least one of the following

special characters: ~!@#$%^&*()_-=+|\[]{}:;,<>/?NOTE

● If you have entered incorrect passwords for threeconsecutive times within 5 minutes, a message will bedisplayed indicating that the login is locked. Try againafter 30 minutes.

● A password will expire 90 days from the date when it isset. If the password expires, a message will bedisplayed to prompt you to change the password.

Login Login. Enter the correct user name and password, andclick this button to access the Mind Studio window.

Modify Password change. If you want to change the passwordafter logging in to Mind Studio, click this button. Fordetails, see 2.3 Changing the Password.

Enter the correct password and click Login.

● If you are logging in for the first time, the password resetting page isdisplayed. For details, see 2.2 Resetting the Password.

● If it is not the first login, the system displays the login information, includingwhether the last login is successful, login time, IP address of the login user,number of login attempts, and validity period of the password. Click OK toaccess the Mind Studio window.– If no operation is performed within 30 minutes after a successful login, a

message will be displayed indicating that the session times out and theuser will be forced to log out. In this case, the user needs to enter thepassword again to log in.To configure a login timeout period, set SessionTimeOut in ~/tools/conf/mind_studio.config. The value range is 5–1440, in minutes. Thedefault value is 30. If this parameter is set to -1, the session never timesout. If the value is not in the valid range, the default value 30 is used.

– After the successful login, the user can open Mind Studio on one webpage of a browser of one client only.

Ascend 310Mind Studio Basic Operations 2 User Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 5

Page 11: Mind Studio Basic Operations - HUAWEI CLOUD

– If the current user is logged in and the same user name and password areused to log in to Mind Studio on a different client, the current user willbe forced to log out.

– If the server is shut down, the message "The service is not available!" isdisplayed upon login. In this case, go to the log file in the tools directory($HOME/tools by default) selected during the installation and check themind_log file to confirm whether the Mind Studio background service isstopped. If yes, restart Mind Studio.

2.2 Resetting the PasswordAfter you successfully log in to Mind Studio for the first time, the page forresetting the password will be displayed, asking you to reset the password. Table2-2 describes the parameters on the page.

Table 2-2 Parameters on the password resetting page

Parameter Description

User Name Login user name. The default value isMindStudioAdmin. You cannot change it orcreate one.

Old Password Default password

New Password New password, which cannot be the same asOld Password.For details about the password format, see thepassword requirements in Table 2-1.The new password must be different from any ofthe latest three passwords.

Confirm Password Confirmed password, which must be the same asNew Password

After the password is reset, click OK. A dialog box is displayed, indicating that thepassword is reset successfully. After you click OK, the page shown in 2.1 LoggingIn will be displayed. Enter the new password to access Mind Studio.

NO TE

● If you fail to reset the password for three consecutive times within 5 minutes, the resetfunction will be locked. Try again in 30 minutes.

● The password can be reset only once.

2.3 Changing the PasswordIf you want to change the password, click Modify Password on the login pageshown in Figure 2-1. The page for changing the password is displayed, as shownin Table 2-3.

Ascend 310Mind Studio Basic Operations 2 User Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 6

Page 12: Mind Studio Basic Operations - HUAWEI CLOUD

Table 2-3 Parameters on the password change page

Parameter Description

User Name Login user name. The default value isMindStudioAdmin. You cannot change it orcreate one.

Old Password Old password

New Password New password, which cannot be the same asOld Password.For details about the password format, see thepassword requirements in Table 2-1.The new password cannot be the same as theprevious three passwords.

Confirm Password Confirmed password, which must be the same asNew Password

NO TE

If you fail to change the password for three consecutive times within 5 minutes, thepassword change function will be locked. Try again in 30 minutes.

After the password is changed, click OK. A dialog box is displayed, indicating thatthe password is changed successfully. After you click OK, the page shown in 2.1Logging In will be displayed. Enter the new password to access Mind Studio.

NO TE

If the password of a logged in user is changed, the user will be forced to log out.

2.4 Logging OutIf you want to log out Mind Studio, choose File > Logout. The dialog box shownin Figure 2-2 will be displayed. Click Yes to exit.

Figure 2-2 Logout dialog box

Ascend 310Mind Studio Basic Operations 2 User Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 7

Page 13: Mind Studio Basic Operations - HUAWEI CLOUD

2.5 Querying Security LogsSecurity logs are stored in the log file in the tools directory (the default path is$HOME/tools/log/login_log). The logs are updated on a daily basis. The namingformat of the log file is USR-year-month-day .LOG. Figure 2-3 shows an exampleof the log content.

Figure 2-3 Security log example

Ascend 310Mind Studio Basic Operations 2 User Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 8

Page 14: Mind Studio Basic Operations - HUAWEI CLOUD

3 Project Management

3.1 Project Introduction

3.2 Basic Project Operations

3.3 Basic Node Operations

3.1 Project IntroductionMind Studio provides the project management function to manage the followingtypes of projects:

● Python projects● Matrix orchestration projects (Mind projects)● C/C++ projects● Tensor Engine projects

Project management operations include:

● Creating/Deleting a project● Uploading/Downloading a project● Opening/Closing a project● Creating/Deleting a file● Uploading a file/folder

3.2 Basic Project Operations

NO TICE

● Ensure that the Mind Studio web page is not zoomed out (zoom-in is allowed).If the page is zoomed out, some menus may not be displayed.

● All windows opened in the Mind project cannot be dragged.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 9

Page 15: Mind Studio Basic Operations - HUAWEI CLOUD

3.2.1 Creating/Deleting a Project● Project creation

In Mind Studio, choose File > New > New Project from the main menu tocreate a project such as a Mind project. In the dialog box that is displayed,click Mind Project under Mind Engine Project, enter the project name, andclick Create to create a project, as shown in Figure 3-1. Table 3-1 describesthe parameters on the page.

Figure 3-1 New Project dialog box

NO TE

● The new Mind Studio project is saved in the /projects file under the directoryspecified by the toolpath parameter in the $HOME/tools/scripts/env.conf file. Forexample, if toolpath is set to ~tools, the new project is saved in $HOME/tools/projects.

● After a project is created, a .project file is automatically generated in the /projectsdirectory. This file cannot be modified or automatically created after it is manuallydeleted.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 10

Page 16: Mind Studio Basic Operations - HUAWEI CLOUD

Table 3-1 Parameter description

Parameter Description

Name Set the project name. Set this parameter as required.The name must be a character string without spaces orChinese characters. A space is automatically filled with ahyphen (-).

Mind Type Project type, which is selected from the drop-down list box● DEFAULT: A canvas is generated as the project is created.

You can orchestrate the project by dragging.● CUSTOM: A custom project is created without generating

a canvas.

Target Running environment, which is selected from the drop-downlist box● ASIC: evaluation Board (EVB) or PCIe board connected● Atlas DK: developer board connected● Local: simulation environment, which is used only for the

Caffe inference engineNOTE

If a local simulation project is created, model components underCaffe Models in Model must be used. For details about how to addCaffe model components, see 5.3.2 Adding a Caffe ModelComponent. The pre-processing node must be ImagePreProcessPil-low and the inference engine must be CaffeInferenceEngine.

Source Code Code source, which is selected from the drop-down list box● Empty: The project is not imported externally.● Local(Web Client): The source file is imported from the

local Windows PC. The text box for uploading the sourcefiles displayed.

● Local(Web Server): The source file is imported from theserver. If this option is selected, the text box for enteringthe code path of the Mind Studio server is displayed.

● Project deletion

Right-click the root directory of the project and choose Delete from theshortcut menu.

3.2.2 Uploading/Downloading a Project● Project import

In Mind Studio, choose File > Upload Project from the main menu. TheUpload Project dialog box is displayed. Select the .zip project file to beuploaded. After the file is uploaded successfully, a progress bar is displayed, asshown in Figure 3-2.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 11

Page 17: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-2 Upload Project dialog box

● Project downloadIn Mind Studio, choose File > Download Project from the main menu. Theproject is downloaded to the download directory of the local user as a .zippackage. Custom datasets and custom models added to the Mind project aredownloaded with the project and saved in the MyDataset and MyModelfolders respectively in the .zip package. When the .zip package is uploadedagain, the data in the MyDataset and MyModel folders is also uploaded tothe corresponding dataset and model directories.

3.2.3 Creating/Deleting a File● Creating a file:

Right-click in the Projects Explorer view and choose New from the shortcutmenu, or choose File > New from the main menu. In the displayed sub-menu,select the file type to be created. In the displayed dialog box, enter the filename (the suffix of the file is not required), as shown in Figure 3-3.

Figure 3-3 Entering the name of the new file

● Deleting a file:Right-click a file and choose Delete from the shortcut menu.

3.2.4 Uploading a File/FolderFor details about the supported formats of the files to be uploaded and the filescontained in the uploaded folders, see 3.2.9 Supported File Formats.

● File upload– Upload from the local computer: In the Projects Explorer view, select a

folder and choose File > Add File > Add File(Client). In the dialog boxthat is displayed, select a local file and upload it. Figure 3-4 shows thesuccessful upload.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 12

Page 18: Mind Studio Basic Operations - HUAWEI CLOUD

– Upload from the server: In the Projects Explorer view, select a folder andchoose File > Add File > Add File(Server). In the dialog box that isdisplayed, select a file and upload it. After the file is uploadedsuccessfully, it can be found in the selected folder.

Figure 3-4 Successful file upload

● Folder uploadIn the Projects Explorer view, select a folder and choose File > Add Folder toopen the folder upload dialog box. Select a local folder and upload it. Afterthe folder is uploaded successfully, the dialog box shown in Figure 3-5 isdisplayed.

Figure 3-5 Successful folder upload dialog box

If a file or folder with the same name already exists in the project, a dialogbox is displayed, as shown in Figure 3-6.

Figure 3-6 Confirm Overwrite dialog box

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 13

Page 19: Mind Studio Basic Operations - HUAWEI CLOUD

NO TE

Ensure that the root directory of the uploaded folder contains files. An empty folder isnot uploaded.

3.2.5 Opening a ProjectTo open a project, choose File > Open Project from the main menu, as shown inFigure 3-7.

Figure 3-7 Open Project sub-menu

The Open Project dialog box is displayed, as shown in Figure 3-8.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 14

Page 20: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-8 Open Project dialog box

Select a project and click Open, as shown in Figure 3-9.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 15

Page 21: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-9 Selecting a project

If no project is selected, a message is displayed prompting you to return to theprevious dialog box to select a project, as shown in Figure 3-10.

Figure 3-10 Open Project dialog box

Then, the opened project is displayed in Projects Explorer.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 16

Page 22: Mind Studio Basic Operations - HUAWEI CLOUD

3.2.6 Closing a ProjectSelect a project in Projects Explorer, and choose File > Close Project, as shown inFigure 3-11.

Figure 3-11 Close Project submenu

The Close Project dialog box is displayed, as shown in Figure 3-12.

Figure 3-12 Close Project dialog box

If you select OK, the project is closed. The project cannot be found in ProjectsExplorer. The files of the project are closed as well.

3.2.7 Compiling a ProjectNO TE

C/C++ and Python projects do not support compilation, running, debugging, or profiling.

Mind Project

Step 1 Create a project. (Project my_vgg16 is used as an example.)

1. In Mind Studio, choose File > New > New Project..... from the main menu.2. In the New Project dialog box, choose Mind Engine Project > Mind Project.

– Set Name to my_vgg16.– Set Mind Type to CUSTOM.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 17

Page 23: Mind Studio Basic Operations - HUAWEI CLOUD

– Set Target to ASIC or Atlas DK.

▪ ASIC: The project runs on the PCIe board. You need to obtain theinstallation package of ASIC during the installation of Mind Studio.

▪ Atlas DK: The project runs the developer board. You need to obtainthe installation package of the developer board during theinstallation of Mind Studio.

– Set Source Code From to Local (WebServer).– Set Local File Path to $HOME/tools/che/ddk > ddk > sample >

fasterrcnn_vgg16_asic.Click Create to import the sample project.

Figure 3-13 Importing a sample project

Step 2 In Projects Explorer, select a Mind project (for example, my_vgg16) and chooseBuild > Edit Build Configuration.... The Build Configurations dialog box isdisplayed, as shown in Figure 3-14.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 18

Page 24: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-14 Build Configurations dialog box

Step 3 Configure a custom project.

The custom configuration project consists of three tab pages: Main, Host, andDevice.

Each .so file needs to be configured on the corresponding tab page based on theside value of each engine in the sample.prototxt file.

Table 3-2 describes the parameters on the Main, Host, and Device tab pages.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 19

Page 25: Mind Studio Basic Operations - HUAWEI CLOUD

Table 3-2 Configuration description

TabPage

Description

Main Used to generate an executable file.Choose Build > Edit Build Configurations > Main and select thefollowing files:● vgg16_main.cpp● /src/data_recv.cpp● /src/dest_engine.cpp● /src/src_engine.cpp● /src/util.cppIn Build Options, enter <project_path> in the text box of includepath.To view the value of <project_path>, right-click the project directoryon the left and choose Show References from the shortcut menu.Separate multiple directories to be included by spaces.Example: /home/ascend/tools/projects/my_vgg16 In the precedingpath, ascend is the installation user name, which must be changedbased on actual requirements.After the compilation is successful, the executable files my_vgg16 (inthe out folder) and CMakeLists.txt (in the build folder under theroot directory of the project) are generated.

Host Used for adding an engine to run on the host and entering theengine nameIn this sample, parameters on this tab page do not need to beconfigured.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 20

Page 26: Mind Studio Basic Operations - HUAWEI CLOUD

TabPage

Description

Device Used for generating the device library.Choose Build > Edit Build Configurations > Device, set EngineName to faster_rcnn_vgg16 (this is the name of the generated .solibrary file, which must be unique), and select /src/faster_rcnn_engine.cpp under Files.In Build Options, enter <project_path> in the text box of includepath.To view the value of <project_path>, right-click the project directoryon the left and choose Show References from the shortcut menu.Separate multiple directories to be included by spaces.Example: /home/ascend/tools/projects/my_vgg16 In the precedingpath, ascend is the installation user name, which must be changedbased on actual requirements.After the compilation is successful, the executable .so files (in the outfolder) and CMakeLists.txt (in the build folder under the rootdirectory of the project) are generated.NOTE

The .so file needs to be signed to avoid being tampered with. The signingmethod is as follows:1. Call the RSA_generate_key interface of the OpenSSL tool to generate the

public key pub.pem and the private key pri.pem. The recommended keylength is greater than or equal to 2048 bits.

2. Use the private key to sign the .so file using the SHA256 algorithm togenerate the .so.signature file, which is stored in the same directory as theoriginal .so file.

3. Call the SetPublicKeyForSignatureEncryption interface to transfer the publickey to Matrix. For details about the interface information, see the Ascend310 Matrix API Reference.

Which of the three tab pages is configured depends on which side the .so file ofthe engine needs to be used. In this sample, SrcEngine and DestEngine areconfigured on the Main tab page while faster_rcnn_vgg16 is configured on theDevice tab page. The following figures show the compilation configurationexamples.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 21

Page 27: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-15 Configuration example on the Main tab page

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 22

Page 28: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-16 Configuration example on the Device tab page

Click Build Options in the Build Configurations dialog box. A dialog box isdisplayed, as shown in Figure 3-17.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 23

Page 29: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-17 Main tab in the Build Options dialog box

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 24

Page 30: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-18 Device tab page in the Build Options dialog box

NO TE

● On the Main and Device tab pages, set Include Path to /home/ascend/tools/projects/my_vgg16. All the .cpp files in the src directory and vgg16_main.cpp reference the /home/acend/tools/projects/my_vgg16/inc/util.h file during compilation.

● In the preceding path, ascend is the installation user name, which must be changedbased on actual requirements.

Table 3-3 describes the parameters on each tab page of the Build Options dialogbox.

Table 3-3 Parameters in the Build Options dialog box

Parameter Description

AutomaticallyregenerateCMakeLists.txt

This check box is selected by default.● If this check box is selected, the CMakeLists.txt file

is automatically overwritten each time theconfiguration is saved. (If Makefile is modified,CMakeLists.txt will also be overwritten.)

● If this check box is deselected, CMakeLists.txt is notautomatically overwritten each time theconfiguration is saved.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 25

Page 31: Mind Studio Basic Operations - HUAWEI CLOUD

Parameter Description

C++ Standard C++ standard. The options are as follows:● C++ 11● C++ 98The default setting is C++ 11.

Debug Flags Compilation mode. The options are as follows:● Debug● ReleaseThe default setting is Debug.

Cpp Flags Compilation option, configurable

Link Library Referenced link library, configurableLinked dynamic library, corresponding to the value of -lin the compilation command

Lib Path Link library path, configurable. Currently, the defaultpath is used.Dynamic library search path, corresponding to thevalue of -L in the compilation command

Include Path Header file path, configurable. Currently, the defaultpath is used.Header file search path, corresponding to the value of -I in the compilation command.

Step 4 After the configuration is complete, click Save to save the project structureconfiguration. Choose Build > Build > Build-Configuration to compile the projectstructure.

----End

Tensor Engine Projects

Step 1 In Projects Explorer, select a Tensor Engine project and choose Build > Edit BuildConfiguration.... The Build Configurations dialog box is displayed, as shown inFigure 3-19.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 26

Page 32: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-19 Build Configurations dialog box of the Tensor Engine project

Step 2 Click Advance Options. The Convert Model Parser area is displayed, as shown inTable 3-4.

Table 3-4 Parameters in the Build Configurations dialog box of the Tensor Engineproject

Parameter Description

Build Configuration Project name

Custom Operator Name Operator to be compiled

Cpp Flags Compilation option, configurable

Link Library Referenced link library, configurableLinked dynamic library, corresponding to thevalue of -l in the compilation command

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 27

Page 33: Mind Studio Basic Operations - HUAWEI CLOUD

Parameter Description

Lib Path Link library path, configurable. Currently, thedefault path is used.Dynamic library search path, correspondingto the value of -L in the compilationcommand

Include Path Header file path, configurable. Currently, thedefault path is used.Header file search path, corresponding tothe value of -I in the compilation command.

Debug Mode Debug mode enable, corresponding to the -g compilation option

Automatically Generate Makefile Whether to generate Makefileautomatically

Step 3 After the configuration is complete, click Save to save the project structureconfiguration. Choose Build > Build. Multiple configurations of the selectedproject are displayed, as shown in Figure 3-20. Select the correspondingconfiguration for compilation as required.

Figure 3-20 Sets of configurations corresponding to one project

----End

3.2.8 Running a ProjectNO TE

The following operations are available only when the project type is CUSTOM.

Select a project in Projects Explorer and choose Run > Edit Run Configuration...from the main menu. The Run Configurations dialog box is displayed, as shownin Figure 3-21.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 28

Page 34: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-21 Run Configurations dialog box

On the configuration page, click + to add a configuration or select a configurationfrom the drop-down list to delete it. The build configurations GUI changesaccording to the value of Run Configuration.

Select a project in Projects Explorer, and then choose Run > Run from the mainmenu. The configurations of the selected project are displayed.

3.2.9 Supported File FormatsFor details about the file formats supported by Mind Studio, see Table 3-5.

Table 3-5 Supported file formats

No. Supported File Format

1 7z

2 asc, asp, and aspx

3 bak, bat, bin, blank, bmp, and build_project

4 c, caffemodel, cc, cce, cfg, check_cache, class, CMake, com,conf, config, cpp, crt, cs, css, csv, and cxx

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 29

Page 35: Mind Studio Basic Operations - HUAWEI CLOUD

No. Supported File Format

5 data, db, and dll

6 exe

7 go and gz

8 h, H.264, H.265, host, hpp, and html

9 i, ico, iml, inc, ini, includecache, info, and internal

10 jar, java, jpeg, jpg, js, json, and jsp

11 key

12 lib and log

13 make, mapping, marks, md, mind, mk, and mkldnn

14 nv12

15 o, obj, om, and out

16 params, pb, php, png, project, property, proto, prototxt, py,and pyc

17 rar, rom, and run

18 scala, sh, so, spec, sql, and src

19 ar, tar.gz, template, TensorFlow, tgz, ts, and txt

20 war

21 xml

22 YAML, YML, YUV, YUV400P, YUV400SP, YUV420P,YUV420SP, YUV422P, YUV422SP, YUV444P, and YUV444SP

23 zip

3.3 Basic Node Operations

3.3.1 Service Node OverviewOn Mind Studio, service developers can orchestrate and run service processes bydragging graphical service nodes, connecting service nodes, and editing servicenode properties to achieve "zero" programming of service process orchestration.

A service node indicates a handling process. For example, the ImagePreProcessnode can be used to re-edit an image, set its size, and zoom it in or out.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 30

Page 36: Mind Studio Basic Operations - HUAWEI CLOUD

NO TE

Mind Studio supports drag-and-drop programming, which reduces the difficulty fordeveloping AI engines. You can drag and drop nodes in a visualized manner toautomatically generate inference code, which is quite simple. The automatically generatedcode is the sample code in a typical application scenario and is for reference only. You mustidentify, modify, and optimize the code based on the actual application scenario.

The connection between service nodes indicates the data flow between nodes. Theoutput of the connection start is the input of the connection end. The propertyconfigurations of a service node are the parameters required for running the node.

Service nodes are classified into the following types:

● Datasets: dataset node, used to specify the data input to a network● Model: model node, used to specify the NN model● PreProcess: data pre-processing node, used to pre-process the data in a

dataset● Customize: data input node● Deep Learning Execution Engine: NN execution node, used to run a network● PostProcess: post-processing node, used to perform post-processing on a

network execution result● Publish: node in publish mode

The following describes the default nodes provided in the current version.

Table 3-6 Built-in nodes

Type Node Name Function

Datasets

MnistDataset Preset dataset for the identification ofhandwritten digits

ImageNet100 Preset ImageNet dataset containing 100 images,used as the data input to a classification network

Pascal100 Preset Pascal dataset containing 100 images, usedas the data input to a detection network

COCO100 Preset COCO dataset containing 100 images, usedas the data input to a detection network

Image10 Preset image-type dataset containing 10 images,used as the data input to the classification anddetection networks

RawDataset Raw-type dataset containing one 224 x 224image, used as the data input to the classificationand detection networks

Model

Resnet18 Classification network model for classifyingimages

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 31

Page 37: Mind Studio Basic Operations - HUAWEI CLOUD

Type Node Name Function

Preprocess

ImagePreProcess Function: used to pre-process the image data andconvert the image data into YUV images in NV12formatRunning side: deviceDataset: image data in JPG, JPEG, PNG, or NV12formatModel: any network modelScenario: Target set to ASIC or Atlas DK

ImagePreProcessPil-low

Function: used to pre-process the image data andconvert the image data into BGR imagesRunning side: Mind Studio serverDataset: image data in JPG, JPEG, PNG, or NV12formatModel: Caffe modelScenario: Target set to Local

Deep-LearningExecutionEngine

MindInferenceEn-gine

Function: Mind inference engine, used in inferencefor the classification network and detectionnetworkRunning side: deviceModel: converted classification or detectionnetwork model using Mind StudioScenario: Target set to ASIC, or Atlas DK

CaffelnferenceEn-gine

Function: open-source Caffe inference engineRunning side: Mind Studio serverModel: Caffe modelScenario: Target set to Local (withImagePreProcessPillow as the pre-processingnode)Faster R-CNN multi-batch is not supported(because it is not supported in open source code).

Postprocess

ImageClassifica-tionPostProcess

Function: post-processing node of theclassification network, used to parse theclassification network inference results and obtainthe inferred categories of images and inferenceprobabilitiesRunning side: hostDataset: classification network dataset (such asImage and ImageNet)Model: classification network model (such asResNet18)Scenario: Target set to ASIC, Atlas DK, or Local

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 32

Page 38: Mind Studio Basic Operations - HUAWEI CLOUD

Type Node Name Function

FasterRCNNPostProcess

Function: used to analyze the output of the FasterR-CNN network and obtain the image detectionresultRunning side: hostDataset: A detection network dataset isrecommended (such as the Pascal or COCOdataset). If the JPG images in the Image orImageNet dataset are used, only the box detectionis supported. The prediction result cannot bemarked.Model: Faster R-CNN network modelScenario: Target set to ASIC, Atlas DK, or LocalRestrictions: The template code of the post-processing node in the Faster R-CNN model isapplicable only to a specific network structure andthe specific number of categories. The defaultnumber of categories is 20. If the Faster R-CNNmodel is customized, the parameters in thetemplate code of the post-processing node needto be modified accordingly.

SSDPostProcess Function: used to analyze the output of the SSDnetwork and obtain the image detection resultRunning side: hostDataset: detection network dataset (such as thePascal or COCO dataset)Model: SSD network modelScenario: Target set to ASIC, Atlas DK, or Local

SaveFilePostProcess Function: post-processing node, used to write theinference result into a file for further processingRunning side: hostDataset: image data in JPG, JPEG, PNG, NV12, orbinary formatModel: any network modelScenario: Target set to ASIC, Atlas DK, or Local

Custmoize

FastRCNNImageIn-fo

Function: used to specify the height, width, andscaling ratio of the images input to a network(only used in the Faster R-CNN network as thethird input of MindInferenceEngine)Running side: deviceDataset: detection network dataset (such as thePascal or COCO dataset)Model: Faster R-CNN network modelScenario: Target set to ASIC, Atlas DK, or Local

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 33

Page 39: Mind Studio Basic Operations - HUAWEI CLOUD

Type Node Name Function

Publish

PublishInput Function: input graphical element in publish modeRunning side: hostDataset: dataset in JPG, PNG, BMP, binary, or JPEGformatModel: models matching datasetsScenario: Target set to ASIC or Atlas DK

PublishOutput Function: output graphical element in publishmodeRunning side: hostScenario: Target set to ASIC or Atlas DK

NO TE

The digital vision pre-process (DVPP) output is in YUV420SP format, that is, in NV12 format(default format). The width is 128-byte aligned and the height is 16-byte aligned.In engine orchestration, the post-processing node is not universal. It is only applicable tothe inference result parsing of specific models.For example, the template code of the post-processing node in Faster R-CNN is onlyapplicable to specific network architectures and the specific quantity of classes. The defaultnumber of classes is 20.

3.3.2 Placing a NodeIn the right pane of the engine process orchestration window, all node types aredisplayed on the tool tab. Click the triangle arrow before a node type to expandits details. Hold down the left mouse button to drag a node to the canvas on theleft, as shown in Figure 3-22. You can move the nodes dragged to the canvasflexibly.

Figure 3-22 Placing a node

For details about the nodes on the Tool tab, see 3.3.1 Service Node Overview.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 34

Page 40: Mind Studio Basic Operations - HUAWEI CLOUD

NO TICE

1. In the Mind Engine process, a Datasets node serves as the start node, and aPostProcess node serves as the end node. The connection direction is fromDatasets to PostProcess.

2. Currently, nodes with the same name cannot coexist because nodes with thesame name represent the same source folder.

3. A folder with the same name as the placed node will be generated in thedirectory of the .mind file on Mind Studio, as shown in Figure 3-23.

Figure 3-23 Folder generated after a node is placed

3.3.3 Deleting a NodeYou can delete a node by pressing the Delete key or using the shortcut menu.

● Pressing the Delete key

a. To delete a single node, click the node to be deleted. A blue frame isdisplayed around the node, as shown in Figure 3-24. Then, press Delete .The connections led out from the node are also deleted.

Figure 3-24 Deleting a single node

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 35

Page 41: Mind Studio Basic Operations - HUAWEI CLOUD

b. To delete multiple nodes, press and hold down the Ctrl key, and thenpress and hold the left mouse button to select an area. Red frames aredisplayed around the nodes in the selected area, as shown in Figure 3-25.

Figure 3-25 Deleting multiple nodes

Select the area and release the Ctrl key, and then press Delete to deleteall the nodes in the selected area. You can click the blank area in thecanvas to cancel the selection.

● Choosing Delete from the shortcut menu

a. To delete a single node, select the node to be deleted, right-click, andchoose Delete from the shortcut menu, as shown in Figure 3-26.

Figure 3-26 Deleting a single node

b. To delete multiple nodes, press and hold down the Ctrl key, and thenpress and hold the left mouse button to select an area. Right-click theselected area and choose Delete from the shortcut menu, as shown inFigure 3-27.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 36

Page 42: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-27 Deleting multiple nodes

3.3.4 Copying and Pasting a NodeYou can copy a single node or multiple nodes.

Select a node or an area covering multiple nodes, right-click, and choose Copyfrom the shortcut menu. Right-click the blank area and choose Paste from theshortcut menu. If you have selected multiple connected nodes, the connections arealso copied. For details, see Figure 3-28, Figure 3-29, and Figure 3-30.

NO TE

After you right-click a selected node and choose Copy or Cut from the shortcut menu, thecopied or cut node can be pasted only on the current canvas. If you switch to anothercanvas or switch to another canvas and then switch back to the current canvas, the Pastefunction is unavailable, and the copied or cut node data will be lost.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 37

Page 43: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-28 Copying a node

Figure 3-29 Pasting a node

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 38

Page 44: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 3-30 Copying multiple nodes

3.3.5 Setting the Properties of a NodeYou can perform the following operations to configure node properties:

Select a node and set its properties on the property tab page in the right pane, asshown in Figure 3-31.

Figure 3-31 Setting node properties

Different types of nodes have different properties, as described in Table 3-7.

Table 3-7 Node properties

Node Type Property Description

All Name Node name

Datasets Path Path for storing the dataset

Data Type Data type

Include YUV420SP Whether YUV420SP is included

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 39

Page 45: Mind Studio Basic Operations - HUAWEI CLOUD

Node Type Property Description

Batch Number of images processed ata time Value range: [1, 65535]

Run mode Image processing mode, whichis selected from the drop-downlist box● All: Processes all images.● Specify: Processes selected

images.● Random: Processes Random

Number images.

Model Model Path Path for storing the model file

DVPP Parameter Path Path for storing the DVPPparameter filesFor a built-in model, thisparameter uses the defaultvalue and cannot be modified.This parameter cannot be setfor a custom model.

Decryption Passcode Model decryption key fileNOTE

This parameter needs to be setonly for encrypted custom models.

Preprocess Running On Side on which the node isdeployed: Host or Device

Crop(crop enable)

From-Upper

Whether to use the cropparameters transferred from theupper-layer engine

point_x Horizontal coordinate of thestart position of cropping. Thestart position is in the upper leftcorner of the image. The valueis [0, 4079] or –1. The valuemust be an integer.

point_y Vertical coordinate of the startposition of cropping. The startposition is in the upper leftcorner of the image. The valueis [0, 4079] or –1. The valuemust be an integer.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 40

Page 46: Mind Studio Basic Operations - HUAWEI CLOUD

Node Type Property Description

crop_width Width of the cropped image.The value is [16, 4096] or –1.The value must be an integer.The value of resize_width/crop_width must be a multipleof [1/32, 16].

crop_height

Height of the cropped image.The value is [16, 4096] or –1.The value must be an integer.The value of resize_height/crop_height must be a multipleof [1/32, 16].

NOTEIf any value of point_x, point_y, crop_width, andcrop_height is –1, the other three values must alsobe –1.

Resize(resizeenable)

resize_width

Width of the cropped imageafter scaling. The value range is[16, 4096]. The value must bean integer. The value ofresize_width/crop_width mustbe a multiple of [1/32, 16].

resize_height

Height of the cropped imageafter scaling. The value range is[16, 4096]. The value must bean integer. The value ofresize_width/crop_width mustbe a multiple of [1/32, 16].

Dump Image Pre-processing result in theform of images

Mean Value(average ofthe imagepre-processingresult)

mean_of_B Image pre-processing channel B.The mean values in theinference and training processesmust be the same. The value isan integer in [0, 255].

mean_of_R Image pre-processing channel R.The mean values in theinference and training processesmust be the same. The value isan integer in [0, 255].

mean_of_G Image pre-processing channelG. The mean values in theinference and training processesmust be the same. The value isan integer in [0, 255].

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 41

Page 47: Mind Studio Basic Operations - HUAWEI CLOUD

Node Type Property Description

Scale scale_value Scaling ratio. The value range is[1, 255]. The value can be afloating point number with upto five decimal places.

NOTEThe Mean Value and Scale parameters are available only in theImagePreProcessPillow node.

Deep-LearningExecutionEngine

Running On Side on which the node isdeployed: Host or Device

Input Count Number of input nodes. Thevalue is an integer in [2, 16].The default value is 2.

Output Count Number of output nodes. Thevalue is an integer in [1, 16].The default value is 1.

Dynamic Aipp(DynamicAIPP)

InputImageFormat

Input image format. The defaultformat is YUV420SP_U8.Options: YUV420SP_U8,XRGB8888_U8, RGB888_U8,and YUV400_U8NOTE

U8 indicates uint8.

ImageFormatConversion

Color gamut conversion. Thisfunction is enabled by default.This function needs to beenabled when the format of theinput image is different fromthat of the model processingfile.

ModelImageFormat

Format of the model processingimage. The default format isBGR888_U8.Options: YUV444SP_U8,YVU444SP_U8, RGB888_U8,BGR888_U8, and GRAYAn option can be selected aftercolor gamut conversion isenabled.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 42

Page 48: Mind Studio Basic Operations - HUAWEI CLOUD

Node Type Property Description

During model conversion, if the ImagePreprocess Mode parameter in the InputImage Preprocess area is set to Dynamic,this parameter is enabled by default when theinference engine is connected. Otherwise, thisparameter is disabled by default. If thedynamic AIPP model is imported by importingan offline model, you need to manuallyenable Dynamic AIPP.

Advanced ThreadCount

Number of threads on a node.Value range: [1, 30]. The valuemust be an integer.

ThreadPriority

Thread priority of a node. Valuerange: [1, 99]. The value mustbe an integer.

Postprocess Running On Side on which the node isdeployed: Host or Device

OutputName Name of the output layer. Thedefault value is prob for aclassification network ordetection_out for a detectionnetwork. The value range is [a-zA-Z0-9_./\-], and the valuecannot end with a dot (.).NOTE

If the name of the last networklayer in the user model is differentfrom the default value of theOutputName parameter of thepost-processing node, a messagesimilar to "the output namedoesn't exist" is displayed. In thiscase, you need to change the nameof the last network layer to prob ordetection_out based on the modeltype.

Output Count Number of output nodes. Valuerange: [0, 15]. The value mustbe an integer.NOTE

This parameter is available only onthe detection network post-processing node.

Advanced ThreadCount

Number of threads on a node.Value range: [1, 30]. The valuemust be an integer.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 43

Page 49: Mind Studio Basic Operations - HUAWEI CLOUD

Node Type Property Description

ThreadPriority

Thread priority of a node. Valuerange: [1, 99]. The value mustbe an integer.

SoName List of file names of all .sodynamic library files required bythe node. Click the plus sign (+)next to SoName to add morefile names. The value range is[a-zA-Z0-9_.], and the valuecannot end with a dot (.).

Configs Node configuration properties,including Name and Value.Click the plus sign (+) next toConfigs to add more properties.The value range of Name is [a-zA-Z0-9_./\-]. The value ofValue cannot contain spaces,Chinese characters, or doublequotation marks and cannotend with a dot (.).

OutputSettings

Output settings, including thefollowing three parameters:● Port: output port ID, which is

selected from the drop-downlist box

● Label: label of the categoryto be filtered. The value is aninteger in [0, 1000000].

● Confidence (%): confidencelevel. The value is an integerin [0, 100].

NOTEThis parameter is available onlywhen the network post-processingnode is detected and the value ofOutput Count is greater than 0.

Publish PublishInput Used to receive external parsingdata and send the data to thenext engine

PublishOutput Post-processing output function

3.3.6 Establishing a ConnectionThe connection between service nodes indicates the data flow direction betweennodes.

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 44

Page 50: Mind Studio Basic Operations - HUAWEI CLOUD

After the basic properties of a node are set, you can set up the node connections.Each node has input and output connecting points.

● An orange solid point represents an output connecting point while a greenone represents an input connecting point. A line must be connected from theoutput connecting point of a node to the input connecting point of anothernode.

● When you hold down an output connecting point, you can pull out theconnection line and place it on the input connecting point of another node toestablish a connection. When you pull out the connection line, a green dashedframe is displayed around the connectable node, as shown in Figure 3-32.

Figure 3-32 Node connection

3.3.7 Saving NodesAfter the connection is established, click Save in the lower left corner of thecanvas to save the flowchart. If the saving is successful, a dialog box is displayed,indicating that the flowchart is saved successfully, as shown in Figure 3-33.

Figure 3-33 Saving the connected nodes

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 45

Page 51: Mind Studio Basic Operations - HUAWEI CLOUD

3.3.8 Generating a .cpp FileAfter the Mind Engine process is saved, click Generate in the lower left corner ofthe canvas. A .cpp file is generated based on the configuration of the Mind project.The generated .cpp file is added to the navigation tree on the left, as shown inFigure 3-34.

Figure 3-34 Generating a .cpp file

NO TICE

If the Mind project lacks configurations, the .cpp file fails to be generated and anerror is reported, as shown in Figure 3-35. Check whether the .project file exists inthe root directory of the project and whether Target is configured in the file.Target can be set to Local, ASIC, or Atlas DK.

Figure 3-35 Error message

Ascend 310Mind Studio Basic Operations 3 Project Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 46

Page 52: Mind Studio Basic Operations - HUAWEI CLOUD

4 Dataset Management

4.1 Overview

4.2 Dataset Management in the Projects Explorer Window

4.3 Dataset Management in the Datasets Explorer Window

4.1 OverviewDatasets are classified into built-in datasets and custom datasets (my datasets).Built-in datasets can be directly used by dragging. Custom datasets need to bemanually imported. The properties of custom datasets are stored in MongoDB,and the files imported by users are stored in the file system. The properties ofcustom datasets are stored in MongoDB, and the files imported by users arestored in the file system.

● Built-in Datasets

Mind Studio provides built-in datasets that can be used in created Mindprojects. Built-in datasets exist before a workspace is created. You can usethem but cannot add, delete, or modify them.

Currently the following built-in datasets are available:

– MnistDataset: most commonly used dataset for reasonableness check. Itconsists of 28 x 28 black and white images of handwritten digits. Thedigits are displayed in the center of each image. MNIST is a simple task.Passing the MNIST test does not necessarily indicate that a model canoperate effectively.

– ImageNet100: most commonly used dataset of the classification network,with a label file. 100 sample images are selected from the official websiteand put into the built-in dataset.

– Pascal100: common dataset of the detection network, with a label file.100 sample images are selected from the official website and put into thebuilt-in dataset.

– COCO100: common dataset of the detection network, with a label file.100 sample images are selected from the official website and put into thebuilt-in dataset.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 47

Page 53: Mind Studio Basic Operations - HUAWEI CLOUD

– Image10: dataset of the image type, which contains 10 images– RawDataset: dataset of the raw type, which contains one 224 x 224

image● My Datasets

You can create your own datasets by saving sets of images as custom datasetsfor future use. A newly created workspace has no custom datasets. Customdatasets can be added or deleted but cannot be modified.The images of a custom dataset come from local files and local folders.

4.2 Dataset Management in the Projects ExplorerWindow

4.2.1 Viewing the DatasetsDouble-click the .mind file of a Mind engine project to open the engineorchestration window.

On the Tool tab page on the right, Datasets consists of two subdirectories, asshown in Figure 4-1.

● Built-in Datasets● My Datasets (custom datasets)

Figure 4-1 Dataset management area

Click to expand a directory. The content of the directory is displayed, as shownin Figure 4-2.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 48

Page 54: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-2 Expanding Built-in Datasets

4.2.2 Importing a Dataset

Importing Different Types of DataYou can import different datasets based on data types. Table 4-1 describes thedata types and their differences.

Table 4-1 Dataset description

Dataset Image Suffix With Label File orNot

Image NV12 (YUV420SP format), jpeg,png, jpg, bmp, JPEG, JPG, PNG,and BMP

No

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 49

Page 55: Mind Studio Basic Operations - HUAWEI CLOUD

Dataset Image Suffix With Label File orNot

Raw bin (float BGR format) No

ImageNet jpeg and JPEG Yes

COCO jpg Yes

PASCAL jpg Yes

Camera N/A No

MIC N/A No

NO TE

The supported width/height range of the image is [16, 4096].

Click on the right of My Datasets, as shown in Figure 4-3. The ImportDataset dialog box is displayed, as shown in Figure 4-4.

Figure 4-3 Dataset import 1

Figure 4-4 Dataset import 2

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 50

Page 56: Mind Studio Basic Operations - HUAWEI CLOUD

● Importing an image dataset– Import a dataset without selecting Include YUV420SP formats, as shown

in Figure 4-5.

i. Set Data Type to Image.ii. Enter the dataset name in the Dataset Name text box.iii. Select a value from the Data Source drop-down list box. For details,

see Importing from Different Data Sources.

iv. On the left of the text box of File, click on the left to import the

dataset from the local web client, and click on the right toimport the dataset from the $HOME directory on the web server(The parameter setting method is the same as that of import fromthe local web client). The following description is based on thedataset import from the local web client.

v. With all the above-mentioned parameters set, the Import button isavailable. Click Import to import a dataset, as shown in Figure 4-5.

Figure 4-5 Dialog box for importing an image dataset 1

NO TE

If Data Source is set to Local Folder, the selected folder must containimages only.

– Import a dataset with Include YUV420SP selected, as shown in Figure4-6.

i. Select the Include YUV420SP check box.ii. Set Width and Height of the images.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 51

Page 57: Mind Studio Basic Operations - HUAWEI CLOUD

NO TE

The width and height of the dataset must be integers.

iii. With all the above-mentioned parameters set, the Import button isavailable. Click Import.

Figure 4-6 Dialog box for importing an image dataset 2

NO TE

The values of Width and Height of all YUV420SP images in the samedataset must be the same.

● Import a raw dataset, as shown in Figure 4-7.

a. Set Data Type to Raw.

b. Enter the dataset name image in the Dataset Name text box.

c. Select Local File from the Data Source drop-down list box. For details,see Importing from Different Data Sources.

d. On the left of the text box of File, click on the left to import the

dataset from the local web client, and click on the right to importthe dataset from the $HOME directory on the web server (The parametersetting method is the same as that of import from the local web client).The following description is based on the dataset import from the localweb client.

e. Image Format: image format, which is selected from the drop-down listbox

f. Width/Height: width and height of the dataset

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 52

Page 58: Mind Studio Basic Operations - HUAWEI CLOUD

NO TE

The width and height of the dataset must be integers.

g. Mean of B/R/G: mean value of the dataset. The value range is [0, 255].

NO TE

The mean values are floating-point numbers with up to four decimal places.

h. With all the above-mentioned parameters set, the Import button isavailable. Click Import.

Figure 4-7 Dialog box for importing a raw dataset

NO TE

The width, height, and mean values of all files in the same raw dataset must bethe same.

● Importing an ImageNet dataset– Import an ImageNet dataset with Use Ground Truth and Use Label

selected, as shown in Figure 4-8.

i. Set Data Type to ImageNet.ii. Enter the dataset name imagenet in the Dataset Name text box.iii. Select Local File from the Data Source drop-down list box. For

details, see Importing from Different Data Sources.

iv. On the left of the text box of File, click on the left to import the

dataset from the local web client, and click on the right toimport the dataset from the $HOME directory on the web server(The parameter setting method is the same as that of import from

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 53

Page 59: Mind Studio Basic Operations - HUAWEI CLOUD

the local web client). The following description is based on thedataset import from the local web client.

v. The Use Ground Truth check box is selected by default, which isconfigurable. In this sample, keep this check box selected.

vi. The Use Label check box is selected by default, which isconfigurable. In this sample, keep this check box selected.On the left of the text boxes of Ground Truth File and Label File,

click on the left to import a file from the local web client, and

click on the right to import a file from the $HOME directory onthe web server (The parameter setting method is the same as that ofimport from the local web client). The following description is basedon the file imported from the local host.

NO TE

A ground truth file is a .csv file, which indicates the number correspondingto the image. A label file is a JSON file, which indicates the objectcorresponding to the number.

vii. With all the above-mentioned parameters set, the Import button isavailable. Click Import.

Figure 4-8 Dialog box for importing an ImageNet dataset

NO TE

If Data Source is set to Local Folder, the selected folder must containimages only.

– Import an ImageNet dataset without selecting Use Ground Truth andUse Label, as shown in Figure 4-9.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 54

Page 60: Mind Studio Basic Operations - HUAWEI CLOUD

If both Dataset Name and File are set, the Import button is available.Click Import.

Figure 4-9 Import Dataset dialog box 1

– Import an ImageNet dataset with only Use Ground Truth selected, asshown in Figure 4-10.

i. Keep the Use Ground Truth check box selected and deselect the UseLabel check box.

ii. Import the .csv ground truth file.iii. With all the above-mentioned parameters set, the Import button is

available. Click Import.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 55

Page 61: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-10 Import Dataset dialog box 2

– Import an ImageNet dataset with a label file, as shown in Figure 4-11.

i. Keep the Use Label check box selected and deselect the Use GroundTruth check box.

ii. Import the .json label file.iii. With all the above-mentioned parameters set, the Import button is

available. Click Import.

Figure 4-11 Import Dataset dialog box 3

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 56

Page 62: Mind Studio Basic Operations - HUAWEI CLOUD

NO TE

If the Use Ground Truth or Use Label check box is selected, theHiAIAnnotations directory is generated in the dataset directory. Thedirectory stores the annotation files of each image. When the Use Labelcheck box is selected, the label dictionary file HiAI_label.json is generatedin this directory, as shown in Figure 4-12.

Figure 4-12 ImageNet dataset

● Import a COCO dataset, as shown in Figure 4-13.

a. Set Data Type to COCO. Data Source can only be set to Folder.b. Enter the dataset name in the Dataset Name text box, for example,

coco.

c. Select a directory for Folder. Click on the left to import a dataset

from the local web client, and click on the right to import a datasetfrom the web server. Select the directory from the $HOME directory onthe web server (The parameter setting method is the same as that ofimport from the local web client). The following description is based onthe dataset import from the local web client.

NO TE

The directory must contain the Annotations and Images directories. TheAnnotations directory must contain the standard .json files of the instances, andthe Images directory must contain jpg images.

d. If both Dataset Name and Folder are set, the Import button is available.Click Import.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 57

Page 63: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-13 Dialog box for importing a COCO dataset

NO TE

After successful import, the HiAIAnnotations directory is generated in thedataset directory. The directory stores the annotation file and label fileHiAI_label.json of each image, as shown in Figure 4-14.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 58

Page 64: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-14 COCO dataset

● Import a PASCAL dataset, as shown in Figure 4-15.

a. Set Data Type to PASCAL. Data Source can only be set to Folder.b. Enter the dataset name pascal in the Dataset Name text box.

c. Select a directory for Folder. Click on the left to import a dataset

from the local web client, and click on the right to import a datasetfrom the web server. (Select the directory from the $HOME directory onthe web server (The parameter setting method is the same as that ofimport from the local web client). The following description is based onthe dataset import from the local web client.

NO TE

The directory must contain the Annotations and JPEGImages directories. TheAnnotations directory contains the XML file of each image, and the JPEGImagesdirectory contains .jpg images.

d. If both Dataset Name and Folder are set, the Import button is available.Click Import.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 59

Page 65: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-15 Dialog box for importing a PASCAL dataset

NO TE

After successful import, the HiAIAnnotations directory is generated in thedataset directory. The directory stores the annotation file and label fileHiAI_label.json of each image, as shown in Figure 4-16.

Figure 4-16 PASCAL dataset

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 60

Page 66: Mind Studio Basic Operations - HUAWEI CLOUD

● Import a camera dataset, as shown in Figure 4-17.

NO TICE

The dataset of this type is used to set parameters only for obtaining images.In actual applications, input data needs to be sourced from cameras. 应用示例请参见“人脸检测”(https://ascend.huawei.com/applications)。

Figure 4-17 Dialog box for importing a camera dataset

Table 4-2 describes the parameters in the dialog box for importing a cameradataset.

Table 4-2 Parameters in the dialog box for importing a camera dataset

Parameter Description

Data Type Camera type

Dataset Name Name of the Camera dataset

Data Source Camera channel. The current channelsinclude Channel-1 and Channel-2.

FPS Frame per second, which is set to thecamera frame rate. Currently, the valuerange is [1, 20].

Image Format Format of the collected image. Currently,only YUV420SP is supported.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 61

Page 67: Mind Studio Basic Operations - HUAWEI CLOUD

Parameter Description

Image Size Size of the image to be collected. Currently,only 1280 x 720 is supported.

NO TE

Currently, the camera dataset supports only the Atlas DK developer board scenario.

● Import an MIC dataset, as shown in Figure 4-18.

Figure 4-18 Dialog box for importing an MIC dataset

Table 4-3 describes the parameters in the dialog box for importing an MICdataset.

Table 4-3 Parameters in the dialog box for importing an MIC dataset

Parameter Description

Data Type MIC type

Dataset Name Name of the MIC dataset

Data Source MIC channel. The current channels includeMONO and STEREO.

Sample Rate MIC sample rate. The available options are asfollows: 8K, 11.025K, 12K, 16K, 22.05K, 32K,44.1K, 48K, 64K, and 96K.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 62

Page 68: Mind Studio Basic Operations - HUAWEI CLOUD

Parameter Description

Sample Number/Frame Number of samples in each frame to becollected. The available options are as follows:80, 160, 240, 480, 1024, and 2048.

Bit Depth Bit depth of each sample

NO TE

● Currently, the MIC dataset supports only the Atlas DK developer board scenario.

● Due to hardware limitations, the interval between frames must be greater than orequal to 10 ms. The following requirement must be met: Sample Number/Frame ≥Sample Rate/100

Importing from Different Data Sources● Import a dataset through a local file, as shown in Figure 4-19.

a. Select Local File from the Data Source drop-down list box.

b. Click next to File to select an image.

Figure 4-19 Importing a dataset through a local file

● Import a dataset through a local folder, as shown in Figure 4-20.

a. Select Local Folder from the Data Source drop-down list box.

b. Click next to Folder to select a folder.

Figure 4-20 Importing a dataset through a local folder

NO TE

A maximum of 50,000 files are supported. If the number of files in the selectedfolder exceeds 50,000, the browser may be suspended. A dialog box will bedisplayed, indicating that the browser does not respond. Click Wait. A foldername may be displayed in the text box.

Follow-up Operations

If the Import Dataset Progress dialog box is displayed during the import, theimport is in progress, as shown in Figure 4-21.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 63

Page 69: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-21 Import Dataset Progress dialog box

If the dialog box shown in Figure 4-22 is displayed, it indicates that the import issuccessful.

Figure 4-22 Create MyDataset Success

Expand My Datasets on the Tool tab page. A new dataset component is added, asshown in Figure 4-23, indicating that the dataset is successfully imported. You candrag the component to use it.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 64

Page 70: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-23 Dataset successfully imported

Expand the my-datasets directory in the Dataset Explorer, and click to refreshthe directory. The new Dataset Name directory is added to the my-datasetsdirectory, as shown in Figure 4-24.

Figure 4-24 Viewing the imported dataset in Datasets Explorer

4.2.3 Viewing the Dataset PropertiesThe property configurations of a service node are the parameters required forrunning the node.

Select a dataset and set its properties on the property tab page in the right pane,as shown in Figure 4-25 and Figure 4-26.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 65

Page 71: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-25 Setting the properties of the built-in COCO100 dataset

Figure 4-26 Setting the properties of the custom raw dataset

Table 4-4 describes the node property parameters.

Table 4-4 Description of the node property parameters

Property Description

Name Dataset name, set in the Import Dataset dialog box.

Path Dataset path on Mind Studio, set in the Import Datasetdialog box

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 66

Page 72: Mind Studio Basic Operations - HUAWEI CLOUD

Property Description

Data Type Data type, set in the Import Dataset dialog box.

IncludeYUV420SP

Whether a YUV420SP image is included in the dataset, set inthe Import Dataset dialog box

Height Image height, available only when Include YUV420SP istrue or Data Type is Raw and set in the Import Datasetdialog box. The value is an integer.

Width Image width, available only when Include YUV420SP is trueor Data Type is Raw and set in the Import Dataset dialogbox. The value is an integer.

Mean of B Mean value of channel B. This parameter is available onlyData Type is Raw and set in the Import Dataset dialog box.The value is a floating-point number with up to four decimalplaces.

Mean of G Mean value of channel G. This parameter is available onlyData Type is Raw and set in the Import Dataset dialog box.The value is a floating-point number with up to four decimalplaces.

Mean of R Mean value of channel R. This parameter is available onlyData Type is Raw and set in the Import Dataset dialog box.The value is a floating-point number with up to four decimalplaces.

Image Format Image format. Only Float is supported.

Batch Number of images processed at a time

Run Mode Running mode● All: Processes all images.● Specify: Processes selected images.● Random: Processes Random Number images.

RandomNumber

This parameter is available only when Run Mode is set toRandom. The value range is [1, Image count in the dataset).If the image count in the dataset is 1, this parameter canonly be set to 1.

4.2.4 Generating a .cpp FileAfter the dataset component is dragged to the canvas, a .cpp file and a .h file areautomatically generated and added to the directory pane on the left for full-process orchestration. For details, see Figure 4-27.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 67

Page 73: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-27 Generating a .cpp file

4.2.5 Selecting ImagesIf a dataset contains too many images and only some of them need to beprocessed, right-click the dataset component and choose Select Images from theshortcut menu to select desired images, as shown in Figure 4-28.

Figure 4-28 Selecting images

On the page that is displayed, select the check boxes of the desired images, andclick select, as shown in Figure 4-29.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 68

Page 74: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-29 Dataset Select dialog box

The Run Mode property of the dataset changes to Specified, indicating that onlythe selected images will be processed.

4.2.6 Deleting a Custom DatasetStep 1 Right-click a dataset under My Datasets and choose Delete from the shortcut

menu, as shown in Figure 4-30.

Figure 4-30 Deleting a Custom Dataset

Step 2 In the Confirmation dialog box that is displayed, click Yes, as shown in Figure4-31.

Figure 4-31 Confirmation dialog box

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 69

Page 75: Mind Studio Basic Operations - HUAWEI CLOUD

When the dialog box shown in Figure 4-32 is displayed, the dataset is successfullydeleted.

Figure 4-32 Successful deletion dialog box

Step 3 Click ok.

Step 4 In Datasets Explorer, expand my-datasets, and click to refresh the directory.The directory of the images in the deleted dataset is gone, as shown in Figure4-33.

Figure 4-33 Checking Datasets Explorer

----End

4.3 Dataset Management in the Datasets ExplorerWindow

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 70

Page 76: Mind Studio Basic Operations - HUAWEI CLOUD

4.3.1 Viewing the DatasetsClick Datasets tab page on the menu bar on the left. The Datasets Explorer viewis displayed, where you can find the datasets directory containing twosubdirectories, as shown in Figure 4-34.

● built-in-datasets● my-datasets (custom datasets)

NO TE

The directory under my-datasets is a controlled directory. Do not store datasets thatare not imported from Mind Studio in this directory.1. When the background service is restarted, data consistency check is performed. If a

directory under my-datasets is not in MongoDB, the data in this directory will beautomatically deleted.

2. If a directory is created under the my-datasets directory and a dataset with thesame name as the new directory is imported from Mind Studio, Mind Studiodeletes the created directory before importing the data.

Figure 4-34 Datasets Explorer

You can click to view the directory details.

4.3.2 Copying a PathRight-click a directory or file of a dataset and choose Copy Path from the shortcutmenu, as shown in Figure 4-35. The background server path of the directory orfile is copied to the clipboard.

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 71

Page 77: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-35 Choosing Copy Path

You can also open the datasets directory on the Mind Studio server, as shown inFigure 4-36.

Figure 4-36 Going to the directory of a custom image dataset

4.3.3 RefreshingIf you add a dataset to my-datasets, a new folder (file) will be generated indatasets. Select a folder as shown in Figure 4-37 and click the Refresh icon, itssub-level content is refreshed. If you expand multiple layers, only one layer isrefreshed, as shown in Figure 4-38. Note that only the sub-level content isrefreshed.

Figure 4-37 Before refresh

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 72

Page 78: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 4-38 After refresh

NO TE

For the sake of performance, you are not allowed to refresh a directory by expanding thefolder. To refresh a directory, click .

Ascend 310Mind Studio Basic Operations 4 Dataset Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 73

Page 79: Mind Studio Basic Operations - HUAWEI CLOUD

5 Model Management

5.1 Overview

5.2 Model Conversion

5.3 Model Management in the Projects Explorer Window

5.4 Model Management in the Model Zoo Explorer Window

5.1 OverviewModels are classified into built-in models, custom models, and Caffe models.

● Built-in models

Built-in models are preset in Mind Studio and exist before a workspace iscreated. You can use them but cannot add, delete, or modify them.

The currently available built-in model is ResNet-18.

● Custom models

A custom model (such as a Caffe or TensorFlow model) can be added byusing the offline conversion function for future use. A newly createdworkspace has no custom models. You can add a custom model by modelconversion or simply adding one.

● Caffe models

After a Caffe model is added to the orchestration window, the Caffe model isadded to Model Zoo. A newly created workspace has no Caffe models.

5.2 Model ConversionTo make it easier for developers to use trained models and build a machinelearning app with the least code, Mind Studio provides an offline model systemthat offers the following features:

● Offline model conversion: The neural network models under open sourceframeworks such as Caffe and TensorFlow can be converted into the networkmodels supported by the Huawei NPU.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 74

Page 80: Mind Studio Basic Operations - HUAWEI CLOUD

● Offline model import: A converted unencrypted model can be directlyimported to a Mind Studio project.

● Offline model visualization: The network structure of the offline model can bevisualized, providing details about each layer.

5.2.1 Model Conversion ModesModel conversion can be implemented in either user interface (UI) or commandline interface (CLI) mode.

● If model conversion is performed in UI mode, model conversion isimplemented by adding a custom model component. When a custom modelcomponent is added, the encryption model or non-encryption model issupported.

● If model conversion is performed in CLI mode, the encryption model or non-encryption model is supported. For details about model conversion in CLImode, see the Ascend 310 Model Conversion Guide.

NO TE

The ARM-based Atlas 300 does not support this function.

5.2.2 Adding a Custom Model ComponentThe navigation paths for adding a customized model component are as follows:

● In the Projects Explorer window, open the orchestration window of the*.mind file and choose Tool > Model > My Models in the right pane to add acustom model component.

● In the Projects Explorer window, select a Mind project, right-click, and chooseTools > Convert Model... from the shortcut menu.

● In the Projects Explorer window, select a Mind project, right-click, and chooseConvert Model... from the shortcut menu.

The following describes the two ways.

Adding a Custom Model Component in the New Model Dialog Box

Step 1 Click on the right of My Models to add a custom model component, asshown in Figure 5-1.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 75

Page 81: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-1 Adding a custom model

Step 2 The Convert Model dialog box is displayed, as shown in Figure 5-2.

Figure 5-2 Convert Model dialog box

Select Caffe, Tensorflow, or OfflineModel from the Model Type drop-down listbox.

● Caffe: The model file and weight file must be configured.● Tensorflow: The model file must be configured.● OfflineModel: The model path must be selected.

Step 3 Click on the right of Model File to select a model file. Click the button onthe left to select a file from the client, and click the button on the right to select a

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 76

Page 82: Mind Studio Basic Operations - HUAWEI CLOUD

file from the root directory of the installation user on the Mind Studio server. Thisrule applies to areas for file selection.

NO TE

To select a model file from the Mind Studio server, the Mind Studio installation user shouldhave the write permission on the directory where the model file is located.

For details, see Figure 5-3.

Figure 5-3 Selecting a model file

● The name of the model file is automatically filled in the Model Name textbox. After selecting a model file, you can change the model name as required.

● Input Shape– Caffe model: The tool parses the model file to obtain the default Input

Shape value of the model. The format is input_name:n,c,h,w.– Offline model: Input Shape is not displayed.– TensorFlow model: The TensorFlow model or models with a custom layer

does not support the parsing of Input Shape. You can click on theright of Input Shape to set this parameter. Up to two records of thisparameter setting are supported, as shown in Figure 5-4.

Figure 5-4 Input Shape

A network model uploaded by the user can be parsed at https://lutzroeder.github.io/netron/ by using the Chrome browser. Figure 5-5shows a parsing result, where, n (number of images processed at a time)is parsed as ?. You need to set n as required.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 77

Page 83: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-5 Parsing result

Step 4 After you select a model file, the button is displayed on the right of ModelFile. Click this button. The original network structure of the model is displayed.You can set the layer which needs to be reported. (After conversion, the output ofthe selected layer is directly used as the output of the offline model.) If Report isset to Yes for a layer, the layer turns green. For details, see Figure 5-6.

Figure 5-6 Model network structure

NO TE

Currently, the button is displayed on the right of Model File only after you select aCaffe model file. This button is not displayed when a TensorFlow model file is selected.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 78

Page 84: Mind Studio Basic Operations - HUAWEI CLOUD

Step 5 Set Quantization to On. Then you can perform quantization settings. For details,see Figure 5-7.

Set Input Type to Image or Binary.

● If you select IMAGE, image folders are available to Images File.● If you select BINARY, bin files are available to Images File.

Figure 5-7 Quantization configuration

NO TE

You are advised to select multiple images for quantization at a time. If the number ofselected images is too small, the precision may be affected. It is recommended that amaximum of 50 images be selected because the excessive number of images may prolongquantization and cause the process timeout. The specified timeout period is three hours.

Step 6 Click Advanced to set Image Format, Mean Less[R][G][B], and StandardDeviation. Then, click ok to make the settings take effect, as shown in Figure 5-8.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 79

Page 85: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-8 Advanced quantization configuration

If the quantization switch is turned on, you can view the configuration informationabout quantization parameters in the convertModel.log file of the correspondingproject after the model conversion is complete. For details about quantizationconfiguration, see the Ascend 310 Model Conversion Guide.

Step 7 Click Optional Options. More options can be configured, as shown in Figure 5-9and Figure 5-10.

Figure 5-9 Optional Options (static)

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 80

Page 86: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-10 Optional Options (dynamic)

Table 5-1 lists the configuration parameters.

Table 5-1 Parameter description of the Optional Options area

Parameter Description

Operator Plugin Path Operator plug-in path.If there are custom development operators for theimported model, you need to import them to thepath.

Input Image Preprocess Advanced image preprocessing (AIPP) configuration.This parameter is enabled by default. You can disableit as required. If this parameter is enabled, you canview the parameter settings in theconvertModel.log file in the corresponding projectdirectory after model conversion is complete. Fordetails about the AIPP configuration, see the Ascend310 Model Conversion Guide.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 81

Page 87: Mind Studio Basic Operations - HUAWEI CLOUD

Parameter Description

Image Preprocess mode AIPP image pre-processing mode, which is selectedfrom the drop-down list box. The default value isStatic.● Static: static AIPP● Dynamic: dynamic AIPP

NOTICE– When Image Preprocess Mode is set to Static, the

system displays the following parameters: InputImage Format, Input Image Size[W|H], ImageFormat Conversion, Model Image Format, CropStart Loc[W|H], Mean Less, and MultiplyingFactor.

– When Image Preprocess Mode is set to Dynamic,the system displays only the parameter Max ImageSize(Byte).

– When Image Preprocess Mode is set to Dynamic, ifyou need to change the input and output formats ofimages after model conversion, modify the propertyparameters of the inference engine node, includingInput Image Format, Image Format Conversion,and Model Image Format. For details about how tomodify information other than the input and outputformats of images, see the Ascend 310 Matrix APIReference.

Input Image Format Input image format. The default format isYUV420SP_U8.Options: YUV420SP_U8, XRGB8888_U8,RGB888_U8, and YUV400_U8

Input Image Size[W|H] Input image size. The default value is obtained basedon the 128-pixel aligned width and 16-pixel alignedheight of the input layer in the model file.

Image FormatConversion

Color gamut conversion. This function is enabled bydefault.This function needs to be enabled when the formatof the input image is different from that of themodel processing file.

Model Image Format Format of the model processing image. The defaultformat is BGR888_U8.Options: YUV444SP_U8, YVU444SP_U8, RGB888_U8,BGR888_U8, and GRAYAn option can be selected after color gamutconversion is enabled.

Crop Start Loc[W|H] Start position of image cropping. This parameter isdisabled by default. After enabling it, you can set thestart position.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 82

Page 88: Mind Studio Basic Operations - HUAWEI CLOUD

Parameter Description

Mean Less Mean reduction values. The mean reduction functionis enabled by default.The default values of the three channels are 104,117, and 123, respectively.

Multiplying Factor Multiplication coefficient (standard deviation orreciprocal of (Max – Min)). This parameter isdisabled by default.

Max Image Size(Byte) Size of the memory that is applied for at a timeduring image processing. The value range is (0,4294967295].To modify this parameter, set this parameter to N *H * W * 4. (The values of N, H, and W are obtainedfrom Input Shape.) The default values of W and Hare obtained by aligning the width by 128 bytes andheight by 16 bytes of the input layer in the modelfile. 4 indicates a coefficient, which varies accordingto the input image format during system verification.The options are as follows: YUV400_U8 (1),YUV420SP_U8 (1.5), RGB888_U8 (3), andXRGB8888_U8 (4). To ensure sufficient space, use themaximum value 4.

Encryption Whether to enable encryption. If the switch is turnedon, encryption is performed. Otherwise, encryption isnot performed.For details, see 5.2.3 Encrypting a Custom Model.

NO TE

When a model is converted in the scenario where Input Image Preprocess is enabledduring model conversion, and Input Image Format is set to XRGB8888_U8 or RGB888_U8,the image imported to the data set should be in NHWC format.

Step 8 After the configuration is complete, click ok to create a model. However, there is a3-hour running time limit on this operation. If the model conversion cannot becompleted within 3 hours, the conversion process ends.

1. After a model is successfully converted, a dialog box indicating conversionsuccess is displayed, as shown in Figure 5-11. You can also view the modelpath (the path of the model running on the device is displayed by default)and file size.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 83

Page 89: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-11 Successful model conversion

2. If a mode fails to be converted, an error report dialog box is displayed.

NO TICE

On the failure report page, ensure that the web page is not zoomed in(zooming out is allowed). Otherwise, some of the menus may be missing.

If the failure is due to operator renaming, select the operator, as shown inFigure 5-12.

Figure 5-12 Conversion failure report - 1

Re-select an operator from the drop-down list box and click Retry, as shownin Figure 5-13.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 84

Page 90: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-13 Re-selecting an operator

The failure may also be caused by an unsupported operator, as shown inFigure 5-14.

Figure 5-14 Conversion failure report - 2

Click Customize to create a project for the unsupported operator and developthe custom operator plug-in. For details, see the Ascend 310 TE CustomOperator Development Guide (Mind Studio).After the custom operator plug-in is developed, import the offline modelagain. During the import, select the customized operator plug-in, as shown inFigure 5-15.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 85

Page 91: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-15 Importing an offline model - selecting the custom operator plug-in

Click ok to start model conversion.

Step 9 After model conversion is successful, check that the converted model is displayedunder My Models, as shown in Figure 5-16. It can be dragged for the subsequentengine orchestration.

Figure 5-16 My Models

Click the Model Zoo tab page on the right. You can view the custom models inmodel-zoo > my-model, as shown in Figure 5-17.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 86

Page 92: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-17 Model file generated after conversion

----End

Adding a Custom Model Component by Model Conversion

Step 1 On the Projects Explorer tab page, select the project whose model needs to beconverted.

Step 2 Right-click the project and choose Convert Model... or choose Tools > ConvertModel... from the shortcut menu.

The Convert Model dialog box is displayed, as shown in Figure 5-18.

Figure 5-18 Convert Model dialog box

Step 3 Parameters on the Convert Model window are the same as those on the NewModel window. For details, see Adding a Custom Model Component in the NewModel Dialog Box.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 87

Page 93: Mind Studio Basic Operations - HUAWEI CLOUD

Step 4 After the configuration is complete, click ok to convert the model.

Step 5 After a model is successfully converted, a dialog box indicating conversion successis displayed, as shown in Figure 5-19. You can also view the model path (the pathof the model running on the device is displayed by default) and file size.

Figure 5-19 Successful conversion dialog box

If the conversion fails and an error report dialog box is displayed, performtroubleshooting by referring to Step 8.2.

Step 6 After the model is converted successfully, you can view the custom modelcomponent in model-zoo > my-model, as shown in Figure 5-20.

Figure 5-20 Model file generated after conversion

NO TE

If the model is not displayed, click the refresh button on the left of Model Zoo Explorer.For the sake of performance, you are not allowed to refresh a directory by expanding thefolder. To refresh a directory, click .

The new model is displayed in tool > My Models, as shown in Figure 5-21.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 88

Page 94: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-21 New model under My Models after successful conversion

----End

5.2.3 Encrypting a Custom ModelBy encrypting models, model users can control the use of models. They can usethe encryption function to obtain the encrypted offline model and key. Only userswith the encrypted model and key can use the model.

An encrypted model can run only in a Mind project whose Target is set to ASIC orAtlas DK.

Step 1 Select a project, choose Tools > Convert Model, or click of My Models on thetool tab page.

Step 2 Expand Optional Options and set Encryption to On, as shown in Figure 5-22.

Figure 5-22 Enabling Encryption

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 89

Page 95: Mind Studio Basic Operations - HUAWEI CLOUD

Step 3 Enter the password in the text box of Customized Key. The encryption systemuses this password to generate a unique key, which is used as an input forencryption.

The password contains no more than 32 characters and does not support Chinesecharacters.

Step 4 If you have entered a password for the workspace, the previous password is usedby default. You can also deselect this option as shown in Figure 5-23 and set anew password.

Figure 5-23 Use Last Password

Step 5 Upload the ISV hardware key, ISV certificate, and ISV private key, as shown inFigure 5-24.

Figure 5-24 Uploading the hardware key, certificate, and private key

Step 6 After the model conversion is complete, the encrypted model file and PASSCODEfile for decrypting the model are generated.

After the model conversion is successful, a dialog box is displayed, indicating thatthe conversion is successful, as shown in Figure 5-25. Offline Model Pathindicates the path of the encrypted file.

Figure 5-25 Successful conversion dialog box

Log in to the Mind Studio server. You can view the encrypted model file in thepath indicated by Offline Model Path and passcode file in the path indicated byPasscode Path.

----End

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 90

Page 96: Mind Studio Basic Operations - HUAWEI CLOUD

5.2.4 Decrypting a Custom ModelStep 1 Add an encrypted offline model to the draggable components.

Step 2 Drag the offline model to the orchestration canvas and go to the property tabpage, as shown in Figure 5-26.

Figure 5-26 Model property tab page

Step 3 Set Decryption to On, select the passcode file, and decrypt the model.

----End

5.3 Model Management in the Projects ExplorerWindow

5.3.1 Viewing the ModelsStep 1 Double-click the .mind file of a Mind Engine project to open the engine

orchestration window.

Step 2 Manage the network models in the Model area on the tool tab page. This areaconsists of three subdirectories, as shown in Figure 5-27.

Figure 5-27 Model area on the Tool tab page

● Built-in Models● My Models● Caffe Models

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 91

Page 97: Mind Studio Basic Operations - HUAWEI CLOUD

Step 3 Click to expand a directory. The content of the directory is displayed, as shownin Figure 5-28.

Figure 5-28 Model directory details

----End

5.3.2 Adding a Caffe Model Component

Step 1 Click next to Caffe Models and add a model, as shown in Figure 5-29.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 92

Page 98: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-29 Adding a Caffe model

Step 2 In the displayed New Caffe Model dialog box, enter the Caffe model name, selectthe model file and weight file, and click ok, as shown in Figure 5-30.

Figure 5-30 New Caffe Model dialog box

Step 3 A new Caffe model component is generated under Caffe Models on the tool tabpage, as shown in Figure 5-31. The Caffe model component is used in the sameway as a custom model. Drag it to the canvas and connect the Caffe inferenceengine to run Caffe model inference.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 93

Page 99: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-31 Generating a Caffe model file

Step 4 After the model is created, the Caffe model file is added to the model-zoo >caffe-model, as shown in Figure 5-32.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 94

Page 100: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-32 Viewing the Caffe model file

----End

5.3.3 Viewing Model PropertiesThe property configurations of a service node are the parameters required forrunning the node.

Viewing the Properties of a Built-in or Custom ModelSelect a model node and set its properties on the property tab page in the rightpane, as shown in Figure 5-33.

Figure 5-33 Setting the model properties

The node properties are described as follows:● Name: Specifies the model name. It is set in the New Model dialog box and

cannot be changed.● Model Path: Specifies the path for storing models on Mind Studio. It is set in

the New Model dialog box and cannot be changed.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 95

Page 101: Mind Studio Basic Operations - HUAWEI CLOUD

● DVPP Parameter Path: Specifies the path for storing the DVPP optimizationparameter files on Mind Studio. The file is generated after DVPP tuning.

● Decryption: For an encrypted model, enable this function and upload thedecryption key. For details, see 5.2.3 Encrypting a Custom Model.

Viewing the Properties of a Caffe Model

Figure 5-34 shows the properties of the Caffe model.

Figure 5-34 Setting the Caffe model properties

The node properties are described as follows:● Name: Specifies the model name. It is set in the New Caffe Model dialog box

and cannot be changed.● Model File: Specifies the path for storing the model file on Mind Studio. It is

set in the New Caffe Model dialog box and cannot be changed.● Weight File: Specifies the path for storing the weight file on Mind Studio. It is

set in the New Caffe Model dialog box and cannot be changed.

5.3.4 Viewing the Network Structure of a Model

Viewing the Network Structure of a Built-In Model or Custom Model

Drag an offline model component to the canvas, right-click the model, and chooseView Model from the shortcut menu, as shown in Figure 5-35.

Figure 5-35 Choosing view model

The network topology dialog box is displayed, as shown in Figure 5-36. The modelproperties are displayed on the upper right of the dialog box.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 96

Page 102: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-36 Viewing the model properties

Select a layer of the model. The properties of the layer are displayed, as shown inFigure 5-37.

Figure 5-37 Viewing the layer properties

Viewing the Network Structure of a Caffe ModelDrag the Caffe model component to the canvas, right-click the canvas, and chooseView Caffe Model from the shortcut menu, as shown in Figure 5-38.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 97

Page 103: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-38 Choosing View Caffe Model

The network topology dialog box is displayed, as shown in Figure 5-39. The modelproperties are displayed on the upper right of the dialog box.

Figure 5-39 Viewing the model properties

Select a layer of the model. The properties of the layer are displayed, as shown inFigure 5-40.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 98

Page 104: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-40 Viewing the layer properties

5.3.5 Deleting a Model ComponentCustom and Caffe model components can be deleted. Right-click the modelcomponent to be deleted and choose delete from the shortcut menu, as shown inFigure 5-41. If the component has been used on the canvas, delete thecomponent on the canvas first.

Figure 5-41 Deleting a model component

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 99

Page 105: Mind Studio Basic Operations - HUAWEI CLOUD

NO TE

When a model under My Models or Caffe Models is deleted, the offline model or Caffemodel file in model-zoo is also deleted.

5.4 Model Management in the Model Zoo ExplorerWindow

5.4.1 Viewing the ModelsClick the Model Zoo tab page on the menu bar on the left. The Model ZooExplorer view is displayed, where you can find the model-zoo directory containingthree subdirectories, as shown in Figure 5-42.

● built-in-model (built-in model)● my-model (custom model)● caffe-model (Caffe model)

Figure 5-42 Model Zoo Explorer view

Click to expand the content of a directory, for example, the built-in modeldirectory.

Viewing the Network Structure of a ModelDouble-click an offline model file (for example, Resnet18.om) in Model ZooExplorer. (Only an offline model is supported. Do not double-click a Caffe modelfile.) Open the offline model in the editor on the right, as shown in Figure 5-43.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 100

Page 106: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-43 Offline model file

The network topology diagram of the model is displayed, and the modelproperties are displayed on the upper right. Select a layer of the model. Theproperties of the layer are displayed, as shown in Figure 5-44.

Figure 5-44 Viewing the layer properties

5.4.2 Adding a Custom Model ComponentFor details about how to add a custom model component in the code editingwindow, see Adding a Custom Model Component by Model Conversion.

5.4.3 Copying a PathRight-click a model file and choose Copy Path from the shortcut menu, as shownin Figure 5-45. The file path on the server is copied to the clipboard.

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 101

Page 107: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-45 Choosing Copy Path

5.4.4 Refreshing a FolderAfter you add a custom model or convert a model, a new folder (file) is generatedin Model Zoo Explorer. Select a folder as shown in Figure 5-46 and click theRefresh icon, its sub-level content is refreshed. If you expand multiple layers, onlyone layer is refreshed, as shown in Figure 5-47. Note that only the sub-levelcontent is refreshed.

Figure 5-46 Before refresh

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 102

Page 108: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 5-47 After refresh

NO TE

For the sake of performance, you are not allowed to refresh a directory by expanding thefolder. To refresh a directory, click .

5.4.5 Importing an Offline ModelA converted offline model file or a model file on the server can be imported to theproject directory for project development. The operation procedure is as follows:

Step 1 Import an offline model.

Select a project, choose Model > My Model on the tool tab page on the right,and click +. The New Model dialog box is displayed. Table 5-2 describes theparameters in the dialog box. Figure 5-48 shows the New Model dialog box.

Figure 5-48 New Model dialog box

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 103

Page 109: Mind Studio Basic Operations - HUAWEI CLOUD

Table 5-2 Parameters in the New Model dialog box

Parameter Value

Model Type Select OfflineModel.

Model Path Select the .om model file.

Click on the left to upload a model from the

client, and click on the right to load a modelfrom the root directory (starting with "~") of theinstallation user on the Mind Studio server.NOTE

To select a model file from the Mind Studio server,upload the model file to the home directory of theMind Studio installation user or its subdirectory. Do notupload the model file to the ~/tools/che/model-zoo/my-model directory. Otherwise, the custom modelin My Models on the GUI is different from that in themy-model directory on the server. The Mind Studioinstallation user should have the read permission onthe model file.

Model Name The value is automatically filled based on themodel file name.

Click OK.

Step 2 Begin engine orchestration using the model file.

The imported model is displayed in the My Models area on the right, as shown inFigure 5-49. Drag the model to the canvas for engine orchestration.

Figure 5-49 My Models area

Step 3 Develop a custom project using the model file.

During code development, directly reference the path of the custom model fileimported to the project.

----End

Ascend 310Mind Studio Basic Operations 5 Model Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 104

Page 110: Mind Studio Basic Operations - HUAWEI CLOUD

6 Publish Mode Management

6.1 Overview

6.2 Function Description

6.1 OverviewThis mode is used to package the process orchestration result and store thepackage in a user-specified path. The publish nodes include the input nodePublishInput and output node PublishOutput.

● PublishInput nodeReceives external parsing data and sends the data to the next engine

● PublishOutput nodeProvides the post-processing output function.

6.2 Function Description

6.2.1 Node DisplayDouble-click the .mind file of a Mind Engine project to open the engineorchestration window.

On the Tool tab page on the right, the Publish area (for publish management)

consists of two sub-directories, as shown in Figure 6-1. You can also click onthe right of a node to customize a publish node.

● PublishInput: input node● PublishOutput: output node

Ascend 310Mind Studio Basic Operations 6 Publish Mode Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 105

Page 111: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 6-1 Graphical element display area

Click to expand a directory. The content of the directory is displayed, as shownin Figure 6-2.

Figure 6-2 Expanding datasets

Ascend 310Mind Studio Basic Operations 6 Publish Mode Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 106

Page 112: Mind Studio Basic Operations - HUAWEI CLOUD

6.2.2 Mode SwitchingAfter the publish function is added, the window of the Publish mode is differentfrom the normal orchestration window. Mind Studio provides buttons that allowthe switch between the Publish mode and Normal mode.

Figure 6-3 shows the process orchestration window with the Publish function. Youcan click Normal and Publish in the lower right corner to switch the mode.

Figure 6-3 Mode switching example

● Click Publish to access the Publish mode. The datasets and post-processingnodes are displayed in gray (unavailable), and the PublishInput andPublishOutput nodes are displayed in blue (available), as shown in Figure6-3.

● Click Normal to access the normal mode. The datasets and post-processingnodes are displayed normally. The PublishInput and PublishOutput nodesare displayed in blue gray (unavailable), as shown in Figure 6-4.

Ascend 310Mind Studio Basic Operations 6 Publish Mode Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 107

Page 113: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 6-4 Normal mode

6.2.3 Node Placement and ConnectionThis topic uses a complete process orchestration canvas as an example, as shownin Figure 6-5. For details about basic node operations, see 3.3 Basic NodeOperations.

Figure 6-5 Canvas without Publish nodes

Click Publish under the canvas in Figure 6-5 or drag the PublishInput orPublishOutput node under Publish on the Tool tab page to the canvas.

Ascend 310Mind Studio Basic Operations 6 Publish Mode Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 108

Page 114: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 6-6 Publish node settings

Table 6-1 describes the parameters.

Table 6-1 Parameter description

Parameter Description

Publish Name Name of a published package. The name must startwith a letter and consists at most 30 characters andsupport letters (a-z, A-Z), digits (0–9), and underscores(_). The default value is the project name.

Publish Languages The value can be C++ or Python (default).

● To add a node by clicking Publish, perform the following steps:After you click Publish and set the parameters shown in Table 6-1, thePublishInput and PublishOutput nodes are added to the canvas. ThePublishInput node is connected in the same way as the datasets and thePublishOutput node is connected in the same way as the post-processingnode. In addition, the Normal and Publish buttons shown in the lower rightcorner of the canvas, and the dataset and post-processing node in the canvasare displayed in gray, as shown in Figure 6-7.

Ascend 310Mind Studio Basic Operations 6 Publish Mode Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 109

Page 115: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 6-7 Clicking Publish

NO TE

If you add a node in this mode, the PublishInput and PublishOutput nodes are addedto the canvas regardless of whether the canvas has nodes.

The folders named after the PublishInput and PublishOutput nodes areautomatically displayed in the project directory, as shown in Figure 6-8. Table6-2 describes the files in the folders.

Figure 6-8 Project directory

Ascend 310Mind Studio Basic Operations 6 Publish Mode Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 110

Page 116: Mind Studio Basic Operations - HUAWEI CLOUD

Table 6-2 File description

File Description

PublishInput.cpp Template code, which is used to replacethe dataset on the orchestration network

PublishInput.h Template code header file

PublishOutput.cpp Template code, which is used to replacethe post-processing node on theorchestration network

PublishOutput.h Template code header file

● To add a node by dragging, perform the following steps:

Drag PublishInput or PublishOutput nodes under Publish on the Tool tabpage to the canvas and set the parameters shown in Figure 6-6. Thecorresponding nodes are displayed in the canvas, and the Normal andPublish buttons for mode switching are displayed in the lower right corner ofthe canvas. The dataset and the post-processing node in the canvas aredisplayed in gray (unavailable). In this mode, only one node can be draggedat a time, and the added nodes are not automatically connected, as shown inFigure 6-9.

Figure 6-9 Dragging a node

Drag another node to the canvas in the same way. In this case, you do notneed to set the parameters described in Figure 6-6. The folders namedPublishInput and PublishOutput are displayed in the project directory, asshown in Figure 6-8.

6.2.4 Packaging and PublishingFor details, see Engine Orchestration in Publish Mode > Packaging andPublishing in Ascend 310 Mind Studio Quick Start.

Ascend 310Mind Studio Basic Operations 6 Publish Mode Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 111

Page 117: Mind Studio Basic Operations - HUAWEI CLOUD

7 System Configuration Management

7.1 Tool Settings

7.2 Assistant ToolThis chapter describes the functions and instructions of the Assistant tool.

7.1 Tool SettingsYou can set the Mind Studio themed GUI and view plug-ins in the Setting... dialogbox .

IDE Settings● Editor settings

Choose IDE > Editor and set the display attributes of the Mind Studio, asshown in Figure 7-1.

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 112

Page 118: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 7-1 Editor settings

For details about the parameters, see Table 7-1.

Table 7-1 Parameters of Editor settings

Category

Parameter Description

Fonts Font Size Sets the font size of the editor.

Font Family Sets the font style of the editor.

Keys Key Bindings Sets the editor style, Vi editing environment orEmacs editing environment.

Tabs Tab Size Sets the space width of the Tab key.

Edit Enable Autosave Enables code auto-saving.

Typing SmartIndentation

Enables smart indenting.

Typing-Autopair Enables symbol auto-pairing.

Autopair[Square]Brackets

Closes square brackets automatically.

Autopair"Quotations"

Closes quotation marks automatically.

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 113

Page 119: Mind Studio Basic Operations - HUAWEI CLOUD

Category

Parameter Description

Whitespaces

ShowWhitespaceCharacters

Shows whitespace characters.

Rulers Show LineNumber Ruler

Shows the line number ruler.

Show FoldingRuler

Shows the folding ruler.

Show OverwriteRuler

Shows the overwrite ruler.

Show ZoomRuler

Shows the zoom ruler.

– Setting the font size and style of the editor

i. In the main menu, choose File > Setting.... The Setting dialog box isdisplayed.

ii. Choose IDE > Editor from the navigation pane.iii. In the Fonts area on the right, choose a value from the Font Size

drop-down list box and choose a value from the Font Family drop-down list box.

iv. Click Save as shown in Figure 7-2. The font size and font style of theeditor before and after the settings are shown in Figure 7-3 andFigure 7-4.

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 114

Page 120: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 7-2 Saving the font size and style settings

Figure 7-3 Default font size and style

Figure 7-4 Modified font size and style

Plug-ins DisplayChoose Plug-Ins > List from the navigation pane. The plug-in information aboutMind Studio is displayed on the right, as shown in Figure 7-5. Table 7-2 describesthe functions of some of the plug-ins.

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 115

Page 121: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 7-5 Plug-in list

Table 7-2 Plug-in description

Parameter Description

BBoxExtension

Black box plug-in

Git Git plug-in

HelpExtension

Help plug-in

NvconfigExtension

NvConfig plug-in

SD MakingExtension

SD card making plug-in

SSH SSH plug-in

BuilderExtension

Compilation plug-in

CCE-GDB CCE-GDB debugging plug-in

CompareTool Extension

Tool comparison plug-in

ConvertmodelDebugger

Model conversion debugging plug-in

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 116

Page 122: Mind Studio Basic Operations - HUAWEI CLOUD

Parameter Description

Convertmodel

Model conversion plug-in

Cpp Cpp plug-in

C# C# plug-in

OfflineModel

Offline model plug-in

DvpptuningExtension

DVPP tuning plug-in

Logtool Log tool

RunExtension

Execution plug-in

PythonExtension

Python plug-in

TVM TVM plug-in

UpdatePackage

Upgrade plug-in

7.2 Assistant ToolThis chapter describes the functions and instructions of the Assistant tool.

7.2.1 OverviewThe Assistant of Mind Studio can be used to quickly query shortcut keys bound toMind Studio.

Figure 7-6 shows the Assistant page.

Figure 7-6 Assistant page

7.2.2 Querying a Shortcut KeyStep 1 Choose Assistant > Key Bindings on the toolbar. A dialog box is displayed, as

shown in Figure 7-7.

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 117

Page 123: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 7-7 Key Bindings dialog box

You can query the shortcut keys supported in the IDE and Editor.

● IDE: Contains the shortcut keys used in Mind Studio.● Editor: Contains the shortcut keys used for editing a document.

Click IDE or Editor to expand shortcut keys. Figure 7-8 shows the shortcut keyssupported in the IDE.

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 118

Page 124: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 7-8 Shortcut keys supported in the IDE

Step 2 Enter keywords in the search text box to search for a shortcut key, as shown inFigure 7-9.

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 119

Page 125: Mind Studio Basic Operations - HUAWEI CLOUD

Figure 7-9 Searching for a shortcut key

----End

Ascend 310Mind Studio Basic Operations 7 System Configuration Management

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 120

Page 126: Mind Studio Basic Operations - HUAWEI CLOUD

A Change History

Release Date Description

2020-05-30 This issue is the first official release.

Ascend 310Mind Studio Basic Operations A Change History

Issue 01 (2020-05-30) Copyright © Huawei Technologies Co., Ltd. 121