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

Illegal Instruction (core dumped)-Running yolov5 on Raspberry pi 3 #11464

Closed
1 task done
berry-sh opened this issue May 1, 2023 · 7 comments
Closed
1 task done

Illegal Instruction (core dumped)-Running yolov5 on Raspberry pi 3 #11464

berry-sh opened this issue May 1, 2023 · 7 comments
Labels
question Further information is requested

Comments

@berry-sh
Copy link

berry-sh commented May 1, 2023

Search before asking

Question

I am trying to run yolov5 on Ubuntu 22.04.2 LTS installed on Raspberry pi 3, but it gives me every time this warning
"/home/ubuntu/.local/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: failed to load image python extension"

Finally, it gives me "Illegal Instruction (core dumped)" even though I am using the same version for all the requirements as when running Yolo on my Laptop (it works on my Laptop).

Additional

No response

@berry-sh berry-sh added the question Further information is requested label May 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2023

👋 Hello @berry-sh, 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 a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

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

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics

@glenn-jocher
Copy link
Member

@berry-sh hi there! The warning you are seeing could be caused by an issue with your TorchVision installation. You could try running pip uninstall torchvision && pip install torchvision to ensure that it is installed correctly.

The "Illegal Instruction (core dumped)" error suggests that there could be a compatibility issue with your Raspberry Pi 3. YOLOv5 is optimized for use on GPUs, so running it on a CPU like the one in the Raspberry Pi 3 may be challenging or slow. You could try reducing the batch size and the image size to see if that helps.

Also, please make sure that all the dependencies including PyTorch are installed properly. You can check if PyTorch is installed correctly by running python -c "import torch;print(torch.version.cuda)" which should output your CUDA version. Let us know if this helps!

@berry-sh
Copy link
Author

berry-sh commented May 2, 2023

okay, so this time instead of installing the versions of packages that worked on my ubuntu PC (by pip freeze > requirements.txt), I just ran pip install -r requirements.txt (the text file on the repo). This file has torch version 1.7.0 and torchvision version 0.8.1. It does not install those version and instead install torch 2.0.0 and torchvision 0.15.1. When it does so, the warning is gone but still I get Illegal Instruction when running python3 detect.py --source 0.

I then ran python -c "import torch;print(torch.version.cuda)" & it gave me Illegal Instruction as well.

If I try pip uninstall torch && pip install torch==1.7.0, it says no such version (only available versions are 1.10.2, 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0)

I then tried installing torch 1.13.0 with torchvision 0.14.0, but I got the warning back ("/home/ubuntu/.local/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: failed to load image python extension") along with the Illegal Instruction error BUT this time, I got NONE when running python -c "import torch;print(torch.version.cuda)"

@berry-sh
Copy link
Author

berry-sh commented May 2, 2023

Is there a way maybe to use the Raspberry pi GPIO pins (because I need to connect ultrasonic sensors and motors to it) while reading and writing to these pins from my PC? This way I can run yolov5 on my PC instead of running it on the Raspberry pi.

Thanks.

@glenn-jocher
Copy link
Member

@berry-sh hey there! Yes, you can definitely use the Raspberry Pi GPIO pins to connect and control ultrasonic sensors and motors while running YOLOv5 on your PC. One way to accomplish this is through a library like gpiozero, which is a simple Python library that provides a way to interact with GPIO devices connected to the Raspberry Pi.

You can run the code that controls the GPIO pins on the Raspberry Pi while also having your YOLOv5 code running on your PC. The two can communicate with each other over a network using a protocol like MQTT or WebSockets, for example.

There are many ways to accomplish this, so it depends on your specific requirements and setup. Let us know if you have any further questions.

@berry-sh
Copy link
Author

berry-sh commented May 2, 2023

Thank you so much

@berry-sh berry-sh closed this as completed May 2, 2023
@glenn-jocher
Copy link
Member

@berry-sh of course, I'd be happy to help! Please let me know what your question is regarding YOLOv5 and I will do my best to assist you. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants