From f047cfff99e00e28c02eb59b6d32386c122f9af6 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sun, 08 Mar 2015 18:31:12 +0000
Subject: [PATCH] renamed sigmoid to logistic

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

diff --git a/src/data.c b/src/data.c
index a6b6db3..a429476 100644
--- a/src/data.c
+++ b/src/data.c
@@ -89,8 +89,8 @@
         float dw = (x - i*box_width)/box_width;
         float dh = (y - j*box_height)/box_height;
         //printf("%d %d %d %f %f\n", id, i, j, dh, dw);
-        int index = (i+j*num_width)*(4+classes+1);
-        truth[index++] = 1;
+        int index = (i+j*num_width)*(4+classes);
+        if(truth[index+classes]) continue;
         truth[index+id] = 1;
         index += classes;
         truth[index++] = dh;
@@ -98,6 +98,12 @@
         truth[index++] = h*(height+jitter)/height;
         truth[index++] = w*(width+jitter)/width;
     }
+    int i, j;
+    for(i = 0; i < num_height*num_width*(4+classes); i += 4+classes){
+        int background = 1;
+        for(j = i; j < i+classes; ++j) if (truth[j]) background = 0;
+        truth[i+classes-1] = background;
+    }
     fclose(file);
 }
 
@@ -143,6 +149,16 @@
     return d;
 }
 
+data load_data_captcha_encode(char **paths, int n, int m, int h, int w)
+{
+    if(m) paths = get_random_paths(paths, n, m);
+    data d;
+    d.shallow = 0;
+    d.X = load_image_paths(paths, n, h, w);
+    d.y = d.X;
+    if(m) free(paths);
+    return d;
+}
 
 void fill_truth(char *path, char **labels, int k, float *truth)
 {
@@ -209,7 +225,7 @@
     data d;
     d.shallow = 0;
     d.X = load_image_paths(random_paths, n, h, w);
-    int k = nh*nw*(4+classes+1);
+    int k = nh*nw*(4+classes);
     d.y = make_matrix(n, k);
     for(i = 0; i < n; ++i){
         int dx = rand()%jitter;
@@ -227,6 +243,7 @@
 
 void *load_detection_thread(void *ptr)
 {
+    printf("Loading data: %d\n", rand());
     struct load_args a = *(struct load_args*)ptr;
     *a.d = load_data_detection_jitter_random(a.n, a.paths, a.m, a.classes, a.h, a.w, a.nh, a.nw, a.jitter);
     translate_data_rows(*a.d, -128);

--
Gitblit v1.10.0