Code Monkey home page Code Monkey logo

doggo-cv-chatbot's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

End2End Dog Breed Classification Chatbot

End-to-end dog breed image classification with machine learning
Report Bug · Request Feature

Note:

  • From data collection/scraping to deployment
  • Bot was previously deployed on an EC2 instance (Ubuntu) as a service
    • When I still had AWS Educate credits

Table of Contents:

Data Scraping

The class labels (dog breeds) are obtained from a website listing 209 dog breeds and are extracted using a simple function utilising BeautifulSoup4 library.

The function is named scrape_for_scraps and its Python corresponding script can be found here.

Data Collection

The image dataset (dog breed images) is gathered with the use of Google Image Search API. Image links are retrieved from Google Image Search API (limit of 100 images per search) and the images are downloaded using Python's Requests library.

The Google Image Search API function can be found here.

The image downloader function can be found here.

Custom Image Processing

A image processor was developed to handle basic image manipulation:

Initial Modeling

A simple convolution neural network architecture is developed and a model was trained with the image dataset.

  • However, too computationally heavy to train the model till a respectable performance is achieved
  • Attained ~5% classification accuracy on test set after training with a laptop's CPU (X1 Carbon 4th Gen)

Transfer Learning

A pre-trained image classification model trained on the ImageNet dataset was used and the chosen architecture was Xception as it has the same number of parameters as Inception V3 but has better classification performance. Only the last layer of weights are retrained to refit the model to be capable of performing dog breed classification.

The code for transfer learning can be found here.

Bot Development

The Telegram bot functionality is created by utilising Python's requests library to interact with Telegram's Bot API.

Some of the bot's functionality includes:

  • Image message recognition (uploaded via Gallery or via @pic)
  • Responding to directed messages
  • Downloading the image in the message
  • Managing the dog breed classification model and using it for image prediction

The Telegram bot implementation can be found here.

Deployment

Dog breed image classification bot was deployed on a AWS EC2 t3.small instance:

  • Initially set to run indefinitely with a cron job restarting the bot every hour
  • Switched to running the bot as a service with systemd, enabling the bot to be restarted automatically only if it terminates

Usage

The gif below shows a sample usage of the bot when it was active.

Built With

Contact

Lim Jia Xiang - [email protected]

Project Link: https://github.com/limjiaxiang/doggo-cv-chatbot

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE.txt file for details

Acknowledgements

doggo-cv-chatbot's People

Contributors

dependabot[bot] avatar limjiaxiang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.