-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsweep_imagenet.py
89 lines (78 loc) · 1.63 KB
/
sweep_imagenet.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
import os
import random
group_names_r = [
"art",
"cartoon",
"deviantart",
"embroidery",
"graffiti",
"graphic",
"origami",
"painting",
"sculpture",
"sketch",
"sticker",
"tattoo",
"toy",
"videogame",
]
group_names_star = [
"in the forest",
"green",
"red",
"pencil sketch",
"oil painting",
"orange",
"on the rocks",
"in bright sunlight",
"person and a",
"in the beach",
"studio lighting",
"in the water",
"at dusk",
"in the rain",
"in the grass",
"yellow",
"blue",
"and a flower",
"on the road",
"at night",
"embroidery",
"in the fog",
"in the snow",
]
def main_r():
random.seed(0)
for group_name in group_names_r:
cfg = f"""
project: ImageNetR
data:
name: ImageNetR
group1: "{group_name}"
group2: "imagenet"
"""
cfg_file = f"configs/sweep_imagenetr/{group_name}-imagenet.yaml"
with open(cfg_file, "w") as f:
f.write(cfg)
print(f"python main.py --config {cfg_file}")
os.system(f"python main.py --config {cfg_file}")
def main_star():
random.seed(0)
for group_name in group_names_star:
cfg = f"""
project: ImageNetStar
data:
name: ImageNetStar
group1: "{group_name}"
group2: "base"
"""
cfg_file = (
f"configs/sweep_imagenetstar/{group_name.replace(' ', '_')}-base.yaml"
)
with open(cfg_file, "w") as f:
f.write(cfg)
print(f"python main.py --config {cfg_file}")
os.system(f"python main.py --config {cfg_file}")
if __name__ == "__main__":
main_r()
main_star()