Coder Social home page Coder Social logo

qianzhang007 / fb.resnet.torch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookarchive/fb.resnet.torch

0.0 2.0 0.0 262 KB

Torch implementation of ResNet from and training scripts

License: Other

Lua 100.00%

fb.resnet.torch's Introduction

ResNet training in Torch

This implements training of residual networks from Deep Residual Learning for Image Recognition by Kaiming He, et. al.

We wrote a more verbose blog post discussing this code, and ResNets in general here.


See the installation instructions for a step-by-step guide.

If you already have Torch installed, update nn, cunn, and cudnn.


See the training recipes for addition examples.

The training scripts come with several options, which can be listed with the --help flag.

th main.lua --help

To run the training, simply run main.lua. By default, the script runs ResNet-34 on ImageNet with 1 GPU and 2 data-loader threads.

th main.lua -data [imagenet-folder with train and val folders]

To train ResNet-50 on 4 GPUs:

th main.lua -depth 50 -batchSize 256 -nGPU 4 -nThreads 8 -shareGradInput true -data [imagenet-folder]

Trained models

Trained ResNet 18, 34, 50, 101, 152, and 200 models are available for download. We include instructions for using a custom dataset, classifying an image and getting the model's top5 predictions, and for extracting image features using a pre-trained model.

The trained models achieve better error rates than the original ResNet models.

Single-crop (224x224) validation error rate

Network Top-1 error Top-5 error
ResNet-18 30.43 10.76
ResNet-34 26.73 8.74
ResNet-50 24.01 7.02
ResNet-101 22.44 6.21
ResNet-152 22.16 6.16
ResNet-200 21.66 5.79


This implementation differs from the ResNet paper in a few ways:

Scale augmentation: We use the scale and aspect ratio augmentation from Going Deeper with Convolutions, instead of scale augmentation used in the ResNet paper. We find this gives a better validation error.

Color augmentation: We use the photometric distortions from Andrew Howard in addition to the AlexNet-style color augmentation used in the ResNet paper.

Weight decay: We apply weight decay to all weights and biases instead of just the weights of the convolution layers.

Strided convolution: When using the bottleneck architecture, we use stride 2 in the 3x3 convolution, instead of the first 1x1 convolution.

fb.resnet.torch's People


arunmallya avatar aychang95 avatar colesbury avatar cubbee avatar cysu avatar ffmpbgrnn avatar iamaaditya avatar ltrottier avatar maraoz avatar soumith avatar szagoruyko avatar tornadomeet avatar


 avatar  avatar

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.