dbnet_torch
dbnet_torch copied to clipboard
you can use dbnet to detect word or bar code,Knowledge Distillation is provided,also python tensorrt inference is provided.
1.DBnet-pytorch
my chinese blog:https://blog.csdn.net/fanzonghao/article/details/107199538
Dbnet is usually used to detect word, in fact barcode can be detected.
This project also provide word detect model.
model:
2.train
follow icdar15 dataset format, x1,y1,x2,y2,x3,y3,x4,y4,label,(x1,y1) is left top,(x2,y2) is right top.
where config/icdar2015_resnet18_FPN_DBhead_polyLR_code_phone.yaml you can change learning rate,train_path and so on.
single gpu train: python train_code_phone.py
multi gpus train:sh multi_gpu_train.sh , nedd notice os.environ['CUDA_VISIBLE_DEVICES'] is match nproc_per_node.
3.torch inference
python predict_code_phone.py
4.tensorrt inference
First python model_to_onnx.py to get onnx model. Then where onnx_project you can python dbcode_tensorrt_predict.py.
notice:change model path
5.Knowledge Distillation
python train_word_industry_res50.py train teacher(res50) model;
python train_word_industry_res18_kd.py train student(res18)model;
6.labelme json to txt:
--change you own path in labelme_txt_box.py
python labelme_txt_box.py
7.requirements
pytorch1.5
torchvision0.6
cuda9.0+
tensorrt 7.0
8.pretrain model
1.word:https://github.com/zonghaofan/dbnet_torch/tree/master/phone_word_model 2.code:https://github.com/zonghaofan/dbnet_torch/tree/master/phone_code_model
9.some examples
-
learning rate show
2.some test examples
3.train loss
10.reference
1. https://github.com/WenmuZhou/DBNet.pytorch
11.to do
More tensortrt inference.