XinzeLee / RotateObjectDetection

This repository is based on Ultralytics/yolov5, with adjustments to enable rotate prediction boxes.
113 stars 21 forks source link

IndexError: index 6 is out of bounds for dimension 1 with size 6I #14

Closed StarBlue98 closed 2 years ago

StarBlue98 commented 2 years ago

I have modified my label into the format (class, cx, cy, w, h, cos, sin),and I sucessfully train UCAS-AOD you provided, but I meet this problem when I train my own dataset. my label is as follows: 0 1244.5523 399.0501 86.4318 225.7462 0.3616157183568731 0.9323272345251117 image

Traceback (most recent call last): File "rotate_train.py", line 553, in train(hyp, opt, device, tb_writer, rotate=opt.rotate) File "rotate_train.py", line 103, in train model = Model(opt.cfg, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) # create File "/home/cdzk/LanXin/R-yolov5/rotate-yolov5/models/yolo.py", line 341, in init super(Rotate_Model, self).init(cfg, ch, nc, anchors) File "/home/cdzk/LanXin/R-yolov5/rotate-yolov5/models/yolo.py", line 110, in init self._initialize_biases() # only run once File "/home/cdzk/LanXin/R-yolov5/rotate-yolov5/models/yolo.py", line 366, in _initialize_biases b.data[:, 6] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image) IndexError: index 6 is out of bounds for dimension 1 with size 6

image

could you know what can I do to revise this ? Thank you for your help!

StarBlue98 commented 2 years ago

By the way , my own data has only one class, so when I train this model, what else should I pay attention to ?

Camilochiang commented 2 years ago

@AllieLan How did you solve ur problem? Just curious

StarBlue98 commented 2 years ago

Oh, I found that the problem is caused by using original yolov5s.yaml which only includes 3 pairs of anchor ratios, not 5 pairs that you revised in models/rotate_yolov5s_ucas.yaml.