osc.data.utils

Helper functions to bridge tensorflow image data to pytorch.

Functions:

  • Image normalization back and forth

  • Augmentation

    • Augmentations with ‘’stateless’’ random seeds

    • Fixed augmentations

    • Double augmentation for contrastive training

Functions

augment_center_crop

Deterministic center crop and processing as in augment_train()

augment_train

Augment image for train/val.

augment_twice

Augment image twice with two different functions.

img_hwc_to_chw

Image channels [..., H, W, C] -> [..., C, H, W]

normalize_tf

Normalize tf.float32 image with [..., H, W, C] channel order.

unnormalize_pt

Un-normalize torch.float32 image with [..., C, H, W] channel order.

wrap_with_seed

Wrap stateless random functions by providing a new seed to each invocation.

Classes

AugmentFnStateless

Function type signature for TF stateless random.