serialize_albumentation_transform#

serialize_albumentation_transform(tf: BasicTransform, lambda_transforms_path: Optional[str] = None, dst_dir: Optional[str] = None) dict[source]#

Serialize an albumentations transform to a dict.

If the transform includes a Lambda transform, a lambda_transforms_path should be provided. This should be a path to a python file that defines a dict named lambda_transforms as required by A.from_dict(). See https://albumentations.ai/docs/examples/serialization/ for details. This path is saved as a field in the returned dict so that it is available at the time of deserialization.

Parameters
  • tf (A.BasicTransform) – The transform to serialize.

  • lambda_transforms_path (Optional[str], optional) – Path to a python file that defines a dict named lambda_transforms as required by A.from_dict(). Defaults to None.

  • dst_dir (Optional[str], optional) – Directory to copy the transforms file to. Useful for copying the file to S3 when running on Batch. Defaults to None.

Returns

The serialized transform.

Return type

dict