This page describes the setup to run experiments.
To set up the Conda environment for running experiments, follow these steps:
-
Ensure you have Conda installed on your system. If not, you can download and install it from here.
-
Run the following command to create the Conda environment in the VI-Net directory:
conda env create -f environment.yaml
-
Activate the newly created environment:
conda activate icml_vinet
Next you need to setup a free account on weights and biases see [https://wandb.ai/site/][https://wandb.ai/site/]. This will be used to save model weights etc.
Note that we used an internal Caching module for the dataset caching for our experiments which we can unfortunately not share. Therefore one can currently only run experiments on CIFAR10 and CIFAR100, rather than all ImageNet Tiny.
To train a baseline we create a sweep with the sweep script. First make it executable.
chmod +x sweep.shYou can now use this script to create a sweep for training a ResNet18 on CIFAR10 as follows.
./sweep.sh \
--seed 42 \
--model local_resnet18 \
--pretrained false \
--use_artifact false \
--num_classes 10 \
--linear_layer_name fc \
--spatial_reduction_factor 1 \
--fc_squeeze_linear true \
--flatten true \
--epochs 100 \
--checkpoint_metric val_acc \
--save_checkpoints false \
--save_last_checkpoint true \
--top_k_checkpoints 3 \
--optimizer sgd \
--gradient_clip false \
--lr 0.01 \
--weight_decay 0.00005 \
--momentum 0.9 \
--nesterov true \
--lr_linear_decay true \
--lr_scheduler linear \
--warmup_fraction 0.05 \
--log_wandb true \
--use_amp false \
--amp_bf16 false \
--gradient_checkpointing false \
--dropout_rate 0.0 \
--dataset cifar10 \
--batch_size 256 \
--val_split 0.05 \
--random_horizontal_flip true \
--img_format BCHW \
--psi 0.1 \
--decay_factor 1 \
--max_pols_per_class 10 \
--max_monomials 10000 \
--oavi_batch_size 256 \
--oavi_oracle ABM \
--aggregation concat \
--batch_norm true \
--combine true \
--max_oavi_parallel_jobs 2 \
--freeze_coefficients false \
--freeze_non_zero false \
--partition pca \
--pca_components 128 \
--partition_spatial_pca 1 \
--max_pool 1 \
--max_degree 5 \
--subsample_size_vanishing 512 \
--polynomial_prune false \
--monomial_prune false \
--load_project VI-Net-baseline-cifar10 \
--load_layer_extract layer4.1.bn1 \
--experiment baseline \
--full_local true \
--project_name VI-Net-baseline-cifar10_rebuttalThis will then yield an output of the form
wandb: Creating sweep from: sweep.yaml
wandb: Creating sweep with ID: 12345678
wandb: View sweep at: https://wandb.ai/user-name/project/sweeps/12345678
wandb: Run sweep agent with: wandb agent user-name/project/12345678
Then run the sweep with the generated command as above. The model will be trained and stored in the project VI-Net-baseline-cifar10_rebuttal.
To train the VI-Net one creates again a sweep and runs it. For the CIFAR10, one would run
./sweep.sh \
--seed 42 \
--model local_resnet18 \
--pretrained false \
--use_artifact false \
--num_classes 10 \
--linear_layer_name fc \
--spatial_reduction_factor 1 \
--fc_squeeze_linear true \
--flatten true \
--epochs 20 \
--checkpoint_metric val_acc \
--save_checkpoints false \
--save_last_checkpoint true \
--top_k_checkpoints 3 \
--optimizer sgd \
--gradient_clip false \
--lr 0.01 \
--weight_decay 0.00005 \
--momentum 0.9 \
--nesterov true \
--lr_linear_decay true \
--lr_scheduler linear \
--warmup_fraction 0.05 \
--log_wandb true \
--use_amp false \
--amp_bf16 false \
--gradient_checkpointing false \
--dropout_rate 0.0 \
--dataset cifar10 \
--batch_size 256 \
--val_split 0.05 \
--random_horizontal_flip true \
--img_format BCHW \
--psi 0.1 \
--decay_factor 1 \
--max_pols_per_class 10 \
--max_monomials 10000 \
--oavi_batch_size 256 \
--oavi_oracle ABM \
--aggregation concat \
--batch_norm true \
--combine true \
--max_oavi_parallel_jobs 2 \
--freeze_coefficients false \
--freeze_non_zero false \
--partition pca \
--pca_components 128 \
--partition_spatial_pca 1 \
--max_pool 1 \
--max_degree 5 \
--subsample_size_vanishing 512 \
--polynomial_prune false \
--monomial_prune false \
--load_project VI-Net-baseline-cifar10_rebuttal \
--load_layer_extract layer4.1.bn1 \
--experiment vinet \
--full_local true \
--project_name VI-Net-vinet-cifar10_rebuttalFor CIFAR-10:
- ResNet-18:
local_resnet18 - ResNet-34:
local_resnet34 - ResNet-50:
local_resnet50
For CIFAR-100:
- ResNet-18:
local_resnet18_cifar100 - ResNet-34:
local_resnet34_cifar100 - ResNet-50:
local_resnet50_cifar100
- CIFAR10:
cifar10 - CIFAR100:
cifar100
Also make sure that num_classes matches the number of classes of the dataset.
- VI-Net:
vinet - Baseline model:
baseline - Inference test:
performance - Linear baseline:
linear