FengheTan9 / Multi-Level-Global-Context-Cross-Consistency

Official Pytorch Code base for "Multi-Level Global Context Cross Consistency Model for Semi-Supervised Ultrasound Image Segmentation with Diffusion Model"
MIT License
31 stars 1 forks source link

about labeled set and unlabeled set #8

Open lmylhy opened 1 year ago

lmylhy commented 1 year ago

hi, thanks for you job! Here is a question about dataloader about labeled dataset and unlabeled dataset. Here a set a semi percentage about 0.5, the batch_size is 8 and labeled_bs is 4, and I set the idx around [0,1903] are unlabeled and else are labeled, but when I call the dataloader, the grouper function is normal, the first four are labeled and the last four are unlabeled, but during the training stage, i found there goes a mixture in labeled idx and unlabeled idx, for example, there is an error about the unlabled mask cannot found in the masked set, is there anything error in the getitem function because it returns both image and label. Thanks a lot!

FengheTan9 commented 1 year ago

Thanks for using our code. First reverse your dataset list. Then, set idx [0, n-1903] labeled and else [n-1903, n] (e.g 1903 total unlabeled samples) unlabeled.

lmylhy commented 1 year ago

Thanks! But the syn images don't have any label, but the function getitem always return image and label, how to slove this problem? Thanks a lot

FengheTan9 commented 1 year ago

Well, you may read syn image file for the syn label: if case[:3] == "syn": label = cv2.imread(os.path.join(self._base_dir, 'images', case + '.png'), cv2.IMREAD_GRAYSCALE)[..., None]