Fixed affine_fc and clarified error message.

This commit is contained in:
Davis King 2017-05-07 16:57:34 -04:00
parent c41b30a8e6
commit 16cd104b1d
1 changed files with 2 additions and 3 deletions

View File

@ -253,19 +253,18 @@ void convert_dlib_xml_to_cafffe_python_code(
else if (i->detail_name == "bn_con" || i->detail_name == "bn_fc") else if (i->detail_name == "bn_con" || i->detail_name == "bn_fc")
{ {
throw dlib::error("Conversion from dlib's batch norm layers to caffe's isn't supported. Instead, " throw dlib::error("Conversion from dlib's batch norm layers to caffe's isn't supported. Instead, "
"you should put your network into 'test mode' by switching batch norm layers to affine layers."); "you should put your dlib network into 'test mode' by switching batch norm layers to affine layers. "
"Then you can convert that 'test mode' network to caffe.");
} }
else if (i->detail_name == "affine_con") else if (i->detail_name == "affine_con")
{ {
fout << " n." << i->caffe_layer_name() << " = L.Scale(n." << find_input_layer_caffe_name(i); fout << " n." << i->caffe_layer_name() << " = L.Scale(n." << find_input_layer_caffe_name(i);
fout << ", axis=1";
fout << ", bias_term=True"; fout << ", bias_term=True";
fout << ");\n"; fout << ");\n";
} }
else if (i->detail_name == "affine_fc") else if (i->detail_name == "affine_fc")
{ {
fout << " n." << i->caffe_layer_name() << " = L.Scale(n." << find_input_layer_caffe_name(i); fout << " n." << i->caffe_layer_name() << " = L.Scale(n." << find_input_layer_caffe_name(i);
fout << ", axis=3";
fout << ", bias_term=True"; fout << ", bias_term=True";
fout << ");\n"; fout << ");\n";
} }