MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / read_boxes

Function read_boxes

yolo_detector/darknet_opt/src/data.c:138–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136
137
138box_label *read_boxes(char *filename, int *n)
139{
140 FILE *file = fopen(filename, "r");
141 if(!file) file_error(filename);
142 float x, y, h, w;
143 int id;
144 int count = 0;
145 int size = 64;
146 box_label *boxes = calloc(size, sizeof(box_label));
147 while(fscanf(file, "%d %f %f %f %f", &id, &x, &y, &w, &h) == 5){
148 if(count == size) {
149 size = size * 2;
150 boxes = realloc(boxes, size*sizeof(box_label));
151 }
152 boxes[count].id = id;
153 boxes[count].x = x;
154 boxes[count].y = y;
155 boxes[count].h = h;
156 boxes[count].w = w;
157 boxes[count].left = x - w/2;
158 boxes[count].right = x + w/2;
159 boxes[count].top = y - h/2;
160 boxes[count].bottom = y + h/2;
161 ++count;
162 }
163 fclose(file);
164 *n = count;
165 return boxes;
166}
167
168void randomize_boxes(box_label *b, int n)
169{

Callers 6

fill_truth_swagFunction · 0.85
fill_truth_regionFunction · 0.85
fill_truth_detectionFunction · 0.85
validate_yolo_recallFunction · 0.85
validate_coco_recallFunction · 0.85
validate_detector_recallFunction · 0.85

Calls 1

file_errorFunction · 0.85

Tested by

no test coverage detected