Converting an Original Model or Offline Model into a .json File

Overview

If you cannot view parameter details of your original model or offline model, you can convert it into a .json file.

Procedure

This section takes the TensorFlow ResNet-50 network model for illustration. Refer to 1 to obtain the original model file.

  • Convert an original model file into a .json file.

    In this scenario, the --om option needs to be specified as the original model file. You can refer to the following command example.

    atc --mode=1 --om=$HOME/module/resnet50_tensorflow*.pb  --json=$HOME/module/out/tf_resnet50.json  --framework=3
  • Convert an offline model into a .json file.

    In this scenario, convert the original model to an offline model and then convert the offline one to a .json file.

    1. Run the following command to convert the original model into an offline model.
      atc --model=$HOME/module/resnet50_tensorflow*.pb --framework=3 --output=$HOME/module/out/tf_resnet50 --soc_version=<soc_version>   
    2. Run the following command to convert the offline model into a .json file.
      atc --mode=1 --om=$HOME/module/out/tf_resnet50.om  --json=$HOME/module/out/tf_resnet50.json
    For details about the command-line options, see Command Line Options. You should see information similar to the following if the conversion is successful. If it fails, refer to Troubleshooting to locate the fault.
    1
    ATC run success
    

    After successful execution, you can check the JSON file in the path specified by --json.