mahmoodlab / CLAM

Data-efficient and weakly supervised computational pathology on whole slide images - Nature Biomedical Engineering
http://clam.mahmoodlab.org
GNU General Public License v3.0
1.02k stars 340 forks source link

ZeroDivisionError: float division by zero #168

Closed qshwan closed 1 year ago

qshwan commented 1 year ago

main.py File "/data/qsh/CLAM-master/utils/utils.py", line 150, in make_weights_for_balanced_classes_split weight_per_class = [N/len(dataset.slide_cls_ids[c]) for c in range(len(dataset.slide_cls_ids))] File "/data/qsh/CLAM-master/utils/utils.py", line 150, in weight_per_class = [N/len(dataset.slide_cls_ids[c]) for c in range(len(dataset.slide_cls_ids))] ZeroDivisionError: float division by zero

MohammedHAlali commented 1 year ago

Make sure that len(dataset.slide_cls_ids) is greater than 0, and also len(dataset) is greater than 0, from the beginning.