(image, target_size)
return cropped_image
Crop image to target size. Image cropped symmetrically.

    Args:
        image (numpy.ndarray): Image of shape (C x H x W).
        target_size (tuple): Target size (H, W).

    Returns:
        numpy.ndarray: Cropped image of shape (C x H x W).
Crop image to target size. Image cropped symmetrically.
Crop image to target size . Image cropped symmetrically .
def crop_image(image, target_size):
    """Crop image to target size. Image cropped symmetrically.

    Args:
        image (numpy.ndarray): Image of shape (C x H x W).
        target_size (tuple): Target size (H, W).

    Returns:
        numpy.ndarray: Cropped image of shape (C x H x W).

    """
    top_crop, right_crop, bottom_crop, left_crop = get_crop_pad_sequence(image.shape[1] - target_size[0],
                                                                         image.shape[2] - target_size[1])
    cropped_image = image[:, top_crop:image.shape[1] - bottom_crop, left_crop:image.shape[2] - right_crop]
    return cropped_image
def crop_image ( image , target_size ) : top_crop , right_crop , bottom_crop , left_crop = get_crop_pad_sequence ( image . shape [ 1 ] - target_size [ 0 ] , image . shape [ 2 ] - target_size [ 1 ] ) cropped_image = image [ : , top_crop : image . shape [ 1 ] - bottom_crop , left_crop : image . shape [ 2 ] - right_crop ] return cropped_image