-
Notifications
You must be signed in to change notification settings - Fork 41
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
[DAR-3771][External] Import of annotation-level properties #925
Conversation
@@ -38,6 +42,7 @@ def base_property_object(base_property_value: PropertyValue) -> FullProperty: | |||
annotation_class_id=0, | |||
property_values=[base_property_value], | |||
options=[base_property_value], | |||
granularity=PropertyGranularity("section"), |
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.
This is questionable: currently the BE has a default 'section' if no granularity is provided. Here we're building a fixture that disregards the BE default. It's not wrong, but I think it'd be interesting to also have a test that doesn't specify the granularity at all when creating a property
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.
The unit tests I just added test creating section-level properties from a manifest file where no granularity
is specified
93d1f4b
to
0cba8ac
Compare
): # using numel() to check if tensor is non-empty | ||
print("WE GOT MASKS") | ||
albumentation_dict["masks"] = masks.numpy() | ||
if isinstance(masks, torch.Tensor): | ||
masks = masks.numpy() | ||
if masks.ndim == 3: # Ensure masks is a list of numpy arrays | ||
masks = [masks[i] for i in range(masks.shape[0])] | ||
albumentation_dict["masks"] = masks |
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.
Change that is unrelated to the ticket, but necessary to resolve these failing tests:
Problem
darwin-py is currently incapable of handling:
granularity
field in the.v7/metadata.json
properties manifest fileframe_index=null
values for annotation-level property valuesBoth concepts must be supported by darwin-py to allow the same import functionality as section-level properties (which are currently supported properties)
Solution
Property
class withgranularity
PropertyGranularity
enum to represent the 3 property granularitiesAdjusted the properties import functions to ensure :
granularity
is optional so that section-level property values can still be importedWe also add unit tests for
_import_annotations
, as none previously existed. These test that for both section & annotation-level properties:granularity
Changelog
Added support for annotation-level properties