CTPN icon indicating copy to clipboard operation
CTPN copied to clipboard

The error that I got when I run "python demo.py --no-gpu"

Open yingning opened this issue 7 years ago • 1 comments

WARNING: Logging before InitGoogleLogging() is written to STDERR W0626 13:00:38.930151 31448 _caffe.cpp:122] DEPRECATION WARNING - deprecated use of Python interface W0626 13:00:38.930178 31448 _caffe.cpp:123] Use this instead (with the named "weights" parameter): W0626 13:00:38.930186 31448 _caffe.cpp:125] Net('/home/jsj/CTPN/models/deploy.prototxt', 1, weights='/home/jsj/CTPN/models/ctpn_trained_model.caffemodel') [libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 387:19: Message type "caffe.LayerParameter" has no field named "transpose_param". F0626 13:00:38.931586 31448 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /home/jsj/CTPN/models/deploy.prototxt *** Check failure stack trace: *** 已放弃 (核心已转储) . I need your help .Thanks in advence . Can you tell me which caffe that you used?,the caffe that i used is from "<module 'caffe' from '/home/jsj/caffe/python/caffe/init.pyc'> @tianzhi0549

the follow is the demo.py that I adjusted :

import sys caffe_root = '/home/jsj/CTPN/caffe/python/caffe' # this file is expected to be in {caffe_root}/examples sys.path.insert(0,caffe_root) from cfg import Config as cfg from other import draw_boxes, resize_im, CaffeModel import cv2, os, caffe from detectors import TextProposalDetector, TextDetector import os.path as osp from timer import Timer print caffe DEMO_IMAGE_DIR="/home/jsj/CTPN/demo_images/" NET_DEF_FILE="/home/jsj/CTPN/models/deploy.prototxt" MODEL_FILE="/home/jsj/CTPN/models/ctpn_trained_model.caffemodel"

#if len(sys.argv)>1 and sys.argv[1]=="--no-gpu":

caffe.set_mode_cpu()

#else:

caffe.set_mode_cpu()

caffe.set_device(cfg.TEST_CPU_ID)

caffe.set_mode_cpu()

initialize the detectors

text_proposals_detector=TextProposalDetector(CaffeModel(NET_DEF_FILE, MODEL_FILE)) text_detector=TextDetector(text_proposals_detector)

demo_imnames=os.listdir(DEMO_IMAGE_DIR) timer=Timer()

for im_name in demo_imnames: print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" print "Image: %s"%im_name

im_file=osp.join(DEMO_IMAGE_DIR, im_name)
im=cv2.imread(im_file)

timer.tic()

im, f=resize_im(im, cfg.SCALE, cfg.MAX_SCALE)
text_lines=text_detector.detect(im)

print "Number of the detected text lines: %s"%len(text_lines)
print "Time: %f"%timer.toc()

im_with_text_lines=draw_boxes(im, text_lines, caption=im_name, wait=False)

print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" print "Thank you for trying our demo. Press any key to exit..." cv2.waitKey(0)

yingning avatar Jun 26 '17 05:06 yingning

I have the same problem. It is a problem with the version of caffe. Finally, I compiled caffe from./CTPN/caffe instead of downloading caffe from the website. You can try. @yingning QQ截图20200311164903

striveallen avatar Mar 12 '20 03:03 striveallen