Skip to content
abstract

GeometricTransform

extendsTransform[P]ABC
GeometricTransform(p: float = 1.0)

Spatial transform — must move masks, boxes, and keypoints.

Re-declaring the companion hooks as abstract turns "a geometric transform handles every target type" into a contract mypy enforces, preventing the silent bug where a new geometric transform forgets to move one of them.

Parameters

pfloat= 1.0
Probability of applying the transform; otherwise the input passes through unchanged.

Examples

The base of everything that moves pixels around — crops, flips,
rotations, warps. Geometric transforms carry their change through to
masks, boxes and keypoints, which is what separates them from
PhotometricTransform:
>>> import lucid, lucid.utils.transforms as T
>>> issubclass(T.Rotate, T.GeometricTransform)
True
>>> issubclass(T.ColorJitter, T.GeometricTransform)
False

Used by 5