Skip to content

Generating examples using CelebA #17

Open

Description

@ozturkoktay

Hi, I'm trying to run code for CelebA dataset. Can you share an example like you shared for CIFAR10 (QuickStart.ipynb) ?

Activity

  1. HanxunH commented on Jan 19, 2024

    @HanxunH
    Owner

    Hi,

    I believe you can change the CIFAR10 dataset in the notebook to the CelebA on your local machine. Don't forget to change noise spatial dimension size.

  2. saigontrade88 commented on Dec 7, 2024

    @saigontrade88

    Hello,
    I am interested in your paper. I am also trying to modify the QuickStart notebook to generate and evaluate the unlearnable dataset on the CelebA-50 dataset. I want to ask about the spatial dimension size for the input images and perturbation setting for the min-min noise algorithm. I currently use (the train dataset's size, 32, 32, 3) and ResNet-18 as the source and target model. The clean test accuracy when trained on the unlearnable dataset is ~90% so I suspect that I used the wrong values for these two parameters. I originally set the dimension to (128, 128, 3) and I got an error with the forward pass. Many thanks.

    `
    num_of_classes = 50
    train_transform = [
    transforms.CenterCrop((32, 32)),
    transforms.RandomHorizontalFlip(),
    transforms.ToTensor()
    ]
    clean_train_dataset = CelebAMini(root='datasets',
    split="train",
    target_type="identity",
    download=False,
    num_of_classes=num_of_classes,
    transform=train_transform)
    clean_test_dataset = CelebAMini(root='datasets',
    split="all",
    target_type="identity",
    download=False,
    num_of_classes=num_of_classes,
    transform=test_transform)

    noise_generator = toolbox.PerturbationTool(epsilon=0.03137254901960784,
    num_steps=20,
    step_size=0.0031372549019607846)

    base_model = ResNet18(num_of_classes)
    `
    Also, based on the notebook, can you suggest on how to save the pertubed images? CelebAMini class only keeps a list of filenames. Many thanks.

  3. HanxunH commented on Dec 8, 2024

    @HanxunH
    Owner

    Hi, thanks for your interest.

     I want to ask about the spatial dimension size for the input images and perturbation setting for the min-min noise algorithm.

    I'm not quite sure what is the original resolution of CelebAMini, the noise shape should be the same as the original image.

    can you suggest on how to save the pertubed images?

    Here is an suggetion that should works. In the CelebAMini class, for the __getitem__(self, index) function, return the name of the file. In the for loop over the data loader, you can get filenames, images, labels, then the filenames are coorsponding to the images sampled from the dataloader. transforms.ToPILImage() can help to convert the tensor to image format and then save them.

  4. saigontrade88 commented on Dec 9, 2024

    @saigontrade88

    Thanks, you for your correct suggestions. The QuickStart Jupyter Notebook also works for ResNet-18 and CelebA. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions