| | |
| | | h = boxes[i].h; |
| | | id = boxes[i].id; |
| | | |
| | | if (w < .01 || h < .01) continue; |
| | | if (w < .001 || h < .001) continue; |
| | | |
| | | int col = (int)(x*num_boxes); |
| | | int row = (int)(y*num_boxes); |
| | |
| | | find_replace(labelpath, ".JPG", ".txt", labelpath); |
| | | find_replace(labelpath, ".JPEG", ".txt", labelpath); |
| | | int count = 0; |
| | | int i; |
| | | box_label *boxes = read_boxes(labelpath, &count); |
| | | if (small_object == 1) { |
| | | for (int i = 0; i < count; ++i) { |
| | | for (i = 0; i < count; ++i) { |
| | | if (boxes[i].w < 0.01) boxes[i].w = 0.01; |
| | | if (boxes[i].h < 0.01) boxes[i].h = 0.01; |
| | | } |
| | |
| | | if(count > num_boxes) count = num_boxes; |
| | | float x,y,w,h; |
| | | int id; |
| | | int i; |
| | | |
| | | for (i = 0; i < count; ++i) { |
| | | x = boxes[i].x; |
| | |
| | | id = boxes[i].id; |
| | | |
| | | // not detect small objects |
| | | if ((w < 0.01 || h < 0.01)) continue; |
| | | if ((w < 0.001 || h < 0.001)) continue; |
| | | |
| | | truth[i*5+0] = x; |
| | | truth[i*5+1] = y; |
| | |
| | | for(i = 0; i < 10000; ++i){ |
| | | unsigned char bytes[3073]; |
| | | fread(bytes, 1, 3073, fp); |
| | | int class = bytes[0]; |
| | | y.vals[i][class] = 1; |
| | | int class_id = bytes[0]; |
| | | y.vals[i][class_id] = 1; |
| | | for(j = 0; j < X.cols; ++j){ |
| | | X.vals[i][j] = (double)bytes[j+1]; |
| | | } |
| | |
| | | for(i = 0; i < 10000; ++i){ |
| | | unsigned char bytes[3073]; |
| | | fread(bytes, 1, 3073, fp); |
| | | int class = bytes[0]; |
| | | y.vals[i+b*10000][class] = 1; |
| | | int class_id = bytes[0]; |
| | | y.vals[i+b*10000][class_id] = 1; |
| | | for(j = 0; j < X.cols; ++j){ |
| | | X.vals[i+b*10000][j] = (double)bytes[j+1]; |
| | | } |