layumi / Seg-Uncertainty

IJCAI2020 & IJCV2021 :city_sunrise: Unsupervised Scene Adaptation with Memory Regularization in vivo
https://arxiv.org/abs/1912.11164
MIT License
386 stars 51 forks source link

Question about stage2 #8

Closed zhangbin0917 closed 4 years ago

zhangbin0917 commented 4 years ago

Nice work! I am a novice in the domain adaptation field. I have a question about stage2. In my understanding about your paper, uncertainty estimation is used for target domain images. But in your code trainer_ms_variance.py, it seems to be calculated on the image of the source domain.

    def gen_update(self, images, images_t, labels, labels_t, i_iter):
            self.gen_opt.zero_grad()

            pred1, pred2 = self.G(images)
            pred1 = self.interp(pred1)
            pred2 = self.interp(pred2)

            if self.class_balance:            
                self.seg_loss = self.update_class_criterion(labels)

            loss_seg1 = self.update_variance(labels, pred1, pred2) 
            loss_seg2 = self.update_variance(labels, pred2, pred1)

            loss = loss_seg2 + self.lambda_seg * loss_seg1
layumi commented 4 years ago

In the stage-II, I set the image path to target domain. We do not use the source image any more.

https://github.com/layumi/Seg-Uncertainty/blob/master/train_ft.py#L35-L41

zhangbin0917 commented 4 years ago

Thanks for reply. I got it. But why you use two loaders for target domain iamges, trainloader and targetloader. Why not use one dataloader to calculate the all loss?

layumi commented 4 years ago

At that time, I hope that Trainer could be re-used in the stage-I.

zhangbin0917 commented 4 years ago

Got it, 3q.