-
Notifications
You must be signed in to change notification settings - Fork 557
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 multi-label support for label-studio integration #4725
Conversation
WalkthroughThe changes involve enhancing the FiftyOne label handling system, specifically supporting multi-label classifications through the integration with Label Studio. New functionalities include adding "classifications" as a supported label type, refining the processing of annotations, and restructuring how classifications are represented. These updates aim to improve label management and facilitate the integration experience between FiftyOne and Label Studio. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LabelStudio
participant FiftyOne
User->>LabelStudio: Initiates labeling process
LabelStudio->>FiftyOne: Sends labeling data
FiftyOne->>FiftyOne: Processes labels
Note over FiftyOne: Checks for classifications type
FiftyOne->>FiftyOne: Maps classifications to their IDs
FiftyOne->>LabelStudio: Returns processed annotations
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add Documentation and Community
|
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- fiftyone/utils/labelstudio.py (3 hunks)
- tests/intensive/labelstudio_tests.py (3 hunks)
Additional context used
Ruff
fiftyone/utils/labelstudio.py
421-421: Ambiguous variable name:
l
(E741)
903-903: Ambiguous variable name:
l
(E741)
Additional comments not posted (5)
tests/intensive/labelstudio_tests.py (2)
268-273
: Refactor to usefo.Classifications
for multi-label support.The change from individual
fo.Classification
instances to a singlefo.Classifications
instance is a good practice for handling multi-label scenarios. This aligns with the PR's objective of enhancing multi-label classification support.
677-678
: Ensure all classifications have valid labels.Adding a condition to check if all classifications have a valid label is a good practice for data integrity and error handling.
fiftyone/utils/labelstudio.py (3)
103-103
: Add support for "classifications" label type.Adding "classifications" to the list of supported label types is crucial for enabling multi-label classification functionality. This change is necessary for the integration to handle more complex labeling scenarios.
420-427
: Refactor_import_annotations
to handleClassifications
.The modification to handle instances of
fol.Classifications
in the_import_annotations
method is essential for supporting multi-label classifications. This change ensures that the system can process and map multiple classifications correctly.Tools
Ruff
421-421: Ambiguous variable name:
l
(E741)
902-904
: Change return type tofol.Classifications
in_from_choices
.Adjusting the return type to
fol.Classifications
in the_from_choices
function aligns with the new structure introduced in other parts of the module. This consistency is crucial for handling multi-label classifications effectively.Tools
Ruff
903-903: Ambiguous variable name:
l
(E741)
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.
Thanks for the contribution @tataganesh !!
From my testing, this is working great for creating new multilabel classification annotations with label studio.
There are some issues I'm running into when working with existing classifications fields that already exist in FiftyOne when the annotation task is being created, but I'm seeing the same thing when working with Classification
fields even outside of this PR, so it is likely a preexisting bug. (For future reference: #4779)
What changes are proposed in this pull request?
Resolves #2946.
This pull request adds multi-label classification support to FiftyOne's label studio integration.
How is this patch tested? If it is not, please explain why.
A subset of the Fashion-MNIST dataset was used to generate a small multi-label classification dataset. The code for creating the dataset and launching label studio for annotation -
After annotating the 5 samples with multiple labels (jn this case, annotating shirt images with ("Shirt", "UpperBody") and sneaker images with ("Sneaker", "Footwear"), view the annotations on the Fiftyone app.
Screenshot of app with multi-label annotations
Release Notes
Is this a user-facing change that should be mentioned in the release notes?
notes for FiftyOne users.
Label Studio integration in FiftyOne now support multi-label classification. For more info, checkout the description
of #2946
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit
New Features
Improvements
Bug Fixes
Documentation