【发布时间】:2019-12-06 04:18:26
【问题描述】:
我想使用YOLOv3 算法进行检测。我正在使用安装了 Linux 的英特尔 DE10 Nano FPGA 板。当我构建 YOLOv3(来自原始源)并运行它时,我收到错误“分段错误(核心转储)”。我做了很多研究,但没有一个有助于解决这个问题。
我使用了预先构建的权重和配置文件,即我运行了以下命令
./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg
但出现上述错误。但同样的事情在我的计算机和其他几个计算机上运行时没有任何问题,但在我的开发板上却没有。 然后我开始调试(使用大量 printf 语句)“python”目录中“darknet.py”中的代码,发现错误位于
"yolo_layer.c" file
line.no.336-> "dets[count].prob[j] = (prob > thresh) ? prob : 0;"
in "get_yolo_detections" function.
我该如何解决这个问题?我已经按照函数和文件来查看错误来自哪里。
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;
}
【问题讨论】:
标签: c image-processing segmentation-fault fpga yolo