arindal1 / yolov5-onnx-object-recognition

An object detection model that uses YOLOv5 and OpenCV

Home Page:https://hacktoberfest.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YOLOv5 Object Detection with OpenCV


hacktober github twitter

Give this repo a ⭐ and contribute!

header image

This repository contains a project demonstrating object detection using the YOLOv5 model, integrated with OpenCV for image processing and Streamlit for a user-friendly interface. It is hacktober-accepted, so you can make your Hacktober OpenSource contributions here. Read CONTRIBUTIONS.md for more info about contributing.

Overview

The code provided demonstrates loading a YOLOv5 model in ONNX format and using it to perform object detection on input images. The detections are visualized by drawing bounding boxes and labels around the detected objects.

Prerequisites

  • Python 3.x
  • OpenCV (cv2)
  • PyTorch (for model training, not needed for inference)
  • COCO Names File (coco.names)
  • YOLOv5 Model Weights (yolov5s.onnx)
  • Input Image(s) for Testing

Run the requirements.txt

pip install -r requirements.txt  # install

Usage

  1. Clone the repository:

    git clone https://github.com/arindal1/yolov5-onnx-object-recognition.git
    
    cd yolov5-onnx-object-recognition
  2. Ensure you have the necessary model weights (yolov5s.onnx) and the COCO class names file (coco.names) in the appropriate locations.

  3. Run the script to perform object detection on the provided sample image (sample.jpg):

    python object_detection.py

Modify the script to work with your own images.

  1. Run the Steamlit app: app.py:
    streamlit run app.py

steamlitapp

  1. Access the app through your web browser at the provided URL (usually http://localhost:8501).

  2. Drag and drop your Input image onto the box.

About this Project

Acknowledgments

This project uses the YOLOv5 model and the COCO dataset. The model weights in ONNX format were obtained from the official YOLOv5 repository Ultralytics.

Contributions

Contributions to this repo are very welcome. This repository is hacktober-accepted, any contributions made will be counted as a part of Hacktober Fest 2023 if you're participating. Read Hacktober Fest Guildelines and CONTRIBUTIONS.md before making Pull Requests, to make sure you are following Hacktober's PR Rules. Any issues, features or changes you want to add, fork this repo and make your pull requests accordingly.
See the open issues for a list of proposed features (and known issues) or add your own and link them to your Pull Request.

For more infomation about contributions, please refer to CONTRIBUTIONS.md.

Contact

If you have any questions or suggestions related to this project, you can reach out to me at:

External Links

⚙️ The Contributors ⚙️



Note: This is a personal project created for educational and demonstrative purposes. I made this project just to learn more about the YOLO model. Feel free to contribute and help me make this project even better.

Have fun coding and contributing 🚀

About

An object detection model that uses YOLOv5 and OpenCV

https://hacktoberfest.com/


Languages

Language:Python 76.9%Language:Jupyter Notebook 13.2%Language:JavaScript 4.5%Language:CSS 2.0%Language:HTML 1.7%Language:Shell 0.8%Language:Dockerfile 0.4%Language:C++ 0.3%Language:Prolog 0.1%Language:CMake 0.0%