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

Add Rename Classes UQL Operation #656

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

NickHerrig
Copy link
Collaborator

Description

This PR adds UQL operation to handle renaming of classes given a class_map.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

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

  • Integration tests passing
  • Local inferences server in Workflow UI

@NickHerrig
Copy link
Collaborator Author

@PawelPeczek-Roboflow let me know if you have any feedback any here from our convo today.

Copy link
Collaborator

@PawelPeczek-Roboflow PawelPeczek-Roboflow left a comment

Choose a reason for hiding this comment

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

There is one issue with potential collapse of class id:
original detections have 1-1 relationship between class name and class id, after mapping this is not guaranteed.
Additional difficulty is also keeping original class.

Maintaining classes ids may be important - for instance to have visualisation that works consistently (look how this is implemented in supervision)

Proposed solution:

  • enforce full mapping - if not given raise operation error
  • when classes collapse - keep lower class id

if for some reason we wish to let non-strict class mappings, I suggest adding operation parameter (strict: bool with default True), such that people take risk by willingly declaring so.

@@ -28,6 +28,11 @@ def red_image() -> np.ndarray:
return cv2.imread(os.path.join(ASSETS_DIR, "red_image.png"))


@pytest.fixture(scope="function")
def fruit_image() -> np.ndarray:
return cv2.imread(os.path.join(ASSETS_DIR, "multi-fruit.jpg"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

please report image credits

@@ -0,0 +1,124 @@
import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

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

great tests coverage

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

Successfully merging this pull request may close these issues.

3 participants