From aea3bceeb16e553ff75a2f28c7f44f04b81513d7 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Mon, 08 Dec 2014 20:11:04 +0000
Subject: [PATCH] timing code

---
 src/data.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/data.c b/src/data.c
index 9b57391..79cfcec 100644
--- a/src/data.c
+++ b/src/data.c
@@ -26,14 +26,16 @@
     char *labelpath = find_replace(path, "imgs", "det");
     labelpath = find_replace(labelpath, ".JPEG", ".txt");
     FILE *file = fopen(labelpath, "r");
+    if(!file) file_error(labelpath);
     int x, y, h, w;
     while(fscanf(file, "%d %d %d %d", &x, &y, &w, &h) == 4){
         int i = x/box_width;
         int j = y/box_height;
-        float dh = (float)(x%box_width)/box_height;
-        float dw = (float)(y%box_width)/box_width;
+        float dw = (float)(x%box_width)/box_height;
+        float dh = (float)(y%box_width)/box_width;
         float sh = h/scale;
         float sw = w/scale;
+        //printf("%d %d %f %f\n", i, j, dh, dw);
         int index = (i+j*num_width)*5;
         truth[index++] = 1;
         truth[index++] = dh;
@@ -41,6 +43,7 @@
         truth[index++] = sh;
         truth[index++] = sw;
     }
+    fclose(file);
 }
 
 void fill_truth(char *path, char **labels, int k, float *truth)
@@ -125,7 +128,7 @@
     }
 }
 
-data load_data_detection_random(int n, char **paths, int m, char **labels, int h, int w, int nh, int nw, float scale)
+data load_data_detection_random(int n, char **paths, int m, int h, int w, int nh, int nw, float scale)
 {
     char **random_paths = calloc(n, sizeof(char*));
     int i;

--
Gitblit v1.10.0