Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visionds #54

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
135bdf0
feat: modify simclr code to include birds
bwbelljr Feb 16, 2021
a1dbb32
chore: add root_dir for storing results
bwbelljr Feb 16, 2021
7d9c5b7
chore: change directory to see if config works
bwbelljr Feb 17, 2021
5697312
fix: add dataset class for birds
bwbelljr Feb 17, 2021
2c43e5f
fix: add birds class (really)
bwbelljr Feb 17, 2021
03b1102
fix: add `get_image` method to Birds
bwbelljr Feb 17, 2021
b30b524
fix: create right path to birds dataset
bwbelljr Feb 17, 2021
5cea2f9
fix: get birds dataset from Birds class
bwbelljr Feb 17, 2021
107938a
fix: add 'birds' to `db_names`
bwbelljr Feb 17, 2021
9cd4711
feat: add train/test split script to repo
bwbelljr Feb 17, 2021
ee03022
feat: create config file for SCAN
bwbelljr Feb 17, 2021
c6a77cb
feat: add config file for self-labeling
bwbelljr Feb 17, 2021
3d48c88
chore: choose hyperparameters
bwbelljr Feb 18, 2021
8c2f0e5
feat: add MNIST dataset
bwbelljr Mar 2, 2021
e6fecc9
fix: address indent error
bwbelljr Mar 2, 2021
f5ca594
fix: add MyPath to import
bwbelljr Mar 2, 2021
31fc871
fix: add missing code to mnist data class
bwbelljr Mar 2, 2021
7932544
fix: fix __getitem__ in mnist data class
bwbelljr Mar 2, 2021
bc4dc61
fix: selected correct resnet backbone
bwbelljr Mar 2, 2021
eff5f72
feat: add scan, selflabel configs for mnist
bwbelljr Mar 2, 2021
3ac48e3
fix: add `get_image` and reduce # epochs
bwbelljr Mar 3, 2021
cf1c5e9
feat: use VisionDataset for MNIST class
bwbelljr Mar 4, 2021
d1681e1
fix: remove [docs] from mnist dataset class
bwbelljr Mar 4, 2021
5f27c82
fix: torchvision.datasets.vision
bwbelljr Mar 4, 2021
b70e3a9
fix: __init__ params
bwbelljr Mar 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/env.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
root_dir: /path/where/to/store/results/
root_dir: /content/data/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better live unchanged

57 changes: 57 additions & 0 deletions configs/pretext/simclr_birds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Setup
setup: simclr

# Model
backbone: resnet50
model_kwargs:
head: mlp
features_dim: 2048

# Dataset
train_db_name: birds
val_db_name: birds
num_classes: 200

# Loss
criterion: simclr
criterion_kwargs:
temperature: 0.07

# Hyperparameters
epochs: 100
optimizer: sgd
optimizer_kwargs:
nesterov: False
weight_decay: 0.0001
momentum: 0.9
lr: 0.005625
scheduler: cosine
scheduler_kwargs:
lr_decay_rate: 0.1
batch_size: 48
num_workers: 8

# Transformations
augmentation_strategy: simclr
augmentation_kwargs:
random_resized_crop:
size: 224
scale: [0.2, 1.0]
color_jitter_random_apply:
p: 0.8
color_jitter:
brightness: 0.4
contrast: 0.4
saturation: 0.4
hue: 0.1
random_grayscale:
p: 0.2
normalize:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

transformation_kwargs:
crop_size: 224
normalize:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
57 changes: 57 additions & 0 deletions configs/pretext/simclr_mnist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Setup
setup: simclr

# Model
backbone: resnet18
model_kwargs:
head: mlp
features_dim: 128

# Dataset
train_db_name: mnist
val_db_name: mnist
num_classes: 10

# Loss
criterion: simclr
criterion_kwargs:
temperature: 0.1

# Hyperparameters
epochs: 5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why epoch=5?
All other yml used 500.
It give bad results training "as is":
{'ACC': 0.1135, 'ARI': 0.0, 'NMI': 6.755387526067596e-16, 'ACC Top-5': 0.5134, 'hungarian_match': [(0, 0), (1, 9), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 1)]}
Did you achieve good result in one of experiments?

optimizer: sgd
optimizer_kwargs:
nesterov: False
weight_decay: 0.0001
momentum: 0.9
lr: 0.4
scheduler: cosine
scheduler_kwargs:
lr_decay_rate: 0.1
batch_size: 48
num_workers: 8

