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

时间:2017-07-10 18:02:14

标签: deep-learning svm caffe convolution softmax

我想在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"
}

1 个答案:

答案 0 :(得分:1)

术语 SVM 通常与用于二进制分类的independent method相关联。这就是为什么Caffe中没有这样的层的原因。你真正想要的是Hinge loss。例如:

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

用于MNIST分类的complete example