0

Im new to MXNet and I was wondering if any one knows how to fine tune more layers in CNN other than only the FC layers. All the examples that Im looking at, have fine tuning only on the FC layers. In Keras this can be easily done and more blocks of ConvNets other than FC block can be fine tuned: https://github.com/Hvass-Labs/TensorFlow-Tutorials/blob/master/10_Fine-Tuning.ipynb

Pre-trained network

If we want to fine-tune only the FC block, we make all the layers trainability to false: layer.trainable = False

finetune the FC layers

If we want to fine-tune more blocks of ConnNet other than FC layers, we make the layer.trainable=True for those layers: finetune blocks of ConvNet in Keras

My question is how to do similarly in MXNet

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
Azi
  • 21
  • 3
  • 2
    Hey @Azi, I recommend adding some examples of a specific problem you need help with. SO users are happy to help, but we need questions to be specific and not general. Typically, this means adding code of what you've already tried. – parker_codes Mar 30 '18 at 01:36

1 Answers1

5

Answer depends on whether you are using the imperative (Gluon) or symbolic API.

If you are using the imperative (Gluon) API:

Instead of creating gluon.Trainer with all parameters (net.collect_params()), you can provide a subset of those parameters that you want to train. Any parameter that is not present in the ParameterDict you pass to Trainer will remain frozen.

If you are using the Symbolic API:

You can use the fixed_param_names parameter while creating Module. You can provide a regex matching the parameter names you want to freeze. Check this example.

Indhu Bharathi
  • 1,437
  • 1
  • 13
  • 22