yolov5 icon indicating copy to clipboard operation
yolov5 copied to clipboard

ValueError: axes don't match array

Open shahizat opened this issue 3 years ago • 2 comments

Search before asking

  • [X] I have searched the YOLOv5 issues and discussions and found no similar questions.

Question

Hi yolov5 community,

Has anyone experienced the below problem, when run detect command using camera source?

Fusing layers... 
YOLOv5n summary: 213 layers, 1867405 parameters, 0 gradients
Unable to init server: Could not connect: Connection refused
WARNING: Environment does not support cv2.imshow() or PIL Image.show() image displays
OpenCV(4.5.4) /home/jetson/opencv/modules/highgui/src/window_gtk.cpp:635: error: (-2:Unspecified error) Can't initialize GTK backend in function 'cvInitSystem'

[ WARN:0] global /home/jetson/opencv/modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
1/1: 2...  Success (inf frames 1280x720 at 30.00 FPS)

Traceback (most recent call last):
  File "detect.py", line 254, in <module>
    main(opt)
  File "detect.py", line 249, in main
    run(**vars(opt))
  File "/home/jetson/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 111, in run
    for path, im, im0s, vid_cap, s in dataset:
  File "/home/jetson/Projects/yolo/yolov5/utils/dataloaders.py", line 396, in __next__
    img = img[..., ::-1].transpose((0, 3, 1, 2))  # BGR to RGB, BHWC to BCHW
ValueError: axes don't match array
terminate called without an active exception

Additional

No response

shahizat avatar Aug 21 '22 08:08 shahizat

👋 Hello @shahizat, 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].

Requirements

Python>=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

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If 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.

github-actions[bot] avatar Aug 21 '22 08:08 github-actions[bot]

👋 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:

  • Wiki – https://github.com/ultralytics/yolov5/wiki
  • Tutorials – https://docs.ultralytics.com/yolov5
  • Docs – https://docs.ultralytics.com

Access additional Ultralytics ⚡ resources:

  • Ultralytics HUB – https://ultralytics.com/hub
  • Vision API – https://ultralytics.com/yolov5
  • About Us – https://ultralytics.com/about
  • Join Our Team – https://ultralytics.com/work
  • Contact Us – https://ultralytics.com/contact

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[bot] avatar Sep 21 '22 00:09 github-actions[bot]

@shahizat hi there,

It looks like you're encountering an issue when running the detect command using a camera source. This could be related to the OpenCV, PIL, or system setup. For some users, this error is resolved by ensuring proper environment settings, while others have encountered it due to underlying hardware or software configurations.

To better understand and address this issue, could you provide more information about your environment and setup? This could include details about the hardware, OS, Python version, and any dependencies or custom configurations you've implemented.

Also, feel free to check out our documentation for insights or existing discussions on similar topics.

Looking forward to helping you resolve this!

glenn-jocher avatar Nov 15 '23 18:11 glenn-jocher