MSKCC-Computational-Pathology / MIL-nature-medicine-2019

340 stars 104 forks source link

About ZeroDivisionError when I run MIL_train.py #16

Open ghost opened 2 years ago

ghost commented 2 years ago

"dataPrepare_for_CNN.py" is okay but when I run the "MIL_train.py", there is a error:

return running_loss/len(loader.dataset) ZeroDivisionError: float division by zero

So sad that I cannot solve this error, please help me

gabricampanella commented 2 years ago

Difficult to say exactly what is wrong. But it definitely has to do with how the data is set up. The script assumes you are loading a dictionary and it is expecting particular keys as I describe in the README file. To give you more help I would need to see this dataPrepare_for_CNN.py script, or see the contents of the data dictionary.

ghost commented 2 years ago

sorry for forgetting that, the dataPrepare_for_CNN.py is coding by another one, he had implemented your work.

https://github.com/TankZhouFirst/clinical-grade-computational-pathology-using-weakly-supervised-deep-learning-on-whole-slide-images/blob/master/code/dataPrepare_for_CNN.py image image image image

It's a little difficult to put the whole code on the issue, so I made a screenshot. It seems it could get some data which need in MIL. hope this will give you more information, and thanks again for your help! Sincerely, mingxin.

qiyueliuhuo23 commented 2 years ago

I am also reproducing the code of this paper recently. Have you solved the problem you encountered? If you have solved the problem, please let me know how to solve it. Thank you very much.