The path can contain uppercase letters, lowercase letters, digits, and underscores (_).
The file name can contain uppercase letters, lowercase letters, digits, underscores (_), and periods (.).
| Parameter | Description | Mandatory | Default Value |
|---|---|---|---|
| --h/help | Displays the help information. | No | N/A |
| --mode | Operating mode. 0: Generates a Da Vinci model. 1: Converts a model to JSON. Converting a model to JSON allows you to view the model architecture in text format. 3: Performs precheck only to check the validity of the model file. | No | 0 |
| --model | Path of the source model file. | Yes | N/A |
| --framework | Framework of the source model. 0: Caffe 3: TensorFlow 5: ONNX 6: MindSpore NOTE - When mode is set to 1, this parameter is optional and can be specified as Caffe, TensorFlow, ONNX, or MindSpore; if not specified, the offline model is converted to the JSON format by default. - When mode is set to 0 or 3, this parameter is mandatory and can be specified as Caffe, TensorFlow, ONNX, or MindSpore. - When the original model format is TensorFlow CheckPoint, SavedModel, or TFLite, you are advised to use the tf2onnx tool to convert the model into an ONNX model. | Yes | N/A |
| --weight | Path of the weight file. This option is required for a Caffe model. Other models do not require this parameter. | No | N/A |
| --output | Path for storing the converted offline model file (including the file name), for example, out/caffe_resnet18. The converted model file is automatically suffixed with .om. | Yes | N/A |
| --hiai_version | OMG version to be used: v300 | v310 | IR | No | IR |
| --om | Path of the model file. This parameter is mandatory when mode is set to 1. | No | N/A |
| --json | Path of the generated JSON model file. | No | N/A |
| --input_shape | Shape of the input data. If input_shape is set to -1, this parameter must be used together with the --dynamic_dims parameter. Example: input_name1:n1, c1, h1, w1; input_name2: n2, c2, h2, w2 input_name must be the node name in the network model before conversion. If the original model is an ONNX model, input_name must be the name of the input operator in the network model before model conversion. NOTE - This parameter is mandatory when the original model is an ONNX model and the input dimensions of the model is dynamic. - This parameter is mandatory when the original model is a TensorFlow model and the input dimensions of the model is dynamic. | No | N/A |
| --input_format | Input data format, which can be NCHW or NHWC. NOTE - This parameter does not take effect if the source framework is Caffe, ONNX, or MindSpore. - This parameter does not need to be specified in most scenarios when the source framework is TensorFlow. Specify it as required during conversion. | No | N/A |
| --input_type | Model input (multi-input or single-input) data type. The supported data types include FP32, FP16, INT32, and UINT8. Whether an offline model can be successfully generated depends on whether the original model supports the specified input data type. For the supported model input data types, see input data types supported in non-AIPP scenarios and input data types supported in AIPP scenarios. Example: input_name1:FP16;input_name2:UINT8 input_name must be the node name in the network model before conversion. If the original model is an ONNX model, input_name must be the name of the input operator in the network model before model conversion. | No | FP32 |
| --input_fp16_nodes | This parameter and --input_type are exclusive. Name of the FP16 (NCHW) input node. Example: node_name1;node_name2 Note: This parameter does not take effect if the source framework is ONNX or MindSpore. | No | N/A |
| --out_nodes | Output node. - Specify the parameter in the following format if the original model is a TensorFlow or Caffe model: "node_name1:0;node_name1:1;node_name2:0". node_name must be the node name in the network model before model conversion. Outputs of the same node are numbered from 0 in ascending order. - Specify the parameter in the following format if the original model is an ONNX model: "tensor_name1;tensor_name2". tensor_name must be the tensor name output by the node in the network model before model conversion. | No | N/A |
| --output_type | Model output (multi-output or single-output) data type. The supported data types include FP32, FP16, INT32, and UINT8. Whether an offline model can be successfully generated depends on whether the original model supports the specified output data type. For the supported model output data types, see input data types supported in non-AIPP scenarios. Example: output_name1:FP16;output_name2:UINT8 output_name must be the node name in the network model before conversion. If the source framework is ONNX, output_name can be the name of the output operator in the network model before model conversion or the tensor_name used in the specified out_nodes. | No | FP32 |
| --is_output_fp16 | This parameter and --output_type are exclusive. Whether the data type of an output is FP16 (NCHW). Example: false, true, false, true Note: This parameter does not take effect if the source framework is ONNX or MindSpore. | No | false |
| --stream_num | Number of streams used by the model. The value must be 1. | No | 1 |
| --check_report | Path of the precheck result file. If this path is not specified, the precheck result is saved in the current path when the model conversion fails or mode is set to 3 (precheck only). | No | N/A |
| --net_format | Preferred data format for network operators. Note: This parameter is no longer recommended and can be derived from the network. | No | N/A |
| --insert_op_conf | Path of the AIPP configuration file. For details, see AIPP Configuration File Used for Model Conversion. | No | N/A |
| --op_name_map | Path of the operator mapping configuration file. This parameter is mandatory when the DetectionOutput network is used. For example, a DetectionOutput operator can play different roles in different networks. It can specify the mapping from DetectionOutput to FSRDetectionOutput or to SSDDetectionOutput. Note: Content example of the operator mapping configuration file: DetectionOutput:SSDDetectionOutput | No | N/A |
| --compress_conf | Path of the size reduction configuration file. This parameter is automatically generated by the size reduction tool. For details, see Model Size Reduction. | No | N/A |
| --weight_data_type | Weight data type, which can be FP32 or FP16. This parameter takes effect only when the existing weight is of the FP32 type. If the value is FP32, the weight is converted from FP32 to FP16. If the value is FP32, the data type of the weight is retained. The default value is FP16. Example: weight_data_type:FP16 Note: Since the CPU compute library (CPUCL) does not support FP16 weight computation, set this parameter to FP32 for CPUCL compatibility. | No | FP16 |
| --weight_merge | Switch for merging weights of offline models. You can specify whether to merge and store weights when generating offline models. If this parameter is set to true, the model weights are merged and stored. If this parameter is set to false, the weights are stored without being merged, which has no impact on performance. The parameter is set to true by default. | No | true |
| --use_origin_format | The input and output formats of a model can be set to be the same as those of the original model. Note: This parameter can be set to true only for service network conversion based on yolo and inception. For other network conversion, use the default value false. | No | false |
| --dynamic_dims | The same original model can be used to generate Da Vinci models that support different dimensions of the input shape. This parameter specifies the variable dimension (dim). It is used together with the --input_shape parameter. You can use -1 to represent the variable dim in input_shape. Values of the variable dims in this parameter are separated by semicolons (;), and dimensions are separated by commas (,). Examples: - Dynamic batch   --input_shape = "input_name1:-1,c,h,w" --dynamic_dims = "n1;n2;n3" - Dynamic image size --input_shape = "input_name1:n,-1,-1,c" --dynamic_dims = "h1,w1;h2,w2" Note: A maximum of 16 dynamic shapes are supported. | No | N/A |
| --platform | Chip platform. This parameter is mandatory when** --target** is set to omc. | No | N/A |
| --target | Target model type. - om Hardware-irrelevant Da Vinci model. - omc Da Vinci model that is closely related to hardware can be deployed only on the platform specified by --platform. | No | om |
Currently, only the scenarios listed in the following table are supported.
Input Data Types Supported in Non-AIPP Scenarios
| Input of the Original Model | Expected Input of the Offline Model (Developer-Defined) | OMG Parameter |
|---|---|---|
| FP32 | FP16 | --input_type |
| FP32 | FP32 | --input_type |
| FP16 | FP16 | --input_type |
| UINT8 | UINT8 | --input_type |
| INT32 | INT32 | --input_type |
| INT8 | INT8 | --input_type |
Input Data Types Supported in AIPP Scenarios
| Input of the Original Model | Expected Input of the Offline Model | With AIPP or Not | OMG Parameter |
|---|---|---|---|
| FP32 | UINT8 | Yes | --input_type |
| FP16 | UINT8 | Yes | --input_type |
| UINT8 | UINT8 | Yes | --input_type |
Supported model output data types
| Original Model | Offline Model Output | OMG Parameter |
|---|---|---|
| FP32 | UINT8 | --output_type |
| FP16 | UINT8 | --output_type |
| UINT8 | UINT8 | --output_type |
| FP16 | FP16 | --output_type |
| FP32 | FP32 | --output_type |
| FP32 | FP16 | --output_type |
| FP16 | FP32 | --output_type |
| INT8 | INT8 | --output_type |
| INT32 | INT32 | --output_type |
| INT64 | INT64 | --output_type |