| | |
| | | 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; |
| | |
| | | truth[index++] = sh; |
| | | truth[index++] = sw; |
| | | } |
| | | fclose(file); |
| | | } |
| | | |
| | | void fill_truth(char *path, char **labels, int k, float *truth) |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |