lorenmt / reco

The implementation of "Bootstrapping Semantic Segmentation with Regional Contrast" [ICLR 2022].
https://shikun.io/projects/regional-contrast
Other
162 stars 25 forks source link

unsupervised_loss #23

Closed wwjwy closed 2 years ago

wwjwy commented 2 years ago

Hi, When i train the model on my own dataset, i notice that the curve of unsupervised_loss is strange, DV$)8OWN@53BT5$(DTC1378 is it normal?

lorenmt commented 2 years ago

Hello, this looks normal. The unsupervised loss depends on the number of pixels that are larger than a strong threshold. At the beginning of training, the network starts from scratch, so we hope we don't have unsupervised loss to contribute much on the total loss.

wwjwy commented 2 years ago

Hello, this looks normal. The unsupervised loss depends on the number of pixels that are larger than a strong threshold. At the beginning of training, the network starts from scratch, so we hope we don't have unsupervised loss to contribute much on the total loss.

Thank you for your reply!

wwjwy commented 2 years ago

Hi, I have another question, how did you determine the value of weak_threshold(0.7) and strong_threshold(0.97)? Now, I train on my dataset, do i need to select different values? Thanks for your patience!

lorenmt commented 2 years ago

Hello, what kind of dataset you are training atm? The hyper-parameters for weak and strong thresholds are fixed across all three datasets evaluated in the paper, so I assume it should be quite robust.

wwjwy commented 2 years ago

yes, it works well on my dataset. Thanks again!

wwjwy commented 2 years ago

在您其他的回答中,我注意到这句话,query是通过在hard augmentation上面通过confident<delta_s这个条件筛选的,这些query的label是通过weak augmentation对应位置上面的预测的伪标签来确定,但是代码中https://github.com/lorenmt/reco/blob/71c1b7324fd36049c6657b122ba3fef373877b72/train_semisup.py#L115 train_u_aug_mask = train_u_aug_logits.ge(args.weak_threshold).float() 这里伪标签的生成, train_u_aug_logits是已经使用了weak augmentation和hard augmentation后获得的结果,这该怎么理解呢?

如何理解您所说的weak augmentation和hard augmentation呢?

lorenmt commented 2 years ago

我不明白你的问题. 你mark的那行代码是选择了 valid pixels 其中valid pixels的定义是选择的class的confidence 大于weak threshold. https://github.com/lorenmt/reco/blob/71c1b7324fd36049c6657b122ba3fef373877b72/module_list.py#L87 然后再这行代码里, 再选取hard query 也就是 hard augmentation的confidence 小于strong threshold

wwjwy commented 2 years ago

选择valid pixels是第一步,然后hard query的选取是在valid pixels里面选择confidence 小于strong threshold的pixel,可以这么理解吗?

lorenmt commented 2 years ago

正确.

wwjwy commented 2 years ago

对于一张无标签的原始图像,是不是意味着只有预测的伪标签上的像素点类别概率在0.7至0.97之间,才可能被选择为query?

lorenmt commented 2 years ago

weak augmentation > 0.7 and hard augmentation < 0.97

wwjwy commented 2 years ago

非常非常感谢您的耐心!

wwjwy commented 2 years ago

最后一个小问题,我注意到在大多数半监督分割中,为什么随着有标注训练数据的增加,性能的提升反而会越来越不明显了呢?感觉只有在最初阶段增加有标注数据的数量性能提升很大,而当使用50%标注数据和使用90%标注数据性能提升会相当小,希望可以倾听一下您的见解!

lorenmt commented 2 years ago

因为ReCo的设计是帮助有效区分 confusing object classes. 而这些 confusing object classes 之所以会confuse 是因为训练数据不够多, 因此网络可以找到shortcut solution. 而为了避免这种情况的发生, ReCo 才再confusing object classes内再做监督, 来帮助学到更正确的representation. 反之,如果标注数据足够多, shortcut solution 就不容易出现, ReCo的帮助就会变小. 这也是文章里提到的一个观点, ReCo在数据量极小的情况,提升效果是最明显的.

wwjwy commented 2 years ago

除了您的文章,我发现大多数半监督方法都会出现这个问题,比如CPS方法, ~YDFZQ7)L`~JM2M_K T~V`C 标注数据越多,性能提升也是越来越不明显。 脱离ROCO论文的话,对于这种现象有没有更为一般的解释呢? 谢谢!

lorenmt commented 2 years ago

无论是CPS还是ReCo, 所有semi-supervised的方法都是希望得到精准的pseudo-label. 如果 pseudo-label 等于 gt label 那么 最后performance 也就等于 supervised learning performance. 所以如果训练足够多, 不同semisupervised learning的差异就会变小, 因为pseudo label 最后都比较准.

wwjwy commented 2 years ago

明白了,谢谢您!