Relative Content

Tag Archive for yolov7

error when training yolov7 model in google colab

this is the code–
%cd /content/gdrive/MyDrive/yolov7
!python train.py –batch 16 –cfg cfg/training/yolov7.yaml –epochs 55 –data {dataset.location}/data.yaml –weights ‘yolov7.pt’ –device 0

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) while trainin yolov7-e6e model

while training yolov7-e6e.pt i got this error.
Traceback (most recent call last):
File “/content/gdrive/MyDrive/files/yolov7-main/train_aux.py”, line 612, in
train(hyp, opt, device, tb_writer)
File “/content/gdrive/MyDrive/files/yolov7-main/train_aux.py”, line 362, in train
loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs) # loss scaled by batch_size
File “/content/gdrive/MyDrive/files/yolov7-main/utils/loss.py”, line 1206, in call
bs_aux, as_aux_, gjs_aux, gis_aux, targets_aux, anchors_aux = self.build_targets2(p[:self.nl], targets, imgs)
File “/content/gdrive/MyDrive/files/yolov7-main/utils/loss.py”, line 1558, in build_targets2
from_which_layer = from_which_layer[fg_mask_inboxes]
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)