yolov5_obb icon indicating copy to clipboard operation
yolov5_obb copied to clipboard

RuntimeError: result type Float can't be cast to the desired output type __int64

Open wangyansenhub opened this issue 2 years ago • 5 comments

 Epoch   gpu_mem       box       obj       cls     theta    labels  img_size

0%| | 0/1 [00:07<?, ?it/s] Traceback (most recent call last): File "D:/Tian/yolov5_obb-master/train.py", line 633, in main(opt) File "D:/Tian/yolov5_obb-master/train.py", line 530, in main train(opt.hyp, opt, device, callbacks) File "D:/Tian/yolov5_obb-master/train.py", line 326, in train loss, loss_items = compute_loss(pred, targets.to(device)) # loss scaled by batch_size File "D:\Tian\yolov5_obb-master\utils\loss.py", line 136, in call tcls, tbox, indices, anchors, tgaussian_theta = self.build_targets(p, targets) # targets File "D:\Tian\yolov5_obb-master\utils\loss.py", line 267, in build_targets indices.append((b, a, gj.clamp_(0, feature_wh[1] - 1), gi.clamp_(0, feature_wh[0] - 1))) # image, anchor, grid indices RuntimeError: result type Float can't be cast to the desired output type __int64 不太清楚这个问题应该怎么解决。

wangyansenhub avatar Jul 01 '22 08:07 wangyansenhub

https://github.com/ultralytics/yolov5/issues/8314 这里有类似解决办法,当前版本有点旧了,需要修改loss.py,作者可以更新一下代码 @hukaixuan19970627

BrianAON avatar Jul 07 '22 07:07 BrianAON

ultralytics/yolov5#8314 这里有类似解决办法,当前版本有点旧了,需要修改loss.py,作者可以更新一下代码 @hukaixuan19970627

Logging results to runs\train\exp35 Starting training for 300 epochs...

 Epoch   gpu_mem       box       obj       cls     theta    labels  img_size
 0/299      8.5G    0.1637   0.03505         0     10.14        33      1024: 100%|██████████| 39/39 [00:33<00:00,  1.15it/s]
           Class     Images     Labels          P          R  [email protected]  [email protected]:.95:   0%|          | 0/20 [00:00<?, ?it/s]

Traceback (most recent call last): File "train.py", line 640, in main(opt) File "train.py", line 537, in main train(opt.hyp, opt, device, callbacks) File "train.py", line 376, in train compute_loss=compute_loss) File "D:\ProgramData\envs\pytorch\lib\site-packages\torch\autograd\grad_mode.py", line 26, in decorate_context return func(*args, *kwargs) File "D:\Tian\yolov5_obb-master\val.py", line 206, in run out = non_max_suppression_obb(out, conf_thres, iou_thres, labels=lb, multi_label=True, agnostic=single_cls) # list(n, [xylsθ, conf, cls]) θ ∈ [-pi/2, pi/2) File "D:\Tian\yolov5_obb-master\utils\general.py", line 857, in non_max_suppression_obb _, i = obb_nms(rboxes, scores, iou_thres) File "D:\Tian\yolov5_obb-master\utils\nms_rotated\nms_rotated_wrapper.py", line 41, in obb_nms inds = nms_rotated_ext.nms_rotated(dets_th, scores, iou_thr) RuntimeError: Not compiled with GPU support 我现在可以运行了,但是用GPU的时候,总是在验证的时候中断,之前会训练一些批次,然后中断。现在第一轮就不行了。用CPU的话就没有问题。

wangyansenhub avatar Jul 13 '22 05:07 wangyansenhub

ultralytics/yolov5#8314 这里有类似解决办法,当前版本有点旧了,需要修改loss.py,作者可以更新一下代码 @hukaixuan19970627

Logging results to runs\train\exp35 Starting training for 300 epochs...

 Epoch   gpu_mem       box       obj       cls     theta    labels  img_size
 0/299      8.5G    0.1637   0.03505         0     10.14        33      1024: 100%|██████████| 39/39 [00:33<00:00,  1.15it/s]
           Class     Images     Labels          P          R  [email protected]  [email protected]:.95:   0%|          | 0/20 [00:00<?, ?it/s]

Traceback (most recent call last): File "train.py", line 640, in main(opt) File "train.py", line 537, in main train(opt.hyp, opt, device, callbacks) File "train.py", line 376, in train compute_loss=compute_loss) File "D:\ProgramData\envs\pytorch\lib\site-packages\torch\autograd\grad_mode.py", line 26, in decorate_context return func(*args, *kwargs) File "D:\Tian\yolov5_obb-master\val.py", line 206, in run out = non_max_suppression_obb(out, conf_thres, iou_thres, labels=lb, multi_label=True, agnostic=single_cls) # list(n, [xylsθ, conf, cls]) θ ∈ [-pi/2, pi/2) File "D:\Tian\yolov5_obb-master\utils\general.py", line 857, in non_max_suppression_obb _, i = obb_nms(rboxes, scores, iou_thres) File "D:\Tian\yolov5_obb-master\utils\nms_rotated\nms_rotated_wrapper.py", line 41, in obb_nms inds = nms_rotated_ext.nms_rotated(dets_th, scores, iou_thr) RuntimeError: Not compiled with GPU support 我现在可以运行了,但是用GPU的时候,总是在验证的时候中断,之前会训练一些批次,然后中断。现在第一轮就不行了。用CPU的话就没有问题。

把这个步骤生成的.so文件删除,然后再编译一次。 image

hukaixuan19970627 avatar Jul 17 '22 09:07 hukaixuan19970627

 Epoch   gpu_mem       box       obj       cls     theta    labels  img_size

0%| | 0/1 [00:07<?, ?it/s] Traceback (most recent call last): File "D:/Tian/yolov5_obb-master/train.py", line 633, in main(opt) File "D:/Tian/yolov5_obb-master/train.py", line 530, in main train(opt.hyp, opt, device, callbacks) File "D:/Tian/yolov5_obb-master/train.py", line 326, in train loss, loss_items = compute_loss(pred, targets.to(device)) # loss scaled by batch_size File "D:\Tian\yolov5_obb-master\utils\loss.py", line 136, in call tcls, tbox, indices, anchors, tgaussian_theta = self.build_targets(p, targets) # targets File "D:\Tian\yolov5_obb-master\utils\loss.py", line 267, in build_targets indices.append((b, a, gj.clamp_(0, feature_wh[1] - 1), gi.clamp_(0, feature_wh[0] - 1))) # image, anchor, grid indices RuntimeError: result type Float can't be cast to the desired output type __int64 不太清楚这个问题应该怎么解决。

我遇到一样的问题了。这个问题是怎么解决的呢?

Chenjiangwen avatar Oct 06 '23 12:10 Chenjiangwen

@wangyansenhub Did you solve?

iamrukeshduwal avatar Apr 18 '24 02:04 iamrukeshduwal