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

PaddleOCR Parser and message #62

Closed
wants to merge 3 commits into from
Closed

PaddleOCR Parser and message #62

wants to merge 3 commits into from

Conversation

aljazkonec1
Copy link
Contributor

This PR adds a classification_sequence_message that returns a sequence of charecters corresponding to maximum probability in the sequence. The message has optional parameters to remove duplicates and ignore background class indexes.

In addition this PR also adds a PaddleOCR Parser, which utilizes the classification_sequence message.

…r characters.

This PR adds a classification_sequence_message that returns a sequence of charecters corresponding to maximum probability in the sequence.
The message has optional parameters to remove duplicates and ignore background class indexes.

In addition this PR also adds a PaddleOCR Parser, which utilizes the classification_sequence message.
@github-actions github-actions bot added the parsers Changes affecting ml.parsers label Sep 10, 2024
Copy link

Test Results

110 tests   110 ✅  1s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit d4cea65.

Copy link

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2033 800 39% 0% 🟢

New Files

File Coverage Status
depthai_nodes/ml/messages/creators/classification_sequence.py 12% 🟢
depthai_nodes/ml/parsers/ppocr.py 25% 🟢
TOTAL 19% 🟢

Modified Files

File Coverage Status
depthai_nodes/ml/messages/creators/init.py 100% 🟢
depthai_nodes/ml/parsers/init.py 100% 🟢
TOTAL 100% 🟢

updated for commit: d4cea65 by action🐍

@aljazkonec1 aljazkonec1 added the messages Changes affecting ml.messages label Sep 10, 2024
@aljazkonec1 aljazkonec1 changed the title PaddleOCR model returns a sequence of classification probabilities fo… PaddleOCR Parser and message Sep 10, 2024
):
"""Initializes the PaddleOCR Parser node.

@param classes: List of class names to be
Copy link
Collaborator

Choose a reason for hiding this comment

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

some descriptions are missing here

self.out = self.createOutput()
self.input = self.createInput()
self.remove_duplicates = remove_duplicates
self.ignored_indexes = [0] if ignored_indexes is None else ignored_indexes
Copy link
Collaborator

Choose a reason for hiding this comment

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

it would be more clean to set the default ignored_indexes to [0] instead of None

def setRemoveDuplicates(self, remove_duplicates: bool):
"""Sets the remove_duplicates flag for the classification sequence model.

@param remove_duplicates: If True, removes consecutive duplicates from the
Copy link
Collaborator

Choose a reason for hiding this comment

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

@type is missing in the docstring (also below)

from .. import Classifications


def create_classification_sequence_message(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure this needs a separate creator function. Could we adjust the create_classification_message to also support the new features (remove_duplicates and ignored_indexes)?

@type classes: List
@param scores: A numpy array of shape (sequence_length, n_classes) containing the (row-wise) probability distributions over the classes.
@type scores: np.ndarray
@param remove_duplicates: If True, removes consecutive duplicates from the sequence.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe explain this duplicate removal better as it not really clear what is removed and why

@jkbmrz jkbmrz mentioned this pull request Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
messages Changes affecting ml.messages parsers Changes affecting ml.parsers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants