CLEAN UP CLEAN UP EVERYBODY DO YOUR oh wait it's just me

This commit is contained in:
Joseph Redmon
2018-03-24 18:23:04 -07:00
parent e31c50127e
commit 777b098232
16 changed files with 620 additions and 337 deletions

View File

@ -133,7 +133,6 @@ void validate_yolo(char *cfg, char *weights)
image *buf = calloc(nthreads, sizeof(image));
image *buf_resized = calloc(nthreads, sizeof(image));
pthread_t *thr = calloc(nthreads, sizeof(pthread_t));
detection *dets = make_network_boxes(net, 0);
load_args args = {0};
args.w = net->w;
@ -167,9 +166,11 @@ void validate_yolo(char *cfg, char *weights)
network_predict(net, X);
int w = val[t].w;
int h = val[t].h;
fill_network_boxes(net, w, h, thresh, 0, 0, 0, dets);
int nboxes = 0;
detection *dets = get_network_boxes(net, w, h, thresh, 0, 0, 0, &nboxes);
if (nms) do_nms_sort(dets, l.side*l.side*l.n, classes, iou_thresh);
print_yolo_detections(fps, id, l.side*l.side*l.n, classes, w, h, dets);
free_detections(dets, nboxes);
free(id);
free_image(val[t]);
free_image(val_resized[t]);
@ -200,7 +201,6 @@ void validate_yolo_recall(char *cfg, char *weights)
snprintf(buff, 1024, "%s%s.txt", base, voc_names[j]);
fps[j] = fopen(buff, "w");
}
detection *dets = make_network_boxes(net, 0);
int m = plist->size;
int i=0;
@ -221,7 +221,8 @@ void validate_yolo_recall(char *cfg, char *weights)
char *id = basecfg(path);
network_predict(net, sized.data);
fill_network_boxes(net, orig.w, orig.h, thresh, 0, 0, 1, dets);
int nboxes = 0;
detection *dets = get_network_boxes(net, orig.w, orig.h, thresh, 0, 0, 1, &nboxes);
if (nms) do_nms_obj(dets, side*side*l.n, 1, nms);
char labelpath[4096];
@ -254,6 +255,7 @@ void validate_yolo_recall(char *cfg, char *weights)
}
fprintf(stderr, "%5d %5d %5d\tRPs/Img: %.2f\tIOU: %.2f%%\tRecall:%.2f%%\n", i, correct, total, (float)proposals/(i+1), avg_iou*100/total, 100.*correct/total);
free_detections(dets, nboxes);
free(id);
free_image(orig);
free_image(sized);
@ -271,7 +273,6 @@ void test_yolo(char *cfgfile, char *weightfile, char *filename, float thresh)
char buff[256];
char *input = buff;
float nms=.4;
detection *dets = make_network_boxes(net, 0);
while(1){
if(filename){
strncpy(input, filename, 256);
@ -289,13 +290,14 @@ void test_yolo(char *cfgfile, char *weightfile, char *filename, float thresh)
network_predict(net, X);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
fill_network_boxes(net, 1, 1, thresh, 0, 0, 0, dets);
int nboxes = 0;
detection *dets = get_network_boxes(net, im.w, im.h, thresh, 0, 0, 0, &nboxes);
if (nms) do_nms_sort(dets, l.side*l.side*l.n, l.classes, nms);
draw_detections(im, dets, l.side*l.side*l.n, thresh, voc_names, alphabet, 20);
save_image(im, "predictions");
show_image(im, "predictions");
free_detections(dets, nboxes);
free_image(im);
free_image(sized);
#ifdef OPENCV