This project uses the YOLOv5 object detection model and PyTorch to detect objects in an image. The model identifies objects, draws bounding boxes around them, displays confidence scores, and saves the final output image.
The project demonstrates the practical use of open-source computer vision technology for image analysis and object detection.
- Detects objects in an image using YOLOv5
- Draws bounding boxes around detected objects
- Displays confidence scores
- Prints detected object names
- Prints the total number of detected objects
- Saves the output image automatically
- Python
- PyTorch
- YOLOv5
- OpenCV
- NumPy
- Matplotlib
The following modifications were made to the original code:
- Changed the confidence threshold to 0.30
- Printed the total number of detected objects
- Printed detected object names and confidence scores
- Added comments to explain important code sections
The project uses a custom image provided by the user.
File:
input_image.jpg
The image contains multiple objects that can be detected by the YOLOv5 model.
git clone https://github.com/YOUR_USERNAME/YOLOvs-Image-Classification.gitcd YOLOvs-Image-Classificationpip install -r requirements.txtpython main.pyTotal detected objects: 5
person: 0.91
chair: 0.88
laptop: 0.84
bottle: 0.79
backpack: 0.75
Replace the above output with your actual detection results.
The detected image is saved as:
output_result.png
The output image contains:
- Bounding boxes
- Object labels
- Confidence scores
YOLOvs-Image-Classification/
│
├── main.py
├── input_image.jpg
├── output_result.png
├── README.md
├── requirements.txt
├── LICENSE
└── report.docx
README.md provides information about the project, including its purpose, features, setup instructions, and usage. It helps other users understand and use the project easily.
requirements.txt contains all required Python libraries. It allows users to install the necessary dependencies quickly and run the project without configuration issues.
This project is licensed under the MIT License.
See the LICENSE file for details.
Tanim Ahammed
Open Source Software Course
Sejong University