Import Error on nms module.
pratikadarsh opened this issue · comments
I'm trying to run the eval.py file but getting the following error :
Traceback (most recent call last):
File "eval.py", line 16, in
from text_connector.detectors import TextDetector
File "/home/a1028510/text-detection/models/CTPN/keras-ctpn-master/text_connector/detectors.py", line 3, in
from text_connector.nms import nms
ImportError: No module named 'text_connector.nms'
So I checked the text_connector folder, it doesn't have an nms.py file instead has an .so file ( nms.cpython-36m-x86_64-linux-gnu.so). Not sure if .so files can be imported like normal python files.
So I figured the solution to this. For anyone facing the same issue, following is what you would need to do:
-
Copy the 'nms.pyx' and 'setup.py' file from eragonruan's ctpn repo into the text_connector directory.
-
Delete line number 7 in setup.py which cythonizes bbox.pyx.
-
Run 'python setup.py build_ext --inplace'.
-
Run 'python setup.py install'
After this step, a .so file and nms.c would be created in the same folder. Now you can use the eval.py script.
Note: You will need Cython for performing the above steps. So install it using pip (pip install Cython) in case you get an error.