(dir_path)
| 34 | |
| 35 | |
| 36 | def load_dataset(dir_path): |
| 37 | dir_path = check_dataset_exist(dirpath=dir_path) |
| 38 | train_x_path = os.path.join(dir_path, 'train-images-idx3-ubyte.gz') # need to change to local disk |
| 39 | train_y_path = os.path.join(dir_path, 'train-labels-idx1-ubyte.gz') # need to change to local disk |
| 40 | valid_x_path = os.path.join(dir_path, 't10k-images-idx3-ubyte.gz') # need to change to local disk |
| 41 | valid_y_path = os.path.join(dir_path, 't10k-labels-idx1-ubyte.gz') # need to change to local disk |
| 42 | |
| 43 | train_x = read_image_file(check_dataset_exist(train_x_path)).astype( |
| 44 | np.float32) |
| 45 | train_y = read_label_file(check_dataset_exist(train_y_path)).astype( |
| 46 | np.float32) |
| 47 | valid_x = read_image_file(check_dataset_exist(valid_x_path)).astype( |
| 48 | np.float32) |
| 49 | valid_y = read_label_file(check_dataset_exist(valid_y_path)).astype( |
| 50 | np.float32) |
| 51 | return train_x, train_y, valid_x, valid_y |
| 52 | |
| 53 | |
| 54 | def read_label_file(path): |
no test coverage detected