-
Notifications
You must be signed in to change notification settings - Fork 8
/
splits.py
142 lines (135 loc) · 10.3 KB
/
splits.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
141
142
mnist = {
'splits': [
{'known_classes': [0, 1, 2, 4, 5, 9], 'unknown_classes': [3, 6, 7, 8]},
{'known_classes': [0, 3, 5, 7, 8, 9], 'unknown_classes': [1, 2, 4, 6]},
{'known_classes': [0, 1, 5, 6, 7, 8], 'unknown_classes': [2, 3, 4, 9]},
{'known_classes': [3, 4, 5, 7, 8, 9], 'unknown_classes': [0, 1, 2, 6]},
{'known_classes': [0, 1, 2, 3, 7, 8], 'unknown_classes': [4, 5, 6, 9]},
]
}
svhn = {
'splits': [
{'known_classes': [0, 1, 2, 4, 5, 9], 'unknown_classes': [3, 6, 7, 8]},
{'known_classes': [0, 3, 5, 7, 8, 9], 'unknown_classes': [1, 2, 4, 6]},
{'known_classes': [0, 1, 5, 6, 7, 8], 'unknown_classes': [2, 3, 4, 9]},
{'known_classes': [3, 4, 5, 7, 8, 9], 'unknown_classes': [0, 1, 2, 6]},
{'known_classes': [0, 1, 2, 3, 7, 8], 'unknown_classes': [4, 5, 6, 9]},
]
}
cifar10 = {
'splits': [
{'known_classes': [0, 1, 2, 4, 5, 9], 'unknown_classes': [3, 6, 7, 8]},
{'known_classes': [0, 3, 5, 7, 8, 9], 'unknown_classes': [1, 2, 4, 6]},
{'known_classes': [0, 1, 5, 6, 7, 8], 'unknown_classes': [2, 3, 4, 9]},
{'known_classes': [3, 4, 5, 7, 8, 9], 'unknown_classes': [0, 1, 2, 6]},
{'known_classes': [0, 1, 2, 3, 7, 8], 'unknown_classes': [4, 5, 6, 9]},
]
}
cifar_plus_10 = {
'splits': [
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [26, 31, 34, 44, 45, 63, 65, 77, 93, 98]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [7, 11, 66, 75, 77, 93, 95, 97, 98, 99]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [2, 11, 15, 24, 32, 34, 63, 88, 93, 95]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [1, 11, 38, 42, 44, 45, 63, 64, 66, 67]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [3, 15, 19, 21, 42, 46, 66, 72, 78, 98]},
]
}
cifar_plus_50 = {
'splits': [
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [1, 2, 7, 9, 10, 12, 15, 18, 21, 23, 26, 30, 32, 33, 34,
36, 37, 39, 40, 42, 44, 45, 46, 47, 49, 50, 51, 52, 55,
56, 59, 60, 61, 63, 65, 66, 70, 72, 73, 74, 76, 78, 80,
83, 87, 91, 92, 96, 98, 99]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [0, 2, 4, 5, 9, 12, 14, 17, 18, 20, 21, 23, 24, 25, 31,
32, 33, 35, 39, 43, 45, 49, 50, 51, 52, 54, 55, 56, 60,
64, 65, 66, 68, 70, 71, 73, 74, 77, 78, 79, 80, 82, 83,
86, 91, 93, 94, 96, 97, 98]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [0, 4, 10, 11, 12, 14, 15, 17, 18, 21, 23, 26, 27, 28, 29,
31, 32, 33, 36, 39, 40, 42, 43, 46, 47, 51, 53, 56, 57,
59, 60, 64, 66, 71, 73, 74, 75, 76, 78, 79, 80, 83, 87,
91, 92, 93, 94, 95, 96, 99]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [0, 2, 5, 6, 9, 10, 11, 12, 14, 16, 18, 19, 21, 22, 23,
26, 27, 28, 29, 31, 33, 35, 36, 37, 38, 39, 40, 43, 45,
49, 52, 56, 59, 61, 62, 63, 64, 65, 71, 74, 75, 78, 80,
82, 86, 87, 91, 93, 94, 96]},
{'known_classes': [0, 1, 8, 9], 'unknown_classes': [0, 1, 4, 6, 7, 12, 15, 16, 17, 19, 20, 21, 22, 23, 26,
27, 28, 32, 39, 40, 42, 43, 44, 47, 49, 50, 52, 53, 54,
55, 56, 59, 61, 62, 63, 65, 66, 67, 68, 73, 74, 77, 82,
83, 86, 87, 93, 94, 97, 98]},
]
}
tiny_imagenet = {
'splits': [{
'known_classes': [2, 3, 13, 30, 44, 45, 64, 66, 76, 101, 111, 121, 128, 130, 136, 158, 167, 170, 187, 193],
'unknown_classes': [0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 67, 68, 69,
70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107, 108, 109,
110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127,
129, 131, 132, 133, 134, 135, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 159, 160, 161, 162, 163,
164, 165, 166, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
182, 183, 184, 185, 186, 188, 189, 190, 191, 192, 194, 195, 196, 197, 198, 199]
}, {
'known_classes': [4, 11, 32, 42, 51, 53, 67, 84, 87, 104, 116, 140, 144, 145, 148, 149, 155, 168, 185, 193],
'unknown_classes': [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45,
46, 47, 48, 49, 50, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 88, 89, 90,
91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143,
146, 147, 150, 151, 152, 153, 154, 156, 157, 158, 159, 160, 161, 162, 163, 164,
165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 198, 199]
}, {'known_classes': [3, 9, 10, 20, 23, 28, 29, 45, 54, 74, 133, 143, 146, 147, 156, 159, 161, 170, 184, 195],
'unknown_classes': [0, 1, 2, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 24, 25, 26,
27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49,
50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 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, 134, 135, 136, 137, 138, 139, 140, 141, 142,
144, 145, 148, 149, 150, 151, 152, 153, 154, 155, 157, 158, 160, 162, 163, 164,
165, 166, 167, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 196, 197, 198, 199]
}, {
'known_classes': [1, 15, 17, 31, 36, 44, 66, 69, 84, 89, 102, 137, 154, 160, 170, 177, 182, 185, 195, 197],
'unknown_classes': [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 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, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 161,
162, 163, 164, 165, 166, 167, 168, 169, 171, 172, 173, 174, 175, 176, 178, 179,
180, 181, 183, 184, 186, 187, 188, 189, 190, 191, 192, 193, 194, 196, 198, 199]
}, {
'known_classes': [4, 14, 16, 33, 34, 39, 59, 69, 77, 92, 101, 103, 130, 133, 147, 161, 166, 168, 172, 173],
'unknown_classes': [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68,
70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
91, 93, 94, 95, 96, 97, 98, 99, 100, 102, 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, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
146, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 162, 163,
164, 165, 167, 169, 170, 171, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199]
}]
}
datasets = {
'mnist': mnist,
'svhn': svhn,
'cifar10': cifar10,
'cifar+10': cifar_plus_10,
'cifar+50': cifar_plus_50,
'tiny_imagenet': tiny_imagenet,
}
def get_splits(dataset, num_split=None):
splits = datasets[dataset]['splits']
if num_split is not None:
splits = splits[num_split]
return splits