如何忽略caffe中的日志打印未使用的图层 [英] How to ignore log print a unused layer in caffe
问题描述
我有一个原型,如下:
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
hdf5_data_param {
source: "./train.txt"
batch_size: 2
}
}
layer {
name: "data_scale2"
type: "HDF5Data"
top: "data_scale2"
top: "label_scale2"
include {
phase: TRAIN
}
hdf5_data_param {
source: "./train_scale2.txt"
batch_size: 2
}
}
其中第二层包含原始数据2的比例因子,我将其命名为data_scale2
.在训练期间,我只使用了data
,label
和data_scale2
,而没有使用label_scale2
.因此,当我进行训练时,label_scale2
的值总是在我的终端上打印.我该如何忽略呢?该日志看起来像
where the second layer contains the scale factor of 2 of the original data, I named it as data_scale2
. During training, I just used the data
,label
and data_scale2
without using label_scale2
. Hence, when I run training, the value of label_scale2
always printing in my terminal. How can I ignore this? This log looks like
I0302 18:01:57.356312 30995 solver.cpp:245] Train net output #221177: label_scale2 = 0
I0302 18:01:57.356314 30995 solver.cpp:245] Train net output #221178: label_scale2 = 0
I0302 18:01:57.356320 30995 solver.cpp:245] Train net output #221179: label_scale2 = 0
I0302 18:01:57.356324 30995 solver.cpp:245] Train net output #221180: label_scale2 = 0
I0302 18:01:57.356328 30995 solver.cpp:245] Train net output #221181: label_scale2 = 0
I0302 18:01:57.356329 30995 solver.cpp:245] Train net output #221182: label_scale2 = 0
I0302 18:01:57.356333 30995 solver.cpp:245] Train net output #221183: label_scale2 = 0
推荐答案
常规解决方案:
如果您想使"top"
层静音,则可以使用 "Silence"
层:
General solution:
If you wan to silence a "top"
layer you can use "Silence"
layer:
layer {
type: "Silence"
name: "silence_this_layer_for_me"
bottom: "label_scale2"
}
就是这样!您将不会再听到label_scale2
的声音
And that's it! You won;t hear from label_scale2
again
HDF5Data解决方案
另外,您不必公开hdf5
输入的所有datasets
.您可以注释多余的"top"
:
A solution for HDF5Data
Alternatively, you do not have to expose all datasets
of an hdf5
input. You can simply comment out the redundant "top"
:
layer {
name: "data_scale2"
type: "HDF5Data"
top: "data_scale2"
# top: "label_scale2"
include {
phase: TRAIN
}
hdf5_data_param {
source: "./train_scale2.txt"
batch_size: 2
}
}
这篇关于如何忽略caffe中的日志打印未使用的图层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!