def get_transform(self, img): _, w = img.shape[:2] do = self._rand_range() < self.prob if do: return HFlipTransform(w) else: return NoOpTransform()
def get_transform(self, img): h, w = img.shape[:2] do = self._rand_range() < self.prob if do: if self.horizontal: return HFlipTransform(w) elif self.vertical: return VFlipTransform(h) else: return NoOpTransform()
def get_transform(self, img): _, w = img.shape[:2] do_horiz = self._rand_range() < self.prob/2 do_vert = self._rand_range() >= self.prob/2 and self._rand_range() < self.prob if do_horiz: return HFlipTransform(w) elif do_vert: return VFlipTransform(w) else: return NoOpTransform()
def get_transform(self, img): h, w = img.shape[:2] # do = self._rand_range() < self.prob # original implementation do = False # No flip! if do: if self.horizontal: return HFlipTransform(w) elif self.vertical: return VFlipTransform(h) else: return NoOpTransform()
def get_transform(self, img): h, w = img.shape[:2] do = self.do[self.idx] # print('idx', self.idx) # print('do', do) # print('self.do', self.do) self.idx += 1 if self.idx == self.ring: self.idx = 0 self.do = [self._rand_range() < self.prob] * self.ring if do: if self.horizontal: # print('HFlipTransform') return HFlipTransform(w) # print([HFlipTransform(w)]*self.ring) # yield from [HFlipTransform(w)]*self.ring elif self.vertical: return VFlipTransform(h) else: # print('NoOpTransform') return NoOpTransform()
def get_transform(self, img): h, w = img.shape[:2] if self.horizontal: return HFlipTransform(w) elif self.vertical: return VFlipTransform(h)