apply transformation to regression params

12 Views Asked by At

I have images which contain ellipses and I have a vector of [center_x, center_y, degree, axis_1_length, axis_2_length]

I want to apply transformations such as random_flip, rotation etc but I'm confused on how to update the regression params so that they will match the augmented image.

I use torchvision.transforms for the augmentations.

This is my get item:

def __getitem__(self, idx) -> Tuple[torch.Tensor, int]:
        r = self.df.iloc[idx]
        img = self.load_image(r.file_path)
        s = img.size[0]
        t = torch.tensor(
            [
                r[' center_x'] / s, r[' center_y'] / s,
                r[' angle'] / 360., 
                r[' axis_1'] / s, r[' axis_2'] / s
            ]
        )

        return self.augs(img), t.float()
    ```
0

There are 0 best solutions below