this->RunV0UpgradeTest(input_proto, expected_output_proto);
}
+TYPED_TEST(V0UpgradeTest, TestAllParams) {
+ const string& input_proto =
+ "name: 'CaffeNet' "
+ "layers { "
+ " layer { "
+ " name: 'data' "
+ " type: 'data' "
+ " source: '/home/jiayq/Data/ILSVRC12/train-leveldb' "
+ " meanfile: '/home/jiayq/Data/ILSVRC12/image_mean.binaryproto' "
+ " batchsize: 256 "
+ " cropsize: 227 "
+ " mirror: true "
+ " scale: 0.25 "
+ " rand_skip: 73 "
+ " } "
+ " top: 'data' "
+ " top: 'label' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'hdf5data' "
+ " type: 'hdf5_data' "
+ " source: '/my/hdf5/data' "
+ " batchsize: 256 "
+ " } "
+ " top: 'hdf5data' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'conv1' "
+ " type: 'conv' "
+ " num_output: 96 "
+ " biasterm: false "
+ " pad: 4 "
+ " kernelsize: 11 "
+ " stride: 4 "
+ " weight_filler { "
+ " type: 'gaussian' "
+ " std: 0.01 "
+ " } "
+ " bias_filler { "
+ " type: 'constant' "
+ " value: 3. "
+ " } "
+ " blobs_lr: 1. "
+ " blobs_lr: 2. "
+ " weight_decay: 1. "
+ " weight_decay: 0. "
+ " } "
+ " bottom: 'data' "
+ " top: 'conv1' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'pool1ave' "
+ " type: 'pool' "
+ " pool: AVE "
+ " kernelsize: 3 "
+ " stride: 2 "
+ " } "
+ " bottom: 'conv1' "
+ " top: 'pool1ave' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'pool1stoch' "
+ " type: 'pool' "
+ " pool: STOCHASTIC "
+ " kernelsize: 4 "
+ " stride: 5 "
+ " } "
+ " bottom: 'conv1' "
+ " top: 'pool1stoch' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'concat' "
+ " type: 'concat' "
+ " concat_dim: 2 "
+ " } "
+ " bottom: 'pool1ave' "
+ " bottom: 'pool1stoch' "
+ " top: 'pool1concat' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'norm1' "
+ " type: 'lrn' "
+ " local_size: 5 "
+ " alpha: 0.0001 "
+ " beta: 0.75 "
+ " } "
+ " bottom: 'pool1concat' "
+ " top: 'norm1' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'fc6' "
+ " type: 'innerproduct' "
+ " num_output: 4096 "
+ " biasterm: false "
+ " weight_filler { "
+ " type: 'gaussian' "
+ " std: 0.005 "
+ " } "
+ " bias_filler { "
+ " type: 'constant' "
+ " value: 1. "
+ " } "
+ " blobs_lr: 1. "
+ " blobs_lr: 2. "
+ " weight_decay: 1. "
+ " weight_decay: 0. "
+ " } "
+ " bottom: 'norm1' "
+ " top: 'fc6' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'relu6' "
+ " type: 'relu' "
+ " } "
+ " bottom: 'fc6' "
+ " top: 'fc6' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'drop6' "
+ " type: 'dropout' "
+ " dropout_ratio: 0.2 "
+ " } "
+ " bottom: 'fc6' "
+ " top: 'fc6' "
+ "} "
+ "layers { "
+ " layer { "
+ " name: 'loss' "
+ " type: 'infogain_loss' "
+ " source: '/my/infogain/matrix' "
+ " } "
+ " bottom: 'fc6' "
+ " bottom: 'label' "
+ "} ";
+ const string& expected_output_proto =
+ "name: 'CaffeNet' "
+ "layers { "
+ " name: 'data' "
+ " type: 'data' "
+ " data_param { "
+ " source: '/home/jiayq/Data/ILSVRC12/train-leveldb' "
+ " mean_file: '/home/jiayq/Data/ILSVRC12/image_mean.binaryproto' "
+ " batch_size: 256 "
+ " crop_size: 227 "
+ " mirror: true "
+ " scale: 0.25 "
+ " rand_skip: 73 "
+ " } "
+ " top: 'data' "
+ " top: 'label' "
+ "} "
+ "layers { "
+ " name: 'hdf5data' "
+ " type: 'hdf5_data' "
+ " hdf5_data_param { "
+ " source: '/my/hdf5/data' "
+ " batch_size: 256 "
+ " } "
+ " top: 'hdf5data' "
+ "} "
+ "layers { "
+ " name: 'conv1' "
+ " type: 'conv' "
+ " convolution_param { "
+ " num_output: 96 "
+ " bias_term: false "
+ " pad: 4 "
+ " kernel_size: 11 "
+ " stride: 4 "
+ " weight_filler { "
+ " type: 'gaussian' "
+ " std: 0.01 "
+ " } "
+ " bias_filler { "
+ " type: 'constant' "
+ " value: 3. "
+ " } "
+ " } "
+ " blobs_lr: 1. "
+ " blobs_lr: 2. "
+ " weight_decay: 1. "
+ " weight_decay: 0. "
+ " bottom: 'data' "
+ " top: 'conv1' "
+ "} "
+ "layers { "
+ " name: 'pool1ave' "
+ " type: 'pool' "
+ " pooling_param { "
+ " pool: AVE "
+ " kernel_size: 3 "
+ " stride: 2 "
+ " } "
+ " bottom: 'conv1' "
+ " top: 'pool1ave' "
+ "} "
+ "layers { "
+ " name: 'pool1stoch' "
+ " type: 'pool' "
+ " pooling_param { "
+ " pool: STOCHASTIC "
+ " kernel_size: 4 "
+ " stride: 5 "
+ " } "
+ " bottom: 'conv1' "
+ " top: 'pool1stoch' "
+ "} "
+ "layers { "
+ " name: 'concat' "
+ " type: 'concat' "
+ " concat_param { "
+ " concat_dim: 2 "
+ " } "
+ " bottom: 'pool1ave' "
+ " bottom: 'pool1stoch' "
+ " top: 'pool1concat' "
+ "} "
+ "layers { "
+ " name: 'norm1' "
+ " type: 'lrn' "
+ " lrn_param { "
+ " local_size: 5 "
+ " alpha: 0.0001 "
+ " beta: 0.75 "
+ " } "
+ " bottom: 'pool1concat' "
+ " top: 'norm1' "
+ "} "
+ "layers { "
+ " name: 'fc6' "
+ " type: 'innerproduct' "
+ " inner_product_param { "
+ " num_output: 4096 "
+ " bias_term: false "
+ " weight_filler { "
+ " type: 'gaussian' "
+ " std: 0.005 "
+ " } "
+ " bias_filler { "
+ " type: 'constant' "
+ " value: 1. "
+ " } "
+ " } "
+ " blobs_lr: 1. "
+ " blobs_lr: 2. "
+ " weight_decay: 1. "
+ " weight_decay: 0. "
+ " bottom: 'norm1' "
+ " top: 'fc6' "
+ "} "
+ "layers { "
+ " name: 'relu6' "
+ " type: 'relu' "
+ " bottom: 'fc6' "
+ " top: 'fc6' "
+ "} "
+ "layers { "
+ " name: 'drop6' "
+ " type: 'dropout' "
+ " dropout_param { "
+ " dropout_ratio: 0.2 "
+ " } "
+ " bottom: 'fc6' "
+ " top: 'fc6' "
+ "} "
+ "layers { "
+ " name: 'loss' "
+ " type: 'infogain_loss' "
+ " infogain_loss_param { "
+ " source: '/my/infogain/matrix' "
+ " } "
+ " bottom: 'fc6' "
+ " bottom: 'label' "
+ "} ";
+ this->RunV0UpgradeTest(input_proto, expected_output_proto);
+}
+
TYPED_TEST(V0UpgradeTest, TestImageNet) {
const string& input_proto =
"name: 'CaffeNet' "
this->RunV0UpgradeTest(input_proto, expected_output_proto);
}
-
} // namespace caffe
if (type == "data") {
layer_param->mutable_data_param()->set_batch_size(
v0_layer_param.batchsize());
+ } else if (type == "hdf5_data") {
+ layer_param->mutable_hdf5_data_param()->set_batch_size(
+ v0_layer_param.batchsize());
} else {
LOG(ERROR) << "Unknown parameter batchsize for layer type " << type;
is_fully_compatible = false;