DIAL-RPI / PIPO-FAN

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

training on BTCV &&LiTS &&Spleen &&KiTS #11

Open sharonlee12 opened 7 months ago

sharonlee12 commented 7 months ago

HELLO,it is a great job,but i want to know how can I train the model on BTCV &&LiTS &&Spleen &&KiTS.As BTCV contains 14 classes,and when I train the model, it will report an error: assert t<=num_classes should I preprocess the BTCV data set,concert 2&3 (left&right kidney) to 2, 1 (spleen) to 3 and 6 (liver) to 1, 4-14 to 0, right? if so,Do I need to pre-process the LITS data set,to combine organs and tumors and set them 1,and for KITS, to combine organs and tumors and set them 2? or should I change the num_classes from 4 to 14 when training on BTCV &&LiTS &&Spleen &&KiTS? Hope to get your reply, thank you!

sharonlee12 commented 7 months ago

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 1111111111111111 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