DACS icon indicating copy to clipboard operation
DACS copied to clipboard

How was "We train using batches with 2 source images and 2 mixed images for 250k iterations" achieved in the code?

Open danielmao2019 opened this issue 1 year ago • 1 comments

How was "We train using batches with 2 source images and 2 mixed images for 250k iterations" achieved in the code? I traced through the training code but did not see how this was implemented. Could anyone please point me to the class method/function that controls this part? Many thanks!

danielmao2019 avatar Apr 29 '24 00:04 danielmao2019

at if mix_mask == "class": for image_i in range(batch_size): classes = torch.unique(labels[image_i]) #classes=classes[classes!=ignore_label] nclasses = classes.shape[0] #if nclasses > 0: classes = (classes[torch.Tensor(np.random.choice(nclasses, int((nclasses+nclasses%2)/2),replace=False)).long()]).cuda()

                if image_i == 0:
                    MixMask0 = transformmasks.generate_class_mask(labels[image_i], classes).unsqueeze(0).cuda()
                else:
                    MixMask1 = transformmasks.generate_class_mask(labels[image_i], classes).unsqueeze(0).cuda()

i think they only use the first and the last element of the batch to perform Mixing pseudo label if you give the image batch size > 2 it will raise error when compute unlabelled loss

dyytnn avatar May 13 '25 11:05 dyytnn