From 55fbdd1007488b2e98dbe4b07cc798954b5e165f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Wed, 23 Sep 2015 06:29:03 +0000
Subject: [PATCH] fixes to image

---
 src/compare.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/compare.c b/src/compare.c
index 9b6d6bf..74c1cf5 100644
--- a/src/compare.c
+++ b/src/compare.c
@@ -175,8 +175,8 @@
     image im1 = load_image_color(box1.filename, net.w, net.h);
     image im2 = load_image_color(box2.filename, net.w, net.h);
     float *X  = calloc(net.w*net.h*net.c, sizeof(float));
-    memcpy(X,                   im1.data, im1.w*im1.h*im1.c);
-    memcpy(X+im1.w*im1.h*im1.c, im2.data, im2.w*im2.h*im2.c);
+    memcpy(X,                   im1.data, im1.w*im1.h*im1.c*sizeof(float));
+    memcpy(X+im1.w*im1.h*im1.c, im2.data, im2.w*im2.h*im2.c*sizeof(float));
     float *predictions = network_predict(net, X);
     
     free_image(im1);
@@ -241,7 +241,8 @@
     srand(time(0));
     set_batch_network(&net, 1);
 
-    list *plist = get_paths("data/compare.sort.list");
+    //list *plist = get_paths("data/compare.sort.list");
+    list *plist = get_paths("data/compare.cat.list");
     //list *plist = get_paths("data/compare.val.old");
     char **paths = (char **)list_to_array(plist);
     int N = plist->size;
@@ -256,15 +257,16 @@
     }
     int round;
     clock_t time=clock();
-    for(round = 1; round <= 40; ++round){
+    for(round = 1; round <= 500; ++round){
         clock_t round_time=clock();
         printf("Round: %d\n", round);
         qsort(boxes, N, sizeof(sortable_bbox), elo_comparator);
         sorta_shuffle(boxes, N, sizeof(sortable_bbox), 10);
+        shuffle(boxes, N, sizeof(sortable_bbox));
         for(i = 0; i < N/2; ++i){
             bbox_fight(boxes+i*2, boxes+i*2+1);
         }
-        if(round >= 4){
+        if(round >= 4 && 0){
             qsort(boxes, N, sizeof(sortable_bbox), elo_comparator);
             if(round == 4){
                 N = N/2;
@@ -275,9 +277,11 @@
         printf("Round: %f secs, %d remaining\n", sec(clock()-round_time), N);
     }
     qsort(boxes, N, sizeof(sortable_bbox), elo_comparator);
+    FILE *outfp = fopen("results/battle.log", "w");
     for(i = 0; i < N; ++i){
-        printf("%s %f\n", boxes[i].filename, boxes[i].elo);
+        fprintf(outfp, "%s %f\n", boxes[i].filename, boxes[i].elo);
     }
+    fclose(outfp);
     printf("Tournament in %d compares, %f secs\n", total_compares, sec(clock()-time));
 }
 

--
Gitblit v1.10.0