C++ からの独自のデータを使用して、独自のトレーニング済みネットワークを使用しようとしています。レイヤーを使用して「.jpg」データでネットワークをトレーニングおよびテストしたImageData
後、基本的なカフェの例「classification.cpp」を実装して、画像を 1 つずつメモリに渡しました。結果として、2 つのクラス (
1 - オブジェクト、
2 - 環境) の確率を知る必要があります。
通常の目的での私の入力レイヤーは次のようになります。
layer {
name: "data"
top: "data"
top: "label"
type: "Input"
input_param { shape: { dim: 1 dim: 3 dim: 256 dim: 256 }}
}
出力層:
layer {
name: "fc6"
top: "fc6"
type: "InnerProduct"
bottom: "drop5"
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
std: 0.1
}
}
}
layer {
name: "prob"
top: "prob"
type: "SoftmaxWithLoss"
bottom: "fc6"
bottom: "label"
}
layer {
name: "accuracy"
top: "accuracy"
type: "Accuracy"
bottom: "fc6"
bottom: "label"
include {
phase: TEST
}
}
テスト段階では、ネットは精度 = 0.93 を達成しましたが、現在 C++ を通常に使用していると、基本的な概念が理解できず、モデルの解析中にエラーが発生します。
Check failure stack trace:
...
caffe::SoftmaxWithLossLayer<>::Reshape()
caffe::Net<>::Init()
caffe::Net<>::Net()
...
Check failed: outer_num_ * inner_num_ == bottom[1]->count() (1 vs. 196608) Number of labels must match number of predictions; e.g., if softmax axis == 1 and prediction shape is (N, C, H, W), label count (number of labels) must be N*H*W, with integer values in {0, 1, ..., C-1}.
1x3x256x256 = 196608 ですが、なぜこのラベル数が必要なのですか? 「classification.cpp」の例のように、「labels.txt」というファイルがあります。
environment
object
なぜ != クラスにラベルを付けるのですか? SoftmaxWithLoss と入力ディメンションはどうすればよいですか?