spalla overlap optimization
This commit is contained in:
+12
-2
@@ -186,6 +186,8 @@ int nms_comparator(const void *pa, const void *pb) {
|
||||
return 0;
|
||||
}
|
||||
float overlap(float x1, float w1, float x2, float w2) {
|
||||
/*
|
||||
//SLOW METHOD
|
||||
float l1 = x1 - w1/2;
|
||||
float l2 = x2 - w2/2;
|
||||
float left = l1 > l2 ? l1 : l2;
|
||||
@@ -193,6 +195,16 @@ float overlap(float x1, float w1, float x2, float w2) {
|
||||
float r2 = x2 + w2/2;
|
||||
float right = r1 < r2 ? r1 : r2;
|
||||
return right - left;
|
||||
*/
|
||||
|
||||
//SPALLA METHOD
|
||||
float l;
|
||||
w1 < w2? l=w1 : l=w2;
|
||||
float d = fabs(x1 - x2);
|
||||
float k = fabs(w1 - w2)/2;
|
||||
if (d <= k) return l;
|
||||
else if (d <= k +l) return l - (d-k);
|
||||
else return 0;
|
||||
}
|
||||
float box_intersection(box a, box b) {
|
||||
float w = overlap(a.x, a.w, b.x, b.w);
|
||||
@@ -235,7 +247,6 @@ void RegionInterpret::interpretData(dnnType *data_h) {
|
||||
get_region_boxes(data_h, imW, imH, output_dim.w, output_dim.h, thresh, probs, boxes, 0, 0, 0.5, 1);
|
||||
|
||||
//delete repeats
|
||||
/*
|
||||
for(int i = 0; i < tot; ++i){
|
||||
s[i].index = i;
|
||||
s[i].cl = classes;
|
||||
@@ -254,7 +265,6 @@ void RegionInterpret::interpretData(dnnType *data_h) {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
res_boxes_n = 0;
|
||||
//print results
|
||||
|
||||
Reference in New Issue
Block a user