From c6ecf1e0420737eafeb99b27b1d716b46a6cbb7a Mon Sep 17 00:00:00 2001
From: Jud White <github@judsonwhite.com>
Date: Sun, 25 Mar 2018 20:41:48 +0000
Subject: [PATCH] README.md: add notes to How to compile on Windows
---
src/region_layer.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/region_layer.c b/src/region_layer.c
index a83831c..f179906 100644
--- a/src/region_layer.c
+++ b/src/region_layer.c
@@ -131,11 +131,11 @@
// Focal loss
if (focal_loss) {
// Focal Loss for Dense Object Detection: http://blog.csdn.net/linmingan/article/details/77885832
- //printf("Used Focal-loss \n");
- float alpha = 0.5; // 0.25
- float gamma = 2.0;
+ float alpha = 0.5; // 0.25 or 0.5
+ //float gamma = 2; // hardcoded in many places of the grad-formula
+
int ti = index + class_id;
- float grad = -gamma * (1 - output[ti])*logf(fmaxf(output[ti], 0.0000001))*output[ti] + (1 - output[ti])*(1 - output[ti]);
+ float grad = -2 * (1 - output[ti])*logf(fmaxf(output[ti], 0.0000001))*output[ti] + (1 - output[ti])*(1 - output[ti]);
for (n = 0; n < classes; ++n) {
delta[index + n] = scale * (((n == class_id) ? 1 : 0) - output[index + n]);
@@ -434,7 +434,7 @@
cuda_pull_array(state.truth, truth_cpu, num_truth);
}
cuda_pull_array(l.output_gpu, in_cpu, l.batch*l.inputs);
- cudaStreamSynchronize(get_cuda_stream());
+ //cudaStreamSynchronize(get_cuda_stream());
network_state cpu_state = state;
cpu_state.train = state.train;
cpu_state.truth = truth_cpu;
@@ -444,7 +444,7 @@
free(cpu_state.input);
if(!state.train) return;
cuda_push_array(l.delta_gpu, l.delta, l.batch*l.outputs);
- cudaStreamSynchronize(get_cuda_stream());
+ //cudaStreamSynchronize(get_cuda_stream());
if(cpu_state.truth) free(cpu_state.truth);
}
--
Gitblit v1.10.0