From 729ce43e6ec45cfdb58e06e227428a0f81c5de0f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 10 Jun 2016 00:20:31 +0000
Subject: [PATCH] stuff
---
src/detection_layer.c | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/src/detection_layer.c b/src/detection_layer.c
index ca32bc0..e103b4e 100644
--- a/src/detection_layer.c
+++ b/src/detection_layer.c
@@ -50,7 +50,7 @@
int index = b*l.inputs;
for (i = 0; i < locations; ++i) {
int offset = i*l.classes;
- softmax_array(l.output + index + offset, l.classes,
+ softmax_array(l.output + index + offset, l.classes, 1,
l.output + index + offset);
}
int offset = locations*l.classes;
@@ -175,6 +175,38 @@
LOGISTIC, l.delta + index + locations*l.classes);
}
}
+
+ if(0){
+ float *costs = calloc(l.batch*locations*l.n, sizeof(float));
+ for (b = 0; b < l.batch; ++b) {
+ int index = b*l.inputs;
+ for (i = 0; i < locations; ++i) {
+ int truth_index = (b*locations + i)*(1+l.coords+l.classes);
+ for (j = 0; j < l.n; ++j) {
+ int p_index = index + locations*l.classes + i*l.n + j;
+ costs[b*locations*l.n + i*l.n + j] = l.delta[p_index]*l.delta[p_index];
+ }
+ }
+ }
+ int indexes[100];
+ top_k(costs, l.batch*locations*l.n, 100, indexes);
+ float cutoff = costs[indexes[99]];
+ for (b = 0; b < l.batch; ++b) {
+ int index = b*l.inputs;
+ for (i = 0; i < locations; ++i) {
+ int truth_index = (b*locations + i)*(1+l.coords+l.classes);
+ for (j = 0; j < l.n; ++j) {
+ int p_index = index + locations*l.classes + i*l.n + j;
+ if (l.delta[p_index]*l.delta[p_index] < cutoff) l.delta[p_index] = 0;
+ }
+ }
+ }
+ free(costs);
+ }
+
+
+
+
printf("Detection 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