2

I'm trying to do inference with a yolov5 model on the webcam stream from a Nvidia Jetson Nano within a Docker container. On both, my Windows PC and Jetson, I get the error:

qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.10/site-packages/cv2/qt/plugins" 
even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted

The Dockerfile looks like this:

FROM python:latest

WORKDIR /yolov5_aiss

COPY requirements.txt . 

RUN pip3 install -r requirements.txt

COPY ./app ./app
RUN apt-get update -y
RUN apt-get install -y ffmpeg libsm6 libxext6  -y
RUN apt install -y libxkbcommon-x11-0

CMD ["python", "./app/detect.py", "--weights","./app/weights/best.pt", "--source", "0"]

1 Answers1

0

This is the solution.

pip uninstall opencv-python
pip install opencv-python-headless

Note

Headless mode can't use --view-img flag of detect.py

Nori
  • 2,340
  • 1
  • 18
  • 41