-
Notifications
You must be signed in to change notification settings - Fork 107
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
base: main
Are you sure you want to change the base?
Conversation
@PawelPeczek-Roboflow let me know if you have any feedback any here from our convo today. |
There was a problem hiding this 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")) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great tests coverage
@NickHerrig planning release tmrw - would u be able to apply changes? if not I can help, but let's agree on what we do with doubts I raised |
@PawelPeczek-Roboflow yes I have time now to complete these changes. I agree with your proposed solution to avoid same class names having different class-id(collapse) causing variability in annotation color, etc. |
ok, great |
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.
How has this change been tested, please provide a testcase or example of how you tested the change?