MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / sample

Function sample

examples/GAN/Image2Image.py:182–198  ·  view source on GitHub ↗
(datadir, model_path)

Source from the content-addressed store, hash-verified

180
181
182def 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
201if __name__ == '__main__':

Callers 1

Image2Image.pyFile · 0.70

Calls 11

get_resultMethod · 0.95
stack_patchesFunction · 0.90
PredictConfigClass · 0.85
SmartInitFunction · 0.85
ImageFromFileClass · 0.85
MapDataClass · 0.85
BatchDataClass · 0.85
joinMethod · 0.80
ModelClass · 0.70

Tested by

no test coverage detected