Skip to content

Latest commit

 

History

History
71 lines (43 loc) · 1.87 KB

File metadata and controls

71 lines (43 loc) · 1.87 KB

Cattle Species Detection with PyTorch

In this project, I classified 7 cattle breeds.

7 cattle breeds: Angus, Charolais, Hereford, Holstein, Jersey, Simmental, Montofon

Thus, it can be determined which breed a given cattle image belongs to.

Table of Contents

Introduction

Accurate cattle species detection is important for efficient farm management and breeding programs. This project leverages deep learning techniques to build a robust classifier for various cattle species.

Dataset

The Cattle dataset used for this project consists of images of different cattle species. Each image is labeled with the corresponding species.

Installation

Clone the repository:

git clone https://github.com/KHRMNKY/Cattle_Species_Detection_with_Pytorch.git

cd Cattle_Species_Detection_with_Pytorch

pip install -r requirements.txt

Using API

uvicorn api:app --reload

image

Using CLI

python cli.py --modelPath <"path model"> --imagePath <"image path">

image

Training

If you want, you can change the hyperparameters (epoch, lr) and train your own model by running the train_model.py file. This trained model will be saved in the models folder.

python train_model.py

Model Architecture

The ResNet50 architecture was used and fine-tuned on our dataset with PyTorch.

Data Preprocessing

In this section, the dataset has been prepared using PCA method and kmeans2 clustering algorithm. These operations are located in the preprocessing.py file.