Code Monkey home page Code Monkey logo

genhash's Introduction

GenHash

This flask-based web application uses CNN and LSTM as the base models to generate the Hashtags for the uploaded image. This web application uses a pre-trained model on the COCO dataset. The COCO (Common Objects in Context) dataset is a large-scale image recognition dataset for object detection, segmentation, and captioning tasks. It contains over 330,000 images, each annotated with 80 object categories.

Stepwise Implementation of the Model

  1. First step is to load the dataset. This is done in the Data loader.py file. 
  2. Next is to generate the vocabulary to train the dataset. Code for this can be found in build vocab.py
  3. Two models are defined in the model.py. One is CNN, and the other is LSTM. Both models are used to encode and then decode the images to generate the hashtags for the given image.
  4. Train.py is run to combine all three files and train the model. The trained model is then saved in the same directory.

Flask web application 

Flask is a tool used to make web applications using Python. This flask application has these files:

  1. model.py
  2. build_vocab.py
  3. data_loader.py
  4. saved models
  5. vocab.pkl
  6. app.py The app.py has four primary functions which define the flow of the application. First is load_image(); it loads the image and resizes it according to the model. The second is the process() function which does all the image preprocessing. It transforms the image and loads the vocabulary wrapper using the save pkl file. Then the model is loaded with the defined weights and layers. The features are encoded using these models, and the hashtags are generated. The predict() function includes all the paths for the files and is called when the upload() function uploads the image. The encoder and decoder files are big therefore providing the drive link for them here. encoder: https://drive.google.com/file/d/1-ZT7IeR9hdpJjFClldUWIr-Bpm3o3UYt/view?usp=sharing decoder: https://drive.google.com/file/d/1ypyJZ8AAZwcSE3nBiPJ3wGuYh-2K24Ni/view?usp=sharing Link of the Screen recording of the code and the Web application: https://drive.google.com/drive/folders/1oz2IglnHGvDT_zXILTmdakJDgMBVWNpM?usp=sharing

genhash's People

Contributors

nimit1jain avatar

Watchers

Kostas Georgiou avatar  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.