Fixed new_coords=1 training

This commit is contained in:
AlexeyAB 2020-12-04 03:06:08 +03:00
parent 312fd2e99a
commit 8d6e56e7b4
1 changed files with 7 additions and 2 deletions

View File

@ -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]);