Fine tune model on new dataset with different outputs


I have a complex problem with one of my project and I hope you can help me solve it or just give me some tips.

I have model fully trained that takes as input an image and outputs 16 coordinates, then compare the outputs to the ground truth 16 coordinates.

But now, I want to fine tune my model on another dataset. The problem is that the model will output 16 coordinates will the ground truth coordinates numbers of this new dataset is 12 (not 16).

So my question is, is there a way with PyTorch to tell my model, ok you can compute 16 coordinates, but when comparing your output with the ground truth, do not take in consideration the coordinates N. Where N is the 4 additional coordinates which are missing in the dataset.

I really need your help on this one.

Thank you,


I want to add that I do not need to know the predictions for these 4 missing coordinates.

I don’t really think that’s what you want to do. Instead, you should just remove the last layer of your model (that used to output 16 coordinates) and replace it with a new layer just like it but with 12 outputs.

Hmm, unfortunately, it doesn’t work for me, So I have created the four missing output by another model.