Last active
September 5, 2021 14:54
-
-
Save pierrelouisbescond/9f67ca0fbd886240bbb7988994b74873 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FOLDER(): | |
def __init__(self, DATA_FOLDER, FOLDERS, LABELS): | |
self.DATA_FOLDER = DATA_FOLDER | |
self.FOLDERS = FOLDERS | |
self.LABELS = LABELS | |
def summary(self, display_ratio=4): | |
for folder in self.FOLDERS: | |
sum_folder = 0 | |
for label in self.LABELS: | |
path = self.DATA_FOLDER+folder+"/"+label+"/*.png" | |
nb_files = len(glob.glob(path)) | |
sum_folder += nb_files | |
print(folder.ljust(10), ":", label.ljust(4), ":", nb_files, ":", "*" * (nb_files // display_ratio)) | |
print("Total Number of pictures in", folder, ":", sum_folder, "\n") | |
if folder == "train": | |
folder_size_train = sum_folder | |
elif folder == "val": | |
folder_size_val = sum_folder | |
print(f"train/val ratio: {100 * (folder_size_train) / (folder_size_train+folder_size_val):.1f} %") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment