【发布时间】:2022-11-12 10:16:17
【问题描述】:
我为 YoloV7 下载了一个准备好的数据集。我还克隆了 yoloV7 Repo。
我想用这个下载的数据集训练一个模型,为此我使用这个命令。
python train.py --workers 8 --device 0 --batch-size 16 --data data.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights yolov7x.pt --name yolov7 --hyp data/hyp.scratch.p5.yaml
我得到了这个 RuntimeError
autoanchor: Analyzing anchors... anchors/target = 5.50, Best Possible Recall (BPR) = 1.0000
Image sizes 640 train, 640 test
Using 8 dataloader workers
Logging results to runs\train\yolov74
Starting training for 300 epochs...
Epoch gpu_mem box obj cls total labels img_size
0%| | 0/372 [00:03<?, ?it/s]
Traceback (most recent call last):
File "D:\projects\yolov7\train.py", line 618, in <module>
train(hyp, opt, device, tb_writer)
File "D:\projects\yolov7\train.py", line 363, in train
loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs) # loss scaled by batch_size
File "D:\projects\yolov7\utils\loss.py", line 585, in __call__
bs, as_, gjs, gis, targets, anchors = self.build_targets(p, targets, imgs)
File "D:\projects\yolov7\utils\loss.py", line 759, in build_targets
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)
我的系统包含 1xCpu、1x Cuda GPU(它是默认的游戏电脑)
【问题讨论】:
标签: yolo