From 516f019ba6fb88de7218dd3b4eaeadb1cf676518 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Mon, 11 May 2015 20:46:49 +0000
Subject: [PATCH] route handles input images well....ish

---
 src/detection.c |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/detection.c b/src/detection.c
index dafecec..a1ba888 100644
--- a/src/detection.c
+++ b/src/detection.c
@@ -115,6 +115,7 @@
         time=clock();
         float loss = train_network(net, train);
 
+        //TODO
         float *out = get_network_output_gpu(net);
         image im = float_to_image(net.w, net.h, 3, train.X.vals[127]);
         image copy = copy_image(im);
@@ -149,7 +150,7 @@
     if(weightfile){
         load_weights(&net, weightfile);
     }
-    detection_layer *layer = get_network_detection_layer(net);
+    detection_layer layer = get_network_detection_layer(net);
     net.learning_rate = 0;
     net.decay = 0;
     printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
@@ -157,9 +158,9 @@
     int i = net.seen/imgs;
     data train, buffer;
 
-    int classes = layer->classes;
-    int background = layer->background;
-    int side = sqrt(get_detection_layer_locations(*layer));
+    int classes = layer.classes;
+    int background = layer.background;
+    int side = sqrt(get_detection_layer_locations(layer));
 
     char **paths;
     list *plist;
@@ -174,7 +175,7 @@
     paths = (char **)list_to_array(plist);
     pthread_t load_thread = load_data_detection_thread(imgs, paths, plist->size, classes, net.w, net.h, side, side, background, &buffer);
     clock_t time;
-    cost_layer clayer = *((cost_layer *)net.layers[net.n-1]);
+    cost_layer clayer = net.layers[net.n-1];
     while(1){
         i += 1;
         time=clock();
@@ -235,15 +236,15 @@
     if(weightfile){
         load_weights(&net, weightfile);
     }
-    detection_layer *layer = get_network_detection_layer(net);
+    detection_layer layer = get_network_detection_layer(net);
     printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
     int imgs = 128;
     int i = net.seen/imgs;
     data train, buffer;
 
-    int classes = layer->classes;
-    int background = layer->background;
-    int side = sqrt(get_detection_layer_locations(*layer));
+    int classes = layer.classes;
+    int background = layer.background;
+    int side = sqrt(get_detection_layer_locations(layer));
 
     char **paths;
     list *plist;
@@ -325,7 +326,7 @@
     if(weightfile){
         load_weights(&net, weightfile);
     }
-    detection_layer *layer = get_network_detection_layer(net);
+    detection_layer layer = get_network_detection_layer(net);
     fprintf(stderr, "Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
     srand(time(0));
 
@@ -336,10 +337,10 @@
     //list *plist = get_paths("/home/pjreddie/data/voc/train.txt");
     char **paths = (char **)list_to_array(plist);
 
-    int classes = layer->classes;
-    int nuisance = layer->nuisance;
-    int background = (layer->background && !nuisance);
-    int num_boxes = sqrt(get_detection_layer_locations(*layer));
+    int classes = layer.classes;
+    int nuisance = layer.nuisance;
+    int background = (layer.background && !nuisance);
+    int num_boxes = sqrt(get_detection_layer_locations(layer));
 
     int per_box = 4+classes+background+nuisance;
     int num_output = num_boxes*num_boxes*per_box;
@@ -393,7 +394,7 @@
     load_weights(&post, "/home/pjreddie/imagenet_backup/localize_1000.weights");
     set_batch_network(&post, 1);
 
-    detection_layer *layer = get_network_detection_layer(net);
+    detection_layer layer = get_network_detection_layer(net);
     fprintf(stderr, "Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
     srand(time(0));
 
@@ -404,10 +405,10 @@
     //list *plist = get_paths("/home/pjreddie/data/voc/train.txt");
     char **paths = (char **)list_to_array(plist);
 
-    int classes = layer->classes;
-    int nuisance = layer->nuisance;
-    int background = (layer->background && !nuisance);
-    int num_boxes = sqrt(get_detection_layer_locations(*layer));
+    int classes = layer.classes;
+    int nuisance = layer.nuisance;
+    int background = (layer.background && !nuisance);
+    int num_boxes = sqrt(get_detection_layer_locations(layer));
 
     int per_box = 4+classes+background+nuisance;
 

--
Gitblit v1.10.0