Skip to content

📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

keys.size不需要提示

benjaminwanc26459063e14
diff --git a/cpp/BaiPiaoOcrOnnx/src/CrnnNet.cpp b/cpp/BaiPiaoOcrOnnx/src/CrnnNet.cpp
index 0f9eb14..33bdcd4 100755
--- a/cpp/BaiPiaoOcrOnnx/src/CrnnNet.cpp
+++ b/cpp/BaiPiaoOcrOnnx/src/CrnnNet.cpp
@@ -53,10 +53,10 @@ void CrnnNet::initModel(const std::string &pathStr, const std::string &keysPath)
printf("The keys.txt file was not found\n");
return;
}
- if (keys.size() != 6623) {
+ /*if (keys.size() != 6623) {
fprintf(stderr, "missing keys\n");
- }
- keys.insert(keys.begin(),"#");
+ }*/
+ keys.insert(keys.begin(), "#");
keys.emplace_back(" ");
printf("total keys size(%lu)\n", keys.size());
}
@@ -75,11 +75,11 @@ TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, i
float maxValue;
for (int i = 0; i < h; i++) {
- maxIndex = int(argmax(&outputData[i * w], &outputData[(i+1) * w-1]));
- maxValue = float(*std::max_element(&outputData[i * w], &outputData[(i + 1) * w-1]));
+ maxIndex = int(argmax(&outputData[i * w], &outputData[(i + 1) * w - 1]));
+ maxValue = float(*std::max_element(&outputData[i * w], &outputData[(i + 1) * w - 1]));
if (maxIndex > 0 && maxIndex < keySize && (!(i > 0 && maxIndex == lastIndex))) {
- scores.push_back(maxValue);
+ scores.emplace_back(maxValue);
strRes.append(keys[maxIndex]);
}
lastIndex = maxIndex;