HiLab-git / SSL4MIS

Semi Supervised Learning for Medical Image Segmentation, a collection of literature reviews and code implementations.
MIT License
2.13k stars 381 forks source link

The first supplied array does not contain any binary object #47

Closed Huiimin5 closed 2 years ago

Huiimin5 commented 2 years ago

Hi, thank you so much for your efforts in implementing all these methods.

After training on ACDC with labeled_num=3, the testing code on ACDC gives me this error "The first supplied array does not contain any binary object", which is raised near:

image

The problem is that the trained model does not predict labeled 2 and label 3, which can be seen here:

image

The visualized dice on validation set shows that there is a performance peak at 600th step

image

The test performance on the validation set (at 600th step) looks normal

image

It's confusing that on a test set image the same model does not prediction label 2 and 3 at all. Have you met this issue and could you give me some advice?

Many thanks.

Luoxd1996 commented 2 years ago

Hi, Please use this function to measure the performance.

def calculate_metric_percase(pred, gt): pred[pred > 0] = 1 gt[gt > 0] = 1 if pred.sum() > 0 and gt.sum() > 0: dice = metric.binary.dc(pred, gt) hd95 = metric.binary.hd95(pred, gt, voxelspacing=[10, 1, 1]) asd = metric.binary.asd(pred, gt, voxelspacing=[10, 1, 1]) return dice, hd95, asd else: return 0, 50, 10. Best, Xiangde.

Huiimin5 commented 2 years ago

Thanks a lot for your clarification. By the way, in your work "Semi-Supervised Medical Image Segmentation via Cross Teaching between CNN and Transformer", you report standard deviation, is it calculated over each image? Basically for each foreground class, aside from taking the average over each image's dice, you also calculate the standard deviation, right? Many thanks

Luoxd1996 commented 2 years ago

Hi, Huimin, Yes, your understanding is right. Best, Xiangde.

2805111860 commented 1 year ago

测试时我将代码改成你上面发布的,但还是出现“The first supplied array does not contain any binary object”,请问大佬这个该怎么解决呢?感谢你的贡献。

supgy commented 10 months ago

测试时我将代码改成你上面发布的,但还是出现“The first supplied array does not contain any binary object”,请问大佬这个该怎么解决呢?感谢你的贡献。

have you soloved this problem?