Segmentation fault (code dumped) in this line "dets[count].prob[j] = (prob > thresh) ? prob : 0;" in YOLOv3 : I want to use YOLOv3 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 "Segmentation fault(core dumped)". I did lot of googling and research but none of them helped to fix this issue.

I used pre-built weights and configuration files i.e I ran the below command

"./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg"

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(lot of printf statements) the code from "darknet.py" in "python" directory and found that the error resides in "yolo_layer.c" file
 
line.no.336-> "dets[count].prob[j] = (prob > thresh) ? prob : 0;"
 
in "get_yolo_detections" function.

I have no idea how to fix this.
Please help.

I've followed function to function and file to file to see where the error is from.

    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 < l.w*l.h; ++i){
            int row = i / l.w;
            int col = i % l.w;
            for(n = 0; n < l.n; ++n){
                int obj_index  = entry_index(l, 0, n*l.w*l.h + i, 4);
                float objectness = predictions[obj_index];
                if(objectness <= 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 < 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 > thresh) ? prob : 0;
                    //^^--error in the above line(got from debugging)

                }
                ++count;
            }
        }
        correct_yolo_boxes(dets, count, w, h, netw, neth, relative);
        return count;
    }