【问题标题】:ABBYY FineReader SDK how to define minimum recognition ratioABBYY FineReader SDK 如何定义最小识别率
【发布时间】:2013-02-18 16:22:12
【问题描述】:

有人使用fineReader abbyy sdk 10 吗?我很好奇图像ocr处理后是否有可能获得数据挖掘的成功率。

对于我们有从图像中收集数据的工作流程的场景,如果识别结果低于 90%,那么我们会将我们的批次进行视觉验证/校正。

对于 sdk 处理,我使用的是 .net - 知道它不是很重要,但是……以防万一

我怎样才能达到这个数字?谢谢建议

【问题讨论】:

  • 好吧,把它说清楚一点。我正在寻找的是整个扫描的 char 置信度摘要 - 是否有任何引擎对象 fnc 可能性?在 RAW 输出文件中对每个字符都有信心,但它太详细了......
  • 也许你应该在 ABBYY 论坛上问这个问题:forum.ocrsdk.com

标签: .net ocr abbyy finereader


【解决方案1】:

没有“全局识别置信度”属性。开发人员应使用自己的置信度标准自行计算。最简单的方法是遍历每个字符,检查 CharParams.IsSuspicious 属性。这是 FREngine 11 的代码示例 (C#)

    //Statistics counters 

    //Count of all suspicious symbols in layout
    private int suspiciousSymbolsCount;
    //Count of all unrecognized symbols in layout
    private int unrecognizedSymbolsCount;
    //Count of all nonspace symbols in layout
    private int allSymbolsCount;
    //Count of all words in layout
    private int allWordsCount;
    //Count of all not dictionary word in layout
    private int notDictionaryWordsCount;
    private void processImage()
    {
        // Create document
        FRDocument document = engineLoader.Engine.CreateFRDocument();

        try {
            // Add image file to document
            displayMessage( "Loading image..." );
            string imagePath = Path.Combine( FreConfig.GetSamplesFolder(), @"SampleImages\Demo.tif" );

            document.AddImageFile( imagePath, null, null );

            //Recognize document
            displayMessage( "Recognizing..." );
            document.Process( null );

            // Calculate text statistics
            displayMessage( "Calculating statistics..." );
            clearStatistics();
            for( int i = 0; i < document.Pages.Count; i++ ) {
                calculateStatisticsForLayout( document.Pages[i].Layout );
            }

            //show calculated statistics
            displayStatistics();

        } catch( Exception error ) {
            MessageBox.Show( this, error.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error );
        }
        finally {
            // Close document
            document.Close();
        }
    }
    private void calculateStatisticsForLayout( Layout layout )
    {    
        LayoutBlocks blocks = layout.Blocks;
        for( int index = 0; index < blocks.Count; index++ ) {
            calculateStatisticsForBlock( blocks[index] );
        }
    }

    void calculateStatisticsForBlock( IBlock block )
    {           
        if( block.Type == BlockTypeEnum.BT_Text ) {
            calculateStatisticsForTextBlock( block.GetAsTextBlock() );
        } else if( block.Type == BlockTypeEnum.BT_Table ) {
            calculateStatisticsForTableBlock( block.GetAsTableBlock() );
        }
    }

    void calculateStatisticsForTextBlock( TextBlock textBlockProperties )
    {
        calculateStatisticsForText( textBlockProperties.Text );
    }

    void calculateStatisticsForTableBlock( TableBlock tableBlockProperties )
    {
        for( int index = 0; index < tableBlockProperties.Cells.Count; index++ ) {
            calculateStatisticsForBlock( tableBlockProperties.Cells[index].Block );
        }
    }

    void calculateStatisticsForText( Text text ) 
    {
        Paragraphs paragraphs = text.Paragraphs;
        for( int index = 0; index < paragraphs.Count; index++ ) {
            calculateStatisticsForParagraph( paragraphs[index] );
        }
    }

    void calculateStatisticsForParagraph( Paragraph paragraph )
    {
        calculateCharStatisticsForParagraph( paragraph );

        calculateWordStatisticsForParagraph( paragraph );
    }

    void calculateCharStatisticsForParagraph( Paragraph paragraph )
    {
        for( int index = 0; index < paragraph.Text.Length; index++ )
        {
            calculateStatisticsForChar( paragraph, index );
        }
    }

    void calculateStatisticsForChar( Paragraph paragraph, int charIndex )
    {
        CharParams charParams = engineLoader.Engine.CreateCharParams();
        paragraph.GetCharParams( charIndex, charParams );
        if( charParams.IsSuspicious ) 
        {
            suspiciousSymbolsCount++;
        }

        if( isUnrecognizedSymbol( paragraph.Text[charIndex] ) ) 
        {
            unrecognizedSymbolsCount++;
        }

        if( paragraph.Text[charIndex] != ' ' ) 
        {
            allSymbolsCount++;
        }
    }

    void calculateWordStatisticsForParagraph( Paragraph paragraph )
    {
        allWordsCount += paragraph.Words.Count;

        for( int index = 0; index < paragraph.Words.Count; index++ ) 
        {
            if( !paragraph.Words[index].IsWordFromDictionary ) 
            {
                notDictionaryWordsCount ++;
            }
        }
    }

    bool isUnrecognizedSymbol( char symbol )
    {
        //it is special constant used by FREngine recogniser
        return ( symbol == 0x005E );
    }

    void displayStatistics()
    {
        labelAllSymbols.Text = "All symbols: " + allSymbolsCount.ToString();
        labelSuspiciosSymbols.Text = "Suspicious symbols: " + suspiciousSymbolsCount.ToString();
        labelUnrecognizedSymbols.Text = "Unrecognized symbols: " + unrecognizedSymbolsCount.ToString();

        labelAllWords.Text = "All words: " + allWordsCount.ToString();
        labelNotDictionaryWords.Text = "Non-dictionary words: " + notDictionaryWordsCount.ToString();
    }

【讨论】:

  • 在:characterParameters.SelectedCharacterRecognitionVariant.CharConfidence 处还有一个逐字符的 1-100 置信度分数
  • 在这种情况下您宁愿不使用它。 0-100 之间的值并不表示特定字符​​的绝对阅读置信度。这是一个相关值,可帮助您了解所选字符变体在此位置的所有其他可能字符中的好坏程度。
【解决方案2】:

恕我直言,没有这样的“全局置信度”值 - 但您可以通过获取每个字符的置信度并对总数取平均值来轻松获得此值。 但是,我认为您应该将您的请求发送到 ABBYY 的论坛或支持电子邮件地址,以了解他们的建议。

如果我使用引擎,我真的不可能告诉你我可以获得什么程度的信心,因为这一切都取决于图像的质量、字体的大小等等:没有这样的事情作为行业用来作为数据基础的“平均文档”。

祝你好运!

【讨论】:

    【解决方案3】:

    FRE SDK 识别的结果只有文本或表格块中的文本。我建议你有一个全局字数统计变量。

    1. 运行异步方法来遍历单词并获取单词中可疑字符的数量。 (可疑)
    2. 查找每个页面中包含可疑字符的单词总数
    3. (带有可疑字符的单词)/(总单词数)并将结果乘以 100。

      2/4 等于 0.5。乘以 0.5 * 100 = 50%。那是您的准确性。上面在 abbyy 的另一个答案中给出了检查可疑字符和置信度的代码示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-22
      • 1970-01-01
      • 2014-03-20
      • 2016-01-15
      • 1970-01-01
      相关资源
      最近更新 更多