使用 DIGITS 在 CAFFE 中向 RNN 添加精度和损失层
Adding Accuracy and Loss Layer to RNN in CAFFE with DIGITS
我刚刚在后台安装了带有caffe的digits。我正在尝试在我的数据集上训练 RNN with 50 layers。为了简单起见,我的数据集中最初只有三个 class,即 roads
、parks
和 ponds
。默认情况下,上述网络不包括准确性和损失层,因此在训练期间或之后它不会在 DIGITS 界面上显示任何准确性或损失。为了解决这个问题,我只是从 AlexNet
复制了相关层并将它们放在 RNN 的末尾以查看实际发生了什么。我从 RNN
添加了以下三层
layer {
name: "accuracy"
type: "Accuracy"
bottom: "fc1000"
bottom: "label"
top: "accuracy"
include {
stage: "val"
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "fc1000"
bottom: "label"
top: "loss"
exclude {
stage: "deploy"
}
}
layer {
name: "softmax"
type: "Softmax"
bottom: "fc1000"
top: "softmax"
include {
stage: "deploy"
}
}
训练网络后,DIGITS 界面显示准确率仅为 34%。当我使用 DIGITS 的 Classify Many
特征和 class 验证验证数据集时,它告诉我一切都是 road
class 因此在混淆矩阵中实现了 33% 的准确率。因为,我是这个领域的新手,我怀疑在网络末端添加上述三层后做错了什么。那正确吗?我搞砸了整个网络吗?在不破坏网络的情况下,要如何可视化数字的准确性和损失?
编辑 1
以下是我添加 facebook Resnet model in DIGITS with Torch. .
时出现的错误
请注意,早些时候有另一个错误抱怨 cudnn
是 nil
当我在网络定义中将 require cunn
更改为 require cudnn
时消失了,因为它对我来说似乎是一个错字。
你没有断网。您只是不需要两个 softmax
层。问题可能是它没有收敛。至于网络初始化参数我找不到作者的training.prototxt
。他建议查看 facebook's torch implementation in this PR which has some changes than the original implementation. One thing you can do is use training network from deepdetect . But that PR's one of the conclusion was that it didn't converge due to caffe's implementation problem with BatchNorm
layer. deepdetect
's author seems to disagree that it doesn't converge. Either way that seems to be fixed in this PR 。所以总结是:
- 使用最新版本
caffe
- 使用
deepdetect
的网络和求解器。
- 首先检查它是否收敛于
imagenet
或 cifar
(损失减少且误差减少)
- 如果是,则使用您自己的数据进行训练
- 如果没有,那么我们将需要有关您的设置的更多信息
我刚刚在后台安装了带有caffe的digits。我正在尝试在我的数据集上训练 RNN with 50 layers。为了简单起见,我的数据集中最初只有三个 class,即 roads
、parks
和 ponds
。默认情况下,上述网络不包括准确性和损失层,因此在训练期间或之后它不会在 DIGITS 界面上显示任何准确性或损失。为了解决这个问题,我只是从 AlexNet
复制了相关层并将它们放在 RNN 的末尾以查看实际发生了什么。我从 RNN
layer {
name: "accuracy"
type: "Accuracy"
bottom: "fc1000"
bottom: "label"
top: "accuracy"
include {
stage: "val"
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "fc1000"
bottom: "label"
top: "loss"
exclude {
stage: "deploy"
}
}
layer {
name: "softmax"
type: "Softmax"
bottom: "fc1000"
top: "softmax"
include {
stage: "deploy"
}
}
训练网络后,DIGITS 界面显示准确率仅为 34%。当我使用 DIGITS 的 Classify Many
特征和 class 验证验证数据集时,它告诉我一切都是 road
class 因此在混淆矩阵中实现了 33% 的准确率。因为,我是这个领域的新手,我怀疑在网络末端添加上述三层后做错了什么。那正确吗?我搞砸了整个网络吗?在不破坏网络的情况下,要如何可视化数字的准确性和损失?
编辑 1
以下是我添加 facebook Resnet model in DIGITS with Torch.
时出现的错误
请注意,早些时候有另一个错误抱怨 cudnn
是 nil
当我在网络定义中将 require cunn
更改为 require cudnn
时消失了,因为它对我来说似乎是一个错字。
你没有断网。您只是不需要两个 softmax
层。问题可能是它没有收敛。至于网络初始化参数我找不到作者的training.prototxt
。他建议查看 facebook's torch implementation in this PR which has some changes than the original implementation. One thing you can do is use training network from deepdetect . But that PR's one of the conclusion was that it didn't converge due to caffe's implementation problem with BatchNorm
layer. deepdetect
's author seems to disagree that it doesn't converge. Either way that seems to be fixed in this PR 。所以总结是:
- 使用最新版本
caffe
- 使用
deepdetect
的网络和求解器。 - 首先检查它是否收敛于
imagenet
或cifar
(损失减少且误差减少) - 如果是,则使用您自己的数据进行训练
- 如果没有,那么我们将需要有关您的设置的更多信息