Crop#
- class deeptrack.augmentations.Crop(*args, crop: int | list[int] | tuple[int] | Callable[[Image], tuple[int]] = (64, 64), crop_mode: PropertyLike[str] = 'retain', corner: PropertyLike[str] = 'random', **kwargs)#
Bases:
AugmentationCrops a regions of an image.
Parameters#
- feature: Feature or list of Features
Feature(s) to augment.
- crop: int or tuple of ints or list of ints or Callable[Image]->tuple of ints
Number of pixels to remove or retain (depending in crop_mode) If a tuple or list, it is assumed to be per axis. Can also be a function that returns any of the other types.
- crop_mode: str {“retain”, “remove”}
How the crop argument is interpreted. If “remove”, then crop denotes the amount to crop from the edges. If “retain”, crop denotes the size of the output.
- corner: tuple of ints or Callable[Image]->tuple of ints or “random”
Top left corner of the cropped region. Can be a tuple of ints, a function that returns a tuple of ints or the string random. If corner is placed so that the cropping cannot be performed, the modulo of the corner with the allowed region is used.
Methods#
- get(image: Image | np.ndarray, corner: PropertyLike[str], crop: PropertyLike[int], crop_mode: PropertyLike[str], **kwargs) -> Image
Abstract method which performs the Crop augmentation.
Methods Summary
get(image, corner, crop, crop_mode, **kwargs)Abstract method which performs the Crop augmentation.
Methods Documentation