''' This implementation is from https://github.com/HobbitLong/SupContrast with small modifications. ''' import torch import torch.nn as nn class SupConLoss(nn.Module): """Supervised Contrastive Learning: https://arxiv.org/pdf/2004.11362.pdf. It also supports the unsupervised contrastive loss ...
logits_mask: the diagonal is zero 原文中的Ai其实就是去除自身样本外的样本,换句话来说分母那项是包括正样本的 其中log_pro=logits−torch.log(exp_logits.sum(1))就是计算当前这个点的Contrastive Loss. 所有点都计算完了,再×mask就得到hard positive sample的loss. ...
代码:https://github.com/HobbitLong/SupContrast 交叉熵损失有很多缺点,例如对嘈杂标签缺乏鲁棒性,分类边距可能较差,导致泛化性能下降。 作者在对比学习的基础上加上了标签信息,提出了一种监督学习的损失,让来自相同类别的特征比不同类别的特征更靠近。 方法 给定一批输入数据,首先应用两次数据增强,获得该 batch 的两...
本文系统总结了Supervised Contrastive Learning这篇paper的主要内容。并对文中部分推导进行了补充,以便理解。若有不当之处,恳请指出。 拓展阅读 《Selective-Supervised Contrastive Learning with Noisy Labels》 引入一个filter机制,用高置信的positive来做supervised contrastive learning,提升监督质量。
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
论文:Self-supervised Contrastive Representation Learning for Semi-supervised Time-Series Classification GitHub:https://github.com/emadeldeen24/CA-TCC TPAMI期刊论文,是CCF-A类的期刊论文,IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI)。
(2) A Simple Framework for Contrastive Learning of Visual Representations.Paper Update Note: if you found it not easy to parse the supcon loss implementation in this repo, we got you. Supcon loss essentially is just a cross-entropy loss (see eq 4 in theStableReppaper). So we got a clea...
Pytorch implementation of Influence Augmented Contrastive (IAC) loss and SCGC : Self-Supervised Contrastive Graph Clustering (https://arxiv.org/abs/2204.12656) - gayanku/SCGC
其它的就和simclr没啥区别了,具体代码可参考: https://github.com/clabrugere/pytorch-scarf/blob/master/scarf/loss.py 这篇paper的主体部分两三页就完事儿了,大部分的内容都是实验的设定,各种对比和消融实验的介绍以及引言,不感兴趣,pass
分出三部分的pixels后结合,contrastive loss 就很好理解了。 整个算法的流程如下: Results Code https://github.com/Haochen-Wang409/U2PL/github.com/Haochen-Wang409/U2PL/ Reference [1] Semi-Supervised Semantic Segmentation Using Unreliable Pseudo-Labels ...