Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[orientation classification] Result differs from docTR #56

Open
felixdittrich92 opened this issue Dec 6, 2024 · 0 comments
Open

[orientation classification] Result differs from docTR #56

felixdittrich92 opened this issue Dec 6, 2024 · 0 comments

Comments

@felixdittrich92
Copy link
Owner

felixdittrich92 commented Dec 6, 2024

Bug description

Ref.: mindee/doctr#1801

Earlier I had written a whole module which uses pdf2image to extract page image and run DocTR to find the orientation of the image. Later I realized that it's not the problem of DocTR but OnnxTR which I was using earlier.

I want to report a strange case where for the same image DocTR gives correct orientation of 0 as the image is vertical, while OnnxTR gives 180degree orientation.

Here's the image:
abc6_page_1

Code snippet to reproduce the bug

import os
import json
from doctr.io import DocumentFile
from doctr.models import ocr_predictor
# from onnxtr.io import DocumentFile
# from onnxtr.models import ocr_predictor

os.environ['USE_TORCH'] = '1'


img_path = "extracted_image/abc6_page_1.png"


predictor = ocr_predictor(
    det_arch="db_resnet50",
    reco_arch="crnn_mobilenet_v3_large",
    resolve_blocks=True,
    resolve_lines=True,
    paragraph_break=0.035,
    assume_straight_pages=False,
    detect_orientation=True,
)

doc = DocumentFile.from_images(img_path)
result = predictor(doc)
text_data = result.render()
json_data = result.export()
print(json_data)

parsed_file = f"doctr-output.txt"
with open(parsed_file, "w") as f:
    f.write(text_data)
@felixdittrich92 felixdittrich92 changed the title [orientation classification] [orientation classification] Result differs from docTR Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant