From 898e0d09f71aa1f855f3531da4313e569a99fb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=9E=A5=EC=9B=90=5FT4105?= Date: Fri, 10 Feb 2023 10:25:56 +0900 Subject: [PATCH] :sparkle: Add `check_image_size.py` --- utils/check_image_size.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 utils/check_image_size.py diff --git a/utils/check_image_size.py b/utils/check_image_size.py new file mode 100644 index 00000000..8c9e2211 --- /dev/null +++ b/utils/check_image_size.py @@ -0,0 +1,22 @@ +from collections import Counter +from pathlib import Path + +from PIL import Image +from rich.console import Console + +INPUT_DIR = Path("/opt/ml/input") +AIHUB_DIR = INPUT_DIR / "aihub" +CAR_DIR = INPUT_DIR / "car" +ANN_DIR = CAR_DIR / "annotations" +IMG_DIR = CAR_DIR / "images" + + +if __name__ == "__main__": + console = Console() + sizes = [] + for _path in IMG_DIR.glob("*.jpg"): + img = Image.open(_path) + sizes.append((img.width, img.height)) + + console.print(Counter(sizes)) + # Counter({(1920, 1080): 13313})