Use Data Augmentation to Avoid Overfitting

  • Data augmentation can improve generalization and avoid overfitting, especially when your dataset is small.pythonCopy codefrom tensorflow.keras.preprocessing.image import ImageDataGenerator datagen = ImageDataGenerator( rotation_range=40, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.2, zoom_range=0.2, horizontal_flip=True, fill_mode='nearest' )

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *