为了在caffe中训练网络,我很难定义带有多个标签的输入源,我无法理解如何定义输入源。
我正在修改caffenet,以获取多个标签以及多个损失和准确性优化。
详细信息:
我有一个标签文件,其中包含一些labels_weather.txt,例如:
此外,我还有另一个文件(labels_day_night.txt),其中包含诸如
我的问题是:
这是我的.prototxt文件的第一部分(此部分存在错误):
# My problem is: I don't know how to create LMDB library, and how to create input data layers on prototxt file
name: "Caffenet"
layers {
name: "data"
type: DATA
top: "data"
top: "label-weather"
data_param {
source: "/home/diego/Code/dayweatherDeepLearning/Folds/lmdb/Test_fold_is_0/weather_train_lmdb/"
backend: LMDB
batch_size: 50
}
transform_param {
crop_size: 227
mean_file: "/home/diego/Code/dayweatherDeepLearning/Folds/mean/Test_fold_is_0/mean.binaryproto"
mirror: true
}
include: { phase: TRAIN }
}
layers {
name: "data"
type: DATA
top: "data"
top: "label-weather"
data_param {
source: "/home/diego/Code/dayweatherDeepLearning/Folds/lmdb/Test_fold_is_0/weather_val_lmdb"
backend: LMDB
batch_size: 50
}
transform_param {
crop_size: 227
mean_file: "/home/diego/Code/dayweatherDeepLearning/Folds/mean/Test_fold_is_0/mean.binaryproto"
mirror: false
}
include: { phase: TEST }
}
layers {
name: "data"
type: DATA
top: "data"
top: "label-day"
data_param {
source: "/home/diego/Code/dayweatherDeepLearning/Folds/lmdb/Test_fold_is_0/day_train_lmdb/"
backend: LMDB
batch_size: 50
}
transform_param {
crop_size: 227
mean_file: "/home/diego/Code/dayweatherDeepLearning/Folds/mean/Test_fold_is_0/mean.binaryproto"
mirror: true
}
include: { phase: TRAIN }
}
layers {
name: "data"
type: DATA
top: "data"
top: "label-day"
data_param {
source: "/home/diego/Code/dayweatherDeepLearning/Folds/lmdb/Test_fold_is_0/day_val_lmdb"
backend: LMDB
batch_size: 50
}
transform_param {
crop_size: 227
mean_file: "/home/diego/Code/dayweatherDeepLearning/Folds/mean/Test_fold_is_0/mean.binaryproto"
mirror: false
}
include: { phase: TEST }
}
接下来,我在train_val_test.prototxt上遇到了多次丢失,这是文件的结尾(准确性和丢失定义):
...
#First layers here
# accuracy and loss layers:
layers {
name: "accuracy-weather"
type: ACCURACY
bottom: "fc8-weather"
bottom: "label-weather"
top: "accuracy-weather"
include: { phase: TEST }
}
layers {
name: "loss-weather"
type: SOFTMAX_LOSS
bottom: "fc8-weather"
bottom: "label-weather"
top: "loss-weather"
}
layers {
name: "accuracy-day"
type: ACCURACY
bottom: "fc8-day"
bottom: "label-day"
top: "accuracy-day"
include: { phase: TEST }
}
layers {
name: "loss-day"
type: SOFTMAX_LOSS
bottom: "fc8-day"
bottom: "label-day"
top: "loss-day"
}