Open zhao181 opened 6 years ago
Thanks for the sharing.
hello, i try to run code on cpu, when i change code according like you, it caused like below: i have enough 17G RAM and i do not kmow what happened @zhao181 @eragonruan
Guys , I am trying to run the code on Raspberry Pi 3, I have tensorflow 1.3 installed and have configured the script to use CPU only, but I get the following error when the script demo.py is executed.
** Tensor("Placeholder:0", shape=(?, ?, ?, 3), dtype=float32) Tensor("conv5_3/conv5_3:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("rpn_conv/3x3/rpn_conv/3x3:0", shape=(?, ?, ?, 512), dtype=float32) WARNING:tensorflow:<tensorflow.python.ops.rnn_cell_impl.BasicLSTMCell object at 0x6fe17ff0>: Using a concatenated state is slower and will soon be deprecated. Use state_is_tuple=True. Tensor("lstm_o/Reshape:0", shape=(?, ?, ?, 128), dtype=float32) Tensor("lstm_o/Reshape:0", shape=(?, ?, ?, 128), dtype=float32) Tensor("rpn_cls_score/Reshape:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_cls_prob:0", shape=(?, ?, ?, ?), dtype=float32) Tensor("Reshape_5:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_bbox_pred/Reshape:0", shape=(?, ?, ?, 40), dtype=float32) Tensor("Placeholder_1:0", shape=(?, 3), dtype=float32) Loading network VGGnet_test... Restoring from checkpoints/VGGnet_fast_rcnn_iter_50000.ckpt... done
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted **
I have narrowed down the cause of error to a line 53 in test.py
rois = sess.run([net.get_output('rois')[0]],feed_dict=feed_dict)
I there is any information missing please do ask. Thanks
I remember that, before I fix the code, there are errors occurring here too. But I forget the details and the solutions.
发自网易邮箱大师
On 12/2/2017 18:09,zunair11notifications@github.com wrote:
Guys , I am trying to run the code on Raspberry Pi 3, I have tensorflow 1.3 installed and have configured the script to use CPU only, but I get the following error when the script demo.py is executed.
Tensor("Placeholder:0", shape=(?, ?, ?, 3), dtype=float32) Tensor("conv5_3/conv5_3:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("rpn_conv/3x3/rpn_conv/3x3:0", shape=(?, ?, ?, 512), dtype=float32) WARNING:tensorflow:<tensorflow.python.ops.rnn_cell_impl.BasicLSTMCell object at 0x6fe17ff0>: Using a concatenated state is slower and will soon be deprecated. Use state_is_tuple=True. Tensor("lstm_o/Reshape:0", shape=(?, ?, ?, 128), dtype=float32) Tensor("lstm_o/Reshape:0", shape=(?, ?, ?, 128), dtype=float32) Tensor("rpn_cls_score/Reshape:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_cls_prob:0", shape=(?, ?, ?, ?), dtype=float32) Tensor("Reshape_5:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_bbox_pred/Reshape:0", shape=(?, ?, ?, 40), dtype=float32) Tensor("Placeholder_1:0", shape=(?, 3), dtype=float32) Loading network VGGnet_test... Restoring from checkpoints/VGGnet_fast_rcnn_iter_50000.ckpt... done 1 terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted
I have narrowed down the cause of error to a line 53 in test.py rois = sess.run([net.get_output('rois')[0]],feed_dict=feed_dict)
I there is any information missing please do ask. Thanks
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Yes I got the same problem "Segmentation fault (core dumped)" . Have you fixed it?
发自网易邮箱大师
On 11/29/2017 14:32,cjt222notifications@github.com wrote:
hello, i try to run code on cpu, but it caused like below:
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
@zunair11 your device may not have sufficient memory to run the code
@zhao181 I have follow your steps, but there always with problems:
➜ utils git:(master) ✗ ./make.sh
Traceback (most recent call last):
File "setup.py", line 39, in <module>
CUDA = locate_cuda()
File "setup.py", line 26, in locate_cuda
raise EnvironmentError('The nvcc binary could not be '
OSError: The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME
mv: rename utils/* to ./*: No such file or directory
And i found the code in lib/utils/setup.py
:
CUDA = locate_cuda()
This block code will always exec.
Thanks.
It seems that you are using a gpu. I run the code only with cpu. I did not run make.sh since I follow the author's instruction and modified the setup.py to compile a cpu support.
发自网易邮箱大师
On 12/4/2017 16:23,David 大伟notifications@github.com wrote:
@zhao181 I have follow your steps, but there always with problems:
➜ utils git:(master) ✗ ./make.sh
Traceback (most recent call last):
File "setup.py", line 39, in
and i found the code in lib/utils/setup.py:
CUDA= locate_cuda()
This block code will always exec.
Thanks.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@zhao181
Got it. Thanks a lot.
@eragonruan I am monitoring the Raspberry Pi resource monitor the ram consumption is shown to be 250 ish MB out of 1 Gigs before the "bad alloc" error is encountered. Do you recommend any work around or is this a dead end for Raspberry Pi's capabilities
Exec with CPU success, but some difference. Hope help people in need.
My Sys Env:
For CPU only, here is my setup.py
from Cython.Build import cythonize
import numpy as np
from distutils.core import setup
from distutils.extension import Extension
try:
numpy_include = np.get_include()
except AttributeError:
numpy_include = np.get_numpy_include()
ext_modules = [
Extension(
'bbox',
sources=['bbox.c'],
include_dirs = [numpy_include]
),
Extension(
'cython_nms',
sources=['cython_nms.c'],
)
]
setup(
ext_modules=ext_modules
)
When execd command python setup.py build
, there was new directory build
have be created,
and copy build/bbox.cpython-36m-darwin.so
and build/cython_nms.cpython-36m-darwin.so
file to utils
.
@zunair11 the code need about 1.5G memory.
When I execute CPU only setup.py file, I get following error: SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help
error: no commands supplied Can you please help me?
@guddulrk python setup.py build_ext --inplace
When I run python setup.py build_ext --inplace it shows me an invalid syntax error.
Any help please
When I run pip setup.py build, it appears this error: unable to find vcvarsall.bat. Should I install the vs for c++ first?
You should run: python setup.py build_ext --include-dirs={your-numpy-include-path} for example my path is: C:\ProgramData\Anaconda3\Lib\site-packages\numpy\core\include
so: python setup.py build_ext --include-dirs=C:\ProgramData\Anaconda3\Lib\site-packages\numpy\core\include
and then you will find the .lib files in "./build/temp.win-amd64-3.6/Release" On my PC, the .lib file is "cython_nms.cp36-win_amd64.lib" and "bbox.cp36-win_amd64.lib", you should rename it properly.
On 12/7/2017 12:06,guddulrknotifications@github.com wrote:
When I run python setup.py build_ext --inplace it shows me an invalid syntax error.
Any help please
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks, but still I am getting the same error. Any solution, please
@guddulrk @Guo-king if your are using windows, use nms and bbox implemented in pure python instead, you have to modify some import
(1) I use the python command to build the setup.py, like this: python setup.py build_ext --include-dirs=C:\ProgramData\Anaconda3\Lib\site-packages\numpy\core\include I do not know what it will response if pip command is used.
(2) you should add your vcvarsall.bat path to the enviroments variables. Generally, if you have visual studio on your machine, the vcvarsall.bat file exists. For many machine, I have vs2013 and vs2015. There all three path for vcvarsall.bat, respectively: You can follow this figure to config your own machine.
(3)Still I am not sure which vcvarsall.bat will be used, so if I want to use VS140COMNTOOLS, I will firstly execute the following command: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat", after switching to the setup.py directory and before building the setup.py,
On 12/7/2017 14:48,Guo-kingnotifications@github.com wrote:
When I run pip setup.py build, it appears this error: unable to find vcvarsall.bat. Should I install the vs for c++ first?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@zhao181 @eragonruan Thank you for your kindly help. I will try again.
When I start running this program I get the following crash on windows 7: Problem Event Name: BEX64 Application Name: pythonw.exe Application Version: 3.5.2150.1013 Application Timestamp: 577be341 Fault Module Name: StackHash_1dc2
All other programs in python are running successfully. Anyone who met with this problem. Please help in the solution. Thanks
I tried a lot of ways. but always got "cannot import name 'bbox'". come from xxx/lib/utils/init.py anyone can help?please. no GPU python3.5
@zhao181 I tried your steps, I got problems of this step:
cd xxx/text-detection-ctpn-master/lib/utils and execute:python setup.py build
Traceback (most recent call last): File "setup_cpu_only_a.py", line 11, in <module> ext_modules=cythonize(["bbox.pyx","cython_nms.pyx"],include_dirs=[numpy_include]), File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 909, in cythonize c_options = CompilationOptions(**options) File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 559, in __init__ raise ValueError(message) ValueError: got unknown compilation option, please remove: include_dirs
this is my setup.py: `from Cython.Build import cythonize import numpy as np from distutils.core import setup
try: numpy_include = np.get_include() except AttributeError: numpy_include = np.get_numpy_include()
setup( ext_modules=cythonize(["bbox.pyx","cython_nms.pyx"],include_dirs=[numpy_include]), )`
How can i resolve it ? thanks.
I followed @struCoder , resolved it .
Dev Environment Tensorflow-1.3 Python-3.6 cython-0.24
CPU Setting: (1) Set "USE_GPU_NMS " in the file ./ctpn/text.yml as "False" (2) Set the "__C.USE_GPU_NMS" in the file ./lib/fast_rcnn/config.py as "False"; (3) Comment out the line "from lib.utils.gpu_nms import gpu_nms" in the file ./lib/fast_rcnn/nms_wrapper.py; (4) To rebuild the setup.py in path "[path]/text-detection-ctpn/lib/utils/setup.py": (5) cd xxx/text-detection-ctpn-master/lib/utils and execute:python setup.py build (6) copy the .so file from the "build" directory to the xxx/text-detection-ctpn-master/lib/utils. (7) cd xxx/text-detection-ctpn-master and execute: python ./ctpn/demo.py
ps: no need to set env variable "CFLAGS"
you may also need to modify some python file, just follow the error, it is pretty straight-forward
setup.py is like blow:
from Cython.Build import cythonize
import numpy as np
from distutils.core import setup
from distutils.extension import Extension
try:
numpy_include = np.get_include()
except AttributeError:
numpy_include = np.get_numpy_include()
ext_modules = [
Extension(
'bbox',
sources=['bbox.c'],
include_dirs = [numpy_include]
),
Extension(
'cython_nms',
sources=['cython_nms.c'],
include_dirs = [numpy_include]
)
]
setup(
ext_modules=ext_modules
)
Thank you for you kindly ways, and i have tried it.
however, when i execute: python ./ctpn/demo.py a problem below occured:
File "/home/aigo/Desktop/text-detection-ctpn-master/lib/utils/init.py", line 6, in
i have solved it by comment "from . import gpu_nms" in file above, maybe you can make your steps more complete.
@struCoder My Environment:
got errors
python setup.py build
......
35 warnings generated.
/usr/bin/gcc -bundle -undefined dynamic_lookup -L/Users/zhangxin/anaconda2/lib -arch x86_64 /Users/zhangxin/anaconda2/lib/python2.7/site-packages/numpy/core/include -arch x86_64 build/temp.macosx-10.6-x86_64-2.7/bbox.o -L/Users/zhangxin/anaconda2/lib -o build/lib.macosx-10.6-x86_64-2.7/bbox.so
ld: can't map file, errno=22 file '/Users/zhangxin/anaconda2/lib/python2.7/site-packages/numpy/core/include' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/gcc' failed with exit status 1
How to solve it
@ZhangXinNan You can try With Python 3.6 version.
@struCoder the same error
34 warnings generated.
/usr/bin/gcc -bundle -undefined dynamic_lookup -L/Users/zhangxin/anaconda2/envs/venv_py3/lib -arch x86_64 -L/Users/zhangxin/anaconda2/envs/venv_py3/lib -arch x86_64 /Users/zhangxin/anaconda2/envs/venv_py3/lib/python3.5/site-packages/numpy/core/include -arch x86_64 build/temp.macosx-10.6-x86_64-3.5/bbox.o -L/Users/zhangxin/anaconda2/envs/venv_py3/lib -o /Users/zhangxin/github/text-detection-ctpn/lib/utils/bbox.cpython-35m-darwin.so
ld: can't map file, errno=22 file '/Users/zhangxin/anaconda2/envs/venv_py3/lib/python3.5/site-packages/numpy/core/include' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/gcc' failed with exit status 1
today, I uninstall python which brew install
brew uninstall python
then comment from . import gpu_nms
in lib/utils/init.py ,
excute python setup.py build
successfully.
If you want to try CPU mode, please test my branch ZhangXinNan/text-detection-ctpn/tree/zxdev_mac
@zhao181 @eragonruan @struCoder
什么 时候开始支持win10 tensorflow 1.5 或者 1.6??
@mialrr win10上我没试过,我在Mac上就是用的tensorflow 1.5,起码inference没问题
@ZhangXinNan 非常感谢您的回答。tensorflow 在win10上面只支持 1.5和1.6 刚才安装了代码看上去没有错误。我先试试cpu版本吧。因为我的电脑是1070一直在跑fastercnn 发现识别文本效果(小的字无法定位大的都能定位res50)
win10 下面怎么 编译和安装utils 谢谢啦
关键怎么执行 什么命令?
D:\pywork\test\ctpn_d\lib\utils>python setup.py install
Traceback (most recent call last):
File "setup.py", line 39, in
After following below https://github.com/eragonruan/text-detection-ctpn/issues/73
First I got error as below Got error unable to find vcvarsall.bat Then conda install libpython then the below error pops up
(E:\Anaconda) E:\text-detection-ctpn-master\text-detection-ctpn-master\lib\utils>python setup_new.py install
running install
running build
running build_ext
Traceback (most recent call last):
File "setup_new.py", line 23, in
Please, I need a clear explanation to run the codeon windows 10 and ubuntu 14.04lts
When I run python ./ctpn/demo.py, some errors occur
E:\模型\text-detection\text-detection-ctpn>python ./ctpn/demo.py 2018-03-25 00:18:29.833224: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\ 36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn 't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. Tensor("Placeholder:0", shape=(?, ?, ?, 3), dtype=float32) Tensor("conv5_3/conv5_3:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("rpn_conv/3x3/rpn_conv/3x3:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("lstm_o/Reshape_2:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("lstm_o/Reshape_2:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("rpn_cls_score/Reshape_1:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_cls_prob:0", shape=(?, ?, ?, ?), dtype=float32) Tensor("Reshape_2:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_bbox_pred/Reshape_1:0", shape=(?, ?, ?, 40), dtype=float32) Tensor("Placeholder_1:0", shape=(?, 3), dtype=float32) Loading network VGGnet_test... Restoring from checkpoints/VGGnet_fast_rcnn_iter _50000.ckpt... done 2018-03-25 00:18:43.404669: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\ 36\tensorflow\core\framework\op_kernel.cc:1192] Invalid argument: ValueError: Bu ffer dtype mismatch, expected 'int_t' but got 'long long' Traceback (most recent call last): File "F:\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1327, in _do_call return fn(*args) File "F:\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1306, in _run_fn status, run_metadata) File "F:\anaconda\lib\contextlib.py", line 89, in exit next(self.gen) File "F:\anaconda\lib\site-packages\tensorflow\python\framework\errors_impl.py ", line 466, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long' [[Node: rois/PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_STRI NG, DT_INT32, DT_INT32], Tout=[DT_FLOAT, DT_FLOAT], token="pyfunc_0", _device="/ job:localhost/replica:0/task:0/cpu:0"](Reshape_2, rpn_bbox_pred/Reshape_1, arg Placeholder_1_0_1, rois/PyFunc/input_3, rois/PyFunc/input_4, rois/PyFunc/input_5 )]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./ctpn/demo.py", line 92, in
Caused by op 'rois/PyFunc', defined at:
File "./ctpn/demo.py", line 77, in
InvalidArgumentError (see above for traceback): ValueError: Buffer dtype mismatc h, expected 'int_t' but got 'long long' [[Node: rois/PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_STRI NG, DT_INT32, DT_INT32], Tout=[DT_FLOAT, DT_FLOAT], token="pyfunc_0", _device="/ job:localhost/replica:0/task:0/cpu:0"](Reshape_2, rpn_bbox_pred/Reshape_1, arg Placeholder_1_0_1, rois/PyFunc/input_3, rois/PyFunc/input_4, rois/PyFunc/input_5 )]]
please, I need a clear explanation to run the codeon windows 8
@hongdajun ,我也遇到这个问题,你解决了吗
python 3.6 VirtualEnv环境下安装tensorflow 1.5 python setup.py build_ext --include-dirs=/Users/xxx/python36/lib/python3.6/site-packages/numpy/core/include
`from Cython.Build import cythonize import numpy as np from distutils.core import setup from distutils.extension import Extension
try: numpy_include = np.get_include() except AttributeError: numpy_include = np.get_numpy_include()
ext_modules = [ Extension( 'bbox', sources=['bbox.c'], include_dirs = [numpy_include], ), Extension( 'cython_nms', sources=['cython_nms.c'], ) ] setup( ext_modules=cythonize(ext_modules) )`
from lib.networks.factory import get_network
ImportError: No module named 'lib'
@honghande lib是lib目录下的文件
does some one got a similar mistake when trying to run "python steup.y build"
@hongdajun @xxllp i have the same problem, have you solve it?
@honghande Please use in command line/ terminal --
export PYTHONPATH='path/to/text-detection-ctpn/'
then run
python ./ctpn/demo.py
in order to excute the code as project which allow main python file to call other python file inside that folder.
I hope that resolves your issue.
@hec44
Are you executing CFLAG
command for numpy_include
??
I think that is not necessary.
run python setup.py build ,but not find .so file i only find .lib , .exp , .pyd file ?
follow you guys, but got this err info, would anyone please tell me how to fix it?
Tensor("Placeholder:0", shape=(?, ?, ?, 3), dtype=float32) Tensor("conv5_3/conv5_3:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("rpn_conv/3x3/rpn_conv/3x3:0", shape=(?, ?, ?, 512), dtype=float32) WARNING:tensorflow:From /home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. Instructions for updating: Use the retry module or similar alternatives. Tensor("lstm_o/Reshape_2:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("lstm_o/Reshape_2:0", shape=(?, ?, ?, 512), dtype=float32) Tensor("rpn_cls_score/Reshape_1:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_cls_prob:0", shape=(?, ?, ?, ?), dtype=float32) Tensor("Reshape_2:0", shape=(?, ?, ?, 20), dtype=float32) Tensor("rpn_bbox_pred/Reshape_1:0", shape=(?, ?, ?, 40), dtype=float32) Tensor("Placeholder_1:0", shape=(?, 3), dtype=float32) Loading network VGGnet_test... Restoring from checkpoints/VGGnet_fast_rcnn_iter_50000.ckpt... done 2018-08-03 16:50:32.922171: W tensorflow/core/framework/op_kernel.cc:1261] Unknown: KeyError: b'TEST' Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 147, in call ret = func(*args)
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/rpn_msr/proposal_layer_tf.py", line 54, in proposal_layer pre_nms_topN = cfg[cfg_key].RPN_PRE_NMS_TOP_N#12000,?ㄥ.nms涔..锛..澶.??..?..ox?扮.
KeyError: b'TEST'
Traceback (most recent call last): File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call return fn(*args) File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1312, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1420, in _call_tf_sessionrun status, run_metadata) File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.UnknownError: KeyError: b'TEST' Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 147, in call ret = func(*args)
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/rpn_msr/proposal_layer_tf.py", line 54, in proposal_layer pre_nms_topN = cfg[cfg_key].RPN_PRE_NMS_TOP_N#12000,?ㄥ.nms涔..锛..澶.??..?..ox?扮.
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, rpn_bbox_pred/Reshape_1, _arg_Placeholder_1_0_1, rois/PyFunc/input_3, rois/PyFunc/input_4, rois/PyFunc/input_4)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./ctpn/demo.py", line 97, in
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 147, in call ret = func(*args)
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/rpn_msr/proposal_layer_tf.py", line 54, in proposal_layer pre_nms_topN = cfg[cfg_key].RPN_PRE_NMS_TOP_N#12000,?ㄥ.nms涔..锛..澶.??..?..ox?扮.
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, rpn_bbox_pred/Reshape_1, _arg_Placeholder_1_0_1, rois/PyFunc/input_3, rois/PyFunc/input_4, rois/PyFunc/input_4)]]
Caused by op 'rois/PyFunc', defined at:
File "./ctpn/demo.py", line 82, in
UnknownError (see above for traceback): KeyError: b'TEST' Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 147, in call ret = func(*args)
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/rpn_msr/proposal_layer_tf.py", line 54, in proposal_layer pre_nms_topN = cfg[cfg_key].RPN_PRE_NMS_TOP_N#12000,?ㄥ.nms涔..锛..澶.??..?..ox?扮.
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, rpn_bbox_pred/Reshape_1, _arg_Placeholder_1_0_1, rois/PyFunc/input_3, rois/PyFunc/input_4, rois/PyFunc/input_4)]]
I have the same issue with b'Test'. Anyone know how to fix it.
@JayGou , @SolinTao , the solution can be found at https://github.com/eragonruan/text-detection-ctpn/issues/73
Hello everyone, it is the first time I could successfully run a demo. Many thanks to the author.
To use cpu only, I follow the author's instruction and make the following modifications: (1) Set "USE_GPU_NMS " in the file ./ctpn/text.yml as "False" (2) Set the "__C.USE_GPU_NMS" in the file ./lib/fast_rcnn/config.py as "False"; (3) Comment out the line "from lib.utils.gpu_nms import gpu_nms" in the file ./lib/fast_rcnn/nms_wrapper.py; (4) To rebuild the setup.py:
The author provides the new code of setup.py for cpu only: ================================== from Cython.Build import cythonize import numpy as np from distutils.core import setup
try: numpy_include = np.get_include() except AttributeError: numpy_include = np.get_numpy_include()
setup( ext_modules=cythonize(["bbox.pyx","cython_nms.pyx"],include_dirs=[numpy_include]), )
(a) execute export CFLAGS=-I/home/zhao181/ProGram1/anaconda2/lib/python2.7/site-packages/numpy/core/include you should use your own numpy path.
(b) cd xxx/text-detection-ctpn-master/lib/utils and execute:python setup.py build
(c) copy the .so file from the "build" directory to the
xxx/text-detection-ctpn-master/lib/utils.
(5) cd xxx/text-detection-ctpn-master and execute: python ./ctpn/demo.py
By the way, I am running under ubuntu 16.04 with Anaconda2-4.2.0-Linux-x86_64.sh and tensorflow-1.3.0-cp27-cp27mu-manylinux1_x86_64.whl(cpu).