Missing Confidence Score in Paragraph Mode
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?
This is not possible to get confidence, because it combines a few results with different confidence
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:-
- Update the latest version of OCR
- Using the detail Parameter:
The readtext method in EasyOCR has a
detailparameter that controls the level of detail in the output. By settingdetail=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}")
- Verify the output structure
- 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
I have completely the same problem!
EasyOCR version - 1.7.2
results = reader.readtext(
img,
allowlist='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -',
height_ths=0.6,
width_ths=0.6,
ycenter_ths=0.5,
detail=1,
paragraph=True
)
logger.info(f"results={results}")
logged message
results=[[[[97, 45], [854, 45], [854, 356], [97, 356]], 'SOME DETECTED TEXT']]
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
readtextfunction.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
Is this AI generated ?