Commit 70060917 authored by nilsfreyer's avatar nilsfreyer

fixed tests for predictor templates

parent df09d622
Pipeline #104119 failed with stages
in 37 seconds
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#include <iostream> #include <iostream>
#include <map> #include <map>
CAFFE2_DEFINE_string(init_net, "./model/${tc.componentName}/init_net.pb", "The given path to the init protobuffer."); CAFFE2_DEFINE_string(init_net_${tc.fileNameWithoutEnding}, "./model/${tc.componentName}/init_net_${tc.fileNameWithoutEnding}.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/${tc.componentName}/predict_net.pb", "The given path to the predict protobuffer."); CAFFE2_DEFINE_string(predict_net_${tc.fileNameWithoutEnding}, "./model/${tc.componentName}/predict_net_${tc.fileNameWithoutEnding}.pb", "The given path to the predict protobuffer.");
using namespace caffe2; using namespace caffe2;
...@@ -43,21 +43,21 @@ class ${tc.fileNameWithoutEnding}{ ...@@ -43,21 +43,21 @@ class ${tc.fileNameWithoutEnding}{
char **a[1]; char **a[1];
caffe2::GlobalInit(&n, a); caffe2::GlobalInit(&n, a);
if (!std::ifstream(FLAGS_init_net).good()) { if (!std::ifstream(FLAGS_init_net_${tc.fileNameWithoutEnding}).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net << "' does not exist." << std::endl; std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net_${tc.fileNameWithoutEnding} << "' does not exist." << std::endl;
exit(1); exit(1);
} }
if (!std::ifstream(FLAGS_predict_net).good()) { if (!std::ifstream(FLAGS_predict_net_${tc.fileNameWithoutEnding}).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net << "' does not exist." << std::endl; std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net_${tc.fileNameWithoutEnding} << "' does not exist." << std::endl;
exit(1); exit(1);
} }
std::cout << "\nLoading network..." << std::endl; std::cout << "\nLoading network..." << std::endl;
// Read protobuf // Read protobuf
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net, &initNet)); CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net_${tc.fileNameWithoutEnding}, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net, &predictNet)); CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net_${tc.fileNameWithoutEnding}, &predictNet));
// Set device type // Set device type
#ifdef USE_GPU #ifdef USE_GPU
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#include <iostream> #include <iostream>
#include <map> #include <map>
CAFFE2_DEFINE_string(init_net, "./model/LeNet/init_net.pb", "The given path to the init protobuffer."); CAFFE2_DEFINE_string(init_net_CNNPredictor_LeNet, "./model/LeNet/init_net_CNNPredictor_LeNet.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/LeNet/predict_net.pb", "The given path to the predict protobuffer."); CAFFE2_DEFINE_string(predict_net_CNNPredictor_LeNet, "./model/LeNet/predict_net_CNNPredictor_LeNet.pb", "The given path to the predict protobuffer.");
using namespace caffe2; using namespace caffe2;
...@@ -43,21 +43,21 @@ class CNNPredictor_LeNet{ ...@@ -43,21 +43,21 @@ class CNNPredictor_LeNet{
char **a[1]; char **a[1];
caffe2::GlobalInit(&n, a); caffe2::GlobalInit(&n, a);
if (!std::ifstream(FLAGS_init_net).good()) { if (!std::ifstream(FLAGS_init_net_CNNPredictor_LeNet).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net << "' does not exist." << std::endl; std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net_CNNPredictor_LeNet << "' does not exist." << std::endl;
exit(1); exit(1);
} }
if (!std::ifstream(FLAGS_predict_net).good()) { if (!std::ifstream(FLAGS_predict_net_CNNPredictor_LeNet).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net << "' does not exist." << std::endl; std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net_CNNPredictor_LeNet << "' does not exist." << std::endl;
exit(1); exit(1);
} }
std::cout << "\nLoading network..." << std::endl; std::cout << "\nLoading network..." << std::endl;
// Read protobuf // Read protobuf
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net, &initNet)); CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net_CNNPredictor_LeNet, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net, &predictNet)); CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net_CNNPredictor_LeNet, &predictNet));
// Set device type // Set device type
#ifdef USE_GPU #ifdef USE_GPU
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#include <iostream> #include <iostream>
#include <map> #include <map>
CAFFE2_DEFINE_string(init_net, "./model/VGG16/init_net.pb", "The given path to the init protobuffer."); CAFFE2_DEFINE_string(init_net_CNNPredictor_VGG16, "./model/VGG16/init_net_CNNPredictor_VGG16.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/VGG16/predict_net.pb", "The given path to the predict protobuffer."); CAFFE2_DEFINE_string(predict_net_CNNPredictor_VGG16, "./model/VGG16/predict_net_CNNPredictor_VGG16.pb", "The given path to the predict protobuffer.");
using namespace caffe2; using namespace caffe2;
...@@ -43,21 +43,21 @@ class CNNPredictor_VGG16{ ...@@ -43,21 +43,21 @@ class CNNPredictor_VGG16{
char **a[1]; char **a[1];
caffe2::GlobalInit(&n, a); caffe2::GlobalInit(&n, a);
if (!std::ifstream(FLAGS_init_net).good()) { if (!std::ifstream(FLAGS_init_net_CNNPredictor_VGG16).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net << "' does not exist." << std::endl; std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net_CNNPredictor_VGG16 << "' does not exist." << std::endl;
exit(1); exit(1);
} }
if (!std::ifstream(FLAGS_predict_net).good()) { if (!std::ifstream(FLAGS_predict_net_CNNPredictor_VGG16).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net << "' does not exist." << std::endl; std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net_CNNPredictor_VGG16 << "' does not exist." << std::endl;
exit(1); exit(1);
} }
std::cout << "\nLoading network..." << std::endl; std::cout << "\nLoading network..." << std::endl;
// Read protobuf // Read protobuf
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net, &initNet)); CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net_CNNPredictor_VGG16, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net, &predictNet)); CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net_CNNPredictor_VGG16, &predictNet));
// Set device type // Set device type
#ifdef USE_GPU #ifdef USE_GPU
...@@ -114,4 +114,4 @@ class CNNPredictor_VGG16{ ...@@ -114,4 +114,4 @@ class CNNPredictor_VGG16{
} }
}; };
#endif // CNNPREDICTOR_VGG16 #endif // CNNPREDICTOR_VGG16
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment