Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
37df819
SpatialDropout
Jun 9, 2016
4a5aae7
tweaking~
Jun 9, 2016
1f94e02
for nv-model
Jun 9, 2016
188bf97
tweaking~
Jun 10, 2016
9f38818
tweaking~
Jun 13, 2016
8c59d9a
tweaking~
Jun 14, 2016
9ef1860
tweaking~
Jun 14, 2016
ab1c571
test
Jun 14, 2016
aecfaf9
test
Jun 14, 2016
9bcc87c
test
Jun 14, 2016
7712e4c
test
Jun 17, 2016
e645528
suport official batchnorm
Jun 17, 2016
f2c4282
test
Jun 17, 2016
cecfdd6
Delete test1.lua
zhanghang1989 Jun 20, 2016
42fddee
converter
Jun 20, 2016
fdfe3b3
coverter
Jun 20, 2016
692d57e
Create README.md
zhanghang1989 Jun 20, 2016
681f2ef
Create install-dep.sh
zhanghang1989 Jun 20, 2016
339a614
Update README.md
zhanghang1989 Jun 20, 2016
cdbf16a
Delete CONTRIBUTING.md
zhanghang1989 Jun 20, 2016
78c5088
Update README.md
zhanghang1989 Jun 20, 2016
7d965f4
Update README.md
zhanghang1989 Jun 20, 2016
61b7366
Delete prep.lua
zhanghang1989 Jun 20, 2016
330987a
Update README.md
zhanghang1989 Jun 20, 2016
17bc441
Update README.md
zhanghang1989 Jun 20, 2016
aa2c50d
Update README.md
zhanghang1989 Jun 21, 2016
8753dfb
Update convert.lua
zhanghang1989 Jul 5, 2016
160af7c
Rename install-dep.sh to install-dep-14.04.sh
zhanghang1989 Jul 11, 2016
38c477a
Create install-dep-16.04.sh
zhanghang1989 Jul 14, 2016
0c6e395
Update README.md
zhanghang1989 Jul 14, 2016
58e3482
Update install-dep-16.04.sh
zhanghang1989 Jul 14, 2016
427aed3
converter
Jul 15, 2016
7da8cdf
Merge branch 'mydev' of https://github.com/zhanghang1989/fb-caffe-ext…
Jul 15, 2016
e451ac8
defaults
Jul 15, 2016
81d0af1
verify
Jul 15, 2016
60c0104
dependencies
Jul 15, 2016
013fa39
dependencies
Jul 15, 2016
39c0760
avoid stupid changes
zhanghang1989 Aug 9, 2016
f6729dd
convert all
zhanghang1989 Aug 10, 2016
9c21a04
Update install-dep-16.04.sh
zhanghang1989 Aug 16, 2016
998d5d1
some script
Aug 16, 2016
0935cd5
Merge branch 'mydev' of https://github.com/zhanghang1989/fb-caffe-ext…
Aug 16, 2016
7993aaa
Update install-dep-16.04.sh
zhanghang1989 Aug 22, 2016
f79fae9
temporary solution
zhanghang1989 Aug 25, 2016
ad53f38
default size
zhanghang1989 Feb 21, 2017
7a8cbf5
default size
zhanghang1989 Feb 21, 2017
31c7b21
stop maintaining
zhanghang1989 Apr 28, 2017
56a5c2d
Update README.md
zhanghang1989 May 3, 2017
0ee0431
stop maintaining
zhanghang1989 May 3, 2017
e691336
Update README.md
zhanghang1989 May 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
torch2caffe/*.pyc
*.t7b
*.caffemodel
*.prototxt
*.csv

42 changes: 0 additions & 42 deletions CONTRIBUTING.md

This file was deleted.

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Torch to Caffe Model Converter
(forked from [Cysu's branch](https://github.com/Cysu/fb-caffe-exts), originally from [fb-caffe-exts](https://github.com/facebook/fb-caffe-exts))

:x: **I have stopped maintaining this repo. If you still want to use the converter, please use the AWS option:**

The easiest option is to launch an AWS EC2 g2.2xlarge instance I created. Choose N.California Sever and search for the instance name of FB-Torch2Caffe (ami-03542e63). [You can follow the [AWS tutorial](http://cs231n.github.io/aws-tutorial/)]

### Get Started

0. Please make sure Torch and Caffe (with pycaffe and python layer) are correctly installed.
0. Download the code and install the dependencies (:x: **If you still would like to set it up on you own workstation, please follow the steps here to install dependencies ([fbcunn/install](https://github.com/facebook/fbcunn/blob/master/INSTALL.md)). Good luck!**)

```bash
git clone https://github.com/zhanghang1989/fb-caffe-exts.git
sudo bash install-dep.sh
```

0. Add Environment Variables (Change the path for your own machine)

```bash
echo "export LD_PRELOAD=/path/to/libcaffe.so; export PYTHONPATH=$PYTHONPATH:/path/to/caffe/python/:/path/to/fb-caffe-exts/;" >>~/.bashrc && source ~/.bashrc
source ~/.bashrc
```

0. Convert your first model:

```bash
th convert.lua torch_model.t7b
```

0. Or custormize the conversion:

```bash
th torch2caffe/torch2caffe.lua --input torch_model.t7b --preprocessing prepnv.lua --prototxt name.prototxt --caffemodel name.caffemodel --input_dims 1 3 224 224
```

### The Layers We Added Support
0. ``ELU``
0. ``SpatialDropout`` We scale the weights of previous layers by (1-p) to hide the difference between torch and caffe.
0. ``SpatialMaxPooling`` It has slightly different behaviours in Torch and Caffe. Torch uses floor(n/s+1) and Caffe uses floor(n/s). Therefore, only the conversion of even featuremap size is supported.
0. ``SpatialBatchNormalization`` Caffe BatchNorm doesn't have bias. We only support non-affine BN. Alternatively, you can convert it into a customized version of BN as in [Cysu's branch](https://github.com/Cysu/fb-caffe-exts).

### Known Issues
0. ``LD_PRELOAD`` crashes your gedit (If you know how to fix it, please update this wiki.)
0. The opencv package that Caffe relies on may cause the error of "libdc1394" failed to initialize, just create a fake device:
```bash
sudo ln /dev/null /dev/raw1394
```

126 changes: 0 additions & 126 deletions README.org

This file was deleted.

3 changes: 3 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rm *.caffemodel
rm *.prototxt
rm *t7b
Loading