Reputation: 2478
I am using TensorFlow 2.4.1 and Python3.8 for Computer Vision based CNN models such as VGG-18, ResNet-18/34, etc. My question is specific to weight decay declaration. There are two ways of defining it:
Example codes are:
weight_decay = 0.0005
Conv2D(
filters = 64, kernel_size = (3, 3),
activation='relu', kernel_initializer = tf.initializers.he_normal(),
strides = (1, 1), padding = 'same',
kernel_regularizer = regularizers.l2(weight_decay),
)
# NOTE: this 'kernel_regularizer' parameter is used for all of the conv layers in ResNet-18/34 and VGG-18 models
optimizer = tf.keras.optimizers.SGD(learning_rate = 0.01, decay = lr_decay, momentum = 0.9)
My question is:
Upvotes: 3
Views: 3946
Reputation: 719
Decay argument has been deprecated for all optimizers since Keras 2.3. For learning rate decay, you should use LearningRateSchedule instead.
As for your questions:
Why not running the different configurations to compare?
Upvotes: 3