- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我希望使用 InfogainLoss
类型的损失层在我的模型中。但是我很难正确定义它。
INFOGAIN_LOSS
用法的教程/示例?层? SOFTMAX
的输出层,还是输入全连接层的“顶部”就足够了? INFOGAIN_LOSS
需要三个输入:类别概率、标签和矩阵
H
.
H
可以作为层参数提供
infogain_loss_param { source: "fiename" }
.
H
的 python 脚本作为
numpy.array
形状
(L,L)
与
dtype='f4'
(其中
L
是我模型中的标签数量)。
numpy.array
变成 binproto
可以作为 infogain_loss_param { source }
提供的文件模型? H
作为损失层的第三个输入(底部)提供(而不是作为模型参数)。我怎样才能做到这一点?H
的新数据层? ?如果是这样,这层的数据不是每次训练迭代都会增加,就像训练数据增加一样吗?H
它知道在所有训练过程中只读取一次的“数据”层吗? 最佳答案
1.有没有关于的使用教程/例子InfogainLoss 层?:
可以找到一个很好的例子here : 使用 InfogainLoss 解决类(Class)不平衡问题。
2. 该层的输入,即类概率,是否应该是 的输出? Softmax 层?
从历史上看,根据 Yair's answer,答案曾经是"is"。 . "InfogainLoss"
的旧实现需要成为 "Softmax"
的输出层或确保输入值在 [0..1] 范围内的任何其他层。
OP注意到使用 "InfogainLoss"
在 "Softmax"
之上层会导致数值不稳定。 His pull request ,将这两个层组合成一个层(很像 "SoftmaxWithLoss"
层),于 2017 年 4 月 14 日被接受并合并到官方 Caffe 存储库中。这个组合层的数学给出了here .
升级后的图层“观感”与旧图层一模一样,除了 不再需要通过 "Softmax"
显式传递输入。层。
3. 如何将 numpy.array 转换为 binproto 文件:
在 python
H = np.eye( L, dtype = 'f4' )
import caffe
blob = caffe.io.array_to_blobproto( H.reshape( (1,1,L,L) ) )
with open( 'infogainH.binaryproto', 'wb' ) as f :
f.write( blob.SerializeToString() )
INFOGAIN_LOSS
添加到模型原始文本中。层与
H
作为参数:
layer {
bottom: "topOfPrevLayer"
bottom: "label"
top: "infoGainLoss"
name: "infoGainLoss"
type: "InfogainLoss"
infogain_loss_param {
source: "infogainH.binaryproto"
}
}
H
作为 DATA 层的一部分
There's no way at present to make data layers load input at different rates. Every forward pass all data layers will advance. However, the constant H input could be done by making an input lmdb / leveldb / hdf5 file that is only H since the data layer will loop and keep loading the same H. This obviously wastes disk IO.
关于numpy - InfogainLoss 层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27632440/
我希望使用 InfogainLoss 类型的损失层在我的模型中。但是我很难正确定义它。 有没有关于 INFOGAIN_LOSS 用法的教程/示例?层? 如果该层的输入,即类概率,是 SOFTMAX 的
我正在尝试建立caffe的infogain损失层来工作。我已经看过帖子和解决方案,但对我来说仍然不起作用 我的数据 lmdb 尺寸为 Nx1xHxW(灰度图像),我的目标图像 lmdb 尺寸为 Nx3
我是一名优秀的程序员,十分优秀!