# Transformations
augmentation_strategy: simclr
augmentation_kwargs:
random_resized_crop:
size: 32
scale: [0.2, 1.0]
color_jitter_random_apply:
p: 0.8
color_jitter:
brightness: 0.4
contrast: 0.4
saturation: 0.4
hue: 0.1
random_grayscale:
p: 0.2
normalize:
mean: [0.5]
std: [0.5]

transformation_kwargs:
crop_size: 32
normalize:
mean: [0.5]
std: [0.5]
59 changes: 59 additions & 0 deletions configs/scan/scan_birds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# setup
setup: scan

# Loss
criterion: scan
criterion_kwargs:
entropy_weight: 5.0

# Model
backbone: resnet50

# Weight update
update_cluster_head_only: True # Train only linear layer during SCAN
num_heads: 10 # Use multiple heads

# Dataset
train_db_name: birds
val_db_name: birds
num_classes: 200
num_neighbors: 50

# Transformations
augmentation_strategy: simclr
augmentation_kwargs:
random_resized_crop:
size: 224
scale: [0.2, 1.0]
color_jitter_random_apply:
p: 0.8
color_jitter:
brightness: 0.4
contrast: 0.4
saturation: 0.4
hue: 0.1
random_grayscale:
p: 0.2
normalize:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

transformation_kwargs:
crop_size: 224
normalize:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

# Hyperparameters
optimizer: sgd
optimizer_kwargs:
lr: 5.0
weight_decay: 0.0000
nesterov: False
momentum: 0.9
epochs: 10
batch_size: 32
num_workers: 8

# Scheduler
scheduler: constant
51 changes: 51 additions & 0 deletions configs/scan/scan_mnist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# setup
setup: scan

# Loss
criterion: scan
criterion_kwargs:
entropy_weight: 5.0

# Weight update
update_cluster_head_only: False # Update full network in SCAN
num_heads: 1 # Only use one head

# Model
backbone: resnet18

# Dataset
train_db_name: mnist
val_db_name: mnist
num_classes: 10
num_neighbors: 20

# Transformations
augmentation_strategy: ours
augmentation_kwargs:
crop_size: 32
normalize:
mean: [0.5]
std: [0.5]
num_strong_augs: 4
cutout_kwargs:
n_holes: 1
length: 16
random: True

transformation_kwargs:
crop_size: 32
normalize:
mean: [0.5]
std: [0.5]

# Hyperparameters
optimizer: adam
optimizer_kwargs:
lr: 0.0001
weight_decay: 0.0001
epochs: 5
batch_size: 48
num_workers: 8

# Scheduler
scheduler: constant
56 changes: 56 additions & 0 deletions configs/selflabel/selflabel_birds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# setup
setup: selflabel

# Threshold
confidence_threshold: 0.99

# EMA
use_ema: True
ema_alpha: 0.999

# Loss
criterion: confidence-cross-entropy
criterion_kwargs:
apply_class_balancing: False

# Model
backbone: resnet50
num_heads: 1

# Dataset
train_db_name: birds
val_db_name: birds
num_classes: 200

# Transformations
augmentation_strategy: ours
augmentation_kwargs:
crop_size: 224
normalize:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
num_strong_augs: 4
cutout_kwargs:
n_holes: 1
length: 75
random: True

transformation_kwargs:
crop_size: 224
normalize:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]

# Hyperparameters
optimizer: sgd
optimizer_kwargs:
lr: 0.03
weight_decay: 0.0
nesterov: False
momentum: 0.9
epochs: 10
batch_size: 32
num_workers: 8

# Scheduler
scheduler: constant
53 changes: 53 additions & 0 deletions configs/selflabel/selflabel_mnist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# setup
setup: selflabel

# ema
use_ema: False

# Threshold
confidence_threshold: 0.99

# Criterion
criterion: confidence-cross-entropy
criterion_kwargs:
apply_class_balancing: True

# Model
backbone: resnet18
num_heads: 1

# Dataset
train_db_name: mnist
val_db_name: mnist
num_classes: 10

# Transformations
augmentation_strategy: ours
augmentation_kwargs:
crop_size: 32
normalize:
mean: [0.5]
std: [0.5]
num_strong_augs: 4
cutout_kwargs:
n_holes: 1
length: 16
random: True

transformation_kwargs:
crop_size: 32
normalize:
mean: [0.5]
std: [0.5]

# Hyperparameters
epochs: 5
optimizer: adam
optimizer_kwargs:
lr: 0.0001
weight_decay: 0.0001
batch_size: 48
num_workers: 8

# Scheduler
scheduler: constant
Loading