Args: names (tuple[str]): the names ('train' or 'test') of the datasets Returns: a mean image of all images in the given datasets, with size 32x32x3
(self, names=('train', 'test'))
| 128 | yield self.data[k] |
| 129 | |
| 130 | def get_per_pixel_mean(self, names=('train', 'test')): |
| 131 | """ |
| 132 | Args: |
| 133 | names (tuple[str]): the names ('train' or 'test') of the datasets |
| 134 | |
| 135 | Returns: |
| 136 | a mean image of all images in the given datasets, with size 32x32x3 |
| 137 | """ |
| 138 | for name in names: |
| 139 | assert name in ['train', 'test'], name |
| 140 | train_files, test_files, _ = get_filenames(self.dir, self.cifar_classnum) |
| 141 | all_files = [] |
| 142 | if 'train' in names: |
| 143 | all_files.extend(train_files) |
| 144 | if 'test' in names: |
| 145 | all_files.extend(test_files) |
| 146 | all_imgs = [x[0] for x in read_cifar(all_files, self.cifar_classnum)] |
| 147 | arr = np.array(all_imgs, dtype='float32') |
| 148 | mean = np.mean(arr, axis=0) |
| 149 | return mean |
| 150 | |
| 151 | def get_label_names(self): |
| 152 | """ |
no test coverage detected