Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running with CPU only #43

Open
zhao181 opened this issue Nov 17, 2017 · 68 comments
Open

Running with CPU only #43

zhao181 opened this issue Nov 17, 2017 · 68 comments

Comments

@zhao181
Copy link

zhao181 commented Nov 17, 2017

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).

@eragonruan
Copy link
Owner

Thanks for the sharing.

@cjt222
Copy link

cjt222 commented Nov 29, 2017

hello, i try to run code on cpu, when i change code according like you, it caused like below:
image
i have enough 17G RAM and i do not kmow what happened @zhao181 @eragonruan

@zunair11
Copy link

zunair11 commented Dec 2, 2017

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

@zhao181
Copy link
Author

zhao181 commented Dec 2, 2017 via email

@zhao181
Copy link
Author

zhao181 commented Dec 2, 2017 via email

@eragonruan
Copy link
Owner

@zunair11 your device may not have sufficient memory to run the code

@struCoder
Copy link

struCoder commented Dec 4, 2017

@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.

@zhao181
Copy link
Author

zhao181 commented Dec 4, 2017 via email

@struCoder
Copy link

@zhao181

Got it.
Thanks a lot.

@zunair11
Copy link

zunair11 commented Dec 4, 2017

@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

@struCoder
Copy link

struCoder commented Dec 4, 2017

Exec with CPU success, but some difference.
Hope help people in need.

My Sys Env:

  • Mac os 10.13.1
  • Python3.6.2
  • Tensorflow 1.3

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.

@eragonruan
Copy link
Owner

@zunair11 the code need about 1.5G memory.

@guddulrk
Copy link

guddulrk commented Dec 7, 2017

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?

@eragonruan
Copy link
Owner

@guddulrk python setup.py build_ext --inplace

@guddulrk
Copy link

guddulrk commented Dec 7, 2017

When I run python setup.py build_ext --inplace
it shows me an invalid syntax error.

Any help please

@Guo-king
Copy link

Guo-king commented Dec 7, 2017

When I run pip setup.py build, it appears this error: unable to find vcvarsall.bat.
Should I install the vs for c++ first?

@zhao181
Copy link
Author

zhao181 commented Dec 7, 2017 via email

@guddulrk
Copy link

guddulrk commented Dec 7, 2017

Thanks, but still I am getting the same error. Any solution, please

@eragonruan
Copy link
Owner

@guddulrk @Guo-king if your are using windows, use nms and bbox implemented in pure python instead, you have to modify some import

@zhao181
Copy link
Author

zhao181 commented Dec 7, 2017 via email

@Guo-king
Copy link

Guo-king commented Dec 7, 2017

@zhao181 @eragonruan Thank you for your kindly help. I will try again.

@guddulrk
Copy link

guddulrk commented Dec 8, 2017

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

@newzyh
Copy link

newzyh commented Dec 22, 2017

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

@quanh
Copy link

quanh commented Dec 25, 2017

@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 .

@hushenglang
Copy link

hushenglang commented Feb 26, 2018

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
)

@daoqinzi
Copy link

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
from . import gpu_nms
ImportError: cannot import name 'gpu_nms'

i have solved it by comment "from . import gpu_nms" in file above, maybe you can make your steps more complete.

@ZhangXinNan
Copy link

@struCoder
My Environment:

  • Mac 10.13.3
  • TensorFlow 1.5.0
  • Cython 0.26.1
  • Python 2.7.14

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

@struCoder
Copy link

@ZhangXinNan
You can try With Python 3.6 version.

@SolinTao
Copy link

@honghande lib是lib目录下的文件

@hec44
Copy link

hec44 commented Jun 19, 2018

image

does some one got a similar mistake when trying to run "python steup.y build"

@icedlemon
Copy link

@hongdajun @xxllp i have the same problem, have you solve it?

@anandi1989
Copy link

@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.

@anandi1989
Copy link

anandi1989 commented Jul 19, 2018

@hec44
Are you executing CFLAG command for numpy_include??
I think that is not necessary.

@tianyexing
Copy link

run python setup.py build ,but not find .so file
i only find .lib , .exp , .pyd file ?

@JayGou
Copy link

JayGou commented Aug 3, 2018

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
_, _ = test_ctpn(sess, net, im)
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/fast_rcnn/test.py", line 51, in test_ctpn
rois = sess.run([net.get_output('rois')[0]],feed_dict=feed_dict)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 905, in run
run_metadata_ptr)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1140, in _run
feed_dict_tensor, options, run_metadata)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
run_metadata)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
raise type(e)(node_def, op, message)
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)]]

Caused by op 'rois/PyFunc', defined at:
File "./ctpn/demo.py", line 82, in
net = get_network("VGGnet_test")
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/networks/factory.py", line 8, in get_network
return VGGnet_test()
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/networks/VGGnet_test.py", line 14, in init
self.setup()
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/networks/VGGnet_test.py", line 55, in setup
.proposal_layer(_feat_stride, anchor_scales, 'TEST', name='rois'))
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/networks/network.py", line 21, in layer_decorated
layer_output = op(self, layer_input, *args, **kwargs)
File "/home/gouyanjie/ctpn/text-detection-ctpn/lib/networks/network.py", line 215, in proposal_layer
[tf.float32,tf.float32])
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 330, in py_func
func=func, inp=inp, Tout=Tout, stateful=stateful, eager=False, name=name)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 231, in _internal_py_func
input=inp, token=token, Tout=Tout, name=name)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/ops/gen_script_ops.py", line 127, in py_func
"PyFunc", input=input, token=token, Tout=Tout, name=name)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3290, in create_op
op_def=op_def)
File "/home/ubuntu/miniconda3/envs/WA-OCR/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1654, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

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)]]

@juanlp
Copy link

juanlp commented Aug 7, 2018

I have the same issue with b'Test'. Anyone know how to fix it.

@juanlp
Copy link

juanlp commented Aug 8, 2018

@JayGou , @SolinTao , the solution can be found at #73

@JayGou
Copy link

JayGou commented Aug 8, 2018

@juanlp
thx, i run demo.py just by using python2.7, this works for me.

@AashishGit
Copy link

I'm getting the following warning after running the setup.py

running build_ext
building 'bbox' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -I/home/zhao181/ProGram1/anaconda2/lib/python2.7/site-packages/numpy/core/include -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c bbox.c -o build/temp.linux-x86_64-2.7/bbox.o
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1777:0,
from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from bbox.c:435:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
creating build/lib.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -I/home/zhao181/ProGram1/anaconda2/lib/python2.7/site-packages/numpy/core/include build/temp.linux-x86_64-2.7/bbox.o -o build/lib.linux-x86_64-2.7/bbox.so
building 'cython_nms' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -I/home/zhao181/ProGram1/anaconda2/lib/python2.7/site-packages/numpy/core/include -fPIC -I/usr/include/python2.7 -c cython_nms.c -o build/temp.linux-x86_64-2.7/cython_nms.o
In file included from /usr/include/python2.7/numpy/ndarraytypes.h:1777:0,
from /usr/include/python2.7/numpy/ndarrayobject.h:18,
from /usr/include/python2.7/numpy/arrayobject.h:4,
from cython_nms.c:435:
/usr/include/python2.7/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -I/home/zhao181/ProGram1/anaconda2/lib/python2.7/site-packages/numpy/core/include build/temp.linux-x86_64-2.7/cython_nms.o -o build/lib.linux-x86_64-2.7/cython_nms.so

@AashishGit
Copy link

Please can someone tell me what is wrong here

@wangdaqian
Copy link

run python setup.py build ,but not find .so file
i only find .lib , .exp , .pyd file ?

I have the same question as yours ,Have you solved this problem?Ask for help,thank you very much!

@tianyexing
Copy link

tianyexing commented Sep 13, 2018

@wangdaqian
you should to see #73. .pyd file can replace .so file

@wangdaqian
Copy link

@wangdaqian
you should to see #73. .pyd file can replace .so file

problem solved ,thank you!

@scaler2017
Copy link

After following below
#73
I run demo.py on windows with cpu successfully!
my environment is:
windows10 ,
python3.6 ,
tensorflow1.10.0 ,
vs2015(ps: If you do not install Visual C++ please install
Otherwise there is an error : Unable to find vcvarsall.bat )

But there is a problem when I use my train data to run python ./ctpn/demo.py. (change checkpoints_path: checkpoints/ to checkpoints_path: output/ctpn_end2end/voc_2007_trainval in ctpn\text.yml)

The error is as follows:
tensorflow.python.framework.errors_impl.NotFoundError: FindFirstFile failed for: /home/jovyan/work/hd/text-detection-ctpn-master/output/ctpn_end2end/voc_2007_trainval : ϵͳ\udcd5Ҳ\udcbb\udcb
5\udcbdָ\udcb6\udca8\udcb5\udcc4·\udcbe\udcb6\udca1\udca3
; No such process

Is anybody can help me, or teach me how to fix the error? Thank a lot.

@zheng1076
Copy link

@zhao181
I succeeded in getting the result, but the result is a bunch of numbers in the result txt file. How do I display it as a Chinese character?

@ghost
Copy link

ghost commented Oct 22, 2018

@zhao181 @eragonruan when running the setup an error message appears:

(ctpn) home@home-lnx:~/programs/text-detection-ctpn/lib/utils$ python setup.py build
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 '
EnvironmentError: The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME

@ghost
Copy link

ghost commented Oct 22, 2018

@hushenglang

(4) To rebuild the setup.py in path "[path]/text-detection-ctpn/lib/utils/setup.py":

What do you mean rebuild the setup.py? How?
because when I run python setup.py build I get the Cuda error you see on top.

Can you upload your the modified setup.py for cpu here?

@HKMV
Copy link

HKMV commented Dec 14, 2018

大佬帮忙看下这是什么情况导致的呢
` File "C:\Users\Serenity\Anaconda3\envs\TensorFlow\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Serenity\Anaconda3\envs\TensorFlow\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.`

@ahsannas109
Copy link

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).

setup(

ext_modules=cythonize(["bbox.pyx","cython_nms.pyx"],include_dirs=[numpy_include]),
)
is this setup line of code okay as in cythonize function include_dirs is being passed as argument??

@AshleyAnna
Copy link

when i run python setup.py build_ext --include-dirs=C:\Users\Administrator\Anaconda3\Lib\site-packages\numpy\core\include,
there is no .so generated and when i try to run demo.py, it will prompt an error that No module named 'lib.utils.bbox'
Is anybody can help me, or teach me how to fix the probelm? Thank a lot.

@wwj-2017-1117
Copy link

@ahsannas109 你的setup.py 怎么配置的? 发出来看看

@NehaMamidwar
Copy link

Using CTPN, text from images are detected and results are good. But now hot to recognize or extract text from that boxes. If anybody knows solution for this kindly reply.

@10p-ds-ayesha
Copy link

@NehaMamidwar This is text detection library not the text recognition/extraction library.
Use text recognition for your task

@sonuagarwal1008
Copy link

Could anybody please tell.
How much time does it take on CPU?

@REBEKAHHHH-ANQI
Copy link

Does anyone know how to fix it ?
" raise 'Check your pretrained {:s}'.format(ckpt.model_checkpoint_path)
TypeError: exceptions must derive from BaseException"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests