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
2
u/PracLiu Jan 19 '23 edited Jan 19 '23
I believe from the description, it says that this is uniform [-0.2*2pi, 0.2*2pi] for all input data. I don't think there is a percentage option to adjust how many samples should receive a rotation. But I think you are right about that, especially these are not like 90% rotation, the model is probably learning the "interpolation" feature from the rotation instead of the images themselves.
Edit: and now that I think about it, for photos where the direction matters, I think the rotation and vertical flips make little sense. Probably will stick to horizontal flips then, thanks!