[关闭]
@StarSky 2019-02-15T07:27:06.000000Z 字数 2054 阅读 485

2018-10-29 crnn

FTW 工作日记


enviroment requirlist

PyTorch v0.4
torch==0.4.0 torchvision
conda install ffmpeg=2.8.6
pip install lmdb ipdb
matplotlib
easydict==1.6
numpy==1.13.1
opencv_python==3.2.0.7

ImportError: libavcodec.so.56: cannot open shared object file: No such file or directory
solve:
reinstall ffmpeg version(2.8.6)
https://github.com/jabelone/OpenCV-for-Pi/issues/10

note for use

test for data
env:source /data/saber/soft/pytorch_py3.6

python3 crnn_main.py --trainroot /export/gpudata/saber/lmdb_capcha_million --valroot /export/gpudata/saber/lmdb_capcha_million_test --cuda (if cuda available)
python3 crnn_main.py --trainroot /export/gpudata/saber/capcha_img/lmdb_capcha_eduinfo_croped --valroot /export/gpudata/saber/capcha_img/lmdb_capcha_eduinfo_val_croped --cuda

test trained model

python test.py --images_dir '/data/saber/soft/crnn_chinese_characters_rec-master/to_lmdb/char_test_chinese/'

train on GPU & test on CPU
https://blog.csdn.net/dcrmg/article/details/79503978

warp_ctc loss

solved refer:

python setup.py install

https://github.com/SeanNaren/warp-ctc/issues/76

from warpctc_pytorch import CTCLoss 

https://github.com/SeanNaren/warp-ctc/pull/31

export WARP_CTC_PATH=/data/saber/soft/warp-ctc-pytorch_bindings/build

tensorboardX
https://github.com/lanpa/tensorboardX

img

imgW, imgH = 80, 32 || imgW, imgH = 160, 32

(train) the wide been setted to 100 in the paper, it depends...
(test) sepecially, remember to resize the image constant scale before recognize ( height=32 ) , make sure image wide >= imgW.

convert to tensorflow version

generate tfrecords file:

python tools/write_text_features.py --dataset_dir /data/saber/soft/CRNN_Tensorflow-master/data --save_dir /data/saber/soft/CRNN_Tensorflow-master/data --charset_dir  /data/saber/soft/CRNN_Tensorflow-master/data/char_dict

train:

python tools/train_shadownet.py --dataset_dir /data/saber/soft/CRNN_Tensorflow-master/data

test single img

python tools/demo_shadownet.py --image_path /export/gpudata/saber/capcha_img/hebei_tax_for_label/9p8_869.jpg --weights_path model/shadownet/shadownet_2018-11-20-10-48-37.ckpt-33

special gpu

CUDA_VISIBLE_DEVICES=1 python ***.py
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注