bubbliiiing / yolov4-pytorch

这是一个YoloV4-pytorch的源码,可以用于训练自己的模型。
MIT License
2.08k stars 613 forks source link

index out of bounds #58

Closed mama110 closed 3 years ago

mama110 commented 3 years ago

我的训练图片原始大小是640 x 512的,然后在train.py中设置图片大小是416 x 416,结果就出了如下错误:

Epoch 1/10: 0%| | 0/3930 [00:00<?, ?it/s<class 'dict'>]/usr/local/lib/python3.5/dist-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name)) Epoch 1/10: 0%| | 19/3930 [00:03<12:38, 5.16it/s, lr=0.001, step/s=0.0667, total_loss=3.67e+3] Traceback (most recent call last): File "/home/kun/master/yolov4-pytorch-master-bubbliiiing/train.py", line 238, in fit_one_epoch(net,yolo_losses,epoch,epoch_size,epoch_size_val,gen,gen_val,Freeze_Epoch,Cuda) File "/home/kun/master/yolov4-pytorch-master-bubbliiiing/train.py", line 60, in fit_one_epoch loss_item = yolo_losses[i](outputs[i], targets) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, **kwargs) File "/home/kun/master/yolov4-pytorch-master-bubbliiiing/nets/yolo_training.py", line 154, in forward mask, noobj_mask, t_box, tconf, tcls, box_loss_scale_x, box_loss_scale_y = self.get_target(targets, scaled_anchors,in_w, in_h,self.ignore_threshold) File "/home/kun/master/yolov4-pytorch-master-bubbliiiing/nets/yolo_training.py", line 243, in get_target tcls[b, best_n, gj, gi, int(target[b][t, 4])] = 1 IndexError: index 16 is out of bounds for dimension 0 with size 3

请问作者,在图片入网络之前,是否有调整大小到416,还是需要我们自己调整? 错误是否与此问题有关,谢谢。

mama110 commented 3 years ago

I've solved this problem.