JinpengLI/deep_ocr

ubuntu16.0.4 docker 执行reco_chars.py 出错

Opened this issue · 5 comments

1, 下载deep_ocr_workspace.zip
2,docker pull jinpengli/deep_ocr_cpu_docker:latest
3,docker run -ti --volume=${HOME}/deep_ocr_workspace:/workspace jinpengli/deep_ocr_cpu_docker:latest /bin/bash
4,python /opt/deep_ocr/reco_chars.py
会出现错误:
root@dd66a9208e12:/workspace# python /opt/deep_ocr/reco_chars.py
libdc1394 error: Failed to initialize libdc1394
WARNING: Logging before InitGoogleLogging() is written to STDERR

。。。中间省略一些普通日志。。。

Traceback (most recent call last):
File "/opt/deep_ocr/reco_chars.py", line 364, in
output_tag_to_max_proba = caffe_cls.predict_cv2_imgs(np_char_imgs)
File "/opt/deep_ocr/reco_chars.py", line 66, in predict_cv2_imgs
self._predict_cv2_imgs_sub(cv2_imgs, i, pos_end)
File "/opt/deep_ocr/reco_chars.py", line 53, in _predict_cv2_imgs_sub
item = (self.y_tag_json[str(index)],
KeyError: '5613'

root@3e93e68313ba:/opt/deep_ocr# python /opt/deep_ocr/reco_chars.py
libdc1394 error: Failed to initialize libdc1394
WARNING: Logging before InitGoogleLogging() is written to STDERR
W0714 02:06:59.801216 45 _caffe.cpp:139] DEPRECATION WARNING - deprecated use of Python interface
W0714 02:06:59.801687 45 _caffe.cpp:140] Use this instead (with the named "weights" parameter):
W0714 02:06:59.801810 45 _caffe.cpp:142] Net('/workspace/data/chongdata_caffe_cn_sim_digits_64_64/deploy_lenet_train_test.prototxt', 1, weights='/workspace/data/chongdata_caffe_cn_sim_digits_64_64/lenet_iter_50000.caffemodel')
Traceback (most recent call last):
File "/opt/deep_ocr/reco_chars.py", line 294, in
caffe_cls = CaffeCls(model_def, model_weights, y_tag_json_path)
File "/opt/deep_ocr/reco_chars.py", line 20, in init
caffe.TEST)
RuntimeError: Could not open file /workspace/data/chongdata_caffe_cn_sim_digits_64_64/deploy_lenet_train_test.prototxt

............................................................................................
我也遇到这个问题了 win10 Ubuntu 14.04 lts

I1013 18:55:36.650260 3948786624 net.cpp:744] Ignoring source layer loss

name
Traceback (most recent call last):
File "./bin/deep_ocr_id_card_reco", line 119, in
ocr_res = reco_text_line.do(boundary2binimgs, segment, caffe_cls)
File "/Users/xiangjy/study/code/python/deep_ocr/deep_ocr/reco_text_line.py", line 132, in do
rects, boundaries, bin_images)
File "/Users/xiangjy/study/code/python/deep_ocr/deep_ocr/reco_text_line.py", line 66, in do_images_maxproba
self._do(rects, boundary)
File "/Users/xiangjy/study/code/python/deep_ocr/deep_ocr/reco_text_line.py", line 39, in _do
output_tag_to_max_proba = self.caffe_cls.predict_cv2_imgs(np_char_imgs)
File "/Users/xiangjy/study/code/python/deep_ocr/deep_ocr/caffe_clf.py", line 66, in predict_cv2_imgs
self._predict_cv2_imgs_sub(cv2_imgs, i, pos_end)
File "/Users/xiangjy/study/code/python/deep_ocr/deep_ocr/caffe_clf.py", line 53, in _predict_cv2_imgs_sub
item = (self.y_tag_json[str(index)],
KeyError: '1972'

the same error @JinpengLI help me, thanks

It seems you didn't download the trained model from baidu cloud, and you didn't mount it into docker container?

@JinpengLI Thank a lot. Now It‘s OK. There is KeyError when i use "https://pan.baidu.com/s/1nvz2wrB". Change to use "https://pan.baidu.com/s/1qYPKH3Y", it's OK.