Created
April 9, 2023 00:39
-
-
Save doleron/a2b0fb8cb7c0bf2c61d7c55e44c01eef to your computer and use it in GitHub Desktop.
This file contains 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
training_files = [] | |
training_labels = [] | |
validation_files = [] | |
validation_labels = [] | |
for label in range(CLASSES_SIZE): | |
indexes = np.where(labels == label)[0] | |
threshold = len(indexes) * 80 // 100 | |
training_indexes = indexes[0:threshold] | |
training_files_for_class = [files[i] for i in training_indexes] | |
training_files.extend(training_files_for_class) | |
training_labels.extend([label] * len(training_files_for_class)) | |
validation_indexes = indexes[threshold:] | |
validation_files_for_class = [files[i] for i in validation_indexes] | |
validation_files.extend(validation_files_for_class) | |
validation_labels.extend([label] * len(validation_files_for_class)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment