Skip to content

Instantly share code, notes, and snippets.

@farukcankaya
Created October 20, 2022 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farukcankaya/ef92f67f9fc71c7c23a9e3d0e873f6ac to your computer and use it in GitHub Desktop.
Save farukcankaya/ef92f67f9fc71c7c23a9e3d0e873f6ac to your computer and use it in GitHub Desktop.
class Transform:
@abstractmethod
def apply_image(self, img: np.ndarray):
@abstractmethod
def apply_coords(self, coords: np.ndarray):
def apply_segmentation(self, segmentation: np.ndarray) -> np.ndarray:
return self.apply_image(segmentation)
def apply_box(self, box: np.ndarray) -> np.ndarray:
...
return trans_boxes
def apply_polygons(self, polygons: list) -> list:
return [self.apply_coords(p) for p in polygons]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment