eragonruan / text-detection-ctpn

text detection mainly based on ctpn model in tensorflow, id card detect, connectionist text proposal network
MIT License
3.42k stars 1.34k forks source link

question about running with cpu #199

Open icedlemon opened 5 years ago

icedlemon commented 5 years ago

i follow the step of this issue https://github.com/eragonruan/text-detection-ctpn/issues/73 but finally cause this problem: Caused by op 'rois/PyFunc', defined at: File "D:/ML_projects/machine_learning/tensorflow/geetst/text-detection-ctpn-master/ctpn/demo.py", line 82, in net = get_network("VGGnet_test") File "D:\ML_projects\machine_learning\tensorflow\geetst\text-detection-ctpn-master\lib\networks\factory.py", line 8, in get_network return VGGnet_test() File "D:\ML_projects\machine_learning\tensorflow\geetst\text-detection-ctpn-master\lib\networks\VGGnet_test.py", line 14, in init self.setup() File "D:\ML_projects\machine_learning\tensorflow\geetst\text-detection-ctpn-master\lib\networks\VGGnet_test.py", line 55, in setup .proposal_layer(_feat_stride, anchor_scales, 'TEST', name='rois')) File "D:\ML_projects\machine_learning\tensorflow\geetst\text-detection-ctpn-master\lib\networks\network.py", line 21, in layer_decorated layer_output = op(self, layer_input, *args, **kwargs) File "D:\ML_projects\machine_learning\tensorflow\geetst\text-detection-ctpn-master\lib\networks\network.py", line 215, in proposal_layer [tf.float32,tf.float32]) File "C:\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\ops\script_ops.py", line 212, in py_func input=inp, token=token, Tout=Tout, name=name) File "C:\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\ops\gen_script_ops.py", line 49, in _py_func "PyFunc", input=input, token=token, Tout=Tout, name=name) File "C:\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "C:\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\framework\ops.py", line 2956, in create_op op_def=op_def) File "C:\Anaconda3\envs\tfenv\lib\site-packages\tensorflow\python\framework\ops.py", line 1470, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

UnknownError (see above for traceback): KeyError: b'TEST' [[Node: rois/PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_STRING, DT_INT32, DT_INT32], Tout=[DT_FLOAT, DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/device:CPU:0"](Reshape_2/_151, rpn_bbox_pred/Reshape_1/_153, _arg_Placeholder_1_0_1, rois/PyFunc/input_3, rois/PyFunc/input_4, rois/PyFunc/input_4)]] [[Node: rois/PyFunc/_155 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_470_rois/PyFunc", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

How should I solve it. thank you.

eragonruan commented 5 years ago

@icedlemon Are you running the code with python2?

icedlemon commented 5 years ago

@eragonruan thank you, i have solve this problem. and i'm sorry to trouble you again. when i train your data follow steps, but cause this problem:

Traceback (most recent call last): File "train_net.py", line 38, in restore=bool(int(cfg.TRAIN.restore))) File "ctpn/ctpn/../lib/fast_rcnn/train.py", line 226, in train_net sw.train_model(sess, max_iters, restore=restore) File "ctpn/ctpn/../lib/fast_rcnn/train.py", line 91, in train_model self.build_image_summary() File "ctpn/ctpn/../lib/fast_rcnn/train.py", line 73, in build_image_summary log_image = gen_logging_ops._image_summary(log_image_name, tf.expand_dims(log_image_data, 0), max_images=1) AttributeError: module 'tensorflow.python.ops.gen_logging_ops' has no attribute '_image_summary'

How should I solve it. thank you.

icedlemon commented 5 years ago

Thanks, I'm sorry that taking such a footling question. i have changed my tensorflow's version and solve this problem

ha121ppy commented 5 years ago

Hi @icedlemon , I got same question with you: no attribute '_image_summary' what do you mean 'change tensorflow's version'? my tensorflow is version1.8.0, is there a substition of '_image_summary' in this version? Thanks a lot! PS: share my solution: change gen_logging_ops._image_summary to gen_logging_ops.image_summary

yhaiqiang commented 5 years ago

@ha121ppy 谢谢你,我也碰到这个问题,按照你的方法解决了

anthpot commented 4 years ago

Hi @icedlemon , I got same question with you: no attribute '_image_summary' what do you mean 'change tensorflow's version'? my tensorflow is version1.8.0, is there a substition of '_image_summary' in this version? Thanks a lot! PS: share my solution: change gen_logging_ops._image_summary to gen_logging_ops.image_summary

Thank you,I solve the problem by using your soluation.