if not verbose:
self.logger.setLevel(40)
self.extensions = (".jpeg", ".jpg", ".png") // file extensions that are admitted
self.img_ls = [file for file in file_ls if file.endswith(self.extensions)]
if len(self.img_ls) < 1:
self.logger.error("No valid image files found (check config file).")
raise ValueError("No valid image files found (check config file).")
After Change
def __init__(self, input_dir, output_dir="./data/output", verbose=True):
self.input_dir = Path(input_dir)
self.data_name = self.input_dir.name
self.output_dir = Path(output_dir) / self.data_name
self.logger = get_logger(__name__)
if not verbose:
self.logger.setLevel(40)
self.extensions = (".jpeg", ".jpg", ".png") // file extensions that are admitted
self.img_ls = [f for f in self.input_dir.iterdir() if f.suffix in self.extensions]
if len(self.img_ls) < 1:
self.logger.error("No valid image files found (check config file).")
raise ValueError("No valid image files found (check config file).")