(label_amount)
| 176 | |
| 177 | # prepare the configuration for baseline model, use_penalty == False |
| 178 | def exp_baseline(label_amount): |
| 179 | config_file = r'./config/' |
| 180 | save_path = r'./saved_models/' |
| 181 | |
| 182 | if not os.path.exists(config_file): |
| 183 | os.mkdir(config_file) |
| 184 | if not os.path.exists(save_path): |
| 185 | os.mkdir(save_path) |
| 186 | |
| 187 | algs = ['flexmatch', 'fixmatch', 'uda', 'pseudolabel', 'fullysupervised', 'remixmatch', 'mixmatch', 'meanteacher', |
| 188 | 'pimodel', 'vat', 'freematch', 'freematch_entropy', 'softmatch'] |
| 189 | datasets = ['cifar10', 'cifar100', 'svhn', 'stl10', 'imagenet'] |
| 190 | # datasets = ['imagenet'] |
| 191 | # seeds = [1, 11, 111] |
| 192 | seeds = [0] # 1, 22, 333 |
| 193 | |
| 194 | dist_port = range(10001, 11120, 1) |
| 195 | count = 0 |
| 196 | |
| 197 | for alg in algs: |
| 198 | for dataset in datasets: |
| 199 | for seed in seeds: |
| 200 | # change the configuration of each dataset |
| 201 | if dataset == 'cifar10': |
| 202 | net = 'WideResNet' |
| 203 | num_classes = 10 |
| 204 | num_labels = label_amount[0] |
| 205 | weight_decay = 5e-4 |
| 206 | depth = 28 |
| 207 | widen_factor = 2 |
| 208 | elif dataset == 'cifar100': |
| 209 | net = 'WideResNet' |
| 210 | num_classes = 100 |
| 211 | num_labels = label_amount[1] |
| 212 | weight_decay = 1e-3 |
| 213 | depth = 28 |
| 214 | widen_factor = 8 |
| 215 | elif dataset == 'svhn': |
| 216 | net = 'WideResNet' |
| 217 | num_classes = 10 |
| 218 | num_labels = label_amount[2] |
| 219 | weight_decay = 5e-4 |
| 220 | depth = 28 |
| 221 | widen_factor = 2 |
| 222 | elif dataset == 'stl10': |
| 223 | net = 'WideResNetVar' |
| 224 | num_classes = 10 |
| 225 | num_labels = label_amount[3] |
| 226 | weight_decay = 5e-4 |
| 227 | depth = 28 |
| 228 | widen_factor = 2 |
| 229 | elif dataset == 'imagenet': |
| 230 | if alg not in ['fixmatch', 'flexmatch']: |
| 231 | continue |
| 232 | net = 'ResNet50' |
| 233 | num_classes = 1000 |
| 234 | num_labels = 100000 # 128000 |
| 235 | weight_decay = 3e-4 |
no test coverage detected