(filepath)
| 28 | |
| 29 | |
| 30 | def load_dataset(filepath): |
| 31 | with open(filepath, 'rb') as fd: |
| 32 | try: |
| 33 | cifar100 = pickle.load(fd, encoding='latin1') |
| 34 | except TypeError: |
| 35 | cifar100 = pickle.load(fd) |
| 36 | image = cifar100['data'].astype(dtype=np.uint8) |
| 37 | image = image.reshape((-1, 3, 32, 32)) |
| 38 | label = np.asarray(cifar100['fine_labels'], dtype=np.uint8) |
| 39 | label = label.reshape(label.size, 1) |
| 40 | return image, label |
| 41 | |
| 42 | |
| 43 | def load_train_data(dir_path='/tmp/cifar-100-python'): |
no test coverage detected