qinenergy / corda

[ICCV 2021] Code for our paper Domain Adaptive Semantic Segmentation with Self-Supervised Depth Estimation
71 stars 12 forks source link

Training on a custom dataset without ground truth label #8

Closed chophilip21 closed 2 years ago

chophilip21 commented 3 years ago

From what I understand after reading your paper, you do not need ground truth label data on the target domain to train the pseudo labels. However, when I look at cityscapes_loader, it seems I need to supply the ground truth seg maps as well.

I am trying to train the network on a custom dataset (that only depth maps, and ground truth seg map only on the source domain), but it looks I cannot get away without providing it. Do you have any thoughts on this?

qinenergy commented 3 years ago

You do not need ground truth segmentation labels for the target domain. For your custom data, you could simply feed a placeholder (for example a zero matrix of the same shape.)

We did not use any target label information and we used the same Cityscapes loader as the other papers~(DACS), and we threw away the target segmentation labels in the training code:

# Line 429 in trainUDA_synthia.py
images_remain, _, _, _, depth_remain = batch_remain 

The second returned (and thrown away) value is the segmentation label, as defined in

# Line 199 in the cityscapes_loader.py
return img, lbl, img_path, lbl_path, depth
chophilip21 commented 3 years ago

wow I was not expecting such a quick reply. Thanks a lot! I'll give that a shot and get back to you.

chophilip21 commented 3 years ago

yup your suggestion worked! thanks. Because I do not have any ground truth, I am assuming I cannot call evaluate() inside trainUDA.py. Should I just disable all evaluate portion?

chophilip21 commented 3 years ago

I just modified some areas on the eval loop and looks good to go. Just wondering where this number 22 came from?

class VOCColorize(object):
    def __init__(self, n=22):
        self.cmap = color_map(22)
qinenergy commented 3 years ago

Hi the class was inherited from DACS (and can trace back to some VOC evaluation code from other papers). As we are not testing on VOC, it is not used. For our visualization code, you can check utils/visualization.py

And yes, you don't need to call evaluate() if you don't have ground truth for your custom target domain validation set, maybe you will need other ways to evaluate your model.

qinenergy commented 2 years ago

Closed as the question seems to be resolved.