-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
How to add NMS to last layer? #1726
Comments
👋 Hello @rsundar96, thank you for your interest in 🚀 YOLOv3! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv3 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv3 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv3 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@rsundar96 for a fully managed inference pipeline including preprocessing and postprocessing I would recommend our YOLOv5 PyTorch Hub models. These include the NMS module you posted above and much more that allow for the simplest integration into your workflow possible. See PyTorch Hub Tutorial below to get started. import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
# Images
dir = 'https://github.com/ultralytics/yolov5/raw/master/data/images/'
imgs = [dir + f for f in ('zidane.jpg', 'bus.jpg')] # batch of images
# Inference
results = model(imgs)
results.print() # or .show(), .save() YOLOv5 Tutorials
|
Hi guys, Thanks in advance, regards |
@LeoCyclope see YOLOv5 PyTorch Hub tutorial for loading custom models. YOLOv5 Tutorials
Custom ModelsThis example loads a custom 20-class VOC-trained YOLOv5s model model = torch.hub.load('ultralytics/yolov5', 'custom', path_or_model='path/to/best.pt') # custom model |
Thanks for this :) Thanks in advance :) |
Hi, have you got the way to add the postprocess(nms) in the whole model when export pytorch to onnx? thanks in advance, |
@dragoncanfly no need, you can run exported ONNX models directly using PyTorch Hub: |
hi, @glenn-jocher, I just want export a pytorch model (yolov3) which was trained by myself. So if there is a way to modify the net structure to enable the convert, of course, with postprocess I mean. Or is there any reference? |
@dragoncanfly You can directly implement non-maximum suppression (NMS) in the post-processing step of your PyTorch YOLOv3 model before exporting it to ONNX. You can refer to the official YOLOv3 implementation and specifically the |
I want to add the NMS as part of the last layer and can see under models/yolo.py that the function nms is present (Line 173, models/yolo.py). How do I add this to my model? (Haven't made any changes to the model architecture present in the repo)
The text was updated successfully, but these errors were encountered: