From 028696bf15efeca3acb3db8c42a96f7b9e0f55ff Mon Sep 17 00:00:00 2001
From: iovodov <b@ovdv.ru>
Date: Thu, 03 May 2018 13:33:46 +0000
Subject: [PATCH] Output improvements for detector results: When printing detector results, output was done in random order, obfuscating results for interpreting. Now: 1. Text output includes coordinates of rects in (left,right,top,bottom in pixels) along with label and score 2. Text output is sorted by rect lefts to simplify finding appropriate rects on image 3. If several class probs are > thresh for some detection, the most probable is written first and coordinates for others are not repeated 4. Rects are imprinted in image in order by their best class prob, so most probable rects are always on top and not overlayed by less probable ones 5. Most probable label for rect is always written first Also: 6. Message about low GPU memory include required amount

---
 src/deconvolutional_layer.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/deconvolutional_layer.c b/src/deconvolutional_layer.c
index d476957..fbef9d5 100644
--- a/src/deconvolutional_layer.c
+++ b/src/deconvolutional_layer.c
@@ -57,13 +57,13 @@
     l.stride = stride;
     l.size = size;
 
-    l.filters = calloc(c*n*size*size, sizeof(float));
-    l.filter_updates = calloc(c*n*size*size, sizeof(float));
+    l.weights = calloc(c*n*size*size, sizeof(float));
+    l.weight_updates = calloc(c*n*size*size, sizeof(float));
 
     l.biases = calloc(n, sizeof(float));
     l.bias_updates = calloc(n, sizeof(float));
     float scale = 1./sqrt(size*size*c);
-    for(i = 0; i < c*n*size*size; ++i) l.filters[i] = scale*rand_normal();
+    for(i = 0; i < c*n*size*size; ++i) l.weights[i] = scale*rand_normal();
     for(i = 0; i < n; ++i){
         l.biases[i] = scale;
     }
@@ -80,9 +80,13 @@
     l.output = calloc(l.batch*out_h * out_w * n, sizeof(float));
     l.delta  = calloc(l.batch*out_h * out_w * n, sizeof(float));
 
+    l.forward = forward_deconvolutional_layer;
+    l.backward = backward_deconvolutional_layer;
+    l.update = update_deconvolutional_layer;
+
     #ifdef GPU
-    l.filters_gpu = cuda_make_array(l.filters, c*n*size*size);
-    l.filter_updates_gpu = cuda_make_array(l.filter_updates, c*n*size*size);
+    l.weights_gpu = cuda_make_array(l.weights, c*n*size*size);
+    l.weight_updates_gpu = cuda_make_array(l.weight_updates, c*n*size*size);
 
     l.biases_gpu = cuda_make_array(l.biases, n);
     l.bias_updates_gpu = cuda_make_array(l.bias_updates, n);
@@ -137,7 +141,7 @@
     fill_cpu(l.outputs*l.batch, 0, l.output, 1);
 
     for(i = 0; i < l.batch; ++i){
-        float *a = l.filters;
+        float *a = l.weights;
         float *b = state.input + i*l.c*l.h*l.w;
         float *c = l.col_image;
 
@@ -167,7 +171,7 @@
 
         float *a = state.input + i*m*n;
         float *b = l.col_image;
-        float *c = l.filter_updates;
+        float *c = l.weight_updates;
 
         im2col_cpu(l.delta + i*l.n*size, l.n, out_h, out_w, 
                 l.size, l.stride, 0, b);
@@ -178,7 +182,7 @@
             int n = l.h*l.w;
             int k = l.size*l.size*l.n;
 
-            float *a = l.filters;
+            float *a = l.weights;
             float *b = l.col_image;
             float *c = state.delta + i*n*m;
 
@@ -193,9 +197,9 @@
     axpy_cpu(l.n, learning_rate, l.bias_updates, 1, l.biases, 1);
     scal_cpu(l.n, momentum, l.bias_updates, 1);
 
-    axpy_cpu(size, -decay, l.filters, 1, l.filter_updates, 1);
-    axpy_cpu(size, learning_rate, l.filter_updates, 1, l.filters, 1);
-    scal_cpu(size, momentum, l.filter_updates, 1);
+    axpy_cpu(size, -decay, l.weights, 1, l.weight_updates, 1);
+    axpy_cpu(size, learning_rate, l.weight_updates, 1, l.weights, 1);
+    scal_cpu(size, momentum, l.weight_updates, 1);
 }
 
 

--
Gitblit v1.10.0