Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about the decrease of the loss #44

Open
hhxzzy opened this issue Mar 1, 2022 · 8 comments
Open

about the decrease of the loss #44

hhxzzy opened this issue Mar 1, 2022 · 8 comments

Comments

@hhxzzy
Copy link

hhxzzy commented Mar 1, 2022

Hello. Thanks for your excellent work!
I transplant the loss function and memory bank of your code to my own code, and run my code on Cityscapes dataset and my own dataset. But it turns out that the decrease of the contrast loss is very small. For example, the contrast loss drops from 1.27 to 1.11 after 80k epoch on Cityscapes, while the ce loss drops from 1.26 to 0.15. And the same thing happens on my own dataset. It seems that the contrast loss is not being useful during train.
I wonder is it normal for the contrast loss to decrease so little? And what can I do to make full use of the contrast loss, like tuning the hyper-parameters?

@guwen007
Copy link

guwen007 commented Mar 3, 2022

I have the same problem too, looking forward to the author's answer

@wingkeihon
Copy link

@hhxzzy I'm sorry to bother you.I added the contrast loss function to my model and code, and this problem also occurred.Has your problem been solved?

@hhxzzy
Copy link
Author

hhxzzy commented Mar 21, 2022

@hhxzzy I'm sorry to bother you.I added the contrast loss function to my model and code, and this problem also occurred.Has your problem been solved?

Hello. I try to make some change to the code, but the contrastive loss is still not going to drop much. But it seems that adding the contrastive can help improve the mIOU on Cityscapes by about 1%. Maybe it is the nature of contrastive loss that it doesn't drop much.
By the way, do you use warmup_iter in your code. I found that using a warm up strategy can be helpful. The author use this strategy in his code but not metion it in the paper.

@wingkeihon
Copy link

wingkeihon commented Mar 21, 2022 via email

@tfzhou
Copy link
Owner

tfzhou commented Mar 21, 2022

@hhxzzy @guwen007 @wingkeihon Thanks for your interests. The contrastive loss is indeed more difficult to optimize than the CE loss. But it will still help to learn a better embedding space, which will benefit segmentation. So I will suggest to see whether the final segmentation performance is improved.

@Pantherk1
Copy link

@tfzhou @hhxzzy @wingkeihon @guwen007
I am a novice postgraduate, and my coding ability is not high. I want to use ContrastiveSeg method on my own two-class segmentation model. Which py files should I read or what should I pay attention to?
Looking forward to your answer, thank you very much.

@hhxzzy
Copy link
Author

hhxzzy commented Mar 23, 2022

@tfzhou @hhxzzy @wingkeihon @guwen007 I am a novice postgraduate, and my coding ability is not high. I want to use ContrastiveSeg method on my own two-class segmentation model. Which py files should I read or what should I pay attention to? Looking forward to your answer, thank you very much.

If you want to run the author's scripts directly, you can take configs/cityscapes/H_48_D_4.json as an example. You need to change "data" and "loss“/"params"/"ce_weight" according to your dataset.
If you wanna use contrastive loss on your own code instead of running the author's scripts, you should look at lib/loss/loss_contrast.py and lib/loss/loss_contrast_mem.py to read the implement of contrastive loss.

@Pantherk1
Copy link

@tfzhou @hhxzzy @wingkeihon @guwen007 I am a novice postgraduate, and my coding ability is not high. I want to use ContrastiveSeg method on my own two-class segmentation model. Which py files should I read or what should I pay attention to? Looking forward to your answer, thank you very much.

If you want to run the author's scripts directly, you can take configs/cityscapes/H_48_D_4.json as an example. You need to change "data" and "loss“/"params"/"ce_weight" according to your dataset. If you wanna use contrastive loss on your own code instead of running the author's scripts, you should look at lib/loss/loss_contrast.py and lib/loss/loss_contrast_mem.py to read the implement of contrastive loss.

Thank you for your prompt attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants