File size: 1,893 Bytes
c1596ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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)}๊ฐœ")