-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[Completed][PyTorch] Add Anchor Boxes #1312
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
Job d2l-en/PR-1312/7 is complete. |
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 PR. Please see the contribution guidelines.
Use d2lbook to save functions in d2l/torch.py. No need to edit that manually.
Follow implementation closer to mx wherever possible. Save or define explicit functions for pytorch if necessary.
Job d2l-en/PR-1312/17 is complete. |
Job d2l-en/PR-1312/35 is complete. |
Job d2l-en/PR-1312/36 is complete. |
Hi @AnirudhDagar Can you please review the changes made as suggested by you. Thanks |
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 PR @suvaansh! Overall LGTM!
Made a few comments PTAL and update the PR.
When you finish a section, just save the notebook.
then run
d2lbook activate all chapter_computer-vision/anchor.md
d2lbook build lib
This will activate all the tabs and then copy the saved functions to the respective libraries.
You need to commit and push updatedd2l/torch.py
file along with this markdown file.
def bbox_to_rect(bbox, color): | ||
"""Convert bounding box to matplotlib format.""" | ||
return d2l.plt.Rectangle(xy=(bbox[0], bbox[1]), width=bbox[2]-bbox[0], height=bbox[3]-bbox[1], fill=False, edgecolor=color, linewidth=2) |
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 method is defined in bounding-box.md
We save it there and use it here.
Similarly for other methods.
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 added it here.
```{.python .input} | ||
#@tab pytorch | ||
#@save | ||
def multibox_prior(feature_map_sizes, sizes, aspect_ratios): |
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.
Here it is right that you define this function because torch/torchvision don't offer a built-in method for multibox_prior like mxnet.multibox prior
#@save | ||
PredBoundingBox = namedtuple("PredBoundingBox", ["probability", "class_id", "classname", "bounding_box"]) | ||
|
||
def non_max_suppression(bounding_boxes: list, iou_threshold: float = 0.1) -> list: |
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.
nms not possible through torchvision.ops
?
This PR has become a mess. So, I am creating a new PR for the same and closing this. It contains all the changes suggested above. Thanks |
Description of changes:
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.