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

Labelstudio instances support #2706

Conversation

jbadger3
Copy link
Contributor

@jbadger3 jbadger3 commented Mar 1, 2023

What changes are proposed in this pull request?

Resolves #2689 and adds support for the 'instances' label_type using Brush based annotations in Label Studio.

How is this patch tested? If it is not, please explain why.

Tested using code given in #2689.

I was not able to run linting on my machine, so if one the maintainers could run linting for me it would be much appreciated!

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.
  • Fixes a bug in LabelStudio integration when specifying label_type of 'instances'. Prior to this fix would lead to bounding box annotations. Now sets up brush based (mask) annotations as indicated in the docs.

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

@codecov
Copy link

codecov bot commented Mar 4, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (4492d9e) 61.67% compared to head (67d1b25) 61.67%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2706   +/-   ##
========================================
  Coverage    61.67%   61.67%           
========================================
  Files          254      254           
  Lines        42851    42851           
  Branches       346      346           
========================================
  Hits         26429    26429           
  Misses       16422    16422           
Flag Coverage Δ
app 48.87% <ø> (ø)
python 99.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@brimoor brimoor left a 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! Left some small comments for you 😄

@@ -575,11 +578,12 @@ def generate_labeling_config(media, label_type, labels=None):
return config_str


def import_label_studio_annotation(result):
def import_label_studio_annotation(result, label_type):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make label_type=None the default, since this extra information is only needed when deciding between semantic and instance segmentations?

@@ -624,7 +628,7 @@ def _update_dict(src_dict, update_dict):
return new


def export_label_to_label_studio(label, full_result=None):
def export_label_to_label_studio(sample, label_field, label_type, full_result=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

full_result already includes original_width and original_height, so can you just use that and avoid changing the signature of this method?

)

brush = fou.lazy_import(
"label_studio_converter.brush",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: lazy_import() can be placed at the very top of the module with other imports, since the module won't actually be imported unless it is used.

I notice that local lazy_import() is used elsewhere in this module, perhaps you could clean that up too? 🤗

"label_studio_converter.brush",
callback=lambda: fou.ensure_import("label_studio_converter.brush"),
)
rle = brush.mask2rle(label.to_segmentation(frame_size=size).get_mask())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please install the dev dependencies? Basically just run:

bash install.bash -d

This will install pre-commit hooks that will automatically run some code formatting tools when you commit your edits.

@brimoor brimoor changed the base branch from develop to labelstudio-instances-support April 17, 2023 04:35
@brimoor
Copy link
Contributor

brimoor commented Apr 17, 2023

@jbadger3 thanks for the contribution! I'm going to go ahead and merge this and the maintainers will handle the remaining TODOs 🤗

@brimoor brimoor merged commit 43ebc94 into voxel51:labelstudio-instances-support Apr 17, 2023
@jbadger3
Copy link
Contributor Author

Thanks Brian. Sorry I was so slow in getting the other TODOs done. Family (toddlers and infants) are cutting into my free time:)

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.

[BUG] Instance segmentations not supported in Label Studio
2 participants