From 6553b3f0e3e55fc30a99c7d4b5798aa86d18a114 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Mon, 30 Mar 2015 02:31:47 +0000
Subject: [PATCH] no comment
---
src/data.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/data.c b/src/data.c
index 8dd7d9a..c1167da 100644
--- a/src/data.c
+++ b/src/data.c
@@ -66,6 +66,7 @@
typedef struct box{
int id;
float x,y,w,h;
+ float left, right, top, bottom;
} box;
box *read_boxes(char *filename, int *n)
@@ -83,6 +84,10 @@
boxes[count].y = y;
boxes[count].h = h;
boxes[count].w = w;
+ boxes[count].left = x - w/2;
+ boxes[count].right = x + w/2;
+ boxes[count].top = y - h/2;
+ boxes[count].bottom = y + h/2;
++count;
}
fclose(file);
@@ -137,18 +142,20 @@
if(j < 0) j = 0;
if(j >= num_height) j = num_height-1;
- float dw = (x - i*box_width)/box_width;
- float dh = (y - j*box_height)/box_height;
+ float dw = constrain(0,1, (x - i*box_width)/box_width );
+ float dh = constrain(0,1, (y - j*box_height)/box_height );
+ float th = constrain(0,1, h*(height+jitter)/height );
+ float tw = constrain(0,1, w*(width+jitter)/width );
int index = (i+j*num_width)*(4+classes+background);
- if(truth[index+classes+background]) continue;
+ if(truth[index+classes+background+2]) continue;
if(background) truth[index++] = 0;
truth[index+id] = 1;
index += classes;
truth[index++] = dh;
truth[index++] = dw;
- truth[index++] = h*(height+jitter)/height;
- truth[index++] = w*(width+jitter)/width;
+ truth[index++] = th;
+ truth[index++] = tw;
}
free(boxes);
}
--
Gitblit v1.10.0