Spaces:
Sleeping
Sleeping
| import os | |
| # ================================ | |
| # 0. μ€μ | |
| # ================================ | |
| TARGET_COUNT = 60 | |
| MIN_RES = 256 # ν΄μλ 256 | |
| PREFIX = "kg" | |
| BASE_DIR = "./data/raw" | |
| # ================================ | |
| # 1. κ²½λ‘ | |
| # ================================ | |
| HOME = os.path.expanduser("~") | |
| DATA_DIR = os.path.join( | |
| HOME, | |
| "Desktop", | |
| "raw_kg" | |
| ) | |
| THRESHOLD = TARGET_COUNT | |
| # ================================ | |
| # 2. ν΄λμ€ λͺ©λ‘ | |
| # ================================ | |
| CLASS_LIST = [ | |
| # μμ λ° μμ¬λ£ | |
| "pizza","hamburger","sushi","pasta","salad", | |
| "steak","cup_cake","sandwich","waffle","dumpling", | |
| # λλ¬Ό | |
| "golden-retriever","bulldog","siamese_cat", | |
| "persian_cat","elephant","sheep","horse", | |
| "penguin","butterfly","squirrel", | |
| # κ½ | |
| "rose","sunflower","daisy","tulip","dandelion", | |
| "lily","lavender","orchid","iris","marigold","aster", | |
| # κ³ΌμΌ | |
| "apple","banana","strawberry","orange", | |
| "carrot","tomato","cucumber", | |
| # νκ² | |
| "car","bicycle","motorcycle","airplane","bus", | |
| # ν¨μ λ° μ‘ν | |
| "t-shirt","sneakers","earrings","glasses", | |
| "pants","bracelet","necklace" | |
| ] | |
| print(f"{THRESHOLD}μ₯ μ΄ν ν΄λμ€ λͺ©λ‘ (0μ₯ ν¬ν¨)\n") | |
| low_classes = [] | |
| # ================================ | |
| # 3. ν΄λμ€λ³ κ°μ μ²΄ν¬ | |
| # ================================ | |
| for cls in sorted(CLASS_LIST): | |
| cls_path = os.path.join(DATA_DIR, cls) | |
| if not os.path.exists(cls_path): | |
| count = 0 | |
| else: | |
| count = len([ | |
| f for f in os.listdir(cls_path) | |
| if os.path.isfile(os.path.join(cls_path, f)) | |
| ]) | |
| if count < THRESHOLD: | |
| print(f"{cls}: {count}μ₯") | |
| low_classes.append((cls, count)) | |
| # ================================ | |
| # 4. μμ½ | |
| # ================================ | |
| print("\nμμ½") | |
| print(f"{THRESHOLD}μ₯ λ―Έλ§ ν΄λμ€ μ: {len(low_classes)}κ°") |