From e36182cd8c5dd5c6d0aa1f77cf5cdca87e8bb1f0 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 21 Nov 2014 23:35:19 +0000
Subject: [PATCH] cleaned up data parsing a lot. probably nothing broken?
---
src/network.c | 20 +++-----------------
1 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/src/network.c b/src/network.c
index d7af995..339e6eb 100644
--- a/src/network.c
+++ b/src/network.c
@@ -476,25 +476,11 @@
}
}
-void top_predictions(network net, int n, int *index)
+void top_predictions(network net, int k, int *index)
{
- int i,j;
- int k = get_network_output_size(net);
+ int size = get_network_output_size(net);
float *out = get_network_output(net);
- float thresh = FLT_MAX;
- for(i = 0; i < n; ++i){
- float max = -FLT_MAX;
- int max_i = -1;
- for(j = 0; j < k; ++j){
- float val = out[j];
- if(val > max && val < thresh){
- max = val;
- max_i = j;
- }
- }
- index[i] = max_i;
- thresh = max;
- }
+ top_k(out, size, k, index);
}
--
Gitblit v1.10.0