From c40cdeb4021fc1a638969563972f13c9f5e90d74 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 09 Oct 2015 19:50:43 +0000
Subject: [PATCH] lots of comparator stuff

---
 src/region_layer.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/src/region_layer.c b/src/region_layer.c
index 4d8c2a4..3239f87 100644
--- a/src/region_layer.c
+++ b/src/region_layer.c
@@ -57,6 +57,28 @@
             activate_array(l.output + index + offset, locations*l.n*(1+l.coords), LOGISTIC);
         }
     }
+    if (l.object_logistic) {
+        for(b = 0; b < l.batch; ++b){
+            int index = b*l.inputs;
+            int p_index = index + locations*l.classes;
+            activate_array(l.output + p_index, locations*l.n, LOGISTIC);
+        }
+    }
+
+    if (l.coord_logistic) {
+        for(b = 0; b < l.batch; ++b){
+            int index = b*l.inputs;
+            int coord_index = index + locations*(l.classes + l.n);
+            activate_array(l.output + coord_index, locations*l.n*l.coords, LOGISTIC);
+        }
+    }
+
+    if (l.class_logistic) {
+        for(b = 0; b < l.batch; ++b){
+            int class_index = b*l.inputs;
+            activate_array(l.output + class_index, locations*l.classes, LOGISTIC);
+        }
+    }
 
     if(state.train){
         float avg_iou = 0;
@@ -85,7 +107,6 @@
                 float best_rmse = 20;
 
                 if (!is_obj){
-                    //printf(".");
                     continue;
                 }
 
@@ -113,6 +134,7 @@
                     }
 
                     float iou  = box_iou(out, truth);
+                    //iou = 0;
                     float rmse = box_rmse(out, truth);
                     if(best_iou > 0 || iou > 0){
                         if(iou > best_iou){
@@ -175,6 +197,20 @@
                 gradient_array(l.output + index + locations*l.classes, locations*l.n*(1+l.coords), 
                         LOGISTIC, l.delta + index + locations*l.classes);
             }
+            if (l.object_logistic) {
+                int p_index = index + locations*l.classes;
+                gradient_array(l.output + p_index, locations*l.n, LOGISTIC, l.delta + p_index);
+            }
+
+            if (l.class_logistic) {
+                int class_index = index;
+                gradient_array(l.output + class_index, locations*l.classes, LOGISTIC, l.delta + class_index);
+            }
+
+            if (l.coord_logistic) {
+                    int coord_index = index + locations*(l.classes + l.n);
+                gradient_array(l.output + coord_index, locations*l.n*l.coords, LOGISTIC, l.delta + coord_index);
+            }
             //printf("\n");
         }
         printf("Region Avg IOU: %f, Pos Cat: %f, All Cat: %f, Pos Obj: %f, Any Obj: %f, count: %d\n", avg_iou/count, avg_cat/count, avg_allcat/(count*l.classes), avg_obj/count, avg_anyobj/(l.batch*locations*l.n), count);

--
Gitblit v1.10.0