Giter Site home page Giter Site logo

bilstm's Introduction

Learning Fashion Compatibility with Bidirectional LSTMs - PyTorch version

PyTorch implementation of the paper Learning Fashion Compatibility with Bidirectional LSTMs [1].

INSTALLATION

In order to run this code, you must install:

  • PyTorch (install it with CUDA support if you want to use GPUs, which is strongly recommended).
  • Python with packages numpy, torchvision, tensorboardX, PIL, collections, cv2 (only if you want to generate result images for fill in the blank task, tested with version 2.4.8), h5py, sklearn, nltk.

If this is your first time using nltk, you'd probably have to download wordnet corpora by executing the following lines in python:

import nltk
nltk.download('wordnet')

The code has been tested with these two configurations:

  • python 2.7.6 - Pytorch 0.3.0.post4 - CUDA 7.5 - numpy 1.11.1 - sklearn 0.18.1
  • python 3.6.0 - PyTorch 0.4.0a0+040336f - CUDA 9.1 - numpy 1.13.3 - sklearn 0.19.1

DATASET

Download the Polyvore dataset from the authors of the paper here and extract it in the bilstm/data folder.

TRAINING

To train the model, run:

python main.py

You can take a look at the evolution of the training by running tensorboard --logdir runs.

Note that we included options to change the default parameters (learning rate, batch size, and convolutional model to extract image features). By default, these are just like in the paper: 0.2, 10 and inception_v3.

EVALUATION

We provide a snapshot for our trained model (with inception) here.

Prior to running the evaluation of the models, you must extract the features of the test images. In order to do so, run:

python src/get_features.py -m model_path -sp path_to_save_data [-t model_type]

This will save a h5 file with the image features.

Evaluation of compatibility AUC

To reproduce the results in the 2nd column of table 1 of the paper, run:

python src/evaluation.py -m model_path -sp path_to_saved_data [-t model_type]

Evaluation of fill in the blank accuracy

To reproduce the results in the 1st column of table 1 of the paper, run:

python src/outfit_generation.py -m model_path -sp path_to_saved_data -i path_to_save_results [-t model_type]

This will generate outfit images in the folder specified in -i. First row of the image is the question with an empty space. Second row shows the possible answers, with the predicted item squared in green (if correct) or in red (if wrong, with the correct answer in green).

[1] Han, Xintong, et al. "Learning Fashion Compatibility with Bidirectional LSTMs." Proceedings of the 2017 ACM on Multimedia Conference. ACM, 2017.

bilstm's People

Contributors

arubior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bilstm's Issues

normalize compatibility score

Hi,

I want to see the score for one set in normalized shape. How can I normalize the score? the score is a negative number. I don't have any idea to normalize that without considering all the data.

lots of problem in running the code

Hi,
I ran the code under pytorch 1.0 and 0.4.0 and got lots of error. Is there any updated version?
what about features file and vocab.json and query.json?
is the format of features h5?

It would be great if you share these files too. and if there is any updated code. Thanks a lot.

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.