Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLYolo training #5

Open
dalqattan opened this issue Jun 9, 2023 · 1 comment
Open

FLYolo training #5

dalqattan opened this issue Jun 9, 2023 · 1 comment

Comments

@dalqattan
Copy link

dalqattan commented Jun 9, 2023

Hi,
I am trying to text the FLyolo using quick start example.

I run train.py but I got the error below


Starting training for 5 epochs...

Epoch   gpu_mem       box       obj       cls    labels  img_size
 0%|                                                                                                                                                                                                                                                                                                | 0/12 [00:08<?, ?it/s]
Traceback (most recent call last):
 File "C:\temp\CarlaFLCAV\FLYolo\yolov5\train.py", line 628, in <module>
   main(opt)
 File "C:\temp\CarlaFLCAV\FLYolo\yolov5\train.py", line 525, in main
   train(opt.hyp, opt, device, callbacks)
 File "C:\temp\CarlaFLCAV\FLYolo\yolov5\train.py", line 322, in train
   loss, loss_items = compute_loss(pred, targets.to(device))  # loss scaled by batch_size
 File "C:\temp\CarlaFLCAV\FLYolo\yolov5\utils\loss.py", line 120, in __call__
   tcls, tbox, indices, anchors = self.build_targets(p, targets)  # targets
 File "C:\temp\CarlaFLCAV\FLYolo\yolov5\utils\loss.py", line 217, in build_targets
   indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1)))  # image, anchor, grid indices
RuntimeError: result type Float can't be cast to the desired output type __int64

It would be appreciated if you can help.

Thanks
Duaa

@bearswang
Copy link
Contributor

It seems that the problem occured due to the torch version. You may change "gain = torch.ones(7, device=targets.device)" into "gain = torch.ones(7, device=targets.device).long()" in file loss.py under folder "yolov5/utils" (C:\temp\CarlaFLCAV\FLYolo\yolov5\utils\loss.py​)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants