hukaixuan19970627 / yolov5_obb

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

cannot import name 'nms_rotated_ext' #421

Open chyphen7 opened 2 years ago

chyphen7 commented 2 years ago

I am trying to run a demo program to train the original dataset demo, but getting ImportError: cannot import name 'nms_rotated_ext' from partially initialized module 'utils.nms_rotated' (most likely due to a circular import) (G:\DeepLearning\yolov5_obb\utils\nms_rotated__init__.py) Any suggestion how to fix the error? Thanks in advance.

Here are error log:

python train.py --weights 'weights/yolov5n_s_m_l_x.pt' --data 'data/yolov5obb_demo.yaml' --hyp 'data/hyps/obb/hyp.finetune_dota.yaml' --epochs 10 --batch-size 1 --img 1024 --device 0 Traceback (most recent call last): File "G:\DeepLearning\yolov5_obb\train.py", line 34, in import val # for end-of-epoch mAP File "G:\DeepLearning\yolov5_obb\val.py", line 28, in from models.common import DetectMultiBackend File "G:\DeepLearning\yolov5_obb\models\common.py", line 23, in from utils.datasets import exif_transpose, letterbox File "G:\DeepLearning\yolov5_obb\utils\datasets.py", line 28, in from utils.augmentations import Albumentations, augment_hsv, copy_paste, letterbox, mixup, random_perspective File "G:\DeepLearning\yolov5_obb\utils\augmentations.py", line 12, in from utils.general import LOGGER, check_version, colorstr, resample_segments, segment2box File "G:\DeepLearning\yolov5_obb\utils\general.py", line 35, in from utils.nms_rotated import obb_nms File "G:\DeepLearning\yolov5_obb\utils\nms_rotated__init__.py", line 1, in from .nms_rotated_wrapper import obb_nms, poly_nms File "G:\DeepLearning\yolov5_obb\utils\nms_rotated\nms_rotated_wrapper.py", line 4, in from . import nms_rotated_ext ImportError: cannot import name 'nms_rotated_ext' from partially initialized module 'utils.nms_rotated' (most likely due to a circular import) (G:\DeepLearning\yolov5_obb\utils\nms_rotated__init__.py)

chyphen7 commented 2 years ago

Forgot to mentioned I encounter the above-mentioned errors when trying to run train.py on Windows 10.

Tejdeep-Kolati commented 2 years ago

Even, I am getting the same circular import error, while I am trying to import detect (.py) in a separate notebook instance in azure ml. It works perfectly if I use the python detect.py to get the bbs in the environment created by using the steps mentioned in read.me but if i try to import it in a notebook instance I am getting the above mentioned error. ImportError: cannot import name 'nms_rotated_ext' from partially initialized module 'utils.nms_rotated' (most likely due to a circular import) @chyphen7 were you able to resolve this ?

Henry-web1 commented 1 year ago

Hi have you resolved this issue? I am meeting the same import error