Skip to content

Instantly share code, notes, and snippets.

@ternaus
Last active April 4, 2024 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ternaus/db2df39d4c5dba3806c8017fff15f705 to your computer and use it in GitHub Desktop.
Save ternaus/db2df39d4c5dba3806c8017fff15f705 to your computer and use it in GitHub Desktop.
Example of the application of RandomResizedCrop in Albumentations
import albumentations as A
import cv2
bgr_image = cv2.imread("cat1.jpeg")
image = cv2.cvtColor(bgr_image, cv2.COLOR_BGR2RGB)
transform = A.Compose([A.RandomResizedCrop(size=(512, 512),
scale=(0.08, 1),
ratio=(0.75, 1.33),
interpolation=cv2.INTER_AREA, p=0.5)])
transformed = transform(image=image)
transformed_image = transformed["image"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment