| @@ 149-159 (lines=11) @@ | ||
| 146 | return n_train, valid_groundtruth, n_test, wnid_map |
|
| 147 | ||
| 148 | ||
| 149 | def create_splits(n_train, n_valid, n_test): |
|
| 150 | n_total = n_train + n_valid + n_test |
|
| 151 | tuples = {} |
|
| 152 | tuples['train'] = (0, n_train) |
|
| 153 | tuples['valid'] = (n_train, n_train + n_valid) |
|
| 154 | tuples['test'] = (n_train + n_valid, n_total) |
|
| 155 | sources = ['encoded_images', 'targets', 'filenames'] |
|
| 156 | return OrderedDict( |
|
| 157 | (split, OrderedDict((source, tuples[split]) for source in sources |
|
| 158 | if source != 'targets' or split != 'test')) |
|
| 159 | for split in ('train', 'valid', 'test') |
|
| 160 | ) |
|
| 161 | ||
| 162 | ||
| @@ 166-175 (lines=10) @@ | ||
| 163 | return n_train, valid_groundtruth, test_groundtruth, wnid_map |
|
| 164 | ||
| 165 | ||
| 166 | def create_splits(n_train, n_valid, n_test): |
|
| 167 | n_total = n_train + n_valid + n_test |
|
| 168 | tuples = {} |
|
| 169 | tuples['train'] = (0, n_train) |
|
| 170 | tuples['valid'] = (n_train, n_train + n_valid) |
|
| 171 | tuples['test'] = (n_train + n_valid, n_total) |
|
| 172 | sources = ['encoded_images', 'targets', 'filenames'] |
|
| 173 | return OrderedDict( |
|
| 174 | (split, OrderedDict((source, tuples[split]) for source in sources)) |
|
| 175 | for split in ('train', 'valid', 'test') |
|
| 176 | ) |
|
| 177 | ||
| 178 | ||