Skip to content

Instantly share code, notes, and snippets.

@likholat
Last active January 18, 2022 16:25
Show Gist options
  • Save likholat/67a5da925900a19caad1c7194f247cdc to your computer and use it in GitHub Desktop.
Save likholat/67a5da925900a19caad1c7194f247cdc to your computer and use it in GitHub Desktop.
OV DeformableConvolution support for DEKR

OV DeformableConvolution support for DEKR

Pytorch layer documentation

OpenVINO layer documentation

Follow these steps to get OpenVINO IR:

  • You can find all the changes needed to support the DeformableConvolution layer here.
  1. Create .onnx model with python3 tools/convert.py --cfg path/to/file.yaml TEST.MODEL_FILE path/to/file.yaml:
  2. Create OpenVINO IR with OpenVINO master branch:
python3 <INSTALL_DIR>/openvino/tools/mo/openvino/tools/mo/mo.py --input_model model.onnx
  1. Open model.xml file and replace all the values of bilinear_interpolation_pad parameter with true:
<layer id="..." name="..." type="DeformableConvolution" ...>
    <data auto_pad="explicit" bilinear_interpolation_pad="true" ...>
  1. Check the result with python3 compare.py.

Expected difference:

  1. For COCO:
python3 tools/convert.py \
    --cfg experiments/coco/inference_demo_coco.yaml \
    TEST.MODEL_FILE model/pose_coco/pose_dekr_hrnetw32_coco.pth

the result is:

Heatmap reference range: [-0.016255718, 0.047695834]
Offset reference range: [-50.128445, 53.03814]

Heatmap diff: 8.2841143e-07
Offset diff: 0.0043911934
  1. For CrowdPose:
python3 tools/convert.py \
    --cfg experiments/crowdpose/inference_demo_crowdpose.yaml \
    TEST.MODEL_FILE model/pose_crowdpose/pose_dekr_hrnetw32_crowdpose.pth

the result is:

Heatmap reference range: [-0.0047741896, 0.028738622]
Offset reference range: [-70.21522, 52.001522]

Heatmap diff: 7.105991e-07
Offset diff: 0.0013594627
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment