Commit 02c89987 authored by benjaminwan's avatar benjaminwan
Browse files

fix: rec字典添加空格

parent 9ccb4089
...@@ -57,6 +57,9 @@ void CrnnNet::initModel(const std::string &pathStr, const std::string &keysPath) ...@@ -57,6 +57,9 @@ void CrnnNet::initModel(const std::string &pathStr, const std::string &keysPath)
printf("The keys.txt file was not found\n"); printf("The keys.txt file was not found\n");
return; return;
} }
keys.insert(keys.begin(), "#");
keys.emplace_back(" ");
printf("total keys size(%lu)\n", keys.size());
} }
template<class ForwardIterator> template<class ForwardIterator>
...@@ -78,7 +81,7 @@ TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, i ...@@ -78,7 +81,7 @@ TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, i
if (maxIndex > 0 && maxIndex < keySize && (!(i > 0 && maxIndex == lastIndex))) { if (maxIndex > 0 && maxIndex < keySize && (!(i > 0 && maxIndex == lastIndex))) {
scores.emplace_back(maxValue); scores.emplace_back(maxValue);
strRes.append(keys[maxIndex - 1]); strRes.append(keys[maxIndex]);
} }
lastIndex = maxIndex; lastIndex = maxIndex;
} }
......
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