Commit 99ac0d4a authored by benjaminwan's avatar benjaminwan
Browse files

再次修复空格问题

parent 5e1c7a08
...@@ -78,7 +78,8 @@ inline static size_t argmax(ForwardIterator first, ForwardIterator last) { ...@@ -78,7 +78,8 @@ inline static size_t argmax(ForwardIterator first, ForwardIterator last) {
} }
TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, int w) { TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, int w) {
int keySize = keys.size(); auto keySize = keys.size();
auto dataSize = outputData.size();
std::string strRes; std::string strRes;
std::vector<float> scores; std::vector<float> scores;
int lastIndex = 0; int lastIndex = 0;
...@@ -87,7 +88,10 @@ TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, i ...@@ -87,7 +88,10 @@ TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, i
for (int i = 0; i < h; i++) { for (int i = 0; i < h; i++) {
int start = i * w; int start = i * w;
int stop = (i + 1) * w - 1; int stop = (i + 1) * w;
if (stop > dataSize - 1) {
stop = (i + 1) * w - 1;
}
maxIndex = int(argmax(&outputData[start], &outputData[stop])); maxIndex = int(argmax(&outputData[start], &outputData[stop]));
maxValue = float(*std::max_element(&outputData[start], &outputData[stop])); maxValue = float(*std::max_element(&outputData[start], &outputData[stop]));
......
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