rmayormartins
commited on
Commit
•
356473a
1
Parent(s):
fbf3e43
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,98 @@
|
|
1 |
-
---
|
2 |
-
license: ecl-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: ecl-2.0
|
3 |
+
---
|
4 |
+
|
5 |
+
# YOLOv5 Cattle Counter
|
6 |
+
|
7 |
+
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.
|
8 |
+
|
9 |
+
## Model Information
|
10 |
+
|
11 |
+
- **Model:** YOLOv5
|
12 |
+
- **Task:** Object Detection
|
13 |
+
- **Classes:** Cattle
|
14 |
+
- **File:** `bestyolo5.pt`
|
15 |
+
|
16 |
+
## How to Use
|
17 |
+
|
18 |
+
To use the YOLOv5 Cattle Counter model, follow these steps:
|
19 |
+
|
20 |
+
### 1. Loading the Model
|
21 |
+
|
22 |
+
You can load the model using the `torch` library and the `ultralytics/yolov5` repository. Here's an example in Python:
|
23 |
+
|
24 |
+
```python
|
25 |
+
import torch
|
26 |
+
|
27 |
+
# Load the model
|
28 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', path='bestyolo5.pt')
|
29 |
+
|
30 |
+
# Load an image
|
31 |
+
img = 'path/to/your/image.jpg'
|
32 |
+
|
33 |
+
# Perform inference
|
34 |
+
results = model(img)
|
35 |
+
|
36 |
+
# Display results
|
37 |
+
results.show()
|
38 |
+
```
|
39 |
+
|
40 |
+
### 2. Running Inference
|
41 |
+
|
42 |
+
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.
|
43 |
+
|
44 |
+
### 3. Example Usage
|
45 |
+
|
46 |
+
Here's an example of how to use the model to detect cattle in an image:
|
47 |
+
|
48 |
+
```python
|
49 |
+
import torch
|
50 |
+
from PIL import Image
|
51 |
+
|
52 |
+
# Load the model
|
53 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', path='bestyolo5.pt')
|
54 |
+
|
55 |
+
# Load an image
|
56 |
+
img = Image.open('path/to/your/cattle_image.jpg')
|
57 |
+
|
58 |
+
# Perform inference
|
59 |
+
results = model(img)
|
60 |
+
|
61 |
+
# Print results
|
62 |
+
results.print() # Print results to console
|
63 |
+
results.show() # Display results
|
64 |
+
|
65 |
+
# Save results
|
66 |
+
results.save('path/to/save/results/') # Save results to a directory
|
67 |
+
```
|
68 |
+
|
69 |
+
## Model Training
|
70 |
+
|
71 |
+
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:
|
72 |
+
|
73 |
+
1. Collecting and annotating the data.
|
74 |
+
2. Training the YOLOv5 model with the annotated data.
|
75 |
+
3. Fine-tuning the model to improve accuracy.
|
76 |
+
|
77 |
+
### Training Configuration
|
78 |
+
|
79 |
+
Soon
|
80 |
+
|
81 |
+
## Acknowledgements
|
82 |
+
|
83 |
+
Special thanks to the contributors and the open-source community for providing resources and support.
|
84 |
+
|
85 |
+
## License
|
86 |
+
|
87 |
+
This project is licensed under the Eclipse Public License 2.0.
|
88 |
+
|
89 |
+
## Contact
|
90 |
+
|
91 |
+
For more information or questions about the model, please contact Ramon Mayor Martins:
|
92 |
+
|
93 |
+
- Email: [rmayormartins@gmail.com](mailto:rmayormartins@gmail.com)
|
94 |
+
- Homepage: [https://rmayormartins.github.io/](https://rmayormartins.github.io/)
|
95 |
+
- Twitter: [@rmayormartins](https://twitter.com/rmayormartins)
|
96 |
+
- GitHub: [https://github.com/rmayormartins](https://github.com/rmayormartins)
|
97 |
+
- My Radio Callsign (PU4MAY) Brazil
|
98 |
+
|