Skip to content
Snippets Groups Projects

WIP: [Transform class] add ResizeCrop for drhagis

Closed Driss KHALIL requested to merge DrhagisUpdates into master
@@ -19,9 +19,7 @@ from .transforms import Compose, ToTensor
def invert_mode1_image(img):
"""Inverts a binary PIL image (mode == ``"1"``)"""
return PIL.ImageOps.invert(img.convert("RGB")).convert(
mode="1", dither=None
)
return PIL.ImageOps.invert(img.convert("RGB")).convert(mode="1", dither=None)
def subtract_mode1_images(img1, img2):
@@ -172,8 +170,7 @@ class SampleListDataset(torch.utils.data.Dataset):
yield k.key
def all_keys_match(self, other):
"""Compares all keys to ``other``, return ``True`` if all match
"""
"""Compares all keys to ``other``, return ``True`` if all match"""
return len(self) == len(other) and all(
[(ks == ko) for ks, ko in zip(self.keys(), other.keys())]
)
@@ -261,8 +258,7 @@ class SSLDataset(torch.utils.data.Dataset):
yield k.key
def all_keys_match(self, other):
"""Compares all keys to ``other``, return ``True`` if all match
"""
"""Compares all keys to ``other``, return ``True`` if all match"""
return len(self) == len(other) and all(
[(ks == ko) for ks, ko in zip(self.keys(), other.keys())]
)
Loading