Open Dev-ori opened 1 year ago
I resolved this problem by modifying the file utils/loss.py
line 759.
The idea is to put both variables in the same device, so I replaced from_which_layer = from_which_layer[fg_mask_inboxes]
with from_which_layer = from_which_layer.to(fg_mask_inboxes.device)[fg_mask_inboxes]
in order to put from_which_layer
in the same device as fg_mask_inboxes
. This resolved the problem and it is working properly.
Thanks @ybenabed, this resolved for me.
@ybenabed Thanks, it works for me while training in Colab GPU.
It did not work for me. Any other sol?
I resolved this problem by modifying the file
utils/loss.py
line 759. The idea is to put both variables in the same device, so I replacedfrom_which_layer = from_which_layer[fg_mask_inboxes]
withfrom_which_layer = from_which_layer.to(fg_mask_inboxes.device)[fg_mask_inboxes]
in order to putfrom_which_layer
in the same device asfg_mask_inboxes
. This resolved the problem and it is working properly.
this fix (and the one from stackoverflow) were working last week but they seem to have stopped working for me as well
Any new solutions??? Urgent plsease help
0%| | 0/53 [00:02<?, ?it/s]
Traceback (most recent call last):
File "C:\Users\Pradeep Kumar\Documents\IEEE\GAN_YO_FBG\train_aux.py", line 612, in
can any one help me to solve this??
I've got this error when training, is there any similar errors or suggestions?
USED Script:
python train.py --workers 8 --device 0 --batch-size 32 --data data/crowdhuman.yaml --img 640 640 --cfg cfg/training/yolov7_cr.yaml --weights 'yolov7.pt' --name yolov7 --hyp data/hyp.scratch.p5.yaml
Where I modified in your code: create new yaml for Customdataset.(cfg/training/.yaml) create new data yaml (data/.yaml)
else, nothing modified.
Displayed Error
0%| | 0/468 [00:03<?, ?it/s] Traceback (most recent call last): File "train.py", line 616, in
train(hyp, opt, device, tb_writer)
File "train.py", line 363, in train
loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs) # loss scaled by batchsize
File "/home/dhan/PycharmProjects/yolov7/utils/loss.py", line 585, in call
bs, as, gjs, gis, targets, anchors = self.build_targets(p, targets, imgs)
File "/home/dhan/PycharmProjects/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)