Giter Site home page Giter Site logo

lancopku / label-embedding-network Goto Github PK

View Code? Open in Web Editor NEW
90.0 13.0 26.0 1.32 MB

Label Embedding Network

Python 90.73% Perl 9.27%
label-embedding deep-learning label-representation cifar10 cifar100 mnist computer-vision natural-language-processing

label-embedding-network's Introduction

Label Embedding Network

This is an implementation of the paper Label Embedding Network: Learning Label Representation for Soft Training of Deep Networks https://arxiv.org/abs/1710.10393.

Label Embedding Network can learn label representation (label embedding) during the training process of deep networks. With the proposed method, the label embedding is adaptively and automatically learned through back propagation. The original one-hot represented loss function is converted into a new loss function with soft distributions, such that the originally unrelated labels have continuous interactions with each other during the training process. As a result, the trained model can achieve substantially higher accuracy and with faster convergence speed. Experimental results based on competitive tasks demonstrate the effectiveness of the proposed method, and the learned label embedding is reasonable and interpretable. The proposed method achieves comparable or even better results than the state-of-the-art systems.

The contributions of this work are as follows:
Learning label embedding and compressed embedding: We propose the Label Embedding Network that can learn label representation for soft training of deep networks. Furthermore, some large-scale tasks have a massive number of labels, and a naive version of label embedding network will suffer from intractable memory cost problem. We propose a solution to automatically learn compressed label embedding, such that the memory cost is substantially reduced.

Interpretable and reusable: The learned label embeddings are reasonable and interpretable, such that we can find meaningful similarities among the labels. The proposed method can learn interpretable label embeddings on both image processing tasks and natural language processing tasks. In addition, the learned label embeddings can be directly adapted for training a new model with improved accuracy and convergence speed.

General-purpose solution and competitive results: The proposed method can be widely applied to various models, including CNN, ResNet, and Seq-to-Seq models. We conducted experiments on computer vision tasks including CIFAR-100, CIFAR-10, and MNIST, and on natural language processing tasks including LCSTS text summarization task and IWSLT2015 machine translation task. Results suggest that the proposed method achieves significantly better accuracy than the existing methods (CNN, ResNet, and Seq-to-Seq). We achieve results comparable or even better than the state-of-the-art systems on those tasks.


bibtex:

@article{LabelEmb,
author = {Xu Sun and Bingzhen Wei and Xuancheng Ren and Shuming Ma},
title = {Label Embedding Network: Learning Label Representation for Soft Training of Deep Networks},
journal = {CoRR},
volume = {abs/1710.10393},
year = {2017}
}

DataSet

CIFAR100: Download
CIFAR10: Download
MNIST: Download
LCSTS: Download
IWSLT2015: Download


Environment and Dependency

  • Ubuntu 16.04
  • Python 3.5
  • Tensorflow 1.3 (for MNIST)
  • Pytorch 0.2.0 (for other tasks)

Training for Computer Vision Tasks

You can change the training mode by setting the parameter "mode", as the mode=baseline means the baseline models(CNN, ResNet-8 or ResNet-18) and the mode=emb means our proposed label embedding network. There are also some other super parameters, see the codes for more details.

CIFAR-100

python3 resnet18.py --mode=baseline
python3 resnet18.py --mode=emb
The outputs will be in ./100_results

CIFAR-10

python3 resnet8.py --mode=baseline
python3 resnet8.py --mode=emb
The outputs will be in ./10_results

MNIST

python3 cnn.py --mode=baseline
python3 cnn.py --mode=emb
The outputs will be in ./cnn_results
python3 mlp.py --mode=baseline
python3 mlp.py --mode=emb
The outputs will be in ./mlp_results



Training for Natural Language Processing Tasks

LCSTS (Text Summarization)

python3 preprocess.py -train_src TRAIN_SRC_DATA -train_tgt TRAIN_TGT_DATA
		      -test_src TEST_SRC_DATA -test_tgt TEST_TGT_DATA
		      -valid_src VALID_SRC_DATA -valid_tgt VALID_TGT_DATA
		      -save_data data/lcsts/lcsts.low.share.train.pt
		      -lower -share
python3 train.py -gpus 0 -config lcsts.yaml -unk -score emb -loss emb -log label_embedding
python3 predict.py -gpus 0 -config lcsts.yaml -unk -score emb -restore data/lcsts/label_embedding/best_rouge_checkpoint.pt

IWSLT2015 (English-Vietnamese Machine Translation)

python3 preprocess.py -train_src TRAIN_SRC_DATA -train_tgt TRAIN_TGT_DATA
		      -test_src TEST_SRC_DATA -test_tgt TEST_TGT_DATA
		      -valid_src VALID_SRC_DATA -valid_tgt VALID_TGT_DATA
		      -save_data data/iwslt15/iwslt.low.train.pt
		      -lower
python3 train.py -gpus 0 -config iwslt.yaml -unk -score emb -loss emb -log label_embedding
python3 predict.py -gpus 0 -config iwslt.yaml -unk -score emb -restore data/lcsts/label_embedding/best_bleu_checkpoint.pt

Results for Computer Vision Tasks

Results of Label Embedding on computer vision:

cv_tab.png

Error rate curve for CIFAR-100, CIFAR-10, and MNSIT. 20 times experiments (the light color curves) are conducted for credible results both on the baseline and our proposed model. The average results are shown as deep color curves:

cv_fig.png

Heatmaps generated by the label embeddings:

cv_heatmap.png


Results for Natural Language Processing Tasks

Results of Label Embedding for LCSTS: lcsts_tab.png

Results of Label Embedding for IWSLT2015: iwslt_tab.png

Examples of the similarity results on IWSLT2015: iwslt_heatmap.png

label-embedding-network's People

Contributors

imwebson avatar

Stargazers

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

Watchers

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

label-embedding-network's Issues

Hyperparameters and arguments

Hi guys,

In the paper, you state that you leave alpha at 0.9 for all tasks, but in the code for CIFAR the default value appears to be 0.5. Further, the README says to use mode=='emb', but the comp_loss function can either return losses corresponding to mode='baseline', mode='emb' or mode is neither, and it looks like the code on e.g. line 109 of ResNet18 is where you actually calculate the loss used in your paper (equation 14). Line 101, which is what mode='emb' returns, looks to be missing several terms. Clarification regarding this would be appreciated.

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.