-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
Yolov5 crashes with RTSP stream analysis #2226
Comments
👋 Hello @philippneugebauer, 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://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 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), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@philippneugebauer you may want to verify that publicly accessible streams are working for you, before trying custom container connections. This works locally for me for example:
Be aware this displays a live preview of detection results. You may need to disable the preview component in non-desktop environments by setting Lines 45 to 54 in f8464b4
|
Damit, yeah, you're right, the |
@philippneugebauer I think we looked at automatically disabling this before but found no easy way to automatically detect non-desktop environments. If you think of any ideas for more robustly handling this please submit a PR! |
I was confused because with the normal video analysis I had no trouble at all. Maybe it's an idea to manually enable the |
@philippneugebauer yes that's true, that is confusing. We turn it on by default for streaming sources since the main use case is new users testing out a local webcam with I think what we need is a line like import cv2
import numpy as np
def check_imshow():
# Check if environment supports image display
try:
cv2.imshow('test', np.zeros((320, 320, 3)))
cv2.waitKey(1)
cv2.destroyAllWindows()
cv2.waitKey(1)
return True
except:
print('WARNING: Environment does not support cv2.imshow() or PIL Image.show() image previews')
return False
print(check_imshow()) |
yeah, I see your point. So that would be the ideal solution. Maybe adding a message to the exception that non-GUI environments should disable the view_img manually. It gives a nice hint for the user and is a simple workaround |
@philippneugebauer good idea! I've created PR #2231 that should address this. Can you give it a quick lookover? |
haha, so I meant the exception I encountered, but it obviously also fit your code :D. Your solution is more useful though. I am not a Python expert but it looks good to me. Let me know if I should test the code locally |
@philippneugebauer yes good point. I've updated now. Looks good in Colab, the Exception actually provides meaningful info. |
@ozett YOLOv5 arguments don't use underscores, they use dashes: About your original question I'm not able to reproduce your command as your stream is not available: We've created a few short guidelines below to help users provide what we need in order to get started investigating a possible problem. How to create a Minimal, Reproducible ExampleWhen asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:
In addition to the above requirements, for Ultralytics to provide assistance your code should be:
If you believe your problem meets all of the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template and providing a minimum reproducible example to help us better understand and diagnose your problem. Thank you! 😃 |
Hi thanks for looking into this.
|
@ozett seems like you are missing some cv2 dependencies. You may want to use one of our verified environments while you debug your local environment. 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. |
Hi all After installing pip install opencv-python-headless a problem in the datasets.py line 350 with cv2.waitkey appeared PS: YoloV5 correctly detected imshow is not supported and print it out |
hi , what should I do if something like this happens? |
https://user-images.githubusercontent.com/55926806/170808240-284a1835-ffc1-47b7-96b5-758813116c8b.png |
@afrahthahir 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. We've created a few short guidelines below to help users provide what we need in order to start investigating a possible problem. How to create a Minimal, Reproducible ExampleWhen asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:
For Ultralytics to provide assistance your code should also be:
If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem. Thank you! 😃 |
okay thanks for the explanation, I'll try to explain again, I use google colab to run the code, when I want to run !python detect.py --source 0 to run using the webcam there is a notification WARNING: Environment does not support cv2.imshow() or PIL Image.show() image displays cv2.imshow() is disabled in Google Colab environments I don't know how to fix it, Pls help me on this thanks |
@andiandhika local webcams are only available in local environments, assuming you have one on your computer. |
Thank you, I want to try again |
@andiandhika colab is not a local environment. Local means right there in front of you, i.e. YOUR computer. |
I don't think so, I tried using this code and it worked only to open the webcam start streaming video from webcamvideo_stream() label for videolabel_html = 'Capturing...' initialze bounding box to emptybbox = ''
|
it would be better to make changes to the code so that it can be run using a webcam, thank you in advance |
@andiandhika hi, thank you for your feature suggestion on how to improve YOLOv5 🚀! The fastest and easiest way to incorporate your ideas into the official codebase is to submit a Pull Request (PR) implementing your idea, and if applicable providing before and after profiling/inference/training results to help us understand the improvement your feature provides. This allows us to directly see the changes in the code and to understand how they affect workflows and performance. Please see our ✅ Contributing Guide to get started. |
ok thanks in advance, definitely when i know more about it |
I think yolov5 has no test.py
May be ur command is for detect.py or train.py
…On Wed, 1 Jun 2022, 00:36 andiandhika, ***@***.***> wrote:
hi I'm trying to calculate the map on the test dataset with the command
!python test.py --weights yolov5s.pt runs/train/yolo_road_det/weights/
best.pt --data road_sign_data.yaml --task test --name yolo_det
, but getting a notification:
python3: can't open file 'test.py': [Errno 2] No such file or directory
this makes sense to me , since I also can't find the test.py file, is the
test.py file really not available?
—
Reply to this email directly, view it on GitHub
<#2226 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANKWAFWKBVEWWPY4A5VT74LVMZPJ7ANCNFSM4XWDWPHQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
In YouTube, for yolov5 realtime object detection code is shown for only
webcam as the source. If u want to use your source as webcam, u should try
at the system directly and don't opt for cloud GPUs such as colab. Colab
doesnot support webcam as source. It is possible but it is complicated than
trying in the system directly. Hope it helps..
…On Sun, 29 May 2022, 20:27 andiandhika, ***@***.***> wrote:
hi i have tried again but the result is the same , i have used local
camera, with command !python detect.py --source 0 but still there is a
notification WARNING: Environment does not support cv2.imshow() or PIL
Image.show() image displays cv2.imshow() is disabled in Google Colab
environment
[image: Capture]
<https://user-images.githubusercontent.com/62016426/170875951-a47ddb3f-951c-42d8-a74f-59dbaa547930.PNG>
s
—
Reply to this email directly, view it on GitHub
<#2226 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANKWAFRT6CDPWXGV7RU6RW3VMOAV7ANCNFSM4XWDWPHQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@mansi733 hello, Thank you for reaching out. Unfortunately, we cannot see the screenshot that you mentioned in your message. Can you please try to attach it again or provide more details on how you are trying to access the CCTV camera with the IP address? This information will help us better understand your issue and provide you with the appropriate solution. Thank you. |
Yes, Please check this code conf_score = 0.40 # change the value for confiedence score. parser = argparse.ArgumentParser(description="Camera type.") camera_type = 'rtsp://192.1.2.68/' model = torch.hub.load('ultralytics/yolov5', 'custom', 'C:/Users/HP/Desktop/Fire-cmd/client.pt' vid = cv2.VideoCapture(camera_type) classes = model.names |
@mansi733 Thank you for providing the code snippet to help us better understand your issue. Based on your code, it seems that you are trying to access an IP camera using RTSP protocol and then loading a custom YOLOv5 model to do object detection on the camera stream. One thing to note is that the IP camera address and port number need to be specified in the Additionally, make sure the camera is connected and streaming video before running the script. If you're still having issues, you can try checking if the camera address and credentials are correct, or try a different protocol (like HTTP) to access the camera. I hope this helps. Let us know if you have any further questions or concerns. Thank you. |
🐛 Bug
If I want to analyze an rtsp stream with Yolov5 in a docker container, regardless the latest or the v4.0 version, it crashes.
To Reproduce (REQUIRED)
Input:
Output:
Expected behavior
Doing the analysis
Environment
The text was updated successfully, but these errors were encountered: