From f11480833d19c0a7e9e1f7b45a19ba5bb5d63666 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sun, 02 Aug 2015 00:26:53 +0000
Subject: [PATCH] Headers are important

---
 src/parser.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/parser.c b/src/parser.c
index 893111e..b373c01 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -167,7 +167,7 @@
     int rescore = option_find_int(options, "rescore", 0);
     int joint = option_find_int(options, "joint", 0);
     int objectness = option_find_int(options, "objectness", 0);
-    int background = option_find_int(options, "background", 0);
+    int background = 0;
     detection_layer layer = make_detection_layer(params.batch, params.inputs, classes, coords, joint, rescore, background, objectness);
     return layer;
 }
@@ -196,7 +196,10 @@
     batch=params.batch;
     if(!(h && w && c)) error("Layer before crop layer must output image.");
 
+    int noadjust = option_find_int_quiet(options, "noadjust",0);
+
     crop_layer l = make_crop_layer(batch,h,w,c,crop_height,crop_width,flip, angle, saturation, exposure);
+    l.noadjust = noadjust;
     return l;
 }
 
@@ -233,6 +236,9 @@
 {
     float probability = option_find_float(options, "probability", .5);
     dropout_layer layer = make_dropout_layer(params.batch, params.inputs, probability);
+    layer.out_w = params.w;
+    layer.out_h = params.h;
+    layer.out_c = params.c;
     return layer;
 }
 
@@ -292,7 +298,6 @@
     net->learning_rate = option_find_float(options, "learning_rate", .001);
     net->momentum = option_find_float(options, "momentum", .9);
     net->decay = option_find_float(options, "decay", .0001);
-    net->seen = option_find_int(options, "seen",0);
     int subdivs = option_find_int(options, "subdivisions",1);
     net->batch /= subdivs;
     net->subdivisions = subdivs;
@@ -498,7 +503,7 @@
     return sections;
 }
 
-void save_weights(network net, char *filename)
+void save_weights_upto(network net, char *filename, int cutoff)
 {
     fprintf(stderr, "Saving weights to %s\n", filename);
     FILE *fp = fopen(filename, "w");
@@ -510,7 +515,7 @@
     fwrite(&net.seen, sizeof(int), 1, fp);
 
     int i;
-    for(i = 0; i < net.n; ++i){
+    for(i = 0; i < net.n && i < cutoff; ++i){
         layer l = net.layers[i];
         if(l.type == CONVOLUTIONAL){
 #ifdef GPU
@@ -544,6 +549,10 @@
     }
     fclose(fp);
 }
+void save_weights(network net, char *filename)
+{
+    save_weights_upto(net, filename, net.n);
+}
 
 void load_weights_upto(network *net, char *filename, int cutoff)
 {

--
Gitblit v1.10.0