yolov5_obb icon indicating copy to clipboard operation
yolov5_obb copied to clipboard

cannot import name 'nms_rotated_ext'

Open chyphen7 opened this issue 2 years ago • 1 comments

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 avatar Jul 31 '22 04:07 chyphen7

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

chyphen7 avatar Jul 31 '22 04:07 chyphen7

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 ?

Tejdeep-Kolati avatar Oct 20 '22 04:10 Tejdeep-Kolati

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

Henry-web1 avatar Jan 03 '23 09:01 Henry-web1