From 6c2d5d80664198fcc103fcf579874be2cdcdec3f Mon Sep 17 00:00:00 2001 From: Maw-Fox Date: Fri, 11 Nov 2022 18:09:09 -0700 Subject: [PATCH] Final cleanup. --- trainer/diffusers_trainer.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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]