Skip to content
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

Does not display webcam and youtube result #10596

Closed
1 of 2 tasks
krolaper opened this issue Dec 26, 2022 · 11 comments
Closed
1 of 2 tasks

Does not display webcam and youtube result #10596

krolaper opened this issue Dec 26, 2022 · 11 comments
Labels
bug Something isn't working Stale Stale and schedule for closing soon

Comments

@krolaper
Copy link

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Detection

Bug

I’m trying to: detect.py --source 0
Hangs in the stage:

YOLOv5 🚀 2022-12-26 Python-3.10.6 torch-1.12.1+cu102 CUDA:0 (NVIDIA GeForce MX130, 2004MiB)

Fusing layers... 
YOLOv5m summary: 290 layers, 22323858 parameters, 0 gradients

With video files and image - normal, but with webcam and link - no.

I went further down the playback path. Go to detect ->

    if webcam:
        view_img = check_imshow(warn=True)

then I will move on to general ->

def check_imshow(warn=False):
	    # Check if environment supports image displays
	    try:
	        assert not is_notebook()
	        assert not is_docker()
	        cv2.imshow('test', np.zeros(((1, 1, 3)))

and on this line of code I have a hang and then the solution does not move.
Numpy ver: 1.23.4, opencv-python ver: last

Environment

YOLOv5 🚀 2022-12-26 Python-3.10.6 torch-1.12.1+cu102 CUDA:0 (NVIDIA GeForce MX130, 2004MiB)

Desktop: Xfce 4.16.0 Distro: Linux Mint 21 Vanessa base: Ubuntu 22.04 jammy
Python 3.10

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@krolaper krolaper added the bug Something isn't working label Dec 26, 2022
@AyushExel
Copy link
Contributor

@krolaper I'm not sure what's happening here but because it's not reproducible for me I'd suggest to you check your webcam-opencv setup. Try to display the webcam feed in an opencv window to confirm.

@krolaper
Copy link
Author

@AyushExel So the same thing happens with YouTube. Сamera monitor correct. Until now, everything worked.

@krolaper
Copy link
Author

krolaper commented Jan 5, 2023

why it can hang at the stage general.py:

def check_imshow(warn=False):
    # Check if environment supports image displays
    try:
        assert not is_notebook()
        assert not is_docker()
        cv2.imshow('test', np.zeros((1, 1, 3)))
        cv2.waitKey(1)
        cv2.destroyAllWindows()
        cv2.waitKey(1)
        return True
    except Exception as e:
        if warn:
            LOGGER.warning(f'WARNING ⚠️ Environment does not support cv2.imshow() or PIL Image.show()\n{e}')
        return False

namely: cv2.imshow('test', np.zeros((1, 1, 3)))
Downloading the last change date didn’t help. Did a test: copied those 4 lines from cv2 and pasted them into a clean script and there they work, but in general.py they do not. Library opencv-python last version

@krolaper
Copy link
Author

krolaper commented Jan 7, 2023

@AyushExel what version of opencv and numpy and torch do you have installed? Looks like it’s all in new versions.

@AyushExel
Copy link
Contributor

Hi @krolaper the opencv and torch version should satisfy the requirements.txt
You can just run pip insall -r requirements.txt from yolov5 folder

@krolaper
Copy link
Author

krolaper commented Jan 7, 2023

@AyushExel they are satisfying, there are the most recent versions, but somehow on them and this problem occurs. Tell me on which versions you checked that everything works?

@AyushExel
Copy link
Contributor

@krolaper I'm not sure as I'm on phone right now. I'll check and let you know tonight when I'm back on my system

@krolaper
Copy link
Author

krolaper commented Jan 7, 2023

@AyushExel Ok

@AyushExel
Copy link
Contributor

@krolaper
opencv==4.6.0
torch==1.13.0
numpy==1.23.4

@krolaper
Copy link
Author

krolaper commented Jan 8, 2023

@AyushExel After testing different versions, I realized it wasn’t these libraries.
It turned out that hovering occurs when libraries are declared in general.py file:

import torchvision
from utils.metrics import box_iou, fitness

and specifically in utils.metrics ---> import matplotlib.pyplot as plt exactly with pyplot.
I don’t know how to fix it.
Reinstalling these libraries did not help, but only led to the need to reinstall the opencv library after them.

This is my list of libraries, maybe a conflict somewhere?

absl-py==1.3.0
addict==2.4.0
altgraph==0.17.3
asttokens==2.1.0
astunparse==1.6.3
av==10.0.0
backcall==0.2.0
basicsr==1.4.2
beautifulsoup4==4.11.1
bottle==0.12.23
bottle-websocket==0.2.9
bs4==0.0.1
cachetools==5.2.0
certifi==2022.9.24
charset-normalizer==2.1.1
click==8.1.3
contourpy==1.0.6
cycler==0.11.0
decorator==5.1.1
dlib==19.24.0
docutils==0.19
easyocr==1.6.2
Eel==0.14.0
executing==1.2.0
face-recognition==1.3.0
face-recognition-models==0.3.0
facexlib==0.2.5
filelock==3.8.2
filterpy==1.4.5
fire==0.5.0
Flask==2.2.2
flatbuffers==22.12.6
fonttools==4.38.0
future==0.18.2
gast==0.4.0
gdown==4.6.0
gevent==22.10.2
gevent-websocket==0.10.1
gfpgan==1.3.8
gitdb==4.0.10
GitPython==3.1.30
google-auth==2.14.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
greenlet==2.0.1
grpcio==1.50.0
h5py==3.7.0
huggingface-hub==0.11.1
idna==3.4
imageio==2.22.4
ipython==8.6.0
itsdangerous==2.1.2
jedi==0.18.1
Jinja2==3.1.2
keras==2.11.0
Kivy-Garden==0.1.5
kiwisolver==1.4.4
libclang==14.0.6
libretranslatepy==2.1.1
llvmlite==0.39.1
lmdb==1.4.0
lxml==4.9.2
Markdown==3.4.1
MarkupSafe==2.1.1
matplotlib==3.6.2
matplotlib-inline==0.1.6
MouseInfo==0.1.3
mtcnn==0.1.1
networkx==2.8.8
ninja==1.11.1
numba==0.56.4
numpy==1.23.5
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
oauthlib==3.2.2
opencv-python==4.5.4.60
opencv-python-headless==4.5.4.60
opt-einsum==3.3.0
ordered-set==4.1.0
packaging==21.3
pafy==0.5.5
pandas==1.5.1
parso==0.8.3
patchelf==0.16.1.0
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.4.0
playsound==1.3.0
progressbar==2.5
prompt-toolkit==3.0.32
protobuf==3.19.6
psutil==5.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.23.0
pyclipper==1.3.0.post4
pygame==2.1.2
PyGetWindow==0.0.9
Pygments==2.13.0
PyGObject==3.42.2
pyinstaller==5.7.0
pyinstaller-hooks-contrib==2022.14
PyMsgBox==1.0.9
pyparsing==3.0.9
pyperclip==1.8.2
PyRect==0.2.0
PyScreeze==0.1.28
PySocks==1.7.1
pytesseract==0.3.10
python-bidi==0.4.2
python-dateutil==2.8.2
python-slugify==7.0.0
python3-xlib==0.15
pytweening==1.0.4
pytz==2022.6
PyWavelets==1.4.1
PyYAML==6.0
realesrgan==0.3.0
requests==2.28.1
requests-oauthlib==1.3.1
retina-face==0.0.12
rsa==4.9
scikit-image==0.19.3
scipy==1.9.3
screeninfo==0.8.1
seaborn==0.12.1
shapely==2.0.0
six==1.16.0
smmap==5.0.0
soupsieve==2.3.2.post1
stack-data==0.6.0
tb-nightly==2.12.0a20221226
tensorboard==2.11.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.11.0
tensorflow-estimator==2.11.0
tensorflow-io-gcs-filesystem==0.29.0
termcolor==2.1.1
terminal==0.4.0
text-unidecode==1.3
thop==0.1.1.post2209072238
tifffile==2022.10.10
tkvideoplayer==2.3
torch==1.13.1
torchvision==0.14.1
tqdm==4.64.1
traitlets==5.5.0
translate==3.6.1
ttkbootstrap==1.10.0
typing_extensions==4.4.0
urllib3==1.26.13
wcwidth==0.2.5
Werkzeug==2.2.2
whichcraft==0.6.1
wikipedia==1.4.0
wrapt==1.14.1
xlib==0.21
yapf==0.32.0
youtube-dl==2021.12.17
zope.event==4.5.0
zope.interface==5.5.1

continue the long test.
if you find only the conflict string:
from utils.metrics import box_iou, fitness
then in half a minute the work will be completed with the message:
Backend GTK3Agg is interactive backend. Turning interactive mode on.

prescription. matplotlib.use('TkAgg',force=True)helped me.
left to solve with torchvision.
Reinstalling av librari did not help.
and here is the root of evil people have found: pytorch/vision#5940
What version of av do you use?
It turns out it is enough to remove just av

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2023

👋 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 ⭐!

@github-actions github-actions bot added the Stale Stale and schedule for closing soon label Feb 8, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale Stale and schedule for closing soon
Projects
None yet
Development

No branches or pull requests

2 participants