Commit bc9bf360 authored by Davis King's avatar Davis King

Add checks into the vector_normalizer and vector_normalizer_pca objects

to detect users giving infinite and NaN values as inputs.
parent ec4865ed
......@@ -1148,6 +1148,8 @@ namespace dlib
m = mean(mat(samples));
sd = reciprocal(sqrt(variance(mat(samples))));
DLIB_ASSERT(is_finite(m), "Some of the input vectors to vector_normalizer::train() have infinite or NaN values");
}
long in_vector_size (
......@@ -1310,6 +1312,8 @@ namespace dlib
<< "\n\tthis: " << this
);
train_pca_impl(mat(samples),eps);
DLIB_ASSERT(is_finite(m), "Some of the input vectors to vector_normalizer_pca::train() have infinite or NaN values");
}
long in_vector_size (
......
......@@ -770,6 +770,7 @@ namespace dlib
- samples == a column matrix or something convertible to a column
matrix via mat(). Also, x should contain
matrix_type objects that represent nonempty column vectors.
- samples does not contain any infinite or NaN values
ensures
- #in_vector_size() == samples(0).nr()
- #out_vector_size() == samples(0).nr()
......@@ -928,6 +929,7 @@ namespace dlib
- samples == a column matrix or something convertible to a column
matrix via mat(). Also, x should contain
matrix_type objects that represent nonempty column vectors.
- samples does not contain any infinite or NaN values
ensures
- This object has learned how to normalize vectors that look like
vectors in the given set of samples.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment