From d0b9326a352ed2fbc3ae66fdef40b4533a2f211d Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Tue, 11 Aug 2015 06:22:27 +0000
Subject: [PATCH] Hacks to get nightmare to not break gridsizing
---
src/detection_layer.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/detection_layer.c b/src/detection_layer.c
index 9ef89d9..e48b8b3 100644
--- a/src/detection_layer.c
+++ b/src/detection_layer.c
@@ -141,20 +141,20 @@
float scale = 1;
float latent_delta = 0;
if(l.joint) scale = state.input[in_i++];
- else if (l.objectness) state.delta[in_i++] = -l.delta[out_i++];
- else if (l.background) state.delta[in_i++] = scale*l.delta[out_i++];
+ else if (l.objectness) state.delta[in_i++] += -l.delta[out_i++];
+ else if (l.background) state.delta[in_i++] += scale*l.delta[out_i++];
for(j = 0; j < l.classes; ++j){
latent_delta += state.input[in_i]*l.delta[out_i];
- state.delta[in_i++] = scale*l.delta[out_i++];
+ state.delta[in_i++] += scale*l.delta[out_i++];
}
if (l.objectness) {
}else if (l.background) gradient_array(l.output + out_i, l.coords, LOGISTIC, l.delta + out_i);
for(j = 0; j < l.coords; ++j){
- state.delta[in_i++] = l.delta[out_i++];
+ state.delta[in_i++] += l.delta[out_i++];
}
- if(l.joint) state.delta[in_i-l.coords-l.classes-l.joint] = latent_delta;
+ if(l.joint) state.delta[in_i-l.coords-l.classes-l.joint] += latent_delta;
}
}
@@ -198,11 +198,13 @@
cpu_state.truth = truth_cpu;
cpu_state.delta = delta_cpu;
- cuda_pull_array(state.input, in_cpu, l.batch*l.inputs);
+ cuda_pull_array(state.input, in_cpu, l.batch*l.inputs);
+ cuda_pull_array(state.delta, delta_cpu, l.batch*l.inputs);
cuda_pull_array(l.delta_gpu, l.delta, l.batch*outputs);
backward_detection_layer(l, cpu_state);
cuda_push_array(state.delta, delta_cpu, l.batch*l.inputs);
+ if (truth_cpu) free(truth_cpu);
free(in_cpu);
free(delta_cpu);
}
--
Gitblit v1.10.0