title: Segmentation fault (core dumped) when using YOLOv3 from pjreddie
body: <p>I want to use <a href="https://github.com/pjreddie/darknet" rel="nofollow noreferrer">YOLOv3</a> algorithm for detection. I am using Intel's DE10 Nano FPGA board with Linux installed. When I built YOLOv3 (from original source) and ran it, I am getting error &quot;Segmentation fault (core dumped)&quot;. I did lot of research but none of them helped to fix this issue.</p>
  <p>I used pre-built weights and configuration files i.e I ran the below command</p>
  <pre><code>./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg
  </code></pre>
  <p>but got the error as stated above.But the same thing runs with out any hiccups on my computer and several others, but not on my Devboard.
  Then I started debugging (using lot of printf statements) the code from &quot;darknet.py&quot; in &quot;python&quot; directory and found that the error resides in</p>
  <pre><code>&quot;yolo_layer.c&quot; file
   
  line.no.336-&gt; &quot;dets[count].prob[j] = (prob &gt; thresh) ? prob : 0;&quot;
   
  in &quot;get_yolo_detections&quot; function.
  </code></pre>
  <p>How can I fix this? I've followed function to function and file to file to see where the error is from.</p>
  <pre><code>int get_yolo_detections(layer l, int w, int h, int netw, int neth, float thresh, int *map, int relative, detection *dets)
  {
      int i,j,n;
      float *predictions = l.output;
      if (l.batch == 2) avg_flipped_yolo(l);
      int count = 0;
      for (i = 0; i &lt; l.w*l.h; ++i){
          int row = i / l.w;
          int col = i % l.w;
          for(n = 0; n &lt; l.n; ++n){
              int obj_index  = entry_index(l, 0, n*l.w*l.h + i, 4);
              float objectness = predictions[obj_index];
              if(objectness &lt;= thresh) continue;
              int box_index  = entry_index(l, 0, n*l.w*l.h + i, 0);
              dets[count].bbox = get_yolo_box(predictions, l.biases, l.mask[n], box_index, col, row, l.w, l.h, netw, neth, l.w*l.h);
              dets[count].objectness = objectness;
              dets[count].classes = l.classes;
              for(j = 0; j &lt; l.classes; ++j){
                  int class_index = entry_index(l, 0, n*l.w*l.h + i, 4 + 1 + j);
                  float prob = objectness*predictions[class_index];
  
                  //|||||||error in below line||||||||
                  dets[count].prob[j] = (prob &gt; thresh) ? prob : 0;
                  //^^--error in the above line(got from debugging)
  
              }
              ++count;
          }
      }
      correct_yolo_boxes(dets, count, w, h, netw, neth, relative);
      return count;
  }
  </code></pre>