From 62235e9aa3d0c15d87d49bf340625d075cba3e65 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sat, 19 Nov 2016 05:51:36 +0000
Subject: [PATCH] cpu batch norm works
---
src/detector.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/detector.c b/src/detector.c
index 50db65b..695b068 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -444,7 +444,6 @@
if(weightfile){
load_weights(&net, weightfile);
}
- layer l = net.layers[net.n-1];
set_batch_network(&net, 1);
srand(2222222);
clock_t time;
@@ -452,9 +451,6 @@
char *input = buff;
int j;
float nms=.4;
- box *boxes = calloc(l.w*l.h*l.n, sizeof(box));
- float **probs = calloc(l.w*l.h*l.n, sizeof(float *));
- for(j = 0; j < l.w*l.h*l.n; ++j) probs[j] = calloc(l.classes, sizeof(float *));
while(1){
if(filename){
strncpy(input, filename, 256);
@@ -467,6 +463,12 @@
}
image im = load_image_color(input,0,0);
image sized = resize_image(im, net.w, net.h);
+ layer l = net.layers[net.n-1];
+
+ box *boxes = calloc(l.w*l.h*l.n, sizeof(box));
+ float **probs = calloc(l.w*l.h*l.n, sizeof(float *));
+ for(j = 0; j < l.w*l.h*l.n; ++j) probs[j] = calloc(l.classes, sizeof(float *));
+
float *X = sized.data;
time=clock();
network_predict(net, X);
@@ -479,6 +481,8 @@
free_image(im);
free_image(sized);
+ free(boxes);
+ free_ptrs((void **)probs, l.w*l.h*l.n);
#ifdef OPENCV
cvWaitKey(0);
cvDestroyAllWindows();
--
Gitblit v1.10.0