Giter Site home page Giter Site logo

codicespaghetti / visual-sentiment-analysis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fabiocarrara/visual-sentiment-analysis

0.0 0.0 0.0 12 KB

PyTorch port of models for Visual Sentiment Analysis pre-trained on the T4SA dataset.

Shell 4.73% Python 95.27%

visual-sentiment-analysis's Introduction

Cross-Media Learning for Image Sentiment Analysis in the Wild

This repo contains the PyTorch-converted models for visual sentiment analysis trained on the T4SA (Twitter for Sentiment Analysis) dataset presented in [1].

[1] Vadicamo, L., Carrara, F., Cimino, A., Cresci, S., Dell'Orletta, F., Falchi, F. and Tesconi, M., 2017.
    Cross-media learning for image sentiment analysis in the wild.
    In Proceedings of the IEEE International Conference on Computer Vision Workshops (pp. 308-317).

Usage

  1. Install Requirements: PyTorch

  2. Download the pretrained models:

    ./download_models.sh
  3. Use the predict.py script to make predictions on images. Example:

    python predict.py images_list.txt --model vgg19_finetuned_all --batch-size 64 > predictions.csv

    The output file contains three columns representing the probability of each image belonging respectively to the negative, neutral, and positive classes in this order.

Converting the original Caffe models

We adopted MMdnn to convert caffe models to PyTorch. We recommend using the pre-built Docker image:

docker pull mmdnn/mmdnn:cpu.small

First, download the original models available at http://t4sa.it and extract them following this folder structure:

original-models/
├── hybrid_finetuned_all/
│   ├── deploy.prototxt
│   ├── mean.binaryproto
│   ├── snapshot_iter_34560.caffemodel
│   └── ...
├── hybrid_finetuned_fc6+/
│   ├── <same as above>
│   └── ...
├── vgg19_finetuned_all/
│   ├── <same as above>
│   └── ...
└── vgg19_finetuned_fc6+/
    ├── <same as above>
    └── ...

Then, run convert_models.sh:

docker run --rm -it -v $(pwd):/workspace -w /workspace mmdnn/mmdnn:cpu.small bash ./convert_models.sh

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.