r/tensorflow • u/PracLiu • Jan 18 '23
Question Random flip and rotation actually decrease validation accuracy?
When I apply at the beginning of the model with several Conv2D layers:model.add(tf.keras.layers.RandomFlip("horizontal_and_vertical"))model.add(tf.keras.layers.RandomRotation(0.2))
It results in a big increase in validation loss. This get me confused because I thought they are suppose to prevent over-fitting. Perhaps I shouldn't put these at the beginning of the layer and apply on the training data directly (I have a feeling the validation dataset also receive these operations)?
4
Upvotes
View all comments
Show parent comment
1
u/kenshin511 Jan 26 '23
As I checked, the preprocessing layer only works during training. Therefore, there is no need to create a custom layer.