-
Notifications
You must be signed in to change notification settings - Fork 4
/
mv_ssl.py
140 lines (121 loc) · 4.44 KB
/
mv_ssl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
from config.experiments.base_experiments import *
from config.templates.models import eamc, mvscn, simvc_comvc, mvae, mviic
from config.templates.fusion import WeightedMean
# ======================================================================================================================
# EAMC
#
# EAMC w/o MV-SSL corresponds to SiMVC with fixed fusion weights, and DDC2Flipped instead of DDC2
# ======================================================================================================================
ablmvssl_noisymnist_eamc = NoisyMNISTExperiment(
model_config=simvc_comvc.SiMVC(
encoder_configs=NOISY_MNIST_ENCODERS,
fusion_config=WeightedMean(trainable_weights=False),
loss_config=eamc.EAMCLoss(
funcs="DDC1|DDC2Flipped|DDC3",
weights=[1.0, 1.0, 1.0]
)
),
wandb_tags="ablation,mv-ssl"
)
ablmvssl_caltech7_eamc = Caltech7Experiment(
model_config=simvc_comvc.SiMVC(
encoder_configs=CALTECH_ENCODERS,
fusion_config=WeightedMean(trainable_weights=False),
loss_config=eamc.EAMCLoss(
funcs="DDC1|DDC2Flipped|DDC3",
weights=[1.0, 1.0, 1.0]
)
),
wandb_tags="ablation,mv-ssl"
)
# ======================================================================================================================
# MVSCN
# ======================================================================================================================
ablmvssl_noisymnist_mvscn = NoisyMNISTExperiment(
model_config=mvscn.MvSCN(
encoder_configs=NOISY_MNIST_ENCODERS,
head_configs=encoder.Encoder(layers=[layers.Dense(n_units=10)]),
loss_config=mvscn.MVSCNLoss(
funcs="MVSCN1",
weights=[1.0],
),
siam_dir="noisymnist_siam-28j69fly/run-0",
),
wandb_tags="ablation,mv-ssl"
)
ablmvssl_caltech7_mvscn = Caltech7Experiment(
model_config=mvscn.MvSCN(
encoder_configs=CALTECH_ENCODERS,
head_configs=encoder.Encoder(layers=[layers.Dense(n_units=10)]),
loss_config=mvscn.MVSCNLoss(
funcs="MVSCN1",
weights=[1.0],
),
siam_dir="caltech7_siam-2vrj0cvd/run-0",
),
wandb_tags="ablation,mv-ssl"
)
# ======================================================================================================================
# Multi-VAE
#
# Multi-VAE without MV-SSL is essentially a randomly initialized network: Not trained since all losses are MV-SSL
# losses.
# ======================================================================================================================
ablmvssl_noisymnist_mvae = NoisyMNISTExperiment(
model_config=mvae.MultiVAE(
encoder_configs=NOISY_MNIST_ENCODERS,
decoder_configs=NOISY_MNIST_DECODERS,
loss_config=mvae.MultiVAELoss(
funcs="Zero",
weights=None
)
),
batch_size=64,
num_sanity_val_steps=0,
wandb_tags="ablation,mv-ssl",
n_epochs=0,
)
ablmvssl_caltech7_mvae = Caltech7Experiment(
model_config=mvae.MultiVAE(
encoder_configs=CALTECH_ENCODERS,
decoder_configs=CALTECH_DECODERS,
loss_config=mvae.MultiVAELoss(
funcs="Zero",
weights=None
)
),
batch_size=64,
num_sanity_val_steps=0,
wandb_tags="ablation,mv-ssl",
n_epochs=0,
)
# ======================================================================================================================
# MvIIC
# ======================================================================================================================
CLUSTERING_HEAD = lambda n_clusters: encoder.Encoder(layers=[layers.Dense(n_units=n_clusters)])
ablmvssl_noisymnist_mviic = NoisyMNISTExperiment(
model_config=mviic.MvIIC(
encoder_configs=NOISY_MNIST_ENCODERS,
clustering_head_config=CLUSTERING_HEAD(10),
overclustering_head_config=None,
n_overclustering_heads=0,
loss_config=mviic.MvIICLoss(
funcs="IICClustering",
weights=None
)
),
wandb_tags="ablation,mv-ssl",
)
ablmvssl_caltech7_mviic = Caltech7Experiment(
model_config=mviic.MvIIC(
encoder_configs=CALTECH_ENCODERS,
clustering_head_config=CLUSTERING_HEAD(7),
overclustering_head_config=None,
n_overclustering_heads=0,
loss_config=mviic.MvIICLoss(
funcs="IICClustering",
weights=None
)
),
wandb_tags="ablation,mv-ssl",
)