Updated on 2022-03-13 GMT+08:00

Loading the Plug-In for Model Conversion

Principle Description

Figure 1 shows the model conversion process when the custom operator plug-in is loaded.

Figure 1 Loading a plug-in for model conversion
  1. The offline model generator (OMG) loads the model file and custom operator plug-in, parses the operator in the model file, and converts the custom operator into the intermediate representation (IR) operator.
  2. The OMG converts the data of the custom operator based on the running environment, calculates the running memory, compiles and generates the binary file (*.o) of the custom operator, and generates the Da Vinci offline model file (*.om).
  3. During application running, the offline model executor (OME) obtains the input data, loads the offline model file, calls the operator cyclically, and outputs the result data.

Operating Procedure

  1. Go to the root directory of the custom operator development project as the DDK installation user.

    cd $HOME/tools/projects/customop_te/

  2. Run the following command to convert the model:

    omg --model=model/deploy_mylenet-1.prototxt --weight=model/mylenet-1.caffemodel --framework=0 --plugin_path=plugin --output=mylenet --ddk_version=1.3.T18.B850
    • --model: relative path of the original model file of the MyLeNet network
    • --weight: relative path of the pre-trained model file of the MyLeNet network
    • --framework: original framework type
      • 0: Caffe
      • 3: TensorFlow
    • --plugin: directory where the custom operator plug-in is located
    • --output: name of the output model file, which can be customized
    • --ddk_version: version number of the matched DDK for running the custom operator. You can view the version number of the DDK in the $HOME/tools/che/ddk/ddk/ddk_info file.

      For details about other parameters, see Model Conversion Guide.