From 11c72b1132feca7c1252ea01d02da4cb497e723f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Thu, 11 Jun 2015 22:38:58 +0000
Subject: [PATCH] testing on one image

---
 src/utils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/utils.c b/src/utils.c
index bc39cec..bd2f54d 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -73,11 +73,11 @@
 void top_k(float *a, int n, int k, int *index)
 {
     int i,j;
-    for(j = 0; j < k; ++j) index[j] = 0;
+    for(j = 0; j < k; ++j) index[j] = -1;
     for(i = 0; i < n; ++i){
         int curr = i;
         for(j = 0; j < k; ++j){
-            if(a[curr] > a[index[j]]){
+            if((index[j] < 0) || a[curr] > a[index[j]]){
                 int swap = curr;
                 curr = index[j];
                 index[j] = swap;

--
Gitblit v1.10.0