Crop#
- class deeptrack.augmentations.Crop(*args, crop: int | Callable[[...], int] = (64, 64), crop_mode: str | Callable[[...], str] = 'retain', corner: str | Callable[[...], str] = 'random', **kwargs)#
Bases:
Augmentation
Crops a regions of an image.
Parameters#
- featurefeature or list of features
Feature(s) to augment.
- cropint or tuple of int or list of int 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_modestr {“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.
- cornertuple 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 Summary
get
(image, corner, crop, crop_mode, **kwargs)Transform an image [abstract method].
Methods Documentation
- get(image, corner, crop, crop_mode, **kwargs)#
Transform an image [abstract method].
Abstract method that defines how the feature transforms the input. The current value of all properties will be passed as keyword arguments.
Parameters#
- image‘Image’ or List[‘Image’]
The Image or list of images to transform.
- **kwargsDict[str, Any]
The current value of all properties in properties as well as any global arguments.
Returns#
- ‘Image’ or List[‘Image’]
The transformed image or list of images.
Raises#
- NotImplementedError
Must be overridden by subclasses.