Development Workflow

Figure 1 Development workflow
  1. Set up the environment.
  2. Create code directories.

    Before developing an app, you must create directories to store the code files, build scripts, test images, and model files.

    The following is an example:

    ├App name
    ├── model                 // Model files
    │   ├── xxxxxx               
    
    ├── data
    │   ├── xxx.jpg          // Test data
    
    ├── inc                   // Header files that declare functions
    │   ├── xxx.h               
    
    ├── out                   // Output files
    
    ├── src     
    │   ├── xxx.json         // Configuration files for system initialization
    │   ├── CMakeLists.txt   // Build scripts
    │   ├── xxx.cpp          // Implementation files
  3. Build a model.

    For model inference, the offline model adapted to the Ascend AI Processor (.om file) is mandatory. For details, see Building a Model.

  4. Develop an app.
    1. Initialize AscendCL. For details, see AscendCL Initialization and Deinitialization.

      Before using the AscendCL APIs to develop an app, aclInit must be called to initialize AscendCL. Failure to do so may result in errors when internal resources are being initialized, which can then lead to service exceptions.

    2. Allocate runtime resources. For details, see Runtime Resource Allocation and Deallocation.
    3. Transfer data. For details, see Data Transfer.
    4. Run model inference. For details, see Model Inference.

      Perform data postprocessing if required. For example, for an image classification app, you might need to identify the class indexes with the top confidence values.

      After model inference is complete, destroy the allocations.

    5. When data processing is complete, destroy runtime allocations. For details, see Runtime Resource Allocation and Deallocation.
    6. Deinitialize AscendCL. For details, see AscendCL Initialization and Deinitialization.
  5. Build and run the app. This includes model conversion, code compilation, and app execution. For details, see App Build and Run.