yijingru / BBAVectors-Oriented-Object-Detection

[WACV2021] Oriented Object Detection in Aerial Images with Box Boundary-Aware Vectors
MIT License
469 stars 88 forks source link

我遇到了 ModuleNotFoundError: No module named 'polyiou' 的错误,我按照教程也编译了。。 #31

Open 18804601171 opened 4 years ago

yijingru commented 4 years ago

You can refer your question to the DOTA_devkit repo. Duplicate of https://github.com/CAPTAIN-WHU/DOTA_devkit/issues/37

jrcai commented 3 years ago

You may want to try add _sys.path.insert(1, 'PATH_TO_YOUR/DOTAdevkit/') before import polyiou

dineshdaultani commented 3 years ago

I faced the same issue and below are the steps on how I fixed it.

After running python setup.py build_ext --inplace for setting up DOTA_devkit, I was getting some warnings. Basically, the error ModuleNotFoundError: No module named 'polyiou' pops up when polyiou is not properly installed.

You can see that there must be a hidden _polyiou.XXX.so file kept in the DOTA_devkit folder. The issue is that this file should be imported in polyiou.py file properly but since package imp is deprecated the import statement doesn't work properly. You can find the below line in polyiou.py file generated automatically through swig: _mod = imp.load_module('_polyiou', fp, pathname, description)

And you can replace the above statement with below statement: _mod = importlib.import_module('_polyiou.cpython-36m-x86_64-linux-gnu.so', [dirname(__file__)]) Don't forget to import importlib package and change the above _polyiou.cpython-36m-x86_64-linux-gnu.so with the appropriate file name installed in your directory.

Reference:

  1. https://github.com/CAPTAIN-WHU/DOTA_devkit/issues/37#issuecomment-697738922
  2. https://blog.csdn.net/qq_34575070/article/details/111554750
MFalam commented 3 years ago

I faced the same issue and below are the steps on how I fixed it.

After running python setup.py build_ext --inplace for setting up DOTA_devkit, I was getting some warnings. Basically, the error ModuleNotFoundError: No module named 'polyiou' pops up when polyiou is not properly installed.

You can see that there must be a hidden _polyiou.XXX.so file kept in the DOTA_devkit folder. The issue is that this file should be imported in polyiou.py file properly but since package imp is deprecated the import statement doesn't work properly. You can find the below line in polyiou.py file generated automatically through swig: _mod = imp.load_module('_polyiou', fp, pathname, description)

And you can replace the above statement with below statement: _mod = importlib.import_module('_polyiou.cpython-36m-x86_64-linux-gnu.so', [dirname(__file__)]) Don't forget to import importlib package and change the above _polyiou.cpython-36m-x86_64-linux-gnu.so with the appropriate file name installed in your directory.

Reference:

  1. CAPTAIN-WHU/DOTA_devkit#37 (comment)
  2. https://blog.csdn.net/qq_34575070/article/details/111554750

Thank you for your suggestion. Indeed, I followed your point and have done the same, but still have the same problem. In the updated DOTA_devkit I did not find _mod = imp.load_module('_polyiou', fp, pathname, description). However, as you suggested I followed your instructions. But, still have the same problem.

BBA-2

I appreciated any suggestion to solve this problem.

dineshdaultani commented 3 years ago

Hi @MFalam, Thanks for trying out my suggestion. Out of the box, I can see that you don't have .so at the end of the file name in the added line. Could you please try again after adding that.

Also the generated file name _polyiou.cpython-36m-x86_64-linux-gnu.so, is it exactly same for your file? I cannot see the full filename in the screenshot.

Also could you please share the contents of polyiou.py file if the above fix doesn't solve your problem. Thanks!

MFalam commented 3 years ago

Hi @MFalam, Thanks for trying out my suggestion. Out of the box, I can see that you don't have .so at the end of the file name in the added line. Could you please try again after adding that.

Also the generated file name _polyiou.cpython-36m-x86_64-linux-gnu.so, is it exactly same for your file? I cannot see the full filename in the screenshot.

Also could you please share the contents of polyiou.py file if the above fix doesn't solve your problem. Thanks!

Hello @dineshdaultani Thanks for the suggestion. I solved this issue by adopting 'dotadevkit'. I used the following steps. First, download 'dotadevkit' from ### https://github.com/ashnair1/dotadevkit and follow the steps to install it. Second, replace import polyiou with from dotadevkit.polyiou import polyiou in the 'ResultMerge_multi_process.py' and 'ResultMerge.py' files of 'BBAVectors-Oriented-Object-Detection' that are loaded from the 'Dota_devkit'.

Lg955 commented 3 years ago

Hi @MFalam, Thanks for trying out my suggestion. Out of the box, I can see that you don't have .so at the end of the file name in the added line. Could you please try again after adding that. Also the generated file name _polyiou.cpython-36m-x86_64-linux-gnu.so, is it exactly same for your file? I cannot see the full filename in the screenshot. Also could you please share the contents of polyiou.py file if the above fix doesn't solve your problem. Thanks!

Hello @dineshdaultani Thanks for the suggestion. I solved this issue by adopting 'dotadevkit'. I used the following steps. First, download 'dotadevkit' from ### https://github.com/ashnair1/dotadevkit and follow the steps to install it. Second, replace import polyiou with from dotadevkit.polyiou import polyiou in the 'ResultMerge_multi_process.py' and 'ResultMerge.py' files of 'BBAVectors-Oriented-Object-Detection' that are loaded from the 'Dota_devkit'.

In dotadevkit, it will install opencv-4.5.3, but the minAreaRect have different definition in opencv-4.0.36( [-90,0) ) and opencv-4.5.3( (0,90] ), if you use dotadevkit, you should note this.

yangyahu-1994 commented 2 years ago

from datasets.DOTA_devkit import polyiou