GithubHelp home page GithubHelp logo

felix-zg / automatic-image-tagger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alecmorgan/automatic-image-tagger

0.0 2.0 0.0 241.03 MB

An image tagging tool utilizing a neural network and ALS recommender to add hashtags to images.

License: MIT License

Python 0.10% Jupyter Notebook 99.90%

automatic-image-tagger's Introduction

Instagram hashtags recommender

We created a model that recommends hashtags for Instagram images within 10 categories: travel, food, animals, cars, babies, wedding, architecture, selfie, fitness, nature.

Our recommendation algorithm is based on ALS model combined with graphic data extracted using transfer learning and base pretrained model MobileNetV2.

Goal: recommend 10 Instagram hashtags for a given image.

Presentation: link to presentation

Team: Alec Morgan, Andy Luc, Anna Zubova

Main working notebook: index.ipynb

Scraping notebook: scraping.ipynb

Ready-to-use model: predict*hashtag*for*new_image.ipynb Note that pickle files used in this notebook are not uploaded to GitHub due to the size. Please, request them if necessary. The model will be deployed as a Flask app shortly.

Overvew

Data collection

We scraped 3000 Instagram images that had the following hashtags (300 images per hashtag): #travel, #food, #animals, #cars, #babies, #wedding, #architecture, #selfie, #fitness, #nature. We also scraped all hashtags that appeared in the comments.

We initially stored the data in S3 bucket, but we experienced unexpected S3 bugs that prevented us from sharing the data between AWS accounts. As the images had an average size of just 100KB, we opted to store those locally.

Modeling

We used a neural network to extract deep features from the base model MobileNetV2. We then applied transfer learning technique and applied the the model to our data, extracting deep features from each individual image. We stored information about deep features in a separate file.

Independently of the graphic data, we applied ALS model to the hashtag text data. This model analized relationship between hashtags and extracted model's user features (which in out case were image features) and item features (in our case - hashtag features). The dot product of each combination represents a kind of recommendation score that allows to select n numbers of the hashtags to recommend. The example of the recommendation made with the ALS model can be found in the presentation. The ALS model is saved in a separate file to be able to use it easily.

Recommendation algorithm

Our recommendation algorithm combines two 2 models mentioned above to reach higher accuracy of recommendations.

The algorithm::

  1. Given a new image to make recommendations for, extract its deep features uning the model pretrained with MobileNetV2.
  2. Find n most similar images using cosine similarity between deep features.
  3. For each of the n most similar images find the average of the ALS's image features.
  4. Find the dot products of the above value and each hashtag's item features (from ALS)
  5. Select n hashtags to recomment that have the highest dot product.

Recommendation example

Test image: test image

Hashtags recommended by the model:

  1. #love
  2. #selfie
  3. #fashion
  4. #instagood
  5. #picoftheday
  6. #photography
  7. #summer
  8. #happy
  9. #instagram
  10. #beautiful

Further steps

  1. The code needs some cleaning and organizing, which will be done in the nearest future
  2. The model will be deployed as a Flask app

automatic-image-tagger's People

Contributors

alecmorgan avatar rokaandy avatar

Watchers

 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.