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

Model Conversion Using OMG

Preparations

Sample

  1. Log in to the DDK server as the DDK installation user.
  2. Set the following environment variable:

    export LD_LIBRARY_PATH=DDKInstallationDirectory/ddk/uihost/lib

  3. Find OMG in the ddk/uihost/bin directory under the DDK installation directory. Run the following command to generate a model file. (The directories and files in the command are for reference only.)

    ./omg --model=/home/username/test/resnet18.prototxt --weight=/home/username/test/resnet18.caffemodel --framework=0 --output=/home/username/test/out/caffe_resnet18 

    After the command is executed successfully, you can view the model file (for example, caffe_resnet18.om).

    A command that exceeds one line will be automatically wrapped due to the restriction of the PDF document format. Therefore, if you want to use the command in the example directly, you need to manually merge the lines into one line and separate the parameters with spaces.

    For details about how to fix the following errors during model conversion (It is recommended to convert layers-structure to layer-structure by caffe tool and Type XXX unsupported), see FAQs.

  4. (Optional) If an output node is specified (that is, the --out_nodes parameter is set) during model conversion and the information of the last operator layer fails to be viewed in the converted .om model, convert the .om model file to the JSON format by running the following command and check the .json file:

    omg --mode=1 --om=/home/username/test/caffe_resnet18.om  --json=/home/username/test/out/resnet.json