projects
/
platform
/
upstream
/
opencv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2f0676f
)
Bug fix for MLP predict for small values to avoid nan responses.
author
Tauranis
<rodrigodefreitas12@gmail.com>
Tue, 12 Apr 2016 11:28:38 +0000
(08:28 -0300)
committer
Tauranis
<rodrigodefreitas12@gmail.com>
Tue, 12 Apr 2016 18:59:32 +0000
(15:59 -0300)
modules/ml/src/ann_mlp.cpp
patch
|
blob
|
history
diff --git
a/modules/ml/src/ann_mlp.cpp
b/modules/ml/src/ann_mlp.cpp
index
19ee913
..
8974b6b
100644
(file)
--- a/
modules/ml/src/ann_mlp.cpp
+++ b/
modules/ml/src/ann_mlp.cpp
@@
-432,8
+432,15
@@
public:
double* data = sums.ptr<double>(i);
for( j = 0; j < cols; j++ )
{
- double t = scale2*(1. - data[j])/(1. + data[j]);
- data[j] = t;
+ if(!cvIsInf(data[j]))
+ {
+ double t = scale2*(1. - data[j])/(1. + data[j]);
+ data[j] = t;
+ }
+ else
+ {
+ data[j] = -scale2;
+ }
}
}
break;