HiLab-git / SSL4MIS

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

KeyError #4

Closed KenChen1998 closed 3 years ago

KenChen1998 commented 3 years ago

Dear Luoxd1996:

When I try to run your code train_2D_fully_supervised.py, it said KeyError, and here is the error information, could you help solve it?

Traceback (most recent call last): File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_fully_supervised.py", line 218, in train(args, snapshot_path) File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_fully_supervised.py", line 73, in train labeled_slice = patients_to_slices(args.root_path, args.labeled_num) File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_fully_supervised.py", line 64, in patients_to_slices return ref_dict[str(patiens_num)] KeyError: '50'

It is fine with train_2D_adversarial_network.py and train_unet_2D_entropy_minimization.py. As for others, it got the similar wrong information, such as

Traceback (most recent call last): File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_interpolation_consistency_training.py", line 301, in train(args, snapshot_path) File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_interpolation_consistency_training.py", line 121, in train labeled_slice = patients_to_slices(args.root_path, args.labeled_num) File "D:/github/Medical/SSL4MIS-master/SSL4MIS-master/code/train_unet_2D_interpolation_consistency_training.py", line 79, in patients_to_slices return ref_dict[str(patiens_num)] KeyError: '300'

Could you help me?

Luoxd1996 commented 3 years ago

Hi Chen, Yes, you can run the train_acdc.sh firstly and use a default labeled_num, which was defined in the patients_to_slices function. I have tested this code many times, it can work well. Best wishes, Xiangde Luo.

KenChen1998 commented 3 years ago

Hi Chen, Yes, you can run the train_acdc.sh firstly and use a default labeled_num, which was defined in the patients_to_slices function. I have tested this code many times, it can work well. Best wishes, Xiangde Luo.

Thanks, it works well onLinux