Created
April 25, 2021 01:35
-
-
Save pbamotra/d48b2940d84a214475dff9be6b5dab8c to your computer and use it in GitHub Desktop.
Cascade Tabnet to Onnx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!pip install cython==0.28.5 | |
!pip install mmdet==2.10.0 requests | |
!pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 -f https://download.pytorch.org/whl/torch_stable.html | |
!pip install mmcv-full==1.2.7+torch1.7.0+cu110 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html | |
!pip install onnx onnxruntime onnxruntime-gpu onnxoptimizer | |
!git clone --branch v2.10.0 https://github.com/open-mmlab/mmdetection.git | |
# Download conf and weights from | |
# https://github.com/iiLaurens/CascadeTabNet/blob/mmdet2x/Demo/Cascade_Tabnet_mmdet_v2_cpu_only_demo.ipynb | |
!cd mmdetection && python tools/deployment/pytorch2onnx.py \ | |
cascade_mask_rcnn_hrnetv2p_w32_20e.py\ | |
General.Model.table.detection.v2.pth \ | |
--output-file General.Model.table.detection.v2.onnx \ | |
--input-img demo.png \ | |
--shape 800 800 \ | |
--simplify | |
# Changes you must do to pytorch2onnx.py | |
# General.Model.table.detection.v2.pth is for general table detection, it does | |
# not produces masks | |
# Delete the following lines | |
# if model.with_mask: | |
# output_names.append('masks') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment