hukaixuan19970627 / yolov5_obb

yolov5 + csl_label.(Oriented Object Detection)(Rotation Detection)(Rotated BBox)基于yolov5的旋转目标检测
GNU General Public License v3.0
1.77k stars 421 forks source link

ModuleNotFoundError: No module named 'DOTA_devkit' #633

Open chrisllove opened 6 months ago

chrisllove commented 6 months ago

ubuntu系统20.04,用的dota数据集,正常分割训练验证。

到了这一步Inferenece with pretrained models. (Splited Dataset) Merge the results. (If you split your dataset) python DOTA_devkit/ResultMerge_multi_process.py \ --scrpath 'runs/val/obb_demo_split/obb_predictions_Txt' \ --dstpath 'runs/val/obb_demo_split/obb_predictions_Txt_Merged'

路径都改好了。输入命令,然后报了这个错误。 Traceback (most recent call last): File "DOTA_devkit/ResultMerge_multi_process.py", line 27, in import DOTA_devkit.polyiou as polyiou ModuleNotFoundError: No module named 'DOTA_devkit'

猜想是devkit包没有装好。 cd yolov5_obb/DOTA_devkit sudo apt-get install swig swig -c++ -python polyiou.i python setup.py build_ext --inplace 最后一步的时候报了warning

报错如下: running build_ext gcc -pthread -B /home/user/anaconda3/envs/vm/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/user/anaconda3/envs/vm/include/python3.8 -c polyiou.cpp -o build/temp.linux-x86_64-3.8/polyiou.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ polyiou.cpp: In function ‘double intersectArea(Point, Point, Point, Point)’: polyiou.cpp:111:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 111 | if(s1s2==-1) res=-res;return res; | ^~ polyiou.cpp:111:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 111 | if(s1s2==-1) res=-res;return res; | ^~ gcc -pthread -B /home/user/anaconda3/envs/vm/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/user/anaconda3/envs/vm/include/python3.8 -c polyiou_wrap.cxx -o build/temp.linux-x86_64-3.8/polyiou_wrap.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ g++ -pthread -shared -B /home/user/anaconda3/envs/vm/compiler_compat -L/home/user/anaconda3/envs/vm/lib -Wl,-rpath=/home/user/anaconda3/envs/vm/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.8/polyiou.o build/temp.linux-x86_64-3.8/polyiou_wrap.o -o build/lib.linux-x86_64-3.8/_polyiou.cpython-38-x86_64-linux-gnu.so

想知道怎么解决。谢谢

chrisllove commented 6 months ago

已经解决了,头文件替换成 import os import numpy as np import re import time import sys sys.path.insert(0,'..') try: import dota_utils as util except: import dota_kit.dota_utils as util import polyiou import pdb import math from multiprocessing import Pool from functools import partial import argparse

这样就可以,希望能帮到卡住的朋友。

因为我在运行别的dota工具包的时候没有报错no module name dotadevkit,仔细比较了一下头文件发现有所不同,最终顺利解决了。