lhoyer / DAFormer

[CVPR22] Official Implementation of DAFormer: Improving Network Architectures and Training Strategies for Domain-Adaptive Semantic Segmentation
Other
466 stars 91 forks source link

Rare class sampling magic number min_pixels=3000 #60

Closed msseibel closed 1 year ago

msseibel commented 1 year ago

Hi Lukas, thank you for your great work.

Can you explain your reasoning for setting min_pixels=3000 for rare class sampling. From the code in uda_dataset.py, I understand that images where the rare class covers less than min_pixels are not included for rare class sampling.

if pixels > self.rcs_min_pixels:
    self.samples_with_class[c].append(file.split('/')[-1])

I couldn't find the threshold in the DAFormer Paper. I am asking, because I want to use your framework for rather small medical images (250x484) with segments of small abnormal tissue (~ 1000 pixels). So I guess, it would make sense to reduce the threshold?

Best, Marc

lhoyer commented 1 year ago

Hi Marc,

Thank you for your interest in our work. The intuition behind min_pixels is that only images with a sufficient amount of rare class pixels are considered to contain this rare class. This excludes images, which have only very distant (small) instances of a rare class such as bicycle. These very small instances are not so helpful for learning rare classes in autonomous driving. As your dataset is much smaller (250x484 instead of 1920x1080) and seems to have relevant small rare class instances, you should probably decrease this threshold.

Best, Lukas

msseibel commented 1 year ago

Thanks a lot.