Decrease the the number of output classes on pretrained model with more classes

As said in title

i trained camvid dataset on segnet architecture. camvid consists of 13 classes

But my own images which i have taken manually has only 4 classes(trees,road,cars people) now i want my model which has 13 classes(trained on camvid) to show output as only 4 classes

any ideas to do it ?

Hello,

Does the way that changing the output of the last fc layer into 4 instead of 13 meet your requirement?

yes

model is already trained, i just wanted to to know how to ignore unwanted classes by removing layers in the last layer

If you want to get the predictions that only include these 4 classes, I think you could perform a mapping operation that maps other classes to the background.

If you want to get to the metrics of these 4 classes, in my shallow view, the other 9 classes will have an influence on the prediction result, because on is a 13-classes classification task and anthor one is 4-classes classification task.