From 9f7d403a3cb7dc62c658231f4cf18e33d152806c Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Wed, 28 Mar 2018 20:33:03 +0000
Subject: [PATCH] Added Yolo v2 bash files

---
 src/route_layer.c |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/route_layer.c b/src/route_layer.c
index 47e3d70..dce7118 100644
--- a/src/route_layer.c
+++ b/src/route_layer.c
@@ -5,7 +5,7 @@
 
 route_layer make_route_layer(int batch, int n, int *input_layers, int *input_sizes)
 {
-    fprintf(stderr,"Route Layer:");
+    fprintf(stderr,"route ");
     route_layer l = {0};
     l.type = ROUTE;
     l.batch = batch;
@@ -36,6 +36,40 @@
     return l;
 }
 
+void resize_route_layer(route_layer *l, network *net)
+{
+    int i;
+    layer first = net->layers[l->input_layers[0]];
+    l->out_w = first.out_w;
+    l->out_h = first.out_h;
+    l->out_c = first.out_c;
+    l->outputs = first.outputs;
+    l->input_sizes[0] = first.outputs;
+    for(i = 1; i < l->n; ++i){
+        int index = l->input_layers[i];
+        layer next = net->layers[index];
+        l->outputs += next.outputs;
+        l->input_sizes[i] = next.outputs;
+        if(next.out_w == first.out_w && next.out_h == first.out_h){
+            l->out_c += next.out_c;
+        }else{
+            printf("%d %d, %d %d\n", next.out_w, next.out_h, first.out_w, first.out_h);
+            l->out_h = l->out_w = l->out_c = 0;
+        }
+    }
+    l->inputs = l->outputs;
+    l->delta =  realloc(l->delta, l->outputs*l->batch*sizeof(float));
+    l->output = realloc(l->output, l->outputs*l->batch*sizeof(float));
+
+#ifdef GPU
+    cuda_free(l->output_gpu);
+    cuda_free(l->delta_gpu);
+    l->output_gpu  = cuda_make_array(l->output, l->outputs*l->batch);
+    l->delta_gpu   = cuda_make_array(l->delta,  l->outputs*l->batch);
+#endif
+    
+}
+
 void forward_route_layer(const route_layer l, network_state state)
 {
     int i, j;

--
Gitblit v1.10.0