From c53e03348c65462bcba33f6352087dd6b9268e8f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Wed, 16 Sep 2015 21:12:10 +0000
Subject: [PATCH] yolo working w/ regions

---
 src/network_kernels.cu |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/network_kernels.cu b/src/network_kernels.cu
index a73ddd9..cfc6e83 100644
--- a/src/network_kernels.cu
+++ b/src/network_kernels.cu
@@ -116,14 +116,15 @@
 {
     int i;
     int update_batch = net.batch*net.subdivisions;
+    float rate = get_current_rate(net);
     for(i = 0; i < net.n; ++i){
         layer l = net.layers[i];
         if(l.type == CONVOLUTIONAL){
-            update_convolutional_layer_gpu(l, update_batch, net.learning_rate, net.momentum, net.decay);
+            update_convolutional_layer_gpu(l, update_batch, rate, net.momentum, net.decay);
         } else if(l.type == DECONVOLUTIONAL){
-            update_deconvolutional_layer_gpu(l, net.learning_rate, net.momentum, net.decay);
+            update_deconvolutional_layer_gpu(l, rate, net.momentum, net.decay);
         } else if(l.type == CONNECTED){
-            update_connected_layer_gpu(l, update_batch, net.learning_rate, net.momentum, net.decay);
+            update_connected_layer_gpu(l, update_batch, rate, net.momentum, net.decay);
         }
     }
 }
@@ -133,6 +134,7 @@
     network_state state;
     int x_size = get_network_input_size(net)*net.batch;
     int y_size = get_network_output_size(net)*net.batch;
+    if(net.layers[net.n-1].type == REGION) y_size = net.layers[net.n-1].truths*net.batch;
     if(!*net.input_gpu){
         *net.input_gpu = cuda_make_array(x, x_size);
         *net.truth_gpu = cuda_make_array(y, y_size);
@@ -147,7 +149,7 @@
     forward_network_gpu(net, state);
     backward_network_gpu(net, state);
     float error = get_network_cost(net);
-    if ((net.seen / net.batch) % net.subdivisions == 0) update_network_gpu(net);
+    if (((*net.seen) / net.batch) % net.subdivisions == 0) update_network_gpu(net);
 
     return error;
 }

--
Gitblit v1.10.0