title: Android Studio OpenCV yolo where do I put my files?
body: <p>I am creating an app in android studio that uses library opencv and yolo. I want to store the yolo config file and weights inside the android package. Right now I have those file in the external storage of my phone and I access them like this:</p>
  <pre><code>String yoloCfg = Environment.getExternalStorageDirectory() + &quot;/dnns/traffic-yolov3-tiny.cfg&quot; ;
  String yoloWeights = Environment.getExternalStorageDirectory() + &quot;/dnns/traffic-yolov3-tiny_15000.weights&quot;;
  yolo = Dnn.readNetFromDarknet(yoloCfg, yoloWeights);
  </code></pre>
  <p>My question is: where do I put yolo config file and weights for them to be inside the app when the user downloads the apk and how do I get the path to them, since readNetFromDarknet needs as args the path of those files.</p>
  <p>I have tried put them in the asset and attempt to get the path to asset but it doesnt work. This is the code I tried:</p>
  <pre><code>String yoloCfg = &quot;file:///android_asset/traffic-yolov3-tiny.cfg&quot;;
  String yoloWeights = &quot;file:///android_asset/traffic-yolov3-tiny_15000.weights&quot;;
  yolo = Dnn.readNetFromDarknet(yoloCfg, yoloWeights);
  </code></pre>
  <p>This is where I have the files:
  <a href="https://i.stack.imgur.com/qQzYh.jpg" rel="nofollow noreferrer">Location of files</a></p>
  <p>And this is the error I get:</p>
  <pre><code>E/cv::error(): OpenCV(4.0.1) Error: Parsing error (Failed to parse NetParameter file: file:///android_asset/traffic-yolov3-tiny.cfg) in readNetFromDarknet, file /build/master_pack-android/opencv/modules/dnn/src/darknet/darknet_importer.cpp, line 207
  E/org.opencv.dnn: dnn::readNetFromDarknet_10() caught cv::Exception: OpenCV(4.0.1) /build/master_pack-android/opencv/modules/dnn/src/darknet/darknet_importer.cpp:207: error: (-212:Parsing error) Failed to parse NetParameter file: file:///android_asset/traffic-yolov3-tiny.cfg in function 'readNetFromDarknet'
  E/SurfaceView: Exception configuring surface
  </code></pre>