Prefer result from inverted image if the mean confidence is better

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2020-10-26 20:37:47 +01:00
parent cfb1fb2540
commit eaf72ace31

View File

@ -302,7 +302,7 @@ bool LSTMRecognizer::RecognizeLine(const ImageData& image_data, bool invert,
&inv_outputs); &inv_outputs);
float inv_min, inv_mean, inv_sd; float inv_min, inv_mean, inv_sd;
OutputStats(inv_outputs, &inv_min, &inv_mean, &inv_sd); OutputStats(inv_outputs, &inv_min, &inv_mean, &inv_sd);
if (inv_min > pos_min && inv_mean > pos_mean && inv_sd < pos_sd) { if (inv_mean > pos_mean) {
// Inverted did better. Use inverted data. // Inverted did better. Use inverted data.
if (debug) { if (debug) {
tprintf("Inverting image: old min=%g, mean=%g, sd=%g, inv %g,%g,%g\n", tprintf("Inverting image: old min=%g, mean=%g, sd=%g, inv %g,%g,%g\n",