Mini-ImageNet / src /collection /check_class_counts.py
ImAMJayKIM's picture
Upload 96 files
c1596ac verified
Raw
History Blame Contribute Delete
1.89 kB
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)}개")