yolov5 icon indicating copy to clipboard operation
yolov5 copied to clipboard

object detection piéce metalique with camera basler

Open ninja8756 opened this issue 9 months ago • 2 comments

Search before asking

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

Question

Hi ✌ I am working on object Detection with yolov5 and I want to use basler camera to detect objects. how can I do that and get frames from the Basler camera and make detection?

Additional

No response

ninja8756 avatar Feb 26 '25 14:02 ninja8756

👋 Hello @ninja8756, 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 ❓ Question about using the Basler camera with YOLOv5, please ensure you have the necessary software to interface with your camera (e.g., Basler's pypylon library for Python) and integrate it to capture frames for processing. If you encounter issues during integration, try sharing some additional details like setup code snippets, errors, or steps causing difficulties, so we can better assist you.

If you believe this is a 🐛 Bug Report, please provide a minimum reproducible example (MRE), including code and steps to reproduce the issue, as well as details on your environment setup.

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 can be run in a variety of environments for seamless experimentation and deployment, including:

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.

Please note this is an automated response. An Ultralytics engineer will review your question and provide further assistance as soon as possible. Thank you for your patience! 😊

UltralyticsAssistant avatar Feb 26 '25 14:02 UltralyticsAssistant

@ninja8756 to integrate a Basler camera with YOLOv5 for object detection, you can use the pypylon library to capture frames and pass them to YOLOv5. Here's a minimal example:

from ultralytics import YOLO
from pypylon import pylon

model = YOLO("yolov5s.pt")  # Load YOLOv5 model
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
camera.StartGrabbing(pylon.GrabStrategy_LatestImageOnly)

while camera.IsGrabbing():
    grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
    if grabResult.GrabSucceeded():
        img = grabResult.Array  # Get numpy array
        results = model.predict(img)  # YOLOv5 inference
        results[0].show()

Install pypylon: pip install pypylon. For more details, see the Ultralytics YOLOv5 Predict documentation. Adjust camera settings as needed via Basler's Pylon API.

pderrenger avatar Feb 27 '25 01:02 pderrenger

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

  • Docs: https://docs.ultralytics.com
  • HUB: https://hub.ultralytics.com
  • Community: https://community.ultralytics.com

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 YOLO 🚀 and Vision AI ⭐

github-actions[bot] avatar Oct 10 '25 00:10 github-actions[bot]