Converting a PyTorch Cascade RCNN R-101 Model

The goal of this article is to present a step-by-step guide on how to convert a PyTorch Cascade RCNN R-101 model to OpenVINO IR. First, you need to download the model and convert it to ONNX.

Downloading and Converting Model to ONNX

git clone https://github.com/open-mmlab/mmdetection
cd mmdetection

Note

To set up an environment, refer to the instructions.

  • Download the pretrained model. The model is also available 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, specify the model name or output directory, using --output-file <path-to-dir>/<model-name>.onnx.

Converting an ONNX Cascade RCNN R-101 Model to OpenVINO 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]