JaidedAI / EasyOCR

Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
https://www.jaided.ai
Apache License 2.0
23.8k stars 3.12k forks source link

Missing Confidence Score in Paragraph Mode #1281

Open devalnor opened 2 months ago

devalnor commented 2 months ago

When extract text from images in paragraph mode, the confidence scores for the detected text are not included in the results.

Only bbox and text are in results.

Any idea of how to solve this?

fiksii-copilot commented 1 month ago

This is not possible to get confidence, because it combines a few results with different confidence

Siddharth-Latthe-07 commented 1 month ago

In EasyOCR, when extracting text from images in paragraph mode, the confidence scores are typically included in the results. However, if they are missing, it might be due to the version of EasyOCR you're using or the specific settings and parameters passed to the readtext function.

Possible solution:-

  1. Update the latest version of OCR
  2. Using the detail Parameter: The readtext method in EasyOCR has a detail parameter that controls the level of detail in the output. By setting detail=1, you should get confidence scores along with the bounding boxes and text.
    
    import easyocr

Initialize the reader

reader = easyocr.Reader(['en'], gpu=True)

Read text from the image

results = reader.readtext('path_to_image', detail=1, paragraph=True)

Print results

for result in results: bbox, text, confidence = result print(f"Bounding Box: {bbox}, Text: {text}, Confidence: {confidence}")


3. Verify the output structure
4. Check for Paragraph Mode Limitations:
If you're specifically working in paragraph mode and confidence scores are not included, it might be due to how the paragraph mode processes text.

Hope this helps
Thanks