license: ecl-2.0
YOLOv5 Cattle Counter
This repository contains a YOLOv5 model trained to detect and count cattle in images. The model is designed to facilitate the monitoring and management of cattle in agricultural settings.
Model Information
- Model: YOLOv5
- Task: Object Detection
- Classes: Cattle
- File:
bestyolo5.pt
How to Use
To use the YOLOv5 Cattle Counter model, follow these steps:
1. Loading the Model
You can load the model using the torch
library and the ultralytics/yolov5
repository. Here's an example in Python:
import torch
# Load the model
model = torch.hub.load('ultralytics/yolov5', 'custom', path='bestyolo5.pt')
# Load an image
img = 'path/to/your/image.jpg'
# Perform inference
results = model(img)
# Display results
results.show()
2. Running Inference
After loading the model, you can perform inference on your images to detect and count cattle. The model will output the image with bounding boxes around detected cattle and the total count of detected cattle.
3. Example Usage
Here's an example of how to use the model to detect cattle in an image:
import torch
from PIL import Image
# Load the model
model = torch.hub.load('ultralytics/yolov5', 'custom', path='bestyolo5.pt')
# Load an image
img = Image.open('path/to/your/cattle_image.jpg')
# Perform inference
results = model(img)
# Print results
results.print() # Print results to console
results.show() # Display results
# Save results
results.save('path/to/save/results/') # Save results to a directory
Model Training
The model was trained using a custom dataset of cattle images. The dataset was annotated with bounding boxes around cattle using MakeSense, and the YOLOv5 model was trained using these annotations. The training process involved:
- Collecting and annotating the data.
- Training the YOLOv5 model with the annotated data.
- Fine-tuning the model to improve accuracy.
Training Configuration
Soon
Acknowledgements
Special thanks to the contributors and the open-source community for providing resources and support.
License
This project is licensed under the Eclipse Public License 2.0.
Contact
For more information or questions about the model, please contact Ramon Mayor Martins:
- Email: [email protected]
- Homepage: https://rmayormartins.github.io/
- Twitter: @rmayormartins
- GitHub: https://github.com/rmayormartins
- My Radio Callsign (PU4MAY) Brazil