Skip to content

Training and inference of image recognition model for Cats and Dogs classification task with kotlinDL

Notifications You must be signed in to change notification settings

korney3/kotlindl-cats-and-dogs

Repository files navigation

Training and inference of image recognition model for Cats and Dogs classification task with kotlinDL

Installation

To use KotlinDL in your project, add the following dependency to your build.gradle file:

   repositories {
      mavenCentral()
   }
   
   dependencies {
       implementation ("org.jetbrains.kotlinx:kotlin-deeplearning-api:[KOTLINDL-VERSION]")
   }

For the reference use build.gradle.kts from this repository

Results

VGG11 model was trained for 10 epochs on CPU. It obtained accuracy on test set equals 0.84. And 1.0 accuracy on special images.

Run

train.kt script is used for training the model and evaluation on test data.

inference.kt script is used for inference of the pretrained model and evaluation on test data and special images.

Pre-trained model for inference can be downloaded here. The archive should be unpacked to the root of the project.

Data

Model was trained with standard dataset dogsCatsDataset from kotlinDL framework.

The model was tested with additional data for checking the generalization abilities:

Cat (looks like dog) Dog (with confusing cat mask pattern)

Any other data can be added to special images directory (according to class file structure) and test the model.

Model

VGG11 architecture was used for classification task. Realization was adopted from examples in kotlinDL repository. Model can be replaced with LeNet architecture. Both architectures are presented here.

About

Training and inference of image recognition model for Cats and Dogs classification task with kotlinDL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages