Skip to content

Commit

Permalink
Fixed new_coords=1 training
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyAB committed Dec 4, 2020
1 parent 312fd2e commit 8d6e56e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/yolo_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,13 @@ ious delta_yolo_box(box truth, float *x, float *biases, int n, int index, int i,

// predict exponential, apply gradient of e^delta_t ONLY for w,h
if (new_coords) {
dw *= 8 * x[index + 2 * stride];
dh *= 8 * x[index + 3 * stride];
dw *= 8 * x[index + 2 * stride] * biases[2 * n] / w;
dh *= 8 * x[index + 3 * stride] * biases[2 * n + 1] / h;

//float grad_w = 8 * exp(-x[index + 2 * stride]) / pow(exp(-x[index + 2 * stride]) + 1, 3);
//float grad_h = 8 * exp(-x[index + 3 * stride]) / pow(exp(-x[index + 3 * stride]) + 1, 3);
//dw *= grad_w;
//dh *= grad_h;
}
else {
dw *= exp(x[index + 2 * stride]);
Expand Down

0 comments on commit 8d6e56e

Please sign in to comment.