From 94e9abf184a72ba15acc4e4176e74be4a8ae892b Mon Sep 17 00:00:00 2001 From: Joel Holdbrooks Date: Tue, 24 Jan 2023 08:36:40 -0800 Subject: [PATCH] Don't bind resolver --- data/resolver.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/data/resolver.py b/data/resolver.py index 8c04c40..23e1b44 100644 --- a/data/resolver.py +++ b/data/resolver.py @@ -191,16 +191,12 @@ def resolve_root(path: str, aspects: list[float], flip_p: float = 0.0, seed=555) :param flip_p: The probability of flipping the image """ if os.path.isfile(path) and path.endswith('.json'): - resolver = JSONResolver(aspects, flip_p, seed) + return JSONResolver(aspects, flip_p, seed).image_train_items(path) if os.path.isdir(path): - resolver = DirectoryResolver(aspects, flip_p, seed) + return DirectoryResolver(aspects, flip_p, seed).image_train_items(path) - if not resolver: - raise ValueError(f"data_root '{path}' is not a valid directory or JSON file.") - - items = resolver.image_train_items(path) - return items + raise ValueError(f"data_root '{path}' is not a valid directory or JSON file.") def resolve(value: typing.Union[dict, str], aspects: list[float], flip_p: float=0.0, seed=555) -> list[ImageTrainItem]: """