Louise Helary
Cow detection model v2
25/03/2024
This repository contains code for a cow detection model using PyTorch and YOLO. The key difference between the first version of the cow detection model and the current one is the preprocessing of images before training. Specifically, we resize large images to smaller ones with dimensions of 640 x 640 pixels.
pip install ultralytics
.The dataset used for training this model consists of images collected from three outdoor cattle farms in France using a UAV (Mavic 3 Enterprise or Mavic 3 Thermal). The flights were conducted at an altitude of 30, 60 or 100 meters in nadir position. Images and their corresponding labeling files are available on the Zenodo repository ICAERUS HE Project.
The following breeds with distinct body colors are present in the dataset:
Image size can be 4000x3000 or 5280x3956 depending on the drone used.
All images from Jalogny and Mauron farms taken at 60 or 100 meters were used (955 over 1148). Dataset was split into training, validation and test with a ratio of 70/20/10.
Color body | White | Spotted | Red/Black |
---|---|---|---|
Number of images | 127 | 25 | 38 |
Number of animals | 1 408 | 690 | 357 |
Afterward, all images underwent cropping to fit the required 640 × 640 pixel dimensions suitable for YOLO models. The Python script responsible for implementing this process will soon be accessible via this GitHub repository.
From this single source image, 6 x 4 smaller subimages measuring are extracted.
Here is the number of obtained images at the end of the process:
Train | Validation | Test | |
---|---|---|---|
Number of images | 24 024 | 6 864 | 3 455 |
% of images with animals | 1.78 | 1.89 | 1.94 |
Metrics:
An example of cow detection in a image from test population: