def __init__(self, crop_shape=(256, 256)): super(ResizeScoreMaps, self).__init__() self.unpack_inputs = pr.UnpackDictionary(['score_maps']) self.crop_shape = crop_shape self.squeeze = pr.Squeeze(axis=0) self.transpose = TransposeOfArray() self.resize_scoremap = pr.ResizeImages(crop_shape) self.list_to_array = ListToArray() self.expand_dims = pr.ExpandDims(axis=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())
def __init__(self, image_size=320, crop_shape=(256, 256)): super(PostProcessSegmentation, self).__init__() self.unpack_inputs = pr.UnpackDictionary( ['image', 'raw_segmentation_map']) self.resize_segmentation_map = ResizeImageWithLinearInterpolation( shape=(image_size, image_size)) self.dilate_map = SegmentationDilation() self.extract_box = ExtractBoundingbox() self.adjust_crop_size = AdjustCropSize() self.crop_image = CropImage(crop_shape[0]) self.expand_dims = pr.ExpandDims(axis=0) self.squeeze_input = pr.Squeeze(axis=0)
def __init__(self, links_origin=MPIIHandJoints.links_origin, parents=MPIIHandJoints.parents, right_hand=False): super(IKNetHandJointAngles, self).__init__() self.calculate_orientation = pr.ComputeOrientationVector(parents) self.links_origin = links_origin self.right_hand = right_hand if self.right_hand: self.links_origin = flip_along_x_axis(self.links_origin) self.links_delta = self.calculate_orientation(self.links_origin) self.concatenate = pr.Concatenate(0) self.compute_absolute_angles = pr.SequentialProcessor( [pr.ExpandDims(0), IKNet(), pr.Squeeze(0)]) self.compute_relative_angles = pr.CalculateRelativeAngles() self.wrap = pr.WrapOutput(['absolute_angles', 'relative_angles'])
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())