Joseph Redmon
2015-09-23 f996bd59a61338d8d51e2b19482d684f6dd04d0f
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));
}