ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite

Home Page:https://docs.ultralytics.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

common.py cannot import export_formats from export.py

jacobbreen25 opened this issue Β· comments

Search before asking

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

YOLOv5 Component

No response

Bug

I have been trying to create a ros2 node for yolov5. Using yolov5.7, I have fully created the driver but in running, I get the following error:

ImportError: cannot import name 'export_formats' from 'export' (/home/jbreen/.local/lib/python3.10/site-packages/export/__init__.py)

After uninstalling the export library, I got an error saying there is no library named export (I do not want to have to reinstall export so I will not put the error)

Environment

YOLO: yolov5.7
ROS2: Humble

Minimal Reproducible Example

python3 detect.py

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

πŸ‘‹ Hello @jacobbreen25, 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.8.0 with all requirements.txt installed including PyTorch>=1.8. 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

@jacobbreen25 hello! Thank you for reporting this issue. It seems like there might be a conflict with another package named export installed in your environment. YOLOv5's export.py should not be installed as a top-level package, so it's possible that Python is trying to import export_formats from the wrong export package.

To resolve this, please ensure that you are running your script from the root directory of the cloned YOLOv5 repository, and not from the site-packages directory. This way, Python should correctly reference the local export.py file rather than an installed package.

If you're still encountering issues, please refer to our documentation for further guidance on setting up your environment and running detection. If the problem persists, feel free to open a new issue with updated details. Thank you for your contribution to the YOLOv5 community! πŸš€

Closing because I found the issue. yolov5 library did not get added to python path so adding it fixed the issue immediately

@jacobbreen25 Great to hear that you've resolved the issue! Adding the YOLOv5 library to the Python path is indeed a crucial step. If you have any more questions or run into any other issues, don't hesitate to reach out. Happy coding and best of luck with your ROS2 node development! πŸŽ‰