Image regression, several points


Good afternoon. I tried to create a model to predict the coordinates of items on pictures, as seen in the lesson 3 Regression with BIWI head pose.
In the end I got the following error when I want to create my dataset in a similar way :

It’s not possible to collate samples of your dataset together in a batch.
Shapes of the inputs/targets:
[[torch.Size([3, 160, 160]), torch.Size([3, 160, 160])], [torch.Size([152, 2]), torch.Size([1, 2])]]

Each pictures can have different number of items/targets to detect (here there has 152 coordinates x/y to predict for one image vs an image with only one item). Do I am trying to do something impossible ? ^^ Or this a specific part of the doc I should look at ? (or maybe change the dimension of my tensor ? something like 152 x 1 x 2 ?).

Thanks !


(Zachary Mueller) #2

How are you creating your databunch? How are you gathering the labels? Could you provide that code please? Those help immensely as I dealt with the same issue a few months back with the Coco dataset :slight_smile:



I am creating data in the following way :

data = (PointsItemList.from_df(df_train, path+"/train_images/")
.transform(tfm_y=True, size=(160,160))

If I put bs = 1 it works. The problem is really about the dimension of the target/output.
Thanks for your help ^^


(Zachary Mueller) #4

When you do bs of 1 your points all come out correctly? Aka show_batch() looks okay?



Yes ^^