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

feat: ✨ from_easyocr detection added #1515

Merged
merged 9 commits into from
Sep 23, 2024
Merged

feat: ✨ from_easyocr detection added #1515

merged 9 commits into from
Sep 23, 2024

Conversation

onuralpszr
Copy link
Collaborator

@onuralpszr onuralpszr commented Sep 15, 2024

Description

EasyOCR detections added.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

Google Collab: https://colab.research.google.com/drive/1GAFuDZwXrxWY0O6M8K8sGdmvNoc9R5i5?usp=sharing

Docs

  • Docs updated? What were the changes:

Example Results

image

image

@onuralpszr onuralpszr added enhancement New feature or request api:detection labels Sep 15, 2024
@onuralpszr onuralpszr self-assigned this Sep 15, 2024
supervision/config.py Outdated Show resolved Hide resolved
@LinasKo
Copy link
Collaborator

LinasKo commented Sep 19, 2024

Hi @onuralpszr 👋

It turns out, this isn't the first instance of OCR we have in supervision. Florence 2 can return a region with OCR text.
(Ctrl+F for if task == "<OCR_WITH_REGION>":)

It uses the labels detected by the model and puts them into Detections.data["class_name"].

The question is whether we should change that, match it or ignore it.
I like the idea of distinguishing OCR results in a dedicated data field, but I'd to be careful about not breaking existing behaviour.

I suggest we change from_lmm, so if florence 2 was run with task of <OCR_WITH_REGION> (task is first key of result), both CLASS_NAME_DATA_FIELD and OCR_TEXT_DATA_FIELD are set to returned labels. Then, let's emit a small deprecation warning, advising that "class_name" will be removed and to use the OCR value (yes, even when they don't access the value - only when OCR results are set). We can then drop the "class_name" support in supervision 0.28.0.

refactor: ♻️  update text data field to CLASS_NAME_DATA_FIELD in config and detection modules to reduce complexity of datafield names

Signed-off-by: Onuralp SEZER <[email protected]>
@onuralpszr
Copy link
Collaborator Author

Based on conversation we made with @LinasKo, I decided to reduce complexity and doing a way without creating "deprecated" type I went for "class_name" that so it will match "CLASS_NAME_DATA_FIELD" and we don't need to change Florance-2 side as well.

Copy link
Collaborator

@LinasKo LinasKo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the docs, verified the results run in Colab (with color_lookup=sv.ColorLookup.INDEX added to each annotator). Going to check for regression in NCNN just in case.

@LinasKo
Copy link
Collaborator

LinasKo commented Sep 23, 2024

Thanks @onuralpszr!

Merging this, after a few miniscule changes.

@LinasKo LinasKo merged commit c211453 into develop Sep 23, 2024
9 checks passed
@onuralpszr onuralpszr deleted the detection/easyocr branch September 23, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:detection enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants