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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

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.

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