text-detection-ctpn
text-detection-ctpn copied to clipboard
Run demo.py on windows with cpu successfully!
thanks to the author and #43 zhao181
my environment is: windows10 , python3.6 , tensorflow1.3 , vs2015(ps:vs2013 not support python3.6 when compile)
step 1:make some change change "np.int_t " to "np.intp_t" in line 25 of the file lib\utils\cython_nms.pyx otherwise appear " ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long' " in step 6.
step 2:updata c file execute:cd your_dir\text-detection-ctpn-master\lib\utils execute:cython bbox.pyx execute:cython cython_nms.pyx
step 3:builf setup file as setup_new.py import numpy as np from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension numpy_include = np.get_include() setup(ext_modules=cythonize("bbox.pyx"),include_dirs=[numpy_include]) setup(ext_modules=cythonize("cython_nms.pyx"),include_dirs=[numpy_include])
step 4:build .pyd file execute:python setup_new.py install copy bbox.cp36-win_amd64.pyd and cython_nms.cp36-win_amd64.pyd to your_dir\text-detection-ctpn-master\lib\utils
step 5:make some change (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) Comment out the line "from . import gpu_nms" in the file \lib\utils_init.py; (5) change "base_name = image_name.split('/')[-1]" to "base_name = image_name.split('\')[-1]" in line 24 of the file ctpn\demo.py
step 6:run demo execute:cd your_dir\text-detection-ctpn-master execute:python ./ctpn/demo.py
@ZhuMingmin9123 Thanks for the sharing.
Thank you!!!
thank you! But the change in the step5 should be like this: " image_name.split('/')[-1]" to "image_name.split('\')[-1]" in line 24.
thank you very much, that's ok
@ZhuMingmin9123 hi, if i want to run demo.py on windows with GPU, how to do? thanks
running install
running build
running build_ext
Traceback (most recent call last):
File "setup.py", line 106, in
In addition, change os.makedirs("data/results/") to os.makedirs("data/results") in line 71 of the file demo.py, otherwise the results dir can't be created.
Thank you very much for your code which works perfectly well on my Windows with CPU.
Actually I found that after the setting up with CPU setup.py, I turned to another conda environment with tensorflow-gpu installed and it (running demo.py) also works perfectly( I failed in the setup.py with GPU configration in windows). The running time is really reduced(for CPU Intel i7-6700hq, ~6.1 second/picture and for GPU Nvidia GTX 1060, ~2.9 second). Is there anything different with directly setting up with GPU configration?
@zhLawliet Have you solved your problem? I have the same problem with you. AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'
@ZhuMingmin9123 I have tried your method.But when I run the demo.py in PyCharm at step6,it doesn't work.The error is:Error running 'demo': Cannot run program "C:\Users\82703\anaconda2\envs\py35\bin\python" (in directory "D:\python_project\text-detection-ctpn-master"): CreateProcess error=2, 系统找不到指定的文件。It's so strange,because I do not have the path of "C:\Users\82703\anaconda2\envs\py35\bin\python" in my computer and I did install the requirement except tensorflow_gpu.Could you give me some help?Thank you very much
thank you very much!
After I change code of ctpn\demo.py in line 24
base_name = image_name.split('/')[-1]
to base_name = image_name.split('\')[-1]
There are some error appeared. And error meesage like this:
File "demo.py", line 24
base_name = image_name.split('\')[-1]
SyntaxError: EOL while scanning string literal
Is anybody can help me, or teach me how to fix the error? Thank a lot.
After I change code of ctpn\demo.py in line 24 base_name = image_name.split('/')[-1] to base_name = image_name.split('\')[-1] There are some error appeared. And error meesage like this: ......
I found the problem. The reason is dir path in windows os use "\" to separate folder or file name. But in python or some other codes, it's should be used like '\\'.
So... I change ctpn\demo.py in line 24 ...
base_name = image_name.split('/')[-1]
to base_name = image_name.split('\\')[-1]
It's work!
When I run the demo, there is a problem about this:
Demo for E:\模型\text-detection\text-detection-ctpn\data\demo\001.jpg
Traceback (most recent call last):
File "./ctpn/demo.py", line 100, in
Is anybody can help me, or teach me how to fix the error? Thank a lot.
@hongdajun The image was not read in successfully. hence the shape of the image is None
@zhLawliet I have the same problems with you.@ZhuMingmin9123 I really want to know how to run demo.py on Windows with GPU.Please let me know when making it.Thanks a lot
i am getting lib.networks no module found
you should edit some code and modification plugin version {(-_-)}
---funnyZpC---
在 2018年4月20日,01:53,balajiwix [email protected] 写道:
i am getting lib.networks no module found
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
@eragonruan raise 'Check your pretrained {:s}'.format(ckpt.model_checkpoint_path) AttributeError: 'NoneType' object has no attribute 'model_checkpoint_path'
@eragonruan raise 'Check your pretrained {:s}'.format(ckpt.model_checkpoint_path) AttributeError: 'NoneType' object has no attribute 'model_checkpoint_path'
When I run the demo, there is a problem about this:
File "cython_nms.pyx", line 28, in lib.utils.cython_nms.nms
ValueError: Buffer dtype mismatch, expected 'intp_t' but got 'long'
[[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)]]
@hongdajun the path of image demo should not have any Chinese character
@cks1999 replace int_t to intp_t. if this does not work. try update your cython version
@ZhuMingmin9123 When I run step 4, I have this error: I don't know where is the problem.
i am getting lib.networks no module found
i am getting lib.networks no module found
Have you solved this problem?I have the same one.Ask for help,thank you!
Has anybody created a fork with cpu enabled modifications?
Hi: You can see my blog:https://www.cnblogs.com/funnyzpc/p/8908906.html
Simon [email protected] 于2018年9月14日周五 上午3:58写道:
Has anybody created a fork with cpu enabled modifications?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eragonruan/text-detection-ctpn/issues/73#issuecomment-421133259, or mute the thread https://github.com/notifications/unsubscribe-auth/AYsR-Mv92olc6C86pMbXa1-rePE52wbaks5uarjQgaJpZM4ROemo .
--
For:
funnyZpC
@ZhuMingmin9123 step4: build .pyd file ? How to do this step?Can you help me explain in detail? PS:When I execute:python setup_new.py install,there is an error here: building 'lib.utils.bbox' extension error: Unable to find vcvarsall.bat
when I execute: python ./ctpn/demo.py,there is an error:
text-detection-ctpn-master\lib\utils_init_.py", line 4, in
in step 5 (4) : there is no file "path/lib/utils_init.py" on my computer. please help!
step3 create a new python file and include only the following codes? import numpy as np from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension numpy_include = np.get_include() setup(ext_modules=cythonize("bbox.pyx"),include_dirs=[numpy_include]) setup(ext_modules=cythonize("cython_nms.pyx"),include_dirs=[numpy_include])