Chris Oswald commited on
Commit
a803284
1 Parent(s): 9c6a8c8

modified patient id generation

Browse files
Files changed (1) hide show
  1. SPIDER.py +1 -16
SPIDER.py CHANGED
@@ -328,9 +328,7 @@ class SPIDER(datasets.GeneratorBasedBuilder):
328
  ]
329
 
330
  # Generate train/validate/test partitions of patient IDs
331
- patient_ids = np.unique([file.split('_')[0] for file in image_files])
332
- print(f'Number of patients: {len(patient_ids)}')
333
-
334
  partition = np.random.choice(
335
  ['train', 'dev', 'test'],
336
  p=[train_share, validate_share, test_share],
@@ -341,13 +339,6 @@ class SPIDER(datasets.GeneratorBasedBuilder):
341
  test_ids = set(patient_ids[partition == 'test'])
342
  assert len(train_ids.union(validate_ids, test_ids)) == len(patient_ids)
343
 
344
-
345
- print(f'# of training ids: {len(train_ids)}')
346
- print(f'# of validation ids: {len(validate_ids)}')
347
- print(f'# of testing ids: {len(test_ids)}')
348
-
349
- print(f'Length of image file list: {len(image_files)}')
350
-
351
  # Subset train/validation/test partition images and mask files
352
  train_image_files = subset_file_list(image_files, train_ids)
353
  validate_image_files = subset_file_list(image_files, validate_ids)
@@ -361,12 +352,6 @@ class SPIDER(datasets.GeneratorBasedBuilder):
361
  assert len(validate_image_files) == len(validate_mask_files)
362
  assert len(test_image_files) == len(test_mask_files)
363
 
364
- print(f'# of training images: {len(train_image_files)}')
365
- print(f'# of validation images: {len(validate_image_files)}')
366
- print(f'# of testing images: {len(test_image_files)}')
367
-
368
- print([x for x in image_files if x not in train_image_files + validate_image_files + test_image_files])
369
-
370
  # Import patient/scanner data and radiological gradings data
371
  overview_data = import_csv_data(paths_dict['overview'])
372
  grades_data = import_csv_data(paths_dict['gradings'])
 
328
  ]
329
 
330
  # Generate train/validate/test partitions of patient IDs
331
+ patient_ids = np.unique([file.split('_')[0] for file in image_files])
 
 
332
  partition = np.random.choice(
333
  ['train', 'dev', 'test'],
334
  p=[train_share, validate_share, test_share],
 
339
  test_ids = set(patient_ids[partition == 'test'])
340
  assert len(train_ids.union(validate_ids, test_ids)) == len(patient_ids)
341
 
 
 
 
 
 
 
 
342
  # Subset train/validation/test partition images and mask files
343
  train_image_files = subset_file_list(image_files, train_ids)
344
  validate_image_files = subset_file_list(image_files, validate_ids)
 
352
  assert len(validate_image_files) == len(validate_mask_files)
353
  assert len(test_image_files) == len(test_mask_files)
354
 
 
 
 
 
 
 
355
  # Import patient/scanner data and radiological gradings data
356
  overview_data = import_csv_data(paths_dict['overview'])
357
  grades_data = import_csv_data(paths_dict['gradings'])