title: Initialising darknet opencv
body: <p>I get this error when trying to initialize darknet.</p>
  <blockquote>
  <p>Error: Assertion failed (separator_index &lt; line.size()) in cv::dnn::darknet::ReadDarknetFromCfgStream, file c:\build\master_winpack-build-win64-vc15\opencv\modules\dnn\src\darknet\darknet_io.cpp, line 507</p>
  </blockquote>
  <p>Anyone know what may be happening?</p>
  <p>I'm using <code>yolov3.weights</code> and <code>yolov3.cfg</code></p>
  <p>piece of code below.</p>
  <p>I've tried absolute file paths</p>
  <pre><code>// Load names of classes
  string classesFile = &quot;B:/coco.names&quot;;
  ifstream ifs(classesFile.c_str());
  string line;
  while (getline(ifs, line)) classes.push_back(line);
  
  // Give the configuration and weight files for the model
  String modelConfiguration = &quot;B:/yolov3a.cfg&quot;;
  String modelWeights = &quot;B:/yolov3.weights&quot;;
  
  // Load the network
  Net net = readNetFromDarknet(modelConfiguration, modelWeights);
  net.setPreferableBackend(DNN_BACKEND_OPENCV);
  net.setPreferableTarget(DNN_TARGET_CPU);
  
  
  //---------------
  
  return 0;
  </code></pre>
  <p>Any help is appreciated</p>