Skip to content

Latest commit

 

History

History
60 lines (51 loc) · 2.44 KB

README.md

File metadata and controls

60 lines (51 loc) · 2.44 KB

CRAFT: Character-Region Awareness For Text detection

CRAFT ONNX

Getting started

Install dependencies

Requirements

  • My Environment:
    • pytorch 1.8.1+cu102
    • onnxruntime 1.10.0
    • check requirements.txt
pip install -r requirements.txt

Convert Craftmlt25k.pth to onnx

  • Download model pth from origin repo: craftmlt25k and push to folder weights
  • Run:
CUDA_VISIBLE_DEVICES=0 python3 craft2onnx.py --craftmlt25kpthpath <craft_model_path.pth> --craftonnxpath <craft_model_onnx_save_path.onnx>

Inference Craftmlt25k without refinet

  • Run:
CUDA_VISIBLE_DEVICES=0 python3 infer_craft_without_refinet.py --craftonnxpath <craft_model_onnx_path.onnx> --image <image_path_inference>

teaser

Convert Refinet.pth to onnx

  • Download model pth from origin repo: refinet and push to folder weights
  • Run:
CUDA_VISIBLE_DEVICES=0 python3 craft2onnx.py --craftmlt25kpthpath <craft_model_path.pth> --refinetpthpath <refinet_model_path.pth> --refinetonnxpath <refinet_model_onnx_save_path.onnx>

Inference Craft model with refinet

  • Run
CUDA_VISIBLE_DEVICES=0 python3 infer_craft_with_refinet.py --craftonnxpath <craft_model_onnx_path.onnx> --refineonnxpath <refinet_model_onnx_path.onnx> --image <image_path_inference>

teaser

Test instruction using pretrained model

  • Download the converted models
Model name Used datasets Languages Purpose Model ONNX Link
General SynthText, IC13, IC17 Eng + MLT For general purpose Click
LinkRefiner CTW1500 - Used with the General Model Click

To do list

  • Convert General craft_mlt_25k to ONNX with dynamic shape
  • Convert LinkRefiner to ONNX with dynamic shape
  • Convert General craft_mlt_25k to TensorRT with dynamic shape
  • Convert LinkRefiner to TensorRT with dynamic shape
  • Convert IC15 to ONNX with dynamic shape

REFERENCE

  1. https://github.com/clovaai/CRAFT-pytorch