-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
AssertionError: 1/1: 0... Failed to open 0 #8180
Comments
👋 Hello @deb-cod, 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 [email protected]. RequirementsPython>=3.7.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. |
@deb-cod webcam inference is only supported on local devices. I’ll add a TODO to improve error reporting on this to make it clearer for users |
Improve user error understanding for #8180
* Reject webcam inference on Colab/Kaggle Improve user error understanding for #8180 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * cleanup Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@deb-cod good news 😃! Your original issue may now be fixed ✅ in PR #8209. This PR adds improved error reporting to help users understand that webcam inference with --source 0 must be run in a local environment with access to a webcam, not on remote environments like Colab/Kaggle. To receive this update:
Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀! |
same question..didU solved it? |
I try to use it locally on my machine and it still has the same bug. Already up to date repo. |
* Reject webcam inference on Colab/Kaggle Improve user error understanding for ultralytics#8180 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * cleanup Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Search before asking
YOLOv5 Component
No response
Bug
Fusing layers...
YOLOv5x summary: 444 layers, 86173414 parameters, 0 gradients
WARNING: Environment does not support cv2.imshow() or PIL Image.show() image displays
cv2.imshow() is disabled in Google Colab environments
[ WARN:0] global /io/opencv/modules/videoio/src/cap_v4l.cpp (802) open VIDEOIO ERROR: V4L: can't open camera by index 0
Traceback (most recent call last):
File "/content/yolov5/detect.py", line 252, in
main(opt)
File "/content/yolov5/detect.py", line 247, in main
run(**vars(opt))
File "/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/content/yolov5/detect.py", line 100, in run
dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt)
File "/content/yolov5/utils/dataloaders.py", line 325, in init
assert cap.isOpened(), f'{st}Failed to open {s}'
AssertionError: 1/1: 0... Failed to open 0
Environment
detect: weights=['/content/yolov5/best.pt'], source=0, data=/content/yolov5/data/fire.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=yolov5/runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 🚀 v6.1-251-gc23a441 Python-3.7.13 torch-1.11.0+cu113 CUDA:0 (Tesla P100-PCIE-16GB, 16281MiB)
I ran in terminal in Colab... still getting the same problem
Minimal Reproducible Example
I ran in terminal in Colab... still getting the same problem
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: