- Notifications
You must be signed in to change notification settings - Fork0
Physics-informed transformations for polarimetric image data augmentation
License
NotificationsYou must be signed in to change notification settings
hahnec/polar_augment
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository provides polarimetric image augmentations such as anSO(2) rotation.
![]() | ![]() | ![]() |
---|---|---|
spatial-only rotation | spatial + polarimetric rotation | ground truth |
@misc{hahne2024isometrictransformationsimageaugmentation, title={Isometric Transformations for Image Augmentation in Mueller Matrix Polarimetry}, author={Christopher Hahne and Omar Rodriguez-Nunez and Éléa Gros and Théotim Lucas and Ekkehard Hewer and Tatiana Novikova and Theoni Maragkou and Philippe Schucht and Richard McKinley}, year={2024}, eprint={2411.07918}, archivePrefix={arXiv}, primaryClass={cs.CV}, url={https://arxiv.org/abs/2411.07918}, }
$ git clone github.com/hahnec/polar_augment$cd polar_augment$ bash install.sh
The provided transforms expect the image dimensions to be in PyTorch styleCxHxW
.
importtorchfrompolar_augment.paddingimportmirror_rotate# direct applicationfrompolar_augment.rotation_mmimportRandomMuellerRotationrotate=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)frompolar_augment.rotation_rawimportRandomPolarRotationrotate=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
fromtorchvision.transformsimportToTensorfrompolar_augment.flip_rawimportRandomPolarFlipfrompolar_augment.rotation_rawimportRandomPolarRotationfrompolar_augment.paddingimportmirror_rotatefrompolar_datasetimportPolarimetryDataset# define list of transformstransforms= [ToTensor(),RandomPolarRotation(degrees=180,p=.5,pad_rotate=mirror_rotate),# rotationRandomPolarFlip(orientation=0,p=.5),# horizontal flipRandomPolarFlip(orientation=1,p=.5),# vertical flipRandomPolarFlip(orientation=2,p=.5),# combined horizontal and vertical flip ]# pass transforms to your datasetPolarimetryDataset(some_file_path,transforms=transforms)
where the augmentation can then be applied to frames and labels within thePolarimetryDataset
classPolarimetryDataset(Dataset):def__init__(self,path,transforms=[], ):self.load_file_paths(path)self.transforms=transformsdef__getitem__(self,i):frame=load_file(self.frame_paths[i])label=load_file(self.label_paths[i])fortransforminself.transforms:frame,label=transform(frame,label=label)
About
Physics-informed transformations for polarimetric image data augmentation
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.