-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkt.py
More file actions
20 lines (16 loc) · 743 Bytes
/
kt.py
File metadata and controls
20 lines (16 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
def count_images_in_folders(root_dir):
class_counts = {}
for class_name in os.listdir(root_dir):
class_path = os.path.join(root_dir, class_name)
if os.path.isdir(class_path):
num_images = len([f for f in os.listdir(class_path) if f.lower().endswith(('.png', '.jpg', '.jpeg'))])
class_counts[class_name] = num_images
return class_counts
# Kiểm tra số lượng ảnh trong tập train và val
train_counts = count_images_in_folders("val")
val_counts = count_images_in_folders("train")
test_counts = count_images_in_folders("test")
print("Số lượng ảnh val:", train_counts)
print("Số lượng ảnh train:", val_counts)
print("Số lượng ảnh test:", test_counts)