OPTML-Group / Unlearn-Saliency

[ICLR24 (Spotlight)] "SalUn: Empowering Machine Unlearning via Gradient-based Weight Saliency in Both Image Classification and Generation" by Chongyu Fan*, Jiancheng Liu*, Yihua Zhang, Eric Wong, Dennis Wei, Sijia Liu
https://www.optml-group.com/posts/salun_iclr24
MIT License
90 stars 12 forks source link

Additional experiment code #16

Closed NilakshanKunananthaseelan closed 2 months ago

NilakshanKunananthaseelan commented 3 months ago

Hi Team, Appreciate your work. I'm interested in unlearning methods for higher-resolution images. CIFAR10 models are ~100% accurate, this makes me curious if are we unlearning correctly. I couldn't find "Maysee/tiny-imagenet" files, therefore I downloaded "zh-plus/tiny-imagenet". I don't see the imagenet.py creating the directory structure for loading the dataset with ImageFolder. Therefore, I used the following snippet to create it.

    import os
    from tqdm import tqdm
    tc = {i:0 for i in range(200)}
    for i in tqdm(range(len(dataset['train'])),total=len(dataset['train'])):
        image = dataset['train'][i]['image']
        target = dataset['train'][i]['label']
        os.makedirs(f'{root}/tiny-imagenet/train/{target}',exist_ok=True)
        image.save(f'{root}/tiny-imagenet/train/{target}/{target}_{tc[target]}.jpeg')
        tc[target] += 1

And used the following command to train the ResNet18 model. python main_train.py --arch resnet18 --dataset TinyImagenet --lr 0.01 --epochs 80 --save_dir ${save_dir} --data_dir ${data_dir}

The learning saturates quickly in 30 epochs with the best accuracy of around 56%. image

Can you also release the code related to supplementary experiments?

Thanks

a-F1 commented 3 months ago

Thank you for your interest in our work. We will endeavor to update the code as soon as possible.

It seems that the model you trained has not converged and thus cannot be used as an origin model for unlearning. We recommend using a larger learning rate and training for more epochs. For instance: python main_train.py --dataset TinyImagenet --batch_size 256 --epochs 160 --lr 1e-1

If you have any other questions, please feel free to contact us.

a-F1 commented 2 months ago

Issue closed. Please feel free to post new responses or initiate another issue if you have further questions. Thanks!

NilakshanKunananthaseelan commented 2 months ago

Thanks, @a-F1. I'll use this command and update you.

NilakshanKunananthaseelan commented 2 months ago

net_train It seems that the previous command is causing overfitting. Have you used any additional regularization other than the default settings?

ljcc0930 commented 2 months ago

Hi @NilakshanKunananthaseelan, the normal trained ResNet-18 on TinyImagenet is ~60 testing ACC. If you want to pick the highest ACC, feel free to stop early.