TechC-SugarCane / ImageRecognitionWinApp

WindowsのGUIアプリ上で、モデルの推論を動作させる
1 stars 0 forks source link

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) #38

Closed Hoku113 closed 8 months ago

Hoku113 commented 8 months ago

YOLOv7を使用した学習を行おうとするときにこのような感じのエラーを出力する可能性があります。

Traceback (most recent call last):
File "/home/arnav/Sushovan/yolov7-main/train.py", line 622, in
train(hyp, opt, device, tb_writer)
File "/home/arnav/Sushovan/yolov7-main/train.py", line 369, in train
loss, loss_items = compute_loss_ota(pred, targets, imgs) # loss scaled by batch_size changed
File "/home/arnav/Sushovan/yolov7-main/utils/loss.py", line 585, in call
bs, as_, gjs, gis, targets, anchors = self.build_targets(p, targets, imgs)
File "/home/arnav/Sushovan/yolov7-main/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

もしこのエラーに遭遇したら以下のリンクを参照してください https://github.com/WongKinYiu/yolov7/issues/1101#issuecomment-1316788682