From cd3e641bcc330436b7057b2b3d75fb92bb5913b5 Mon Sep 17 00:00:00 2001 From: Frank Haverland Date: Sun, 30 Jul 2023 18:25:56 +0200 Subject: [PATCH] #2540 fix trunc of first with imprecise precision (#2543) * added more debug for #2447 * new model on new images dig-class100-0165_s2 * #2465 fix first digit with extended_Resolution=false * fix #2491 * #2540 fix trunc of first with imprecise precision --- .../jomjol_flowcontroll/ClassFlowCNNGeneral.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp index ac1e6c28..2d08ff01 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp @@ -145,7 +145,8 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred { // on first digit is no spezial logic for transition needed // we use the recognition as given. The result is the int value of the recognition - result = (int) ((int) trunc(number) + 10) % 10; + // add precisition of 2 digits and round before trunc + result = (int) ((int) trunc(round((number+10 % 10)*100)) ) / 100; LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - No predecessor - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty)); @@ -484,7 +485,7 @@ bool ClassFlowCNNGeneral::doFlow(string time) if (!doAlignAndCut(time)){ return false; - }; + } LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doFlow after alignment"); @@ -852,10 +853,9 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) bool ClassFlowCNNGeneral::isExtendedResolution(int _number) { - if (!(CNNType == Digital)) - return true; - - return false; + if (CNNType == Digital) + return false; + return true; }