mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Fixed box.c
This commit is contained in:
parent
9d78cf5d00
commit
b4b9e8f3c3
32
src/box.c
32
src/box.c
@ -249,39 +249,11 @@ int nms_comparator(const void *pa, const void *pb)
|
||||
void do_nms_obj(box *boxes, float **probs, int total, int classes, float thresh)
|
||||
{
|
||||
int i, j, k;
|
||||
sortable_bbox *s = calloc(total, sizeof(sortable_bbox));
|
||||
sortable_bbox *s = (sortable_bbox *)calloc(total, sizeof(sortable_bbox));
|
||||
|
||||
for(i = 0; i < total; ++i){
|
||||
s[i].index = i;
|
||||
s[i].class = classes;
|
||||
s[i].probs = probs;
|
||||
}
|
||||
|
||||
qsort(s, total, sizeof(sortable_bbox), nms_comparator);
|
||||
for(i = 0; i < total; ++i){
|
||||
if(probs[s[i].index][classes] == 0) continue;
|
||||
box a = boxes[s[i].index];
|
||||
for(j = i+1; j < total; ++j){
|
||||
box b = boxes[s[j].index];
|
||||
if (box_iou(a, b) > thresh){
|
||||
for(k = 0; k < classes+1; ++k){
|
||||
probs[s[j].index][k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
free(s);
|
||||
}
|
||||
|
||||
|
||||
void do_nms_sort(box *boxes, float **probs, int total, int classes, float thresh)
|
||||
{
|
||||
int i, j, k;
|
||||
sortable_bbox *s = calloc(total, sizeof(sortable_bbox));
|
||||
|
||||
for(i = 0; i < total; ++i){
|
||||
s[i].index = i;
|
||||
s[i].class = classes;
|
||||
s[i].class1 = classes;
|
||||
s[i].probs = probs;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user