title: CNN model does not load inside Visual Studio 2017 using dnn.readNetFromTensorflow
body: <p>I have created a simple CNN model which I froze into <code>tf_model.pb</code> file and I have tried loading it using open cv <code>dnn.readNetFromTesnorflow(model_path)</code> method inside Jupyter Notebook and it works perfectly. The problem is when I try to load it inside Visual Studio 2017, for some reason it does not load correctly.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  #include &lt;opencv2/dnn.hpp&gt;
  #include &lt;vector&gt;
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  using namespace std;
  using namespace cv;
  using namespace cv::dnn;
  
  int main(int argc, char** argv) {
  
  
      class CharNet {
  
          private:
              Net network;
              string output_layer;
  
          public:
  
              CharNet(string path) {
                  try {
                      cout &lt;&lt; "Path: "&lt;&lt; path &lt;&lt; endl;
  
                      network = readNetFromTensorflow(path);
  
                      vector&lt;String&gt; network_layers = network.getLayerNames();
                      cout &lt;&lt; "There are "&lt;&lt;network_layers.size()&lt;&lt; " layers" &lt;&lt; endl;
                      for (int i = 0; i &lt; network_layers.size(); i++) {
                          cout &lt;&lt; network_layers[i] &lt;&lt; endl;
                          if ( network_layers[i].find("Softmax") != std::string::npos ) {
                              cout &lt;&lt; "Output Layer: "&lt;&lt; network_layers[i] &lt;&lt; endl;
                              output_layer = network_layers[i];
                              break;
                          }
                      }
  
                  }
                  catch (cv::Exception&amp; e) {
                      cerr &lt;&lt; "Exception: " &lt;&lt; e.what() &lt;&lt; endl;
                      if (network.empty()) {
                          cerr &lt;&lt; "Can't load the model" &lt;&lt; endl;
                      }
                  }
              }
  
      };
  
      string model = "C:/Users/stefan_cepa995/source/repos/OpenCV_Test/OpenCV_Test/tf_model.pb";
  
      CharNet* obj = new CharNet(model);
  
      return 0;
  
  }
  </code></pre>
  
  <p>Since the model is not loaded correctly I never enter the for loop. Does anyone have any idea whats going on?</p>