liuheng92 / tensorflow_PSENet

This is a tensorflow re-implementation of PSENet: Shape Robust Text Detection with Progressive Scale Expansion Network.My blog:
https://blog.csdn.net/liuxiaoheng1992/article/details/87646951
MIT License
491 stars 162 forks source link

ImportError: No module named 'Queue' #3

Closed globalmaster closed 5 years ago

globalmaster commented 5 years ago

你好: 我下载了模型和工程代码,在Ubuntu16.04、tensorflow-gpu==1.12.0环境下运行:python3 eval.py --test_data_path=./test_input_0.5/ --gpu_list=0 --checkpoint_path=./model/ --output_dir=./output/ 报了如下错误: Traceback (most recent call last): File "eval.py", line 8, in from utils.utils_tool import logger, cfg File "/media/jack/code/clion_kdevelop/OCR/tensorflow_PSENet/utils/utils_tool.py", line 3, in import Queue ImportError: No module named 'Queue'

我尝试通过sudo pip3 install Queue的方式进行安装,但是失败了。查看了整个工程,也没有Queue.py。请问我该如何解决这个问题?谢谢! @atulak @liuheng92

globalmaster commented 5 years ago

这个问题在stackoverflow上找到了解决办法: On Python 2, the module is named Queue, on Python 3, it was renamed to follow PEP8 guidelines (all lowercase for module names), making it queue. The class remains Queue on all versions (following PEP8).

Typically, the way you'd write version portable imports would be to do:

try: import queue except ImportError: import Queue as queue

但是我又遇到了另外一个问题,在python2和python3上都出现: Traceback (most recent call last): File "eval.py", line 235, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "eval.py", line 171, in main model_path = os.path.join(FLAGS.checkpoint_path, os.path.basename(ckpt_state.model_checkpoint_path)) AttributeError: 'NoneType' object has no attribute 'model_checkpoint_path'

liuheng92 commented 5 years ago

这个问题在stackoverflow上找到了解决办法: On Python 2, the module is named Queue, on Python 3, it was renamed to follow PEP8 guidelines (all lowercase for module names), making it queue. The class remains Queue on all versions (following PEP8).

Typically, the way you'd write version portable imports would be to do:

try: import queue except ImportError: import Queue as queue

但是我又遇到了另外一个问题,在python2和python3上都出现: Traceback (most recent call last): File "eval.py", line 235, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "eval.py", line 171, in main model_path = os.path.join(FLAGS.checkpoint_path, os.path.basename(ckpt_state.model_checkpoint_path)) AttributeError: 'NoneType' object has no attribute 'model_checkpoint_path'

you can modify model_path in eval.py

globalmaster commented 5 years ago

谢谢你的回复!怎么改model_path能说详细一些吗? 这个和EAST的eval.py很像,为什么EAST没问题,而这里有问题呢?

globalmaster commented 5 years ago

在存放模型的文件夹内加了个checkpoint文件就可以了,checkpoint文件内容为: model_checkpoint_path: "/tmp/model/model.ckpt" all_model_checkpoint_paths: "/tmp/model/model.ckpt"

ww451575464 commented 5 years ago

我也遇到以上问题,加上try等语句,解决Queue的问题,加上checkpoint文件,并且在执行eval的时候指定checkpoint_path为model文件夹,但是最后还是有个问题 在 from .pse import pse_cpp 这条语句的时候报错 undefined symbol: _Py_ZeroStruct 请问是什么情况,有碰到过么 @liuheng92 @globalmaster

globalmaster commented 5 years ago

我也遇到以上问题,加上try等语句,解决Queue的问题,加上checkpoint文件,并且在执行eval的时候指定checkpoint_path为model文件夹,但是最后还是有个问题 在 from .pse import pse_cpp 这条语句的时候报错 undefined symbol: _Py_ZeroStruct 请问是什么情况,有碰到过么 @liuheng92 @globalmaster

没遇见,你是用的Ubuntu系统自带的python3吗?建议你把eval.py运行时编译pse.so的命令复制下来,手动用系统自带的python3编译pse.so。

liuheng92 commented 5 years ago

我也遇到以上问题,加上try等语句,解决Queue的问题,加上checkpoint文件,并且在执行eval的时候指定checkpoint_path为model文件夹,但是最后还是有个问题 在 from .pse import pse_cpp 这条语句的时候报错 undefined symbol: _Py_ZeroStruct 请问是什么情况,有碰到过么 @liuheng92 @globalmaster

看readme,改makefile

ww451575464 commented 5 years ago

我也遇到以上问题,加上try等语句,解决Queue的问题,加上checkpoint文件,并且在执行eval的时候指定checkpoint_path为model文件夹,但是最后还是有个问题 在 from .pse import pse_cpp 这条语句的时候报错 undefined symbol: _Py_ZeroStruct 请问是什么情况,有碰到过么 @liuheng92 @globalmaster

看readme,改makefile

OK了,感谢