DIAL-RPI / PIPO-FAN

PIPO-FAN for multi organ segmentation over partial labeled datasets using pytorch
MIT License
59 stars 22 forks source link

Multi-organ segmentation over multiple datasets #2

Closed ChandraV76 closed 4 years ago

ChandraV76 commented 4 years ago

Dear @seconds7 ,

Thank you for sharing your work.

I have question about how to train the network with multiple dataset. (It's not written yet on that section) Currently I have KiTS, LITS, and Decathlon (Pancreas and Spleen) dataset, I would like to train them all together. Waiting for your guide.

Best regards, ChandraV76

xifang001 commented 4 years ago

Hi, @ChandraV76,

Thanks for your question. The training method is same as training the network on one dataset. To train multiple datasets together, you need to change the folder_training and folder_validation to fit your own dataset. Then, you need to specify the class number for multi organ segmentation (eg. liver 1, kidney 2) and modify the training policy part in Row 614 according to these labels in train and validation part. You can refer to the paper for more details. I will complete the multiple dataset part in near future.

Thanks, Xi

ChandraV76 commented 4 years ago

Thank you. I plan to segment out all the 13 organs in BTCV dataset. which parameter should I set? can you guide me?

xifang001 commented 4 years ago

Hi, @ChandraV76 , I would be happy to guide you. You can try training the model on BTCV only to segment all 13 organs. To do that, you can first comment row 614-614 in the train_sf_partial.py. Then class number in row 453 should be fixed to 14. Some default path should be modified according to your own data path. Run this file, then it should work. If you encounter any problem or have any suggestions, don't hesitate to let me know.

ChandraV76 commented 4 years ago

Thank you.

comment row 614-614

Maybe you mean 614-624.

I also changed the dataset_muor_2D.py to match the files structures. I also have LITS, KiTS, and Spleen (Medical Decathlon) dataset. Is it the same parameters for train them together for 13 organs segmentation (also uncomment the 614-624 rows)?

xifang001 commented 4 years ago

Yes, 614-624. Have you succeed in running the file for multi-organ segmentation already? After then, to train all datasets together, you need to iteratively train these datasets epoch by epoch. Same parameters are used to train them.

ChandraV76 commented 4 years ago

Yes, its working. I also changed it using CPU ( by changing cuda() to cpu() ). But I stopped my training in the epoch 32th because of my limited hardware to avoid over-heating on my laptop (I afraid of the fan noise). Later I will run training on my lab computer after the office started when this pandemic over. In this case I have no intent to segmented out the tumor, just taking out the organs. Should I manually remove the tumor label first from LiTS and KiTS?

xifang001 commented 4 years ago

In my experiment, the tumor is regarded as part of the organ. For example, when training on LiTS data, the class number of tumor is changed from 2 into 1, which is the same as liver.

sharonlee12 commented 7 months ago

In my experiment, the tumor is regarded as part of the organ. For example, when training on LiTS data, the class number of tumor is changed from 2 into 1, which is the same as liver.

hello,I try to modify in the training file like this: if(data_type=='1'): label_batch[label_batch == 1] = 1 # liver label_batch[label_batch == 2] = 1 # liver if(data_type=='2'): label_batch[label_batch == 1] = 2 #kid label_batch[label_batch == 2] = 2 #kid if(data_type=='3'): label_batch[label_batch == 1] = 3 #spleen if(data_type=='4'): label_batch[label_batch == 1] = 3 # spleen label_batch[label_batch == 2] = 2 # rkid + lkid label_batch[label_batch == 3] = 2 # rkid + lkid label_batch[label_batch == 4] = 0 # label_batch[label_batch == 5] = 0 # label_batch[label_batch == 6] = 1 # liver label_batch[label_batch > 6] = 0 image but while training there is an error: ../aten/src/ATen/native/cuda/NLLLoss2d.cu:93: nll_loss2d_forward_kernel: block: [2,0,0], thread: [384,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:93: nll_loss2d_forward_kernel: block: [2,0,0], thread: [385,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:93: nll_loss2d_forward_kernel: block: [2,0,0], thread: [386,0,0] Assertion t >= 0 && t < n_classes failed.

I hope to know where is the problem with my settings