Model Conversion Using OMG
Preparations
- Environment preparation
This document describes how to convert models in command line interface (CLI) mode. For details about how to convert models in the Mind Studio IDE, see Ascend 310 Mind Studio Basic Operations.
The following describes the scenario where the DDK is independently installed.
If the DDK installation user is HwHiAiUser and the log fails to be output to the screen, see What Do I Do If No Log Is Output to the Screen When the DDK Installation User Is HwHiAiUser?. If the OS and architecture configuration of the DDK server is Arm (aarch64) and model conversion takes too long, see What Do I Do If Model Conversion Takes Too Long When the OS and Architecture Configuration of the DDK Server is Arm (aarch64)?.
- Upload the model file (*.prototxt), weight file (*.caffemodel) required by model conversion to the /home/username/test/ directory on the DDK server as the DDK installation user.
Sample
- Log in to the DDK server as the DDK installation user.
- Set the following environment variable:
export LD_LIBRARY_PATH=DDKInstallationDirectory/ddk/uihost/lib
- 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.
- (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
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot