Deep-SVDD-PyTorch icon indicating copy to clipboard operation
Deep-SVDD-PyTorch copied to clipboard

Performance of DeepSVDD in cifar10

Open HelloSeeing opened this issue 5 years ago • 10 comments

Hi,

Thanks for sharing your source code! I clone this repository and run the experiment of cifar10 with digit 6 as the known class samples by the following command:

python main.py \
    cifar10 \
    cifar10_LeNet \
    ../log/cifar10_test \
    ../data \
    --objective one-class \
    --lr 0.0001 \
    --n_epochs 150 \
    --lr_milestone 50 \
    --batch_size 200 \
    --weight_decay 0.5e-6 \
    --pretrain True \
    --ae_lr 0.0001 \
    --ae_n_epochs 350 \
    --ae_lr_milestone 250 \
    --ae_batch_size 200 \
    --ae_weight_decay 0.5e-6 \
    --normal_class 7

However, the result is:

INFO:root:Training time: 183.387
INFO:root:Finished training.
INFO:root:Starting testing...
INFO:root:Testing time: 1.911
INFO:root:Test set AUC: 60.59%
INFO:root:Finished testing.

Could you please help me with this?

HelloSeeing avatar Jun 16 '19 10:06 HelloSeeing

@HelloSeeing Hi, When I run this code ,some errors occurred.

python main.py cifar10 cifar10_LeNet ../log/cifar10_test ../data --objective one-class --lr 0.0001 --n_epochs 150 --lr_milestone 50 --batch_size 200 --weight_decay 0.5e-6 --pretrain True --ae_lr 0.0001 --ae_n_epochs 350 --ae_lr_milestone 250 --ae_batch_size 200 --ae_weight_decay 0.5e-6 --normal_class 7 INFO:root:Log file is ../log/cifar10_test/log.txt. INFO:root:Data path is ../data. INFO:root:Export path is ../log/cifar10_test. INFO:root:Dataset: cifar10 INFO:root:Normal class: 7 INFO:root:Network: cifar10_LeNet INFO:root:Deep SVDD objective: one-class INFO:root:Nu-paramerter: 0.10 INFO:root:Computation device: cpu INFO:root:Number of dataloader workers: 0 Files already downloaded and verified Traceback (most recent call last): File "main.py", line 192, in <module> main() File "E:\anaconda\envs\CenterNet\lib\site-packages\click\core.py", line 764, in __call__ return self.main(*args, **kwargs) File "E:\anaconda\envs\CenterNet\lib\site-packages\click\core.py", line 717, in main rv = self.invoke(ctx) File "E:\anaconda\envs\CenterNet\lib\site-packages\click\core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "E:\anaconda\envs\CenterNet\lib\site-packages\click\core.py", line 555, in invoke return callback(*args, **kwargs) File "main.py", line 114, in main dataset = load_dataset(dataset_name, data_path, normal_class) File "D:\Deep-SVDD\src\datasets\main.py", line 17, in load_dataset dataset = CIFAR10_Dataset(root=data_path, normal_class=normal_class) File "D:\Deep-SVDD\src\datasets\cifar10.py", line 43, in __init__ train_idx_normal = get_target_label_idx(train_set.train_labels, self.normal_classes) AttributeError: 'MyCIFAR10' object has no attribute 'train_labels'

Can you help me? Thanks a lot!

coderKyf avatar Aug 07 '19 06:08 coderKyf

@coderKyf Did you run your code under the virtual environment provided?

HelloSeeing avatar Aug 07 '19 09:08 HelloSeeing

@HelloSeeing Yes, I had run this code in mnist successfully.

coderKyf avatar Aug 07 '19 10:08 coderKyf

@coderKyf I think you could check the version of your installed torchvision is 0.2.1 or not. In addition, I think you should check all versions of packages listed in requirements.txt

HelloSeeing avatar Aug 07 '19 10:08 HelloSeeing

@HelloSeeing Thanks a lot. Torchvision is not 0.2.1. Thanks.

coderKyf avatar Aug 07 '19 13:08 coderKyf

@coderKyf Could you please share me with results of your experiments on cifar10? Thanks!

HelloSeeing avatar Aug 07 '19 15:08 HelloSeeing

@HelloSeeing From class 0 to 9 are 59.51% 61.12% 62.05% 58.73% 56.57% 61.57% 57.20% 62.60% 76.44% 68.45%

Maybe it would be better to change the hyperparameters.

coderKyf avatar Aug 09 '19 13:08 coderKyf

@coderKyf Thanks!

HelloSeeing avatar Aug 10 '19 05:08 HelloSeeing

@coderKyf Hello, is each normal class result under the same hyperparameter or adjust some when change the normal class?

TabGuigui avatar Aug 11 '21 14:08 TabGuigui

@HelloSeeing From class 0 to 9 are 59.51% 61.12% 62.05% 58.73% 56.57% 61.57% 57.20% 62.60% 76.44% 68.45%

Maybe it would be better to change the hyperparameters.

i didnt think so. the average AUC ROC i got was 61.8% of one class and 60.8% of soft boundary. maybe its unable to get the same data of paper

crazyn2 avatar Apr 14 '23 06:04 crazyn2