xy-guo / Learning-Monocular-Depth-by-Stereo

Learning Monocular Depth by Distilling Cross-domain Stereo Networks, ECCV18
https://arxiv.org/abs/1808.06586
MIT License
94 stars 8 forks source link

No module named mkl #6

Closed kwea123 closed 5 years ago

kwea123 commented 5 years ago

Hi, in your readme, I didn't see any instruction for installing mkl package. This error occurs when I tried to run main_stereo.py, where mkl is imported and used on the second and third lines.

Can you clarify how to install it correctly? I tried pip install mkl and the installation runs successfully, but the ImportError persists. Other than installing the package, I found a solution which is commenting out the mkl part, and manually set --num_threads to 0 to avoid the shared memory limit. Perhaps you can add this workaround to your readme. Thank you.

xy-guo commented 5 years ago

mkl is already included in the Anaconda package. The numpy package in Anaconda will call mkl for parallel matrix multiplication acceleration, and I found this will cause low-efficiency problem for the multi-process dataloader due to too many threads. mkl.set_num_threads(1) is used to disable parallel in mkl library to improve efficiency.

You can remove import mkl; mkl.set_num_threads(1) if you find there is no such problem on your machine.

kwea123 commented 5 years ago

I didn't install Anaconda so this package doesn't exist by default. Yes, I removed those two lines, but I also had to set --num_threads to 0 (which is by default 8) to avoid the shared memory limit (I'm using docker). In case some other people encounters this problem in the future, you could propably add this solution to readme.