tf.image.random_crop

View source on GitHub

Randomly crops a tensor to a given size.

tf.image.random_crop(
    value, size, seed=None, name=None
)

Slices a shape size portion out of value at a uniformly chosen offset. Requires value.shape >= size.

If a dimension should not be cropped, pass the full size of that dimension. For example, RGB images can be cropped with size = [crop_height, crop_width, 3].

Args:

Returns:

A cropped tensor of the same rank as value and shape size.