Joseph Redmon
2014-12-04 1edcf73a73d2007afc61289245763f5cf0c29e10
src/data.c
@@ -26,14 +26,16 @@
    char *labelpath = find_replace(path, "imgs", "det");
    labelpath = find_replace(labelpath, ".JPEG", ".txt");
    FILE *file = fopen(labelpath, "r");
    if(!file) file_error(labelpath);
    int x, y, h, w;
    while(fscanf(file, "%d %d %d %d", &x, &y, &w, &h) == 4){
        int i = x/box_width;
        int j = y/box_height;
        float dh = (float)(x%box_width)/box_height;
        float dw = (float)(y%box_width)/box_width;
        float dw = (float)(x%box_width)/box_height;
        float dh = (float)(y%box_width)/box_width;
        float sh = h/scale;
        float sw = w/scale;
        //printf("%d %d %f %f\n", i, j, dh, dw);
        int index = (i+j*num_width)*5;
        truth[index++] = 1;
        truth[index++] = dh;
@@ -41,6 +43,7 @@
        truth[index++] = sh;
        truth[index++] = sw;
    }
    fclose(file);
}
void fill_truth(char *path, char **labels, int k, float *truth)
@@ -125,7 +128,7 @@
    }
}
data load_data_detection_random(int n, char **paths, int m, char **labels, int h, int w, int nh, int nw, float scale)
data load_data_detection_random(int n, char **paths, int m, int h, int w, int nh, int nw, float scale)
{
    char **random_paths = calloc(n, sizeof(char*));
    int i;