Data augmentation tool that allows you to crop your samples to a specified height and width with certain probability.
Since it is center crop, the central part of the image is cropped.
It defines the height of the newly cropped image.
It defines the width of the newly cropped image.
It is the probability of the application of this transform.
import albumentations as albu from PIL import Image import numpy as np transform =albu.CenterCrop(200,200,p=0.5)#set height, width, and probability image = np.array(Image.open('/some/image/file/path')) image = transform(image=image)['image'] \# Now the image is cropped and ready to be accepted by the model