Code Monkey home page Code Monkey logo

datasetcondensation's Introduction

Dataset Condensation

Dataset condensation aims to condense a large training set T into a small synthetic set S such that the model trained on the small synthetic set can obtain comparable testing performance to that trained on the large training set.

This repository includes codes for Dataset Condensation with Gradient Matching (ICLR 2021 Oral), Dataset Condensation with Differentiable Siamese Augmentation (ICML 2021) and Dataset Condensation with Distribution Matching (arXiv 2021).

Off-the-shelf synthetic sets can be downloaded from Google Drive. Each .pt file includes 5 synthetic sets learned with ConvNet in 5 independent experiments and corresponding 100 testing accuracies. Note that these synthetic data have been normalized.

Dataset Condensation with Gradient Matching [PDF]

Method

Figure 1: Dataset Condensation (left) aims to generate a small set of synthetic images that can match the performance of a network trained on a large image dataset. Our method (right) realizes this goal by learning a synthetic set such that a deep network trained on it and the large set produces similar gradients w.r.t. the parameters. The synthetic data can later be used to train a network from scratch in a fraction of the original computational load. CE denotes Cross-Entropy.

Setup

install packages in the requirements.

Basic experiments - Table 1

python main.py  --dataset CIFAR10  --model ConvNet  --ipc 10
# --dataset: MNIST, FashionMNIST, SVHN, CIFAR10, CIFAR100
# --ipc (images/class): 1, 10, 20, 30, 40, 50

Cross-architecture experiments - Table 2

python main.py  --dataset MNIST  --model ConvNet  --ipc 1  --eval_mode M
# --model: MLP, LeNet, ConvNet, AlexNet, VGG11BN, ResNet18BN_AP, Note: set --lr_img 0.01 when --model MLP

Ablation study on different modules - Table T2, T3, T4, T5, T6, T7

python main.py  --dataset MNIST  --model ConvNetW32  --eval_mode W  --ipc 1 
python main.py  --dataset MNIST  --model ConvNetW64  --eval_mode W  --ipc 1
python main.py  --dataset MNIST  --model ConvNetW128  --eval_mode W  --ipc 1
python main.py  --dataset MNIST  --model ConvNetW256  --eval_mode W  --ipc 1

python main.py  --dataset MNIST  --model ConvNetD1  --eval_mode D  --ipc 1
python main.py  --dataset MNIST  --model ConvNetD2  --eval_mode D  --ipc 1
python main.py  --dataset MNIST  --model ConvNetD3  --eval_mode D  --ipc 1
python main.py  --dataset MNIST  --model ConvNetD4  --eval_mode D  --ipc 1

python main.py  --dataset MNIST  --model ConvNetAS  --eval_mode A  --ipc 1
python main.py  --dataset MNIST  --model ConvNetAR  --eval_mode A  --ipc 1
python main.py  --dataset MNIST  --model ConvNetAL  --eval_mode A  --ipc 1

python main.py  --dataset MNIST  --model ConvNetNP  --eval_mode P  --ipc 1
python main.py  --dataset MNIST  --model ConvNetMP  --eval_mode P  --ipc 1 
python main.py  --dataset MNIST  --model ConvNetAP  --eval_mode P  --ipc 1

python main.py  --dataset MNIST  --model ConvNetNN  --eval_mode N  --ipc 1
python main.py  --dataset MNIST  --model ConvNetBN  --eval_mode N  --ipc 1 
python main.py  --dataset MNIST  --model ConvNetLN  --eval_mode N  --ipc 1
python main.py  --dataset MNIST  --model ConvNetIN  --eval_mode N  --ipc 1
python main.py  --dataset MNIST  --model ConvNetGN  --eval_mode N  --ipc 1


python main.py  --dataset MNIST  --model ConvNet  --ipc 1  --dis_metric mse
# --dis_metric (gradient distance metrics): ours, mse, cos
# --model: MLP, LeNet, ConvNet, AlexNet, VGG11BN, ResNet18BN_AP

Performance

MNIST FashionMNIST SVHN CIFAR10 CIFAR100
1 img/cls 91.7 70.5 31.2 28.3 12.8
10 img/cls 97.4 82.3 76.1 44.9 25.2
50 img/cls 98.8 83.6 82.3 53.9 -

Table 1: Testing accuracies (%) of ConvNets trained from scratch on 1, 10 or 50 synthetic image(s)/class. Note that the performances are achieved with defult hyper-parameters. Better results can be obtained, if more hyper-parameters are tried.

Visualization

Figure 2: Visualization of condensed 1 image/class with ConvNet for MNIST, FashionMNIST, SVHN and CIFAR10. Average testing accuracies on randomly initialized ConvNets are 91.7%, 70.5%, 31.2% and 28.3% respectively.

Figure 3: Visualization of condensed 10 images/class with ConvNet for MNIST, FashionMNIST, SVHN and CIFAR10. Average testing accuracies on randomly initialized ConvNets are 97.4%, 82.3%, 76.1% and 44.9% respectively.

Citation

@inproceedings{
zhao2021DC,
title={Dataset Condensation with Gradient Matching},
author={Bo Zhao and Konda Reddy Mopuri and Hakan Bilen},
booktitle={International Conference on Learning Representations},
year={2021},
url={https://openreview.net/forum?id=mSAKhLYLSsl}
}

Dataset Condensation with Differentiable Siamese Augmentation [PDF]

Method

Figure 4: Differentiable Siamese augmentation (DSA) applies the same parametric augmentation (e.g. rotation) to all data points in the sampled real and synthetic batches in a training iteration. The gradients of network parameters w.r.t. the sampled real and synthetic batches are matched for updating the synthetic images. A DSA example is given that rotation with the same degree is applied to the sampled real and synthetic batches.

Setup

install packages in the requirements.

Basic experiments - Table 1 & 2

python main.py  --dataset CIFAR10  --model ConvNet  --ipc 10  --init real  --method DSA  --dsa_strategy color_crop_cutout_flip_scale_rotate
# --dataset: MNIST, FashionMNIST, SVHN, CIFAR10, CIFAR100
# --ipc (images/class): 1, 10, 20, 30, 40, 50
# note: use color_crop_cutout_flip_scale_rotate for FashionMNIST CIFAR10/100, and color_crop_cutout_scale_rotate for the digit datasets (MNIST and SVHN), as flip augmentation is not good for digit datasets.

Ablation study on augmentation strategies - Table 4

python main.py  --dataset CIFAR10  --model ConvNet  --ipc 10  --init real  --method DSA  --dsa_strategy crop
# --dataset: MNIST, FashionMNIST, SVHN, CIFAR10
# --dsa_strategy: color, crop, cutout, flip, scale, rotate, color_crop_cutout_scale_rotate, color_crop_cutout_flip_scale_rotate
# note: flip augmentation is not good for digit datasets (MNIST and SVHN).

Performance

MNIST FashionMNIST SVHN CIFAR10 CIFAR100
1 img/cls 88.7 70.6 27.5 28.8 13.9
10 img/cls 97.8 84.6 79.2 52.1 32.3
50 img/cls 99.2 88.7 84.4 60.6 -

Table 2: Testing accuracies (%) of ConvNets trained from scratch on 1, 10 or 50 synthetic image(s)/class. Note that the performances are achieved with defult hyper-parameters. Better results can be obtained, if more hyper-parameters are tried.

Visualization

Figure 5: Visualization of the generated 10 images/class synthetic sets of MINIST and CIFAR10. Average testing accuracies on randomly initialized ConvNets are 97.8% and 52.1% respectively.

Initialization

Figure 6: The learning/rendering process of two classes in CIFAR10 initialized from random noise and real images respectively.

Citation

@inproceedings{
zhao2021DSA,
title={Dataset Condensation with Differentiable Siamese Augmentation},
author={Zhao, Bo and Bilen, Hakan},
booktitle={International Conference on Machine Learning},
year={2021}
}

Dataset Condensation with Distribution Matching [PDF]

Method

Figure 7: Dataset Condensation with Distribution Matching. We randomly sample real and synthetic data, and then embed them with the randomly sampled deep neural networks. We learn the synthetic data by minimizing the distribution discrepancy between real and synthetic data in these sampled embedding spaces.

Setup

install packages in the requirements.

TinyImageNet

TinyImageNet dataset download. Put it into data_path.
Tricks to solve the out of memory (OOM) problem: Use "if 'BN' not in args.model:" (Line 158) branch, as we suggest including samples from multiple classes when measuring the running mean/std for BatchNorm. Put image optimization (Line 198-201) into the class loop (Line 158), then you can optimize each class independently. We jointly optimize when memory is enough, as empirically we find it is faster.

Basic experiments

python main_DM.py  --dataset CIFAR10  --model ConvNet  --ipc 10  --dsa_strategy color_crop_cutout_flip_scale_rotate  --init real  --lr_img 1  --num_exp 5  --num_eval 5 
# Empirically, for CIFAR10 dataset we set --lr_img 1 for --ipc = 1/10/50, --lr_img 10 for --ipc = 100/200/500/1000/1250. For CIFAR100 dataset, we set --lr_img 1 for --ipc = 1/10/50/100/125.

Figure 8: Learning large-scale synthetic sets on CIFAR10.

DM achieves 67.0 ± 0.3%, 71.2 ± 0.4%, 76.1±0.3%, 79.8±0.3% and 80.8±0.3% testing accuracies with ConvNets when learning 100, 200, 500, 1000 and 1250 images/class synthetic sets on CIFAR10 dataset respectively, which means we can recover 79%, 84%, 90%, 94% and 95% relative performance using only 2%, 4%, 10%, 20% and 25% training data compared to whole dataset training. The performances will be further improved if BatchNorm is used, i.e. ConvNetBN.

Cross-architecture experiments

python main.py  --dataset CIFAR10  --model ConvNetBN  --ipc 50  --init real  --method DSA  --dsa_strategy color_crop_cutout_flip_scale_rotate  --lr_img 0.1  --eval_mode B  --num_exp 5  --num_eval 5
python main_DM.py  --dataset CIFAR10  --model ConvNetBN  --ipc 50  --init real  --dsa_strategy color_crop_cutout_flip_scale_rotate  --lr_img 1  --eval_mode B  --num_exp 5  --num_eval 5 
# For DM cross-architecture experiments, we use models with batchnorm layer. --model can be ConvNetBN, AlexNetBN, VGG11BN, ResNet18BN_AP/ResNet18BN, ConvNetASwishBN.

We introduce Swish activation function which may achieve better performance, especially for DC/DSA methods.

Continual learning experiments

We do 5 experiments with 5 seeds to generate the class order for both 5 and 10 step learning:

for seed_cl in range(5):
    np.random.seed(seed_cl)
    class_order = np.random.permutation(num_classes).tolist()

Please download the synthetic sets from Google Drive which are learned in the continual learning scenario and put them into the data path (refer to the code). Then run CL_DM.py using the following scripts:

python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 5 --method random 
python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 5 --method herding 
python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 5 --method DSA 
python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 5 --method DM 

python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 10 --method random 
python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 10 --method herding 
python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 10 --method DSA 
python CL_DM.py  --dataset CIFAR100  --model ConvNet  --steps 10 --method DM 

Citation

@article{zhao2023DM,
  title={Dataset Condensation with Distribution Matching},
  author={Zhao, Bo and Bilen, Hakan},
  booktitle={Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
  year={2023}
}

Synthesizing Informative Training Samples with GAN [PDF]

We propose to learn the latent vectors of generators that produces informative training images. Then, we store the generator and learned latent vectors instead of synthetic images, which needs less storage. The code and data have been released in VICO-UoE/IT-GAN.

Citation

@article{zhao2022synthesizing,
  title={Synthesizing Informative Training Samples with GAN},
  author={Zhao, Bo and Bilen, Hakan},
  journal={NeurIPS 2022 Workshop on Synthetic Data for Empowering ML Research},
  year={2022}
}

Star History

Star History Chart

datasetcondensation's People

Contributors

patrickzh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datasetcondensation's Issues

Can I have more images?

I notice that you limit the ipc in get_loops function. Can I set it as 100, 1000 or even more? You mentioned that 'The following values are empirically good'. I just want to know how bad if ipc=100 or 1000. Thank you!

About the reported performances of DM

Your generously provided code helps me a lot for implementing new thang from existing methods.
Having said that, existing code do not show the reported performances of DM, even when i reproduced it with same hyper-parameters.
In detail, results for CIFAR10 with 50 samples per classes does not go over 55% even when i try bunch of hyper-parameter tunings.

Generate condensed images from file.pt

Hi VICO-UoE,

Nice work!

I have tried the code and the training works so well.

But may I ask how to extract the generated images from the .pt file?

Thanks in advance!

k-center baseline results

hi! thanks for your awesome works thus far in DC.
I am trying to replicate the reported k-center baseline results in the paper and was wondering if you could point me to the code base/pseudocode which you used.

为什么多卡训练DM的时候embed将显存都集中在了主卡上

` if 'BN' not in args.model: # for ConvNet
loss = torch.tensor(0.0).to(args.device)
for c in range(num_classes):
img_real = get_images(c, args.batch_real)
img_syn = image_syn[c*args.ipc:(c+1)*args.ipc].reshape((args.ipc, channel, im_size[0], im_size[1]))

                if args.dsa:
                    seed = int(time.time() * 1000) % 100000
                    img_real = DiffAugment(img_real, args.dsa_strategy, seed=seed, param=args.dsa_param)
                    img_syn = DiffAugment(img_syn, args.dsa_strategy, seed=seed, param=args.dsa_param)

                output_real = embed(img_real).detach()
                output_syn = embed(img_syn)

                loss += torch.sum((torch.mean(output_real, dim=0) - torch.mean(output_syn, dim=0))**2)`

inner_loop and outer_loop

Hello author, in your papaer, the outer-loop is K and the inner_loop is T, but why in the code inner_loop the number of times the neural network is updated?

different Figures from README

Hi, I tried to recover the the synthetic images from the dataset you offered in Google Drive. These are what I got:
syn0-0-0-0
syn0-1-0-0
syn4-8-0-8
Dataset name: DC_MNIST_ConvNet_1ipc.pt
I can identify them as 0,1and 8. However, the background is white or grey. Is there anything wrong I did?

Thank you!

Code for running the herding baselines

I am trying to run the baseline for herding, but I see that the codebase pulls preprocessed versions of the dataset from google drive. Could you share the scripts used to run the herding algorithm?

learning rate

The experiments in the paper should be based on CIFAR10 and Convnet, and the lr_img and lr_net are set for these two by default, right? If I want to switch to vgg11BN and ResNet18BN_AP, what should I adjust the learning rates to for better performance? Thank you.

Question about condensed data for continual learning

Thanks for sharing the codes and it is an amazing work.

May I ask a question about the experiments for the paper Dataset Condensation with Distribution Match?
More specifically how do you condense the dataset at each step for continual learning.

Take the 5-step one as an example, for cifar100, each step contains 20 new classes and the images per class is 20, so each step you have 400 images in total. Then, my question is what is the set you used to condense on into these 400 images? Is it the original 10,000 images for the same 20 classes? (for cifar100, there are 500 training images per class)?

Or you did in another way? If so, do you mind elaborating on this.

Thanks.

Hyperparams for large synthetic sets

Congratulations on this interesting work. It seems that in the code you define the hyperparams only for the dataset sizes that appear in the paper (up to 50 ipc), would it be possible to provide the hyperparams for the results reported in your ICLR comments to reviewers? (with 100, 200, 500, 1000 condensed images per class).

Thank you in advance!

DM synthetic images on ResNet-18

Hi,

Thanks for the work. I follow the experimental setting and generate 1 condensed image per class for MNIST with ResNet-18 using Group Normalization with DSA augmentation. However, the test accuracy is about 10% ~ 20%. I've read the other issues about ResNet-18. I wonder if it is normal, or if I can continue to improve the test accuracy.

Here are my hyperparameter settings.

method=DM, dataset=MNIST, batch_real=64, dis_metric='ours', dsa_strategy='color_crop_cutout_scale_rotate', init='real', ipc=1, iter=20000, lr_img=1.0, batch_train=64, lr_net=0.01

Furthermore I want to run experiments on medical image classification datasets, such as ISIC-2020, EyePACS. Would you please give some advice on how to set iteration and lr_img hyperparameters? Should I keep using ResNet-18 as backbone?

I would appreciate it if you answer my questions.

a question about hyperparameter settings

Hi, thanks for the great work. I try to follow the experimental setting and generate 1 condensed image per class for CIFAR10 with ResNet18BN_AP without data augmentation. However, the test accuracy is only 16%. How should I set the hyperparameters for the ResNet network?
Hyper-parameters: {method: DC, dataset: CIFAR10, model: ResNet18BN_AP, ipc: 1, eval_mode: S, num_exp: 5, num_eval: 20, epoch_eval_train: 300, Iteration: 1000, lr_img: 0.1, lr_net: 0.01, batch_real: 256, batch_train: 256, init: noise, dsa_strategy: None, data_path: data/CIFAR10, save_path: result, dis_metric: ours, outer_loop: 1, inner_loop: 1, device: cuda, dsa: False}

RuntimeError: unsupported operation: some elements of the input tensor and the written-to tensor refer to a single memory location. Please clone() the tensor before performing the operation.

When using Dataset Condensation with Differentiable Siamese Augmentation network for training cifar 10 with ipc =1.
I am getting an error.

Evaluation
model_train = ConvNet, model_eval = ConvNet, iteration = 0
DSA augmentation strategy: 
 color_crop_cutout_flip_scale_rotate
DSA augmentation parameters: 
 {'aug_mode': 'S', 'prob_flip': 0.5, 'ratio_scale': 1.2, 'ratio_rotate': 15.0, 'ratio_crop_pad': 0.125, 'ratio_cutout': 0.5, 'brightness': 1.0, 'saturation': 2.0, 'contrast': 0.5}
/home/ece/anaconda3/envs/distillation/lib/python3.9/site-packages/torch/nn/functional.py:4255: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
  warnings.warn(
/home/ece/anaconda3/envs/distillation/lib/python3.9/site-packages/torch/nn/functional.py:4193: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
  warnings.warn(
/home/ece/anaconda3/envs/distillation/lib/python3.9/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  /opt/conda/conda-bld/pytorch_1646756402876/work/aten/src/ATen/native/TensorShape.cpp:2228.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
[2023-02-06 17:12:26] Evaluate_00: epoch = 1000 train time = 3 s train loss = 0.000725 train acc = 1.0000, test acc = 0.1447
[2023-02-06 17:12:31] Evaluate_01: epoch = 1000 train time = 3 s train loss = 0.003311 train acc = 1.0000, test acc = 0.1494
[2023-02-06 17:12:35] Evaluate_02: epoch = 1000 train time = 3 s train loss = 0.001446 train acc = 1.0000, test acc = 0.1440
[2023-02-06 17:12:40] Evaluate_03: epoch = 1000 train time = 3 s train loss = 0.000057 train acc = 1.0000, test acc = 0.1455
[2023-02-06 17:12:44] Evaluate_04: epoch = 1000 train time = 3 s train loss = 0.000042 train acc = 1.0000, test acc = 0.1444
Evaluate 5 random ConvNet, mean = 0.1456 std = 0.0020
-------------------------
Traceback (most recent call last):
  File "/mnt/8ec88946-510d-4eb2-925c-16cccd63436b/shubham/Piyush/ebm-distillation/baseline/DatasetCondensation/main_DM.py", line 215, in <module>
    main()
  File "/mnt/8ec88946-510d-4eb2-925c-16cccd63436b/shubham/Piyush/ebm-distillation/baseline/DatasetCondensation/main_DM.py", line 158, in main
    img_syn = DiffAugment(img_syn, args.dsa_strategy, seed=seed, param=args.dsa_param)
  File "/mnt/8ec88946-510d-4eb2-925c-16cccd63436b/shubham/Piyush/ebm-distillation/baseline/DatasetCondensation/utils.py", line 516, in DiffAugment
    x = f(x, param)
  File "/mnt/8ec88946-510d-4eb2-925c-16cccd63436b/shubham/Piyush/ebm-distillation/baseline/DatasetCondensation/utils.py", line 561, in rand_flip
    randf[:] = randf[0]
RuntimeError: unsupported operation: some elements of the input tensor and the written-to tensor refer to a single memory location. Please clone() the tensor before performing the operation.

how do you calculate the mean and std? It seems that it is different when using dataset to calculate

def get_dataset(dataset, data_path):
if dataset == 'MNIST':
channel = 1
im_size = (28, 28)
num_classes = 10
mean = [0.1307]
std = [0.3081]
transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=mean, std=std)])
dst_train = datasets.MNIST(data_path, train=True, download=True, transform=transform) # no augmentation
dst_test = datasets.MNIST(data_path, train=False, download=True, transform=transform)
class_names = [str(c) for c in range(num_classes)]

elif dataset == 'FashionMNIST':
    channel = 1
    im_size = (28, 28)
    num_classes = 10
    mean = [0.2861]
    std = [0.3530]
    transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=mean, std=std)])
    dst_train = datasets.FashionMNIST(data_path, train=True, download=True, transform=transform) # no augmentation
    dst_test = datasets.FashionMNIST(data_path, train=False, download=True, transform=transform)
    class_names = dst_train.classes

elif dataset == 'SVHN':
    channel = 3
    im_size = (32, 32)
    num_classes = 10
    mean = [0.4377, 0.4438, 0.4728]
    std = [0.1980, 0.2010, 0.1970]
    transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=mean, std=std)])
    dst_train = datasets.SVHN(data_path, split='train', download=True, transform=transform)  # no augmentation
    dst_test = datasets.SVHN(data_path, split='test', download=True, transform=transform)
    class_names = [str(c) for c in range(num_classes)]

elif dataset == 'CIFAR10':
    channel = 3
    im_size = (32, 32)
    num_classes = 10
    mean = [0.4914, 0.4822, 0.4465]
    std = [0.2023, 0.1994, 0.2010]
    transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=mean, std=std)])
    dst_train = datasets.CIFAR10(data_path, train=True, download=True, transform=transform) # no augmentation
    dst_test = datasets.CIFAR10(data_path, train=False, download=True, transform=transform)
    class_names = dst_train.classes

elif dataset == 'CIFAR100':
    channel = 3
    im_size = (32, 32)
    num_classes = 100
    mean = [0.5071, 0.4866, 0.4409]
    std = [0.2673, 0.2564, 0.2762]
    transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=mean, std=std)])
    dst_train = datasets.CIFAR100(data_path, train=True, download=True, transform=transform) # no augmentation
    dst_test = datasets.CIFAR100(data_path, train=False, download=True, transform=transform)
    class_names = dst_train.classes

Could you please release the synthetic Cifar10

Hi, thanks for the great work. Could you please release the synthetic Cifar10 trained on ConvNet or ResNet-18, with 10/50 imgs/class? This would be greatful since I was trying to use the synthetic data to conduct some downstream tasks. Thanks.

About TSNSE in DM

Hello,
In Figure3 T-SNSE of the DM paper, how to extract the features of synthetic images,does it extract features from a model trained on whole dataset or from a model trained on synthetic images?
Thanks.

The loss does not decrease on ResNet18 with CIFAR10

Hi Patrick. I tried run your code on ResNet18 with CIFAR10 and the setting is following:

Hyper-parameters: {'method': 'DC', 'dataset': 'CIFAR10', 'model': 'ResNet18', 'ipc': 50, 'eval_mode': 'S', 'num_exp': 1, 'num_eval': 3, 'epoch_eval_train': 300, 'Iteration': 1000, 'lr_img': 0.1, 'lr_net': 0.01, 'batch_real': 500, 'batch_train': 7000, 'init': 'noise', 'dsa_strategy': 'None', 'data_path': 'data', 'save_path': 'result', 'dis_metric': 'ours', 'outer_loop': 50, 'inner_loop': 10, 'device': 'cuda', 'dsa_param': <utils.ParamDiffAug object at 0x7f75704a9890>, 'dsa': False}

The loss is like this:
iter = 0000, loss = 3493.9713
iter = 0500, loss = 3476.0204
iter = 0990, loss = 3391.6486

And envaluation result is like this:
Run 1 experiments, train on ResNet18, evaluate 3 random ResNet18, mean = 12.46% std = 0.33%

Did you do the same experiment on ResNet18? Do you have any suggestions on this?
Thank you!

Experiments on NAS

Hi, I found the experiments on neural architecture search very interesting. I try to follow the experimental setting but do it on NAS-Bench-201. I use the Cifar10_ConvNet_10ipc synthetic data, train each network 200 epochs without data augmentation, learning rate = 0.01 and decay by 10 at 100epoch. Surprisingly, I found the validation accuracy is negtively correlated with the grouth truth accuracy (Kendall's tau is around -0.3). Have you ever tried to do the experiments on NAS benchmarks? Does this imply the ConvNet generated synthetic data cannot generalize well to various network structure? Thanks very much for your help.

DM Synthesized Images

Hi,

Thanks for putting together this amazing project. I found the shared syn datasets very useful!
Do you plan to add DM generated syn images to the shared folder any time in the future ?

Thanks!

Reproduction for distribution matching with IPC=50

Hi, I'm gihyun kim interested to your research and codes. I read some papers and the DM method shows 63% accuracy on CIFAR10 with ipc=50. However, I can not reproduce the performance by your code somehow, only got 57% accuracy.

I use default setting of argument except the number of experiments and number of evaluation, which I set 1 and 5 each.

Can you let me know how to reproduce your performance?

Thank you.

Are there additional data augmentations when training on synthetic data

Dear authors, I have a quick question about training networks using the synthetic data. Did you apply data augmentations (such as flip, randomcrop, etc.) to the synthetic images or you just use the original synthetic images (let's say 10pic/class then that would be the same 100 images in each iteration)? Thanks for your help.

How to use DM with ResNet18BN

Hi, I want to use DM with ResNet18BN and test in the ResNet18BN, but the performance is poor e.g. 12%(worse than random selection which is 14.6% in your report) under the setting where dataset=cifar100, ipc=10. I only replace the --model parameter. I don't know if that's normal. Do I need to change other hyperparameters?. Thanks very much for your replay.

Learned samples in each step K

Hey, great paper! I'm just curious, do you have the synthetic data (or performance) from each step of K? I would expect that in each step, after the weights are resampled, that in early iterations the gradients look really different from later batches (steps T). I'm surprised that the data isn't completely changed after each resample. Thanks!

hyperparameters for CIFAR100

Hi
It is nice work!
I want to know hyperparameters or any other settings for learning CIFAR100.
In DM paper, I saw you generated 20 images/class on CIFAR100 for continual learning.
I will try to generate synthetic images (20 images/class on CIFAR100) using DC method.
Thanks.

Use the code for other dataset for multioutput classification task

Hello,

I hope this message finds you well. I am currently working on a project involving multioutput classification, and I am interested in using your code (specifically the part related to dataset distillation) for my task. However, I have a few questions and clarifications I would like to seek your guidance on.

I am aiming to apply dataset distillation techniques to MAAD_FACE dataset for a multioutput classification task. Your repository has been a great resource, and I believe your code could significantly enhance the performance of my model.

Thank you for your time and assistance. I look forward to your guidance and suggestions on this matter.

Best regards,

Code for Continual learning applications

Thanks for the great works, I would like to ask where can we find the code for task incremental learning applications conducted in your first two papers (SVHN→MNIST→USPS). It seems like the current CL_DM.py only works for class incremental learning setups in Distribution Matching paper.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.