Esempio n. 1
0
 def to_proto(
     self,
     proto: Optional[image_util.ImagePreprocess] = None
 ) -> image_util.ImagePreprocess:
     proto = proto or image_util.ImagePreprocess()
     setattr(proto.resize, "width", self.width)
     setattr(proto.resize, "height", self.height)
     return proto
Esempio n. 2
0
    def to_proto(
        self,
        proto: Optional[image_util.ImagePreprocess] = None
    ) -> image_util.ImagePreprocess:
        if proto is None:
            proto = image_util.ImagePreprocess()

        if self.preprocessor == "bgr2rgb":
            proto.bgr2rgb.SetInParent()
        elif self.preprocessor == "mirror":
            proto.mirror.SetInParent()
        else:
            raise NotImplementedError

        return proto