diff --git a/trainer/diffusers_trainer.py b/trainer/diffusers_trainer.py index c04bec2..d42e9af 100644 --- a/trainer/diffusers_trainer.py +++ b/trainer/diffusers_trainer.py @@ -266,18 +266,15 @@ class ImageStore: self.validator = Validation( args.skip_validation, args.extended_validation - ) + ).validate - self.resizer = Resize(args.resize, args.data_migration) + self.resizer = Resize(args.resize, args.data_migration).resize - self.image_files = [x for x in self.image_files if self.__valid_file(x)] + self.image_files = [x for x in self.image_files if self.validator(x)] def __len__(self) -> int: return len(self.image_files) - def __valid_file(self, f) -> bool: - return self.validator.validate(f) - # iterator returns images as PIL images and their index in the store def entries_iterator(self) -> Generator[Tuple[Img, int], None, None]: for f in range(len(self)): @@ -285,7 +282,7 @@ class ImageStore: # get image by index def get_image(self, ref: Tuple[int, int, int]) -> Img: - return self.resizer.resize( + return self.resizer( self.image_files[ref[0]], ref[1], ref[2]