Downloads · 30 days
0
rmayormartins/yolov5-farm-cattle
yolov5-farm-cattle is a machine learning model from rmayormartins. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as ecl-2.0.
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.
Downloads · 30 days
0
Access
Public
Updated May 22, 2024
Repo size
14.4 MB
Likes
0
Public
Click a slice to open those files.
.pt14.4 MB · 100%
From the Hugging Face model README
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.
bestyolo5.ptTo use the YOLOv5 Cattle Counter model, follow these steps:
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()
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.
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
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:
Soon
Special thanks to the contributors and the open-source community for providing resources and support.
This project is licensed under the Eclipse Public License 2.0.
For more information or questions about the model, please contact Ramon Mayor Martins: