Open adraffy opened 7 years ago
I found this code which just copies over the values in the case where the number of classes is expanding:
https://github.com/shelhamer/fcn.berkeleyvision.org/blob/master/surgery.py
def expand_score(new_net, new_layer, net, layer):
Doing something like the opposite for reducing the number of classes from 21 to 3 (or whatever) makes sense to me but it was missing from the instructions.
hey @adraffy . Did youhave any succes in doing net Surgery for smaller number of class (3) in your case ?
I'm not sure how to resize the net properly to reduce the number of output classes.
When I reduce the number of classes in the prototxt, I get dimensional issues while trying to copy values from the base model:
Cannot copy param 0 weights from layer 'inference1'; shape mismatch. Source param shape is 1 1 21 21 (441); target param shape is 1 1 2 2 (4). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.
If I rename the resized layers so the weights aren't copied over,
solver.py
complains that the layers are "composed of zeros!"What is the appropriate way to retain the initial weights but reduce the number of output classes?
Thanks!