BIT-DA / CIRL

[CVPR 2022 Oral] Code release for "Causality Inspired Representation Learning for Domain Generalization"
125 stars 12 forks source link

About the Fourier transform of causality intervention module #5

Open ABBlankSpace opened 2 years ago

ABBlankSpace commented 2 years ago

Hi author, thank you for your excellent work. I have a question about the paper and code. The Causal Intervention Module in the paper says that $x^a$ is obtained by using Fourier transform, but in your code, I see the data transformation in the below function, which seems to be not Fourier transform. I am not an expert in the image field, so I have some doubts about this. In addition, I have not seen the paper in the data transformation λ~U(0,η) either.

def get_pre_transform(image_size=224, crop=False, jitter=0):
    if crop:
        img_transform = [transforms.RandomResizedCrop(image_size, scale=[0.8, 1.0])]
    else:
        img_transform = [transforms.Resize((image_size, image_size))]
    if jitter > 0:
        img_transform.append(transforms.ColorJitter(brightness=jitter,
                                                    contrast=jitter,
                                                    saturation=jitter,
                                                    hue=min(0.5, jitter)))
    img_transform += [transforms.RandomHorizontalFlip(), lambda x: np.asarray(x)]
    img_transform = transforms.Compose(img_transform)
    return img_transform

Looking forward to your reply.

feimo49 commented 2 years ago

The function you mentioned above is just a common technique used to pre-process the images. As for the Fourier transformation, you can refer to class FourierDGDataset() in Line 32 in data/DGDataReader.py. Thanks for your interest.