Convert PyTorch Cascade RCNN R-101 Model¶
Download and Convert Model to ONNX¶
Clone the repository :
git clone https://github.com/open-mmlab/mmdetection
cd mmdetection
Note
To set up an environment, refer to this instruction.
Download the pre-trained model. You can also find the link to the model here.
To convert the model to ONNX format, use this script.
python3 tools/deployment/pytorch2onnx.py configs/cascade_rcnn/cascade_rcnn_r101_fpn_1x_coco.py cascade_rcnn_r101_fpn_1x_coco_20200317-0b6a2fbf.pth --output-file cascade_rcnn_r101_fpn_1x_coco.onnx
The script generates ONNX model file cascade_rcnn_r101_fpn_1x_coco.onnx
in the directory tools/deployment/
. If required, you can specify the model name or output directory using --output-file <path-to-dir>/<model-name>.onnx
Convert ONNX Cascade RCNN R-101 Model to IR¶
mo --input_model cascade_rcnn_r101_fpn_1x_coco.onnx --mean_values [123.675,116.28,103.53] --scale_values [58.395,57.12,57.375]