-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Document Keypoint RCNN separately #5933
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
Conversation
if include_pattern is not None: | ||
weights = [w for w in weights if include_pattern in str(w)] | ||
if exclude_pattern is not None: | ||
weights = [w for w in weights if exclude_pattern not in str(w)] |
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.
Not a die-hard fan of this, but we have to special-case this generation function (or its inputs) in some way. Happy to consider other suggestions.
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 other alternative makes the code simpler here but moves complexity to the caller, i.e., they could provide a validation pattern as regex.
def generate_weights_table(module, table_name, metrics, include_pattern=".*"):
weight_enums = [getattr(module, name) for name in dir(module) if name.endswith("_Weights")]
weights = [w for weight_enum in weight_enums for w in weight_enum if re.match(include_pattern, w)]
...
regex would include both include and exclude patterns
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.
I thought about using regex, but I could not find a include_pattern
where
re.match(include_pattern, w)
would be Truthy for weights that do not contain "Keypoint"
. I'm sure it's possible, but the complexity of the resulting regex might outweight the complexity of the current code. Any pointer @jdsgomes ?
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.
I think this should do the trick:
In [59]: re.match("^((?!Keypoint).)*$", "no_keypoint_in_name")
Out[59]: <re.Match object; span=(0, 19), match='no_keypoint_in_name'>
vs
In [58]: re.match("^((?!Keypoint).)*$", "xxxKeypoint")
Out[58]: None
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 @jdsgomes , that seems to work indeed. I'm a bit on the fence with this. In general, I try to avoid regex like the plague. This one typically doesn't read easily to me and would require some extra comment IMHO.
I'll yield to whichever you prefer. Do you have a preference here?
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.
since we are including/excluding simple patterns I would agree that regex here might just complicate things and just save a few lines of code, so I would say to leave as is.
docs/source/models_new.rst
Outdated
Keypoint detection | ||
------------------ |
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 has the same level of heading as the table above. Should it be instead at the same level as "classification", "detection", "segmentation" sections?
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.
I think we should split Object Detection, Instance Segmentation and Person Keypoint Detection. In that case yes, this Keypoint detection would be at the same level as "classification", "detection", "segmentation".
- Classification
- Table of all available Classification weights
...
- Table of all available Classification weights
- Object Detection
- Table of all available detection weights
- Keypoint detection
- Table of all available detection weights
Otherwise we can keep them in the same group but the relative hierarchy need to change:
- Object Detection, Instance Segmentation and Person Keypoint Detection
- Object Detection
- Table of all available detection weights
- Keypoint detection
- Table of all available detection weights
- Object Detection
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 input @jdsgomes , that sounds good.
The currently title is Object Detection, Instance Segmentation and Person Keypoint Detection
. Do we actually have Instance Segmentation models ATM?
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.
I don't think so
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.
hold on?! Isn't mask rcnn instance segmentation?
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 @oke-aditya you're right. As you also properly noted offline, mask-rcnn has a custom mask_map metric, so it would make sense for it to have its own table. Would you like to submit a PR to fix this?
Thinking about our layout again, I guess it could look like
Object Detection, Instance Segmentation and Person Keypoint Detection
Object Detection
table
Instance segmentation
table
Keypoint detection
table
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.
yep, will send a PR :)
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.
LGTM, thanks for making the changes!
Hey @NicolasHug! You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py |
Summary: * Document Keypoint RCNN separately * Move Keypoint detection into its own section * ufmt Reviewed By: YosuaMichael Differential Revision: D36204385 fbshipit-source-id: b8adb5cd48f9d78d1a9dc4ad393123e41209a8e8
Closes #5882
This PR documents Keypoint RCNN separately, in its own section and with its own table.