Sheep Detection

Photo by Süha Eryaşar on Dribbble

The main use of this application is to detect sheep from the image, which can then be used for many purposes like counting sheep and keeping track of the sheep in the yard. 
It will help farms to maintain a proper record of there sheep too.

So, Lets get started

Dataset: https://www.kaggle.com/intelecai/sheep-detection

This dataset contains 203 images of sheep. Mainly, Sheep images with bounding box annotations in Pascal VOC format

Now lets have a look at the necessary imports

https://gist.github.com/Rodio346/dd6a705b6d85ce30e4c00ca47e10a366

Since we are not having many images we need to apply data augmentation

Data augmentation helps us by duplicating images while applying tilt, rotations and other methods which does not tamper with the main object but changes it a bit thereby keeping the main goal intact.

https://gist.github.com/Rodio346/1e8c5128663c1fcb122fcab981de09ca

Lets have a look at the samples

Model

https://gist.github.com/Rodio346/6e8cbd7cc7506a8b3c8b8883f291364e

Resulting Model

This model is then trained using binary cross entropy using Adam with the learning rate of 0.0001. Also callbacks are used to introduce early stopping. With the help of early stopping we stop the model from further training by monitoring defined parameters.

Result

As you can see you the model has reached more than 90% accuracy allowing us to predict whether the sheep is in the image on not.

Predictions

Lets have a look at the predictions

https://gist.github.com/Rodio346/7a47e010c87c1e2f1f747ec5a62df314

Notebook Link : Here

Credit: vishal yadav