【问题标题】:Use the SVM classifier instead of Softmax in the caffe CNN architecture在 caffe CNN 架构中使用 SVM 分类器而不是 Softmax
【发布时间】:2017-07-10 18:02:13
【问题描述】:

我想在 caffe CNN 架构中使用 SVM 分类器而不是 Softmax。

怎么做,最后一层的deploy.prototxttrain_val.prototxt应该怎么改?

deploy 我拥有的最后一层:

layer {
    name: "loss"
    type: "SoftmaxWithLoss"
    bottom: "fc8"
    bottom: "label"
    top: "loss"
}

train_val 中我拥有的最后一层:

layer {
    name: "loss"
    type: "SoftmaxWithLoss"
    bottom: "fc8"
    bottom: "label"
    top: "loss"
}

【问题讨论】:

  • 我不清楚你想做什么; SVM 分类器采用输入观察的向量(原始数据)并返回该数据点所在区域的类别。这是一个训练有素的 SVM 模型。 SoftMax 采用分类分数向量并将它们归一化为概率;这是培训过程的一部分。两者使用相同的数据格式,但在不同的应用程序上工作。如果您有可用的 SVM 对输入进行分类,则根本不需要 CNN。
  • 很清楚。感谢您的回复。
  • @Prune SVM 分类器非常适合作为分类的最后一层。它不返回概率,而是每个类的铰链损失。它可以反向传播,在实践中,SVM 和 Softmax 通常是可比的。在这里你可以找到详细信息:cs231n.github.io/linear-classify/#svm 所以这个问题是关于什么的绝对清楚。

标签: deep-learning svm caffe convolution softmax


【解决方案1】:

SVM 一词通常与用于二元分类的independent method 相关联。这就是 Caffe 中没有 such 层的原因。你真正要找的是Hinge loss。示例:

layer {
  name: "loss"
  type: "HingeLoss"
  bottom: "fc8"
  bottom: "label"
  top: "loss"
  hinge_loss_param {
    norm: L2
  }
}

用于 MNIST 分类的 complete example

【讨论】:

    猜你喜欢
    • 2019-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-27
    • 2019-06-14
    • 1970-01-01
    • 2017-11-14
    • 2018-07-08
    相关资源
    最近更新 更多