Datasets:
Tasks:
Feature Extraction
Modalities:
Image
Formats:
imagefolder
Size:
10K - 100K
Tags:
climate
License:
import os | |
def count_images_in_folders(base_path): | |
"""Counts the number of images in each class subdirectory under test, train, and val.""" | |
subsets = ['test', 'train', 'val'] | |
for subset in subsets: | |
subset_path = os.path.join(base_path, subset) | |
if not os.path.exists(subset_path): | |
continue | |
for class_name in os.listdir(subset_path): | |
class_path = os.path.join(subset_path, class_name) | |
if os.path.isdir(class_path): | |
image_count = len([f for f in os.listdir(class_path) if f.endswith('.jpg')]) | |
print(f"Folder {subset}/{class_name} has {image_count} images") | |
# Define base path | |
base_directory = "classify" | |
# Run the function | |
count_images_in_folders(base_directory) | |