Skip to content

read mask error? only batches of spatial targets supported (3D tensors) but got targets of size: : [1, 360, 640, 3] #118

@mengxia1994

Description

@mengxia1994

the error is below:
RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of size: : [1, 360, 640, 3]
I think it is because the dataloader read the mask png as rgb 3 channel. If i reshape it in pytorch-auto-drive/utils/runners/lane_det_trainer.py like labels = labels[:, :, :, 0].clone(), I got error:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 128, 45, 80]], which is output 0 of ReluBackward0, is at version 20; expected version 0 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
Have searched and tried several way, maybe it can only be solved at early place, like in dataloader.
Please tell me where I was wrong and how to solve this.
By the way, I am using custom dataset orgnized in tusimple format and used pytorch-auto-drive/tools/tusimple_list_convertor.py to generate txt(change some path). Using resa_resnet18_tusimple config.
The mask png data shouldn't be a problem because I have used it to train several other open source code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions