This repository provides polarimetric image augmentations such as an SO(2) rotation.
![]() |
![]() |
![]() |
|---|---|---|
| spatial-only rotation | spatial + polarimetric rotation | ground truth |
@ARTICLE{11202388,
author={Hahne, Christopher and Rodríguez-Núñez, Omar and Gros, Éléa and Lucas, Théotim and Hewer, Ekkehard and Novikova, Tatiana and Maragkou, Theoni and Schucht, Philippe and McKinley, Richard},
journal={IEEE Transactions on Image Processing},
title={Physically Consistent Image Augmentation for Deep Learning in Mueller Matrix Polarimetry},
year={2025},
volume={34},
number={},
pages={6953-6962},
keywords={Imaging;Polarimetry;Deep learning;Data augmentation;Training;Optical polarization;Optical imaging;Vectors;Interpolation;Standards;Augmentation;polarimetry;Mueller matrix;tumor;classification},
doi={10.1109/TIP.2025.3618390}
}
$ git clone github.com/hahnec/polar_augment
$ cd polar_augment
$ bash install.shThe provided transforms expect the image dimensions to be in PyTorch style CxHxW.
import torch
from polar_augment.padding import mirror_rotate
# direct application
from polar_augment.rotation_mm import RandomMuellerRotation
rotate = RandomMuellerRotation(degrees=45, p=float('inf'), pad_rotate=mirror_rotate)
mm_img = torch.randn([128, 128, 4, 4]).flatten(2, 3).permute(2, 0, 1)
mm_img_rotated = rotate(mm_img)
print(mm_img_rotated.shape)
# application for calibration matrices (dataloader-friendly for raw data)
from polar_augment.rotation_raw import RandomPolarRotation
rotate = RandomPolarRotation(degrees=45, p=float('inf'), pad_rotate=mirror_rotate)
mm_img = torch.randn([128, 128, 4*3, 4]).flatten(2, 3).permute(2, 0, 1)
mm_img_rotated = rotate(mm_img)
print(mm_img_rotated.shape)Alternatively, the transforms can be integrated during dataloading as for example by
from torchvision.transforms import ToTensor
from polar_augment.flip_raw import RandomPolarFlip
from polar_augment.rotation_raw import RandomPolarRotation
from polar_augment.padding import mirror_rotate
from polar_dataset import PolarimetryDataset
# define list of transforms
transforms = [
ToTensor(),
RandomPolarRotation(degrees=180, p=.5, pad_rotate=mirror_rotate), # rotation
RandomPolarFlip(orientation=0, p=.5), # horizontal flip
RandomPolarFlip(orientation=1, p=.5), # vertical flip
RandomPolarFlip(orientation=2, p=.5), # combined horizontal and vertical flip
]
# pass transforms to your dataset
PolarimetryDataset(some_file_path, transforms=transforms)where the augmentation can then be applied to frames and labels within the PolarimetryDataset
class PolarimetryDataset(Dataset):
def __init__(
self,
path,
transforms=[],
):
self.load_file_paths(path)
self.transforms = transforms
def __getitem__(self, i):
frame = load_file(self.frame_paths[i])
label = load_file(self.label_paths[i])
for transform in self.transforms:
frame, label = transform(frame, label=label)

