Open2

DCNv2あれこれ検討

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

wget https://github.com/microsoft/onnxruntime/releases/download/v1.9.0/onnxruntime-linux-x64-1.9.0.tgz
wget https://github.com/microsoft/onnxruntime/releases/download/v1.9.0/onnxruntime-linux-x64-gpu-1.9.0.tgz

tar -zxvf onnxruntime-linux-x64-1.9.0.tgz && rm onnxruntime-linux-x64-1.9.0.tgz
tar -zxvf onnxruntime-linux-x64-gpu-1.9.0.tgz && rm onnxruntime-linux-x64-gpu-1.9.0.tgz

cd onnxruntime-linux-x64-gpu-1.9.0
export ONNXRUNTIME_DIR=$(pwd)
export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH

cd ..
MMCV_WITH_OPS=1 MMCV_WITH_ORT=1 sudo python3 setup.py develop

pip3 install onnxruntime-gpu==1.9.0
PINTOPINTO
cd ~
git clone https://github.com/open-mmlab/mmdetection
cd mmdetection
git checkout 6cf9aa1866b745fce8f1da6717fdb833d7c66fab
wget https://github.com/open-mmlab/mmdetection/tree/master/configs/dcn/faster_rcnn_r50_fpn_dconv_c3-c5_1x_coco.py
wget https://download.openmmlab.com/mmdetection/v2.0/dcn/faster_rcnn_r50_fpn_dconv_c3-c5_1x_coco/faster_rcnn_r50_fpn_dconv_c3-c5_1x_coco_20200130-d68aed1e.pth
pip3 uninstall mmcv-full
pip3 install mmcv-full==1.3 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
CONFIG_FILE=faster_rcnn_r50_fpn_dconv_c3-c5_1x_coco.py
CHECKPOINT_FILE=faster_rcnn_r50_fpn_dconv_c3-c5_1x_coco_20200130-d68aed1e.pth
OUTPUT_FILE=dcnv2.onnx
IMAGE_SHAPE="480 640"
OPSET_VERSION=11

python3 tools/deployment/pytorch2onnx.py \
${CONFIG_FILE} \
${CHECKPOINT_FILE} \
--output-file ${OUTPUT_FILE} \
--shape ${IMAGE_SHAPE} \
--opset-version ${OPSET_VERSION} \
--verify \
--simplify