Skip to content

Conversation

MohiteYash
Copy link

@MohiteYash MohiteYash commented Jul 27, 2025

Summary

This PR adds a lightweight and minimal YOLOv5 inference script (inference_minimal.py) for users who want a simple, clean way to run inference on a single image using pretrained models.


Features

  • Minimal dependencies (torch, opencv-python, PIL, matplotlib)
  • Accepts --img-path as input
  • Uses pretrained YOLOv5s model by default
  • Draws and saves bounding box results

Motivation

The existing detect.py script is full-featured but not beginner-friendly. This PR provides a cleaner starting point for new users, educational purposes, or quick tests.


Example Usage

python inference_minimal.py --img-path data/images/bus.jpg


## 🛠️ PR Summary

<sub>Made with ❤️ by [Ultralytics Actions](https://github.com/ultralytics/actions)<sub>

### 🌟 Summary
Added a minimal example script for running YOLOv5 inference with just a few lines of code. 🚀

### 📊 Key Changes
- Introduced `inference_minimal.py`, a new script demonstrating simple YOLOv5 inference.
- The script loads a pretrained YOLOv5 model, processes an example image, runs inference, and displays/saves the results.

### 🎯 Purpose & Impact
- Makes it easier for new users to quickly understand and try YOLOv5 inference with minimal setup.
- Provides a clear, easy-to-follow reference for basic usage, lowering the barrier for beginners and speeding up prototyping. 🧑‍💻
- Helps users verify their environment and model installation with a ready-to-run example.

Copy link
Contributor

github-actions bot commented Jul 27, 2025

All Contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@UltralyticsAssistant UltralyticsAssistant added detect Object Detection issues, PR's enhancement New feature or request python Pull requests that update python code labels Jul 27, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @MohiteYash, thank you for submitting an ultralytics/yolov5 🚀 PR! To help ensure a smooth review and integration process, please review and complete the following checklist:

  • Define a Purpose: Make sure your PR description clearly explains the purpose of your addition, and link to any relevant issues. Ensure your commit messages are clear and follow the project's conventions.
  • Synchronize with Source: Confirm your PR is up-to-date with the ultralytics/yolov5 main branch. If not, please update it by clicking the 'Update branch' button or running git pull and git merge main locally.
  • Ensure CI Checks Pass: Confirm that all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues before requesting review.
  • Update Documentation: If your new minimal inference script changes usage or adds new functionality, please update the relevant documentation accordingly.
  • Add Tests: If applicable, include or update tests to cover your changes, and verify that all tests are passing.
  • Sign the CLA: If this is your first PR to Ultralytics, please sign our Contributor License Agreement (CLA) by commenting "I have read the CLA Document and I sign the CLA" in this PR.
  • Minimize Changes: Ensure your PR contains only the changes necessary for this minimal inference script. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For detailed contribution steps, please see our Contributing Guide. If you have any questions, feel free to comment here and an Ultralytics engineer will assist you soon. This is an automated response 🤖, but our team will review your PR and provide feedback shortly. Thank you for contributing to Ultralytics! 🚀

@MohiteYash
Copy link
Author

Hi maintainers 👋 — I'm seeing a "There is no CLA to sign for ultralytics/yolov5" error from the CLA Assistant bot. It seems the CLA isn't currently set up on this repo. Could you please check or disable the CLA check? Thanks!

@MohiteYash
Copy link
Author

I have read the CLA Document and I sign the CLA

@MohiteYash
Copy link
Author

recheck

@pderrenger
Copy link
Member

Thanks for this contribution @MohiteYash! A minimal inference example is exactly what many new users need to get started with YOLOv5. The CLA bot appears to be having issues - this is a known intermittent problem and the team will handle the CLA verification manually during review. Your concept of providing a beginner-friendly script alongside the full-featured detect.py aligns perfectly with our goal of making computer vision accessible to everyone. Once CI passes, the maintainers will review the implementation details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detect Object Detection issues, PR's enhancement New feature or request python Pull requests that update python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants