Image Regression with Custom Head


I am new to fastai (getting started with the lib), fascinated to see the speed boost, tweaks and productivity it provides in creating models.

Am trying to create a model with custom head from a pre-trained model eg, resnet34 for an Image Regression problem - Price prediction based on Image, but doesn’t know how to achieve it using fastai library.

Looking forward to your help and discussion.

Thank you.

Might be to make the ask clear, am looking forward to know how to setup custom head for a pertained model like resnet in a cleaner way!

HI @LotusGaurdian , what have you been able to do so far? can you draw a picture or some code samples of what you’ve done so far?

Isn’t fine-tuning essentially the same thing? Is the custom head going to be drastically different from the resnet34 model?

Hi Mike,

Thanks for stepping in to guide.

Am very new to lib and does’t recognise how to do a standard regression custom head on a pertained body, with concise apis.

Yes, fine-tuning is essentially going to be same, I expect.

The custom head won’t be any different but a standard one.

All I am trying to do is input a image and instead of classifying it, would like to predict it’s expected price in numbers.

Please refer the below image, and sorry for a quick scribble. The challenge is how to do construct via lib and begin fine tuning.

Any reference snippets, inputs, reference material would be of great help! Thanks.

1 Like

Thanks for the great diagrams @LotusGaurdian , it becomes much more clear now. Thanks to your post, I looked up image regression and learned a new concept!

Also, it’ beyond my current capabilities to suggest concrete snippets etc :sweat_smile: , but just as a general direction, would it make sense to turn this into a multi-class prediction and each prediction represents a price range? So, instead of ‘goldfish’ we take ‘goldfish’ to mean “$120-130” ? To make it finer grained, make the number of categories larger and that’d squeeze the range accordingly?

There was an answer to a similar question previously, not sure if it fits your scenario exactly, but might help in moving things forward a bit?