GithubHelp home page GithubHelp logo

pytorch-resnet's Introduction

pytorch-resnet

This repository contains codes for converting resnet50,101,152 trained in caffe to pytorch model.

First, you need to have pycaffe and pytorch. Secondly, you should download the caffe models from https://github.com/KaimingHe/deep-residual-networks. Put them in data folder.

Then,

python convert.py

or

python convert2.py

The models generated by convert.py expect different preprocessing than the other models in the PyTorch model zoo. Images should be in BGR format in the range [0, 255], and the following BGR values should then be subtracted from each pixel: [103.939, 116.779, 123.68].

The models generated by convert2.py expect RGB image ranging [0, 1]. You can use standard trn.Normalize([0.485, 0.456, 0.406],[0.229, 0.224, 0.225]).

Converted models (converted from convert.py, used in my pytorch-faster-rcnn repo)

resnet50-caffe: https://drive.google.com/open?id=0B7fNdx_jAqhtbllXbWxMVEdZclE

resnet101-caffe: https://drive.google.com/open?id=0B7fNdx_jAqhtaXZ4aWppWV96czg

resnet152-caffe: https://drive.google.com/open?id=0B7fNdx_jAqhtMXU1N0VTZkN1dHc

Converted models (converted from convert2.py, used in my neuraltalk2-pytorch repo)

resnet50: https://drive.google.com/uc?export=download&id=0B7fNdx_jAqhtam1MSTNSYXVYZ2s

resnet101: https://drive.google.com/uc?export=download&id=0B7fNdx_jAqhtSmdCNDVOVVdINWs

resnet152: https://drive.google.com/uc?export=download&id=0B7fNdx_jAqhtckNGQ2FLd25fa3c

Note

This model is different from what's in pytorch model zoo. Although you can actually load the parameters into the pytorch resnet, the strucuture of caffe resnet and torch resnet are slightly different. The structure is defined in the resnet.py. (The file is almost identical to what's in torchvision, with only some slight changes.)

Acknowledgement

A large part of the code is borrowed from https://github.com/ry/tensorflow-resnet

pytorch-resnet's People

Contributors

ruotianluo avatar

Watchers

James Cloos avatar Lily 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.