Commit 9d6386ad authored by Davis King's avatar Davis King

Fixed a bug in the sequence_segmenter which could cause it to output detected

sequences that go slightly beyond the end of the input sequence.
parent 9e41955c
...@@ -129,9 +129,9 @@ namespace dlib ...@@ -129,9 +129,9 @@ namespace dlib
template <typename EXP> template <typename EXP>
bool reject_labeling ( bool reject_labeling (
const sequence_type& , const sequence_type& x,
const matrix_exp<EXP>& y, const matrix_exp<EXP>& y,
unsigned long unsigned long pos
) const ) const
{ {
if (ss_feature_extractor::use_BIO_model) if (ss_feature_extractor::use_BIO_model)
...@@ -177,6 +177,15 @@ namespace dlib ...@@ -177,6 +177,15 @@ namespace dlib
return true; return true;
if (y(1) == UNIT && y(0) == LAST) if (y(1) == UNIT && y(0) == LAST)
return true; return true;
// if at the end of the sequence
if (pos == x.size()-1)
{
if (y(0) == BEGIN)
return true;
if (y(0) == INSIDE)
return true;
}
} }
else else
{ {
...@@ -184,6 +193,13 @@ namespace dlib ...@@ -184,6 +193,13 @@ namespace dlib
return true; return true;
if (y(0) == LAST) if (y(0) == LAST)
return true; return true;
// if at the end of the sequence
if (pos == x.size()-1)
{
if (y(0) == BEGIN)
return true;
}
} }
} }
return false; return false;
......
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