From 8bcdee86585f496afe1a8a38d608ea0504a11243 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Tue, 01 Sep 2015 18:22:03 +0000
Subject: [PATCH] Some bug fixes, random stuff
---
src/yolo.c | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/src/yolo.c b/src/yolo.c
index 5ad9534..9bf96de 100644
--- a/src/yolo.c
+++ b/src/yolo.c
@@ -88,14 +88,26 @@
int background = layer.objectness;
int side = sqrt(get_detection_layer_locations(layer));
- pthread_t load_thread = load_data_detection_thread(imgs, paths, plist->size, classes, net.w, net.h, side, side, background, &buffer);
+ load_args args = {0};
+ args.w = net.w;
+ args.h = net.h;
+ args.paths = paths;
+ args.n = imgs;
+ args.m = plist->size;
+ args.classes = classes;
+ args.num_boxes = side;
+ args.background = background;
+ args.d = &buffer;
+ args.type = DETECTION_DATA;
+
+ pthread_t load_thread = load_data_in_thread(args);
clock_t time;
while(i*imgs < N*130){
i += 1;
time=clock();
pthread_join(load_thread, 0);
train = buffer;
- load_thread = load_data_detection_thread(imgs, paths, plist->size, classes, net.w, net.h, side, side, background, &buffer);
+ load_thread = load_data_in_thread(args);
printf("Loaded: %lf seconds\n", sec(clock()-time));
time=clock();
@@ -126,7 +138,8 @@
pthread_join(load_thread, 0);
free_data(buffer);
- load_thread = load_data_detection_thread(imgs, paths, plist->size, classes, net.w, net.h, side, side, background, &buffer);
+ args.background = background;
+ load_thread = load_data_in_thread(args);
}
if((i-1)*imgs <= 120*N && i*imgs > N*120){
@@ -237,8 +250,17 @@
image *buf = calloc(nthreads, sizeof(image));
image *buf_resized = calloc(nthreads, sizeof(image));
pthread_t *thr = calloc(nthreads, sizeof(pthread_t));
+
+ load_args args = {0};
+ args.w = net.w;
+ args.h = net.h;
+ args.type = IMAGE_DATA;
+
for(t = 0; t < nthreads; ++t){
- thr[t] = load_image_thread(paths[i+t], &buf[t], &buf_resized[t], net.w, net.h);
+ args.path = paths[i+t];
+ args.im = &buf[t];
+ args.resized = &buf_resized[t];
+ thr[t] = load_data_in_thread(args);
}
time_t start = time(0);
for(i = nthreads; i < m+nthreads; i += nthreads){
@@ -249,7 +271,10 @@
val_resized[t] = buf_resized[t];
}
for(t = 0; t < nthreads && i+t < m; ++t){
- thr[t] = load_image_thread(paths[i+t], &buf[t], &buf_resized[t], net.w, net.h);
+ args.path = paths[i+t];
+ args.im = &buf[t];
+ args.resized = &buf_resized[t];
+ thr[t] = load_data_in_thread(args);
}
for(t = 0; t < nthreads && i+t-nthreads < m; ++t){
char *path = paths[i+t-nthreads];
@@ -259,7 +284,7 @@
int w = val[t].w;
int h = val[t].h;
convert_yolo_detections(predictions, classes, objectness, background, num_boxes, w, h, thresh, probs, boxes);
- if (nms) do_nms(boxes, probs, num_boxes, classes, iou_thresh);
+ if (nms) do_nms(boxes, probs, num_boxes*num_boxes, classes, iou_thresh);
print_yolo_detections(fps, id, boxes, probs, num_boxes, classes, w, h);
free(id);
free_image(val[t]);
--
Gitblit v1.10.0