-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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
multi-GPU for val.py #6249
Comments
👋 Hello @bozihu, thank you for your interest in YOLOv5 🚀! 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://ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 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 YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@bozihu val.py only supports CPU and single GPU backends. You can pass it a single GPU index, i.e. --device 0. |
Sometimes, we may use many cameras unite to detect objects. So, we want to use multi GPU to deal with the requirement. That is why we asked about the issue. |
@wandaoyi one option for Multi-GPU inference is you can initialize models on different backends with YOLOv5 PyTorch Hub models just for normal inference (not validation), i.e.: import torch
model0 = torch.hub.load('ultralytics/yolov5', 'yolov5s', device=0)
model1 = torch.hub.load('ultralytics/yolov5', 'yolov5s', device=1)
model2 = torch.hub.load('ultralytics/yolov5', 'yolov5s', device=2)
... Make sure you git pull or |
However, how can we balance the resources of gpus. If we have 1 to n video streaming to be detected objects. we don't know that when its' be use. So, when we use gpu=0, or 1, or 2?
…------------------ 原始邮件 ------------------
发件人: "Glenn ***@***.***>;
发送时间: 2022年1月14日(星期五) 下午3:23
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [ultralytics/yolov5] multi-GPU for val.py (Issue #6249)
@wandaoyi one option for Multi-GPU inference is you can initialize models on different backends with YOLOv5 PyTorch Hub models just for normal inference (not validation), i.e.:
import torch model0 = torch.hub.load('ultralytics/yolov5', 'yolov5s', device=0) model1 = torch.hub.load('ultralytics/yolov5', 'yolov5s', device=1) model2 = torch.hub.load('ultralytics/yolov5', 'yolov5s', device=2) ...
Make sure you git pull or force_reload=True as we updated this code recently in #6290
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@wandaoyi I don't know, it depends on your application. You want to create a good pipeline that produces high GPU utilization rates (i.e. check with |
Thank you all the same
…------------------ 原始邮件 ------------------
发件人: "Glenn ***@***.***>;
发送时间: 2022年1月17日(星期一) 凌晨5:31
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [ultralytics/yolov5] multi-GPU for val.py (Issue #6249)
@wandaoyi I don't know, it depends on your application. You want to create a good pipeline that produces high GPU utilization rates (i.e. check with nvidia-smi) to fully use your available hardware.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐! |
Search before asking
Question
I want to use the multi-GPU to get faster inference time. When I use the comand: python -m torch.distributed.launch --nproc_per_node 2 val.py, there is a bug occur.
usage: val.py [-h] [--data DATA] [--weights WEIGHTS [WEIGHTS ...]] [--batch-size BATCH_SIZE] [--imgsz IMGSZ] [--conf-thres CONF_THRES] [--iou-thres IOU_THRES] [--task TASK] [--device DEVICE] [--workers WORKERS] [--single-cls] [--augment] [--verbose] [--save-txt] [--save-hybrid]
[--save-conf] [--save-json] [--project PROJECT] [--name NAME] [--exist-ok] [--half] [--dnn]
val.py: error: unrecognized arguments: --local_rank=1
usage: val.py [-h] [--data DATA] [--weights WEIGHTS [WEIGHTS ...]] [--batch-size BATCH_SIZE] [--imgsz IMGSZ] [--conf-thres CONF_THRES] [--iou-thres IOU_THRES] [--task TASK] [--device DEVICE] [--workers WORKERS] [--single-cls] [--augment] [--verbose] [--save-txt] [--save-hybrid]
[--save-conf] [--save-json] [--project PROJECT] [--name NAME] [--exist-ok] [--half] [--dnn]
val.py: error: unrecognized arguments: --local_rank=0
Traceback (most recent call last):
File "/home/ubuntu/.conda/envs/yolov5_obb/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/ubuntu/.conda/envs/yolov5_obb/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/ubuntu/.conda/envs/yolov5_obb/lib/python3.8/site-packages/torch/distributed/launch.py", line 260, in
main()
File "/home/ubuntu/.conda/envs/yolov5_obb/lib/python3.8/site-packages/torch/distributed/launch.py", line 255, in main
raise subprocess.CalledProcessError(returncode=process.returncode,
subprocess.CalledProcessError: Command '['/home/ubuntu/.conda/envs/yolov5_obb/bin/python', '-u', 'val.py', '--local_rank=1']' returned non-zero exit status 2.
I want to request how to use val.py with multi-GPU?
Additional
No response
The text was updated successfully, but these errors were encountered: