throwdlib::error("The dlib model requires input tensors with NUM_ROWS=="+to_string((long)layers.back().attribute("nr"))+", but the dtoc command line specified NUM_ROWS=="+to_string(NR));
if(NC!=layers.back().attribute("nc"))
throwdlib::error("The dlib model requires input tensors with NUM_COLUMNS=="+to_string((long)layers.back().attribute("nc"))+", but the dtoc command line specified NUM_COLUMNS=="+to_string(NC));
if(K!=3)
throwdlib::error("The dlib model requires input tensors with NUM_CHANNELS==3, but the dtoc command line specified NUM_CHANNELS=="+to_string(K));
}
elseif(layers.back().detail_name=="input")
{
fout<<"input_num_channels = 1;"<<endl;
fout<<"input_num_rows = "<<NR<<";"<<endl;
fout<<"input_num_cols = "<<NC<<";"<<endl;
if(K!=1)
throwdlib::error("The dlib model requires input tensors with NUM_CHANNELS==1, but the dtoc command line specified NUM_CHANNELS=="+to_string(K));
}
else
{
throwdlib::error("No known transformation from dlib's "+layers.back().detail_name+" layer to caffe.");
}
fout<<endl;
fout<<"# Call this function to write the dlib DNN model out to file as a pair of caffe\n";
fout<<"# definition and weight files. You can then use the network by loading it with\n";
fout<<"# this statement: \n";
fout<<"# net = caffe.Net(def_file, weights_file, caffe.TEST);\n";