Skip to content

RuntimeError: result type Float can't be cast to the desired output type long int #16

@tommylatranvu

Description

@tommylatranvu

Hello Chen,
Thank you very much for taking your time to answer me! I appreciate!
When I run the training code train.py, I had the error:

Image sizes 512 train, 512 test
Using 8 dataloader workers
Logging results to LEVIR-Ship/exp2
Starting training for 1000 epochs...

 Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size

0%| | 0/145 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/la/Desktop/DRENet_ship/train.py", line 515, in
train(hyp, opt, device, tb_writer, wandb)
File "/home/la/Desktop/DRENet_ship/train.py", line 294, in train
loss, loss_items, adaptParams = compute_loss(pred, dgimgs.to(device), targets.to(device)) # loss scaled by batch_size
File "/home/la/Desktop/DRENet_ship/utils/loss.py", line 135, in call
tcls, tbox, indices, anchors = self.build_targets(p[0], targets) # targets
File "/home/la/Desktop/DRENet_ship/utils/loss.py", line 245, 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 long int
wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing.

I did not change anything from your code. Could you please give me a solution to solve this problem. Thanks!

Best regards,

Tran-Vu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions