MixUp
classkeras_cv.layers.MixUp(alpha=0.2, seed=None, **kwargs)
MixUp implements the MixUp data augmentation technique.
Arguments
References
Example
(images, labels), _ = keras.datasets.cifar10.load_data()
images, labels = images[:10], labels[:10]
# Labels must be floating-point and one-hot encoded
labels = tf.cast(tf.one_hot(labels, 10), tf.float32)
mixup = keras_cv.layers.preprocessing.MixUp(10)
augmented_images, updated_labels = mixup(
{'images': images, 'labels': labels}
)
# output == {'images': updated_images, 'labels': updated_labels}