karolzak / cntk-hotel-pictures-classificator

This POC is using CNTK 2.1 to train model for multiclass classification of images. Our model is able to recognize specific objects (i.e. toilet, tap, sink, bed, lamp, pillow) connected with picture types we are looking for. It plays a big role in a process which will be used to classify pictures from different hotels and determine whether it's a picture of bathroom, bedroom, hotel front, swimming pool, bar, etc.
MIT License
37 stars 22 forks source link

ImportError: No module named 'utils.cython_modules.cython_bbox' #2

Open TreeLLi opened 6 years ago

TreeLLi commented 6 years ago

I know this error has been widely discussed and here are some specifications I found for this program.

  1. The default cython binaries in the directory 'Detection/utils/cython_modules/' only support for particular version, 3.4(Linux) and 3.5(Windows), of Python. So anyone who got the error info like the title should checks if your Python version is suitable.

  2. The latest cython module binaries have been updated on the repo of CNTK. But after copying the corresponding binaries for Python 3.5(Linux), i.e. cpu_nms.cpython-35m.so and cython_bbox.cpython-35m.so, into the directory of current project 'Detection/utils/cython_modules/', it still reports the same error as the title during compilation, while the program will run well if I change my Python to 3.4 by Anaconda virtual environment and run the same project, i.e. same directory and same program.

  3. Another solution for this problem is to recompile the above cython modules by ourselves following instructions from CNTK Guide. The lucky thing is that the program can pass the compilation without any error report, while unfortunately it produces/prints some unknown error info during the training.

All of my testing are run on the latest DSVM for Linux. Default Python: Python 3.5 with CNTK 2.2 Python 3.4 Virtual Environment: Python 3.4 with CNTK 2.1

TreeLLi commented 6 years ago

For anyone who are troubled by the case 2, i.e. the corresponding binaries have been already put into the proper directory but still get the error of 'Not Found', you should rename the binaries as below:

  1. cpu_nms.cpython-35m.so as cpu_nms.so
  2. cython_bbox.cpython-35m.so as cython_bbox.so

this solution is found from others' discussion

karolzak commented 6 years ago

Hi @TreeLLi,

First off, thanks for stoping by! :) I must say I haven't tested it on Linux really.. I know there used to be some missing Cython modules in CNTK for Linux with Python version different from 3.4 but from what I know they added the modules to original CNTK repo few months ago. From what I understand from your second comment you already found a solution for that issue. And I think I know what caused it.. If you take a look at imports of this file in utils/nms: from utils.cython_modules.cpu_nms import cpu_nms This line works perfectly on Windows but it seems like it's causing some issues on Linux..

TreeLLi commented 6 years ago

Thanks for your explanation.

The problem has been addressed perfectly. But I still think including the latest cython binaries in your directory will be a good idea, since it's not like a problem of missing some external library e.g. easydict. Besides, currently the solution is not such easy to find, for people have to combine the info from CNTK website and others' issue discussion.

So updating the cython module or pointing it out clearly in the Readme file will be super friendly to some beginners specifically for CNTK Faster-RCNN.

karolzak commented 6 years ago

@TreeLLi that's very accurate! Thanks for feedback! I will add missing cython libraries and I'll try to add some sort of if statement automatically loading up the appropriate cython libs depending on OS and Python version