All Projects → vithursant → Magnetloss Pytorch

vithursant / Magnetloss Pytorch

Licence: mit
PyTorch implementation of a deep metric learning technique called "Magnet Loss" from Facebook AI Research (FAIR) in ICLR 2016.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Magnetloss Pytorch

Eda nlp
Data augmentation for NLP, presented at EMNLP 2019
Stars: ✭ 902 (+315.67%)
Mutual labels:  classification, cnn, embeddings
Deeplearning Nlp Models
A small, interpretable codebase containing the re-implementation of a few "deep" NLP models in PyTorch. Colab notebooks to run with GPUs. Models: word2vec, CNNs, transformer, gpt.
Stars: ✭ 64 (-70.51%)
Mutual labels:  cnn, embeddings
Rnn Theano
使用Theano实现的一些RNN代码,包括最基本的RNN,LSTM,以及部分Attention模型,如论文MLSTM等
Stars: ✭ 31 (-85.71%)
Mutual labels:  classification, cnn
Transfer Learning Suite
Transfer Learning Suite in Keras. Perform transfer learning using any built-in Keras image classification model easily!
Stars: ✭ 212 (-2.3%)
Mutual labels:  classification, cnn
Deep Music Genre Classification
🎵 Using Deep Learning to Categorize Music as Time Progresses Through Spectrogram Analysis
Stars: ✭ 23 (-89.4%)
Mutual labels:  classification, cnn
Servenet
Service Classification based on Service Description
Stars: ✭ 21 (-90.32%)
Mutual labels:  classification, cnn
Fastrtext
R wrapper for fastText
Stars: ✭ 103 (-52.53%)
Mutual labels:  classification, embeddings
Humpback Whale Identification 1st
https://www.kaggle.com/c/humpback-whale-identification
Stars: ✭ 591 (+172.35%)
Mutual labels:  classification, metric-learning
Model Quantization
Collections of model quantization algorithms
Stars: ✭ 118 (-45.62%)
Mutual labels:  classification, cnn
Keras transfer cifar10
Object classification with CIFAR-10 using transfer learning
Stars: ✭ 120 (-44.7%)
Mutual labels:  classification, cnn
Keras Vgg16 Places365
Keras code and weights files for the VGG16-places365 and VGG16-hybrid1365 CNNs for scene classification
Stars: ✭ 138 (-36.41%)
Mutual labels:  cnn, embeddings
Cnn 3d Images Tensorflow
3D image classification using CNN (Convolutional Neural Network)
Stars: ✭ 199 (-8.29%)
Mutual labels:  classification, cnn
Tensorflow cookbook
Code for Tensorflow Machine Learning Cookbook
Stars: ✭ 5,984 (+2657.6%)
Mutual labels:  classification, cnn
Cnn Question Classification Keras
Chinese Question Classifier (Keras Implementation) on BQuLD
Stars: ✭ 28 (-87.1%)
Mutual labels:  classification, cnn
Pytorchinsight
a pytorch lib with state-of-the-art architectures, pretrained models and real-time updated results
Stars: ✭ 713 (+228.57%)
Mutual labels:  classification, cnn
Graph 2d cnn
Code and data for the paper 'Classifying Graphs as Images with Convolutional Neural Networks' (new title: 'Graph Classification with 2D Convolutional Neural Networks')
Stars: ✭ 67 (-69.12%)
Mutual labels:  classification, embeddings
Food Recipe Cnn
food image to recipe with deep convolutional neural networks.
Stars: ✭ 448 (+106.45%)
Mutual labels:  classification, cnn
Multi Class Text Classification Cnn Rnn
Classify Kaggle San Francisco Crime Description into 39 classes. Build the model with CNN, RNN (GRU and LSTM) and Word Embeddings on Tensorflow.
Stars: ✭ 570 (+162.67%)
Mutual labels:  cnn, embeddings
Sytora
A sophisticated smart symptom search engine
Stars: ✭ 111 (-48.85%)
Mutual labels:  classification, embeddings
Mstar deeplearning project
Radar target classification, detection and recognition using deeplearning methods on MSTAR dataset
Stars: ✭ 163 (-24.88%)
Mutual labels:  classification, cnn

MagnetLoss-PyTorch

PyTorch implementation of the Magnet Loss for Deep Metric Learning, based on the following paper:

Table of Contents

Installation

The program requires the following dependencies (easy to install using pip, Ananconda or Docker):

  • python (tested on 2.7 and 3.6)
  • pytorch (tested with v0.3 and v0.3.1 with CUDA 8.0/9.0)
  • numpy
  • matplotlib
  • seaborn
  • pandas
  • tqdm
  • pillow
  • sklearn
  • scipy
  • visdom

Anaconda

Anaconda: Installation

To install MagnetLoss in an Anaconda environment:

(Python 2.7) conda env create -f pytorch-2p7-cuda80.yml
(Python 3.6) conda env create -f pytorch-3p6-cuda80.yml

To activate Anaconda environment:

(Python 2.7) source activate magnet-loss-py27-env
(Python 3.6) source activate magnet-loss-py36-env

Anaconda: Train

Train ConvNet with Magnet Loss on the local machine using MNIST dataset:

python magnet_loss_test.py --lr 1e-4 --batch-size 64 --mnist --magnet-loss

Docker GPU Training

Prerequisites:

  1. Docker installed on your machine. If you don't have Docker installed already, then go here to Docker Setup
  2. Install nvidia-docker 2.0 from Nvidia Docker 2.0
  3. Register nvidia runtime with the Docker engine using Nvidia Container Runtime

Docker: Build Image

docker build -t magnetloss .

Docker: Train

Deploy and train on Docker container:

docker run --rm -it --runtime=nvidia magnetloss python magnet_loss_test.py --lr 1e-4 --mnist --batch-size 64 --magnet-loss

or

./run_gpu_docker.sh magnetloss

Results

MNIST

Iterations Learned Embedding Space
0
2000
4000
6000
8000
10000
12000
14000

Citing MagnetLoss-PyTorch

If you use MagnetLoss-PyTorch in a scientific publication, I would appreciate references to the source code.

Biblatex entry:

@misc{MagnetLossPyTorch,
  author = {Thangarasa, Vithursan},
  title = {MagnetLoss-PyTorch},
  year = {2018},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/vithursant/MagnetLoss-PyTorch}}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].