NEW
All annotation is now free in Hasty.

Random Crop

This data augmentation option allows you to crop the images into a certain dimension, creating synthetic data. The cropping could yield any patch of the image and is therefore called "Random Crop".

You should make sure that the original image size is larger than the requested crop size.

Parameters

Height

Sets the height of the desired cropped image in pixels.

Width

Sets the width of the desired cropped image in pixels.

Code Implementation

import albumentations as albu
from PIL import Image

transform =albu.RandomCrop(200,200)
augmented_image = transform(image=figure)['image']

# we have our required croppedimage in augmented_image.

The following code implementation crops by taking 4 specific corner points. However, the tool generates random points for each of the training images that needs to be cropped.

Further Resources

Last updated on Jun 01, 2022

Removing the risk from vision AI.

Only 13% of vision AI projects make it to production, with Hasty we boost that number to 100%.