Search code examples
c++dlib

Why does dlib's neural net xml export contain different parameters for layers than specified by the trainer?


In DLib it is possible to simply output a neural net type via the dlib::net_to_xml(some_net, some_filename) function. It works fine, but it also displays information like for example the net type, learning_rate_multi. In my case for example it exports the following line for one of the layers (the rest of the exported xml is omitted for clarity):

<fc num_outputs='42' learning_rate_mult='1' weight_decay_mult='1' bias_learning_rate_mult='500' bias_weight_decay_mult='0'>

Those values are correct, except for learning_rate_mult and weight_decay_mult, which always show 1. I tried setting them to different values with the trainer class, like 2 or 0.0001, but they keep showing 1. I verified that the values 2 and 0.0001 indeed were used by the net.

Might this be a bug in dlib's dlib::net_to:xml function?


Solution

  • Those values apply for every layer and are independent from the trainer-values. The layer parameters are relevant for optimzers like the Adam Optimization Algorithm:

    https://machinelearningmastery.com/adam-optimization-algorithm-for-deep-learning/

    you can change them by specifyng them in every layer. So no it is not a bug.