qubvel / segmentation_models.pytorch

Semantic segmentation models with 500+ pretrained convolutional and transformer-based backbones.
https://smp.readthedocs.io/
MIT License
9.14k stars 1.63k forks source link

'tuple' object has no attribute 'to' #833

Closed lauramnf closed 5 months ago

lauramnf commented 7 months ago

Hi,

I am trying to train a model with my custom data base using pytorch DataBase class. It is a multi class data base in which you can have more than 1 object detection in a single image. I have images in png format and the annotations in xml format (VOC standard). In the getitem method I transform the bonding boxes, labels and the images in tensors, but when I try to train the model using segmentation models, I get the error:

/usr/local/lib/python3.10/dist-packages/segmentation_models_pytorch/utils/train.py in run(self, dataloader) 48 ) as iterator: 49 for x, y in iterator: ---> 50 x, y = x.to(self.device), y.to(self.device) 51 loss, y_pred = self.batch_update(x, y) 52

AttributeError: 'tuple' object has no attribute 'to'

Can someone help me figure this out, please?

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 5 months ago

This issue was closed because it has been stalled for 7 days with no activity.