Created
May 30, 2023 10:14
-
-
Save rekalantar/9054999cefb1d18957dc9015e429cb2a 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
| # Initialize dictionary for storing image and label paths | |
| data_paths = {} | |
| # Create directories and print the number of images and masks in each | |
| for dataset in datasets: | |
| for data_type in data_types: | |
| # Construct the directory path | |
| dir_path = os.path.join(base_dir, f'{dataset}_{data_type}') | |
| # Find images and labels in the directory | |
| files = sorted(glob.glob(os.path.join(dir_path, "*.nii.gz"))) | |
| # Store the image and label paths in the dictionary | |
| data_paths[f'{dataset}_{data_type.split("_")[1]}'] = files | |
| print('Number of training images', len(data_paths['train_images'])) | |
| print('Number of validation images', len(data_paths['val_images'])) | |
| print('Number of test images', len(data_paths['test_images'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment