From 37d7c1e79f65a75caf87e29a562d30c51cd654e5 Mon Sep 17 00:00:00 2001
From: Joe Redmon <pjreddie@gmail.com>
Date: Thu, 26 Nov 2015 21:52:56 +0000
Subject: [PATCH] fixed label linking
---
src/network_kernels.cu | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/network_kernels.cu b/src/network_kernels.cu
index 593de0a..26b8404 100644
--- a/src/network_kernels.cu
+++ b/src/network_kernels.cu
@@ -1,6 +1,11 @@
+#include "cuda_runtime.h"
+#include "curand.h"
+#include "cublas_v2.h"
+
extern "C" {
#include <stdio.h>
#include <time.h>
+#include <assert.h>
#include "network.h"
#include "image.h"
@@ -12,13 +17,13 @@
#include "crop_layer.h"
#include "connected_layer.h"
#include "detection_layer.h"
-#include "region_layer.h"
#include "convolutional_layer.h"
#include "deconvolutional_layer.h"
#include "maxpool_layer.h"
#include "avgpool_layer.h"
#include "normalization_layer.h"
#include "cost_layer.h"
+#include "local_layer.h"
#include "softmax_layer.h"
#include "dropout_layer.h"
#include "route_layer.h"
@@ -35,16 +40,16 @@
for(i = 0; i < net.n; ++i){
layer l = net.layers[i];
if(l.delta_gpu){
- scal_ongpu(l.outputs * l.batch, 0, l.delta_gpu, 1);
+ fill_ongpu(l.outputs * l.batch, 0, l.delta_gpu, 1);
}
if(l.type == CONVOLUTIONAL){
forward_convolutional_layer_gpu(l, state);
} else if(l.type == DECONVOLUTIONAL){
forward_deconvolutional_layer_gpu(l, state);
+ } else if(l.type == LOCAL){
+ forward_local_layer_gpu(l, state);
} else if(l.type == DETECTION){
forward_detection_layer_gpu(l, state);
- } else if(l.type == REGION){
- forward_region_layer_gpu(l, state);
} else if(l.type == CONNECTED){
forward_connected_layer_gpu(l, state);
} else if(l.type == CROP){
@@ -87,6 +92,8 @@
backward_convolutional_layer_gpu(l, state);
} else if(l.type == DECONVOLUTIONAL){
backward_deconvolutional_layer_gpu(l, state);
+ } else if(l.type == LOCAL){
+ backward_local_layer_gpu(l, state);
} else if(l.type == MAXPOOL){
if(i != 0) backward_maxpool_layer_gpu(l, state);
} else if(l.type == AVGPOOL){
@@ -95,8 +102,6 @@
backward_dropout_layer_gpu(l, state);
} else if(l.type == DETECTION){
backward_detection_layer_gpu(l, state);
- } else if(l.type == REGION){
- backward_region_layer_gpu(l, state);
} else if(l.type == NORMALIZATION){
backward_normalization_layer_gpu(l, state);
} else if(l.type == SOFTMAX){
@@ -115,14 +120,17 @@
{
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);
+ } else if(l.type == LOCAL){
+ update_local_layer_gpu(l, update_batch, rate, net.momentum, net.decay);
}
}
}
@@ -132,6 +140,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 == DETECTION) 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);
@@ -146,7 +155,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