The output size of the last layer doesn't match the number of classes

2 views (last 30 days)
Hello,
I used one pretrained network (vgg16) for my set of images. Vgg16 is trainned with 11 classes.
I want to redefine the number of classes to be 6. The problem appear at the last layer: the number of classes from the last Layer is 11, not 6.
I tried something like:
layersMine(2,1).ClassWeights = length(classNames);
layerMine(2,1).ClassNames(1:6) = classNames
How can I change the number of classes from the last layer to 6?
Can I redefine the last layer (classificationLayer)? How?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!