All Projects → wy1iu → Spherenet

wy1iu / Spherenet

Licence: mit
Implementation for <Deep Hyperspherical Learning> in NIPS'17.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Spherenet

Learning2run
Our NIPS 2017: Learning to Run source code
Stars: ✭ 57 (-48.65%)
Mutual labels:  nips-2017
Factorized Bilinear Network
FBN: Factorized Bilinear Models for Image Recognition (ICCV 2017)
Stars: ✭ 66 (-40.54%)
Mutual labels:  image-recognition
Uploadcare Php
PHP API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
Stars: ✭ 77 (-30.63%)
Mutual labels:  image-recognition
Imago
Optical position recognition for the game of Go
Stars: ✭ 59 (-46.85%)
Mutual labels:  image-recognition
Pneumonia Detection From Chest X Ray Images With Deep Learning
Detecting Pneumonia in Chest X-ray Images using Convolutional Neural Network and Pretrained Models
Stars: ✭ 64 (-42.34%)
Mutual labels:  image-recognition
Cogalg
This project is a Computer Vision implementation of general hierarchical pattern discovery principles introduced in README
Stars: ✭ 68 (-38.74%)
Mutual labels:  image-recognition
Image recognition
Packages for image recognition - Robocup TU/e Robotics
Stars: ✭ 53 (-52.25%)
Mutual labels:  image-recognition
Coremldemo
A simple demo for Core ML
Stars: ✭ 90 (-18.92%)
Mutual labels:  image-recognition
Fastai deeplearn part1
Notes for Fastai Deep Learning Course
Stars: ✭ 1,135 (+922.52%)
Mutual labels:  image-recognition
Ntp
End-to-End Differentiable Proving
Stars: ✭ 74 (-33.33%)
Mutual labels:  nips-2017
People Counter Python
Create a smart video application using the Intel Distribution of OpenVINO toolkit. The toolkit uses models and inference to run single-class object detection.
Stars: ✭ 62 (-44.14%)
Mutual labels:  image-recognition
Mean Teacher
A state-of-the-art semi-supervised method for image recognition
Stars: ✭ 1,130 (+918.02%)
Mutual labels:  nips-2017
Datecastle
图像识别与推荐系统两类
Stars: ✭ 69 (-37.84%)
Mutual labels:  image-recognition
Rostensorflow
TensorFlow ImageNet demo using ROS sensor_msgs/Image
Stars: ✭ 59 (-46.85%)
Mutual labels:  image-recognition
Run Skeleton Run
Reason8.ai PyTorch solution for NIPS RL 2017 challenge
Stars: ✭ 83 (-25.23%)
Mutual labels:  nips-2017
Biglittlenet
Official repository for Big-Little Net
Stars: ✭ 57 (-48.65%)
Mutual labels:  image-recognition
Alphacsc
Convolution dictionary learning for time-series
Stars: ✭ 66 (-40.54%)
Mutual labels:  nips-2017
Sod
An Embedded Computer Vision & Machine Learning Library (CPU Optimized & IoT Capable)
Stars: ✭ 1,460 (+1215.32%)
Mutual labels:  image-recognition
Half Size
Code for "Effective Dimensionality Reduction for Word Embeddings".
Stars: ✭ 89 (-19.82%)
Mutual labels:  nips-2017
Group Sparsity Sbp
Structured Bayesian Pruning, NIPS 2017
Stars: ✭ 72 (-35.14%)
Mutual labels:  nips-2017

Deep Hyperspherical Learning

By Weiyang Liu, Yan-Ming Zhang, Xingguo Li, Zhiding Yu, Bo Dai, Tuo Zhao, Le Song

License

SphereNet is released under the MIT License (refer to the LICENSE file for details).

Updates

  • [x] SphereNet: a neural network that learns on hyperspheres
  • [x] SphereResNet: an adaptation of SphereConv to residual networks

Contents

  1. Introduction
  2. Citation
  3. Requirements
  4. Usage
  5. Results
  6. Notes
  7. Third-party re-implementation
  8. Contact

Introduction

The repository contains an example Tensorflow implementation for SphereNets. SphereNets are introduced in the NIPS 2017 paper "Deep Hyperspherical Learning" (arXiv). SphereNets are able to converge faster and more stably than its CNN counterparts, while yielding to comparable or even better classification accuracy.

Hyperspherical learning is inspired by an interesting obvervation of the 2D Fourier transform. From the image below, we could see that magnitude information is not crucial for recognizing the identity, but phase information is very important for recognition. By droping the magnitude information, SphereNets can reduce the learning space and therefore gain more convergence speed. Hypersphereical learning provides a new framework to improve the convolutional neural networks.

The features learned by SphereNets are also very interesting. The 2D features of SphereNets learned on MNIST are more compact and have larger margin between classes. From the image below, we can see that local behavior of convolutions could lead to dramatic difference in final features, even if they are supervised by the same standard softmax loss. Hypersphereical learning provides a new perspective to think about convolutions and deep feature learning.

Besides, the hyperspherical learning also leads to a well-performing normalization technique, SphereNorm. SphereNorm basically can be viewed as SphereConv operator in our implementation.

Citation

If you find our work useful in your research, please consider to cite:

@inproceedings{liu2017deep,
    title={Deep Hyperspherical Learning},
    author={Liu, Weiyang and Zhang, Yan-Ming and Li, Xingguo and Yu, Zhiding and Dai, Bo and Zhao, Tuo and Song, Le},
    booktitle={Advances in Neural Information Processing Systems},
    pages={3953--3963},
    year={2017}
}

Requirements

  1. Python 2.7
  2. TensorFlow (Tested on version 1.01)
  3. numpy

Usage

Part 1: Setup

  • Clone the repositary and download the training set.

    git clone https://github.com/wy1iu/SphereNet.git
    cd SphereNet
    ./dataset_setup.sh
    

Part 2: Train Baseline/SphereNets

  • We use '$SPHERENET_ROOT' to denote the directory path of this repository.

  • To train the baseline model, please open $SPHERENET_ROOT/baseline/train_baseline.py and assign an available GPU. The default hyperparameters are exactly the same with SphereNets.

    cd $SPHERENET_ROOT/baseline
    python train_baseline.py
    
  • To train the SphereNet, please open $SPHERENET_ROOT/train_spherenet.py and assign an available GPU.

    cd $SPHERENET_ROOT
    python train_spherenet.py
    

Part 3: Train Baseline/SphereResNets

  • We use '$SPHERENET_ROOT' to denote the directory path of this repository.

  • To train the baseline ResNet-32 model, please open $SPHERENET_ROOT/sphere_resnet/baseline/train_baseline.py and assign an available GPU. The default hyperparameters are exactly the same with SphereNets.

    cd $SPHERENET_ROOT/sphere_resnet/baseline
    python train_baseline.py
    
  • To train the SphereResNet-32 (the default setting is Linear SphereConv with the standard softmax loss), please open $SPHERENET_ROOT/sphere_resnet/train_sphere_resnet.py and assign an available GPU.

    cd $SPHERENET_ROOT/sphere_resnet
    python train_sphere_resnet.py
    

Configuration

The default setting of SphereNet is Cosine SphereConv + Standard Softmax Loss. To change the type of SphereConv, please open the spherenet.py and change the norm variable.

  • If norm is set to none, then the network will use original convolution and become standard CNN.
  • If norm is set to linear, then the SphereNet will use linear SphereConv.
  • If norm is set to cosine, then the SphereNet will use cosine SphereConv.
  • If norm is set to sigmoid, then the SphereNet will use sigmoid SphereConv.
  • If norm is set to lr_sigmoid, then the SphereNet will use learnable sigmoid SphereConv.

The w_norm variable can also be changed similarly in order to use the weight-normalized softmax loss (combined with different SphereConv). By setting w_norm to none, we will use the standard softmax loss.

There are some examples of setting these two variables provided in the examples/ foloder.

Results

Part 1: Convergence

The convergence curves for baseline CNN and several types of SphereNets are given as follows.

Part 2: Best testing accuracy on CIFAR-10 (SphereNet-9)

  • Baseline (standard CNN with standard softmax loss): 90.86%
  • SphereNet with cosine SphereConv and standard softmax loss: 91.31%
  • SphereNet with linear SphereConv and standard softmax loss: 91.65%
  • SphereNet with sigmoid SphereConv and standard softmax loss: 91.81%
  • SphereNet with learnable sigmoid SphereConv and standard softmax loss: 91.66%
  • SphereNet with cosine SphereConv and weight-normalized softmax loss: 91.44%

Part 3: Best testing accuracy on CIFAR-10+ (SphereResNet-32)

  • Baseline (standard ResNet-32 with standard softmax loss): 93.09%
  • SphereResNet-32 with linear SphereConv and standard softmax loss: 94.68%

Part 4: Training log (SphereNet-9)

  • Baseline: here
  • SphereNet with cosine SphereConv and standard softmax loss: here.
  • SphereNet with linear SphereConv and standard softmax loss: here.
  • SphereNet with sigmoid SphereConv and standard softmax loss: here.
  • SphereNet with learnable sigmoid SphereConv and standard softmax loss: here.
  • SphereNet with cosine SphereConv and weight-normalized softmax loss: here.

Part 5: Training log (SphereResNet-32)

  • Baseline: here
  • SphereResNet-32 with linear SphereConv and standard softmax loss: here.

Notes

  • Empirically, SphereNets have more accuracy gain with larger filter number. If the filter number is very small, SphereNets may yield slightly worse accuracy but can still achieve much faster convergence.
  • SphereConv may be useful for RNNs and deep Q-learning where better convergence can help.
  • By adding rescaling factors to SphereConv and make them learnable in order for the SphereNorm to degrade to the original convolution, we present a new normalization technique, SphereNorm. SphereNorm does not contradict with the BatchNorm, and can be used either with or without BatchNorm
  • We also developed an improved SphereNet in our latest CVPR 2018 paper, which works better than this version. The paper and code will be released soon.

Third-party re-implementation

Contact

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].