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 default value for info argument of ClassDescription #3017

Merged
merged 5 commits into from
Aug 17, 2023

Conversation

emilk
Copy link
Member

@emilk emilk commented Aug 17, 2023

Two changes:

  • You can now easily specify the info without having to also specify label and color, using info=0.
  • The default info is one with id=0, matching 0.7.0 behavior and how log_points work

(This took me over an hour to figure out 😭)

Checklist

* Closes #2924

This took me over an hour to figure out 😭
@emilk emilk added this to the 0.8.1 milestone Aug 17, 2023
@emilk emilk added the 🐍 Python API Python logging API label Aug 17, 2023
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

not acutally sure if the default value is a good idea. "Give a title to this class" becomes odd when one doesn't specify which class is meant - or am I missunderstanding the situation?

@emilk
Copy link
Member Author

emilk commented Aug 17, 2023

I don't know - AnnotationInfo is too complicated for my brain.

Where are you quoting from? I can't find "Give a title to this class" anywhere

@Wumpf
Copy link
Member

Wumpf commented Aug 17, 2023

Oh that's not a quote, that's more of my interpretation of what giving a setting an annotationinfo means

@emilk
Copy link
Member Author

emilk commented Aug 17, 2023

I don't like the implicit default value either. I think I'll merge this and cherry-pick for 0.8.1 (since it fixes a subtle 0.8.0 API regression) and then make a new PR to make info mandatory, making the user code more explicit and intentionally breaking the API

Copy link
Member

@jleibs jleibs left a comment

Choose a reason for hiding this comment

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

Probably worth adding a comment to the generated docstring (in class_description.fbs) that if no info is provided, the default is 0.

The consequences of this really are that a line such as:

rr.ClassDescription(keypoint_connections=[(0, 1), (1, 2), (2, 0), (2, 3), (0, 4), (1, 5)])

Implicitly says to annotate keypoint_connections for keypoints that have a class_id of 0, which matches the behavior of log_points, which sets the class_id to 0 if you log keypoints without logging a class-id.

@@ -29,7 +29,8 @@

def classdescription_init(
self: ClassDescription,
info: AnnotationInfoLike,
info: AnnotationInfoLike = 0,
Copy link
Member

Choose a reason for hiding this comment

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

This still strikes me as a bit of a footgun, but it matches the pre-existing behavior.

Copy link
Member Author

@emilk emilk Aug 17, 2023

Choose a reason for hiding this comment

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

I'm gonna remove it in a follow-up-PR, but keep it here to not break API further in the 0.8.1 patch release

Copy link
Member

Choose a reason for hiding this comment

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

If you want to break it in the future, why not break it now? Is there a meaningful difference between breaking it in 0.8 and breaking it in 0.9?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's more that I want to do the least intrusive change for 0.8.1.

If we require info to be explicit, should we also make it explicit for log_points? Why require explicitness in one but not the other?

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough.

@emilk emilk merged commit e78fc1c into main Aug 17, 2023
@emilk emilk deleted the emilk/fix-annotation-context-default branch August 17, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐍 Python API Python logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

face_tracking example fails with new AnnotationContext implementation
3 participants