Skip to content

achatrian/measureanimals

Repository files navigation

Measure Animals

App to detect animals in images and train custom classifiers to detect animal breeds.

Steps:

Classifier was trained on https://www.kaggle.com/datasets/anandkumarsahu09/cattle-breeds-dataset. See classify_breed python code folder for classification results. Results were achieved for dataset also in java code (see app_data/models.json)

Classifier performs well, there are a lot of noise images in dataset and thus the mean accuracy is around 66% for multiclass classification. For most images with a clear view of the cow the classification is good (>90% in test).

Get started

Config file

Write a config.properties file with the following format: projectPath=/path/to/project dataPath=/path/to/training/data

Dataset for classifier training

The classifier is trained on the cattle breed dataset: https://kaggle.com/datasets/anandkumarsahu09/cattle-breeds-dataset/data which can be downloaded with the script download_cattle_breed_dataset.py. The classifier training is generic and a new classifier can be trained on any dataset with the following folder structure:

dataset
├── ...
├── class1        
│   ├── image1.png
│   ├── image2.png
│   └── ...
├── class2        
│   ├── image1.png
│   ├── image2.png
│   └── ...
└── ...

The dir names will be the names of the classes

Running the application:

In order to run the application on your machine, a ready-made shaded jar file can be found at: measureanimals/target/measureanimals-1.0.jar If you have java installed, the app can be run using: java -jar ./target/measureanimals-1.0.jar

Instructions within app:

  • Upload an image from your dataset:

  • Application look; alt text

  • Upload image: alt text

  • Run the coco detection:

  • Detect cattle: alt text

  • Run the category classifier (for cattle breed in this case):

  • Classify cattle: alt text

Classifier info

The classifier uses SIFT to extract keypoints, then bags the keypoints by using KMeans, and then uses GradientBoostedTrees to run the file

About

A small app to train a SIFT-feature based classifier to recognize different animal classes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published