HealthML / self-supervised-3d-tasks

Apache License 2.0
185 stars 39 forks source link

issues while fine tuning cpc model with brats dataset #9

Closed Zeev1988 closed 3 years ago

Zeev1988 commented 3 years ago

Hi, First of all, thank you for publishing your amazing work.

I'm trying to run the fine-tuning stage on cpc model. I configured the input layer to receive (32,32,32,4) sized patches so from one brats sample(128,128,128,4) the input is of shape (64,32,32,32,4). I stumbled upon the following issues: 1) segmentation_task_loader.data_generation() - If I understand correctly, the idea when data_x consists of 4 stacked brats modalities also data_y should consist of the same label stacked 4 times. but in line 187 you do: n_classes = np.max(data_y) + 1 data_y = np.eye(n_classes)[data_y] In case a label consists of less than 3 different values(specifily found in case of brats 2020 sample number 287) it causes a bug in test_data_backend.get_data_from_gen() when trying to concatnate data_y.

2) segmentation_task_loader.data_generation() - line 170 fails due to bad dufault values: np.random.randint(0, img.shape[0] - self.patch_size[0], self.patches_per_scan) img.shape[0] = 128, img.patch_size = (128,128,128), self.patches_per_scan = 3 I changed patch_size to be (32,32,32) and patches_per_scan to 64 and just wanted to make sure it is correct for my case.

aihamtaleb commented 3 years ago

Hi, Thanks for your questions, and comments.

  1. You're completely right, in case of some instance not having the complete number of labels, this line will cause an error. Originally, we discovered this problem, but forgot to address it due to deadlines. Thanks for pointing this out. A better solution is probably to store (hard-code) the number of labels in the Brats dataset in the config json file.
  2. The values you use now are correct. The default values are provided as a simple example of how the function expects these values to look like, but not to be used everywhere. I think it's hard to remove these default values, otherwise the users won't be able to figure out how these arguments look like.

Thanks for your questions and interest.

Zeev1988 commented 3 years ago

thank you for your help