Exemplo n.º 1
0
 def __init__(self, shape, mean=pr.BGR_IMAGENET_MEAN):
     super(PreprocessImage, self).__init__()
     self.add(pr.ResizeImage(shape))
     self.add(pr.CastImage(float))
     if mean is None:
         self.add(pr.NormalizeImage())
     else:
         self.add(pr.SubtractMeanImage(mean))
Exemplo n.º 2
0
 def __init__(self, model, colors=None):
     super(PostprocessSegmentation, self).__init__()
     self.add(PreprocessImage())
     self.add(pr.ExpandDims(0))
     self.add(pr.Predict(model))
     self.add(pr.Squeeze(0))
     self.add(Round())
     self.add(MasksToColors(model.output_shape[-1], colors))
     self.add(pr.DenormalizeImage())
     self.add(pr.CastImage('uint8'))
     self.add(pr.ShowImage())
Exemplo n.º 3
0
 def __init__(self, model, colors=None):
     super(PostprocessSegmentation, self).__init__()
     self.add(pr.UnpackDictionary(['image_path']))
     self.add(pr.LoadImage())
     self.add(pr.ResizeImage(model.input_shape[1:3]))
     self.add(pr.ConvertColorSpace(pr.RGB2BGR))
     self.add(pr.SubtractMeanImage(pr.BGR_IMAGENET_MEAN))
     self.add(pr.ExpandDims(0))
     self.add(pr.Predict(model))
     self.add(pr.Squeeze(0))
     self.add(Round())
     self.add(MasksToColors(model.output_shape[-1], colors))
     self.add(pr.DenormalizeImage())
     self.add(pr.CastImage('uint8'))
     self.add(pr.ShowImage())
Exemplo n.º 4
0
 def __init__(self, shape=(48, 48)):
     self.shape = shape
     super(PostrocessEigenFace, self).__init__()
     self.add(pe.MinMaxNormalization(255.0))
     self.add(pe.Reshape(shape))
     self.add(pr.CastImage('uint8'))
Exemplo n.º 5
0
 def __init__(self):
     super(PostProcessImage, self).__init__()
     self.add(pr.AddMeanImage(pr.BGR_IMAGENET_MEAN))
     self.add(pr.CastImage('uint8'))
     self.add(pr.ConvertColorSpace(pr.BGR2RGB))
Exemplo n.º 6
0
 def __init__(self, num_classes, colors=None):
     super(PostprocessSegmentationIds, self).__init__()
     self.add(MasksToColors(num_classes, colors))
     self.add(pr.DenormalizeImage())
     self.add(pr.CastImage('uint8'))