(datadir, model_path)
| 180 | |
| 181 | |
| 182 | def sample(datadir, model_path): |
| 183 | pred = PredictConfig( |
| 184 | session_init=SmartInit(model_path), |
| 185 | model=Model(), |
| 186 | input_names=['input', 'output'], |
| 187 | output_names=['viz']) |
| 188 | |
| 189 | imgs = glob.glob(os.path.join(datadir, '*.jpg')) |
| 190 | ds = ImageFromFile(imgs, channel=3, shuffle=True) |
| 191 | ds = MapData(ds, split_input) |
| 192 | ds = AugmentImageComponents(ds, [imgaug.Resize(256)], (0, 1)) |
| 193 | ds = BatchData(ds, 6) |
| 194 | |
| 195 | pred = SimpleDatasetPredictor(pred, ds) |
| 196 | for o in pred.get_result(): |
| 197 | o = o[0][:, :, :, ::-1] |
| 198 | stack_patches(o, nr_row=3, nr_col=2, viz=True) |
| 199 | |
| 200 | |
| 201 | if __name__ == '__main__': |
no test coverage detected