发布时间:2024-03-27 17:01
import torch
def CORAL(source, target):
d = source.data.shape[1] #coral公式中的分母部分
ns, nt = source.data.shape[0], target.data.shape[0]
# source covariance
xm = torch.mean(source, 0, keepdim=True) - source #对应着Cs的分子部分
xc = xm.t() @ xm/(ns-1) #对应着Cs的分子部分
# target covariance
xmt = torch.mean(target, 0, keepdim=True) - target#对应着Ct的分子部分
xct = xmt.t() @ xmt/(nt-1)#对应着Ct的分子部分
# frobenius norm between source and target
loss = torch.mean(torch.mul((xc - xct), (xc - xct))) #Cs-Ct的点乘
loss = loss/(4*d*d)
return loss
Coral公式:
只做学习使用,作者也是看了别人进行了学习总结,希望能对你有所帮助。
故障诊断与python学习
Deep CORAL: Correlation Alignment for Deep Domain Adaptation_gdtop818的博客-CSDN博客
Code Runner for VS Code,下载量突破 4000 万!支持超过50种语言
Ampere Altra Max 提供可持续的高分辨率 H.265 编码
java形参和实参的三种传递方式(值传递,地址传递,引用传递)
用原生promise特性替代async/await解决异步的方法
保姆级教程 | TensorFlow-YOLOv3 从本地训练到服务器部署全过程
通过CSS,H5,JavaScript实现表格表单的随机选择,和简单的随机点名。
10月15日深圳见!开放原子开源基金会·区块链工作组成立大会来了
Python+Selenium自动化测试(五):Page Object模式
利用Python实现新冠疫情数据可视化(获取疫情历史数据,制作南丁格尔玫瑰图、疫情地图、动态疫情组合图、词云)
el-upload http-request使用 多个文件上传携带其他参数方式