Under /Examples/Image/Detection directory __init.py__ is an empty file which leads to import errors while running DemoDetection.py and/or run_fast_rcnn.py.
I get errors as
ImportError: No module named 'utils.od_utils'
ImportError: No module named 'utils.map_helpers'
ImportError: No module named 'utils.rpn'
ImportError: No module named 'utils.cython_modules.cpu_nms'
ImportError: No module named 'cython_modules.cython_bbox'
etc. when running codes.
Please help. @KeDengMS @cha-zhang @sayanpa
Can you try add it to PYTHONPATH?
@KeDengMS I tried adding path 'my-path/Examples/Image/Detection/' to PYTHONPATH and exported it.
Yet, I get the following error :
ImportError: No module named 'utils.cython_modules.cpu_nms' while running DetectionDemo.pyImportError: No module named 'utils.cython_modules.cython_bbox' while running run_fast_rcnn.pyI also tried adding __init__.py to utils, rpn and cython_modules directories.
You should add this to PYTHONPATH:
Examples/Image/Detection/utils/cython_modules
I tried adding cython_modules as already mentioned above.
But get following error: ImportError: No module named 'utils.cython_modules.cpu_nms'
You mentioned that you added 'my-path/Examples/Image/Detection/'. Did you try adding Examples/Image/Detection/utils/cython_modules?
Also, what's your platform and Python version? We have pre-built modules for Python 3.5 for Windows and for Python 3.4, 3.5, 3.6 for Linux. If you specs are different, then you will have to build these modules yourself.
@spandantiwari I tried all the possible permutations.
I'm running docker cntk-2.3-cpu-py35 image on MacOS. I also tried this process on AWS EC2.
@KeDengMS @spandantiwari
I was able to solve this problem by doing 2 things:
'my-path/Examples/Image/Detection/' to PYTHONPATHcpu_nms.cpython-35m.so as cpu_nms.socython_bbox.cpython-35m.so as cython_bbox.soNote: One should rename files with cpython-3Xm based on their version of python; where 3X is 36 for python3.6 and 35 for python3.5.
Hope this helps.
@hellosaumil
How did you manage to solve the issue with:
_ImportError: No module named 'utils.rpn'_
Did you just add the directory to PYTHONPATH?
I have tried adding:
export PYTHONPATH="$PYTHONPATH:/home/<path>/Detection/"
to ~/.bashrc
but it does not seem to work.
@bartkowiaktomasz After adding it to ~/.bashrc, did you source that file like, source ~/.bashrc or try running it in new tab/window? If not, then please do so.
If it still doesn't work, try creating an empty __init__.py file under the utils folder.
What is the version of your CNTK?
@hellosaumil Creating __init__.py in utils helped! Thank you!
Btw. I though the issue with creating empty init files was resolved in earlier versions of Python (I'm using 3.5).
I've tried changing file names and things like that but keep running into random errors like stated above:


When I change even more filenames the issue doesn't get better


Any ideas?
Also wouldn't it be a good idea that if we apparently need these files renamed that we actually check this in?
@devedse You need to set the PYTHONPATH varibale to (also) point at the folder with cython modules. Something like:
set PYTHONPATH=E:\cntk\Examples\Image\Detection\utils\cython_modules;%PYTHONPATH%
@spandantiwari I got it configured like this:

But still see this error:

My guess is that you are on Windows. What Python version do you have? For Windows, we have cython modules for Python 3.5 only (Linux we have for 3.5 and 3.6).
You mentioned that you added 'my-path/Examples/Image/Detection/'. Did you try adding Examples/Image/Detection/utils/cython_modules?
Also, what's your platform and Python version? We have pre-built modules for Python 3.5 for Windows and for Python 3.4, 3.5, 3.6 for Linux. If you specs are different, then you will have to build these modules yourself.
@spandantiwari Would it be possible to further illustrate how to build those modules for python 3.6?
Most helpful comment
@KeDengMS @spandantiwari
I was able to solve this problem by doing 2 things:
'my-path/Examples/Image/Detection/'toPYTHONPATH2.1
cpu_nms.cpython-35m.soascpu_nms.so2.2
cython_bbox.cpython-35m.soascython_bbox.soNote: One should rename files with
cpython-3Xmbased on their version of python; where 3X is 36 for python3.6 and 35 for python3.5.Hope this helps.