Skip to content

Commit

Permalink
Merge branch 'master' of github.com:solrex/caffe-mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
solrex committed Feb 5, 2017
2 parents ff0372a + 173d0ba commit c91e9e3
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Caffe on Mobile Devices
==================

TODO
iOS/Android Caffe lib with demo APP (CPU_ONLY, NO_BACKWARD, NO_BOOST, NO_HDF5, NO_LEVELDB)

# For iPhone Simulator

## Step 1: Build Caffe-Mobile Lib with cmake&make
## Step 1: Build Caffe-Mobile Lib with cmake

```
$ git clone --recursive https://github.com/solrex/caffe-mobile.git
Expand All @@ -18,7 +18,7 @@ $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../third_party/ios-cmake/toolchain/iOS.cmake \
$ make -j 4
```

## Step 2: Build Example iOS App: CaffeSimple with Xcode
## Step 2: Build iOS App: CaffeSimple with Xcode

- For CaffeSimple to run, you need a pre-trained LeNet on MNIST caffe model and the weight file.
Follow the instructions in [Training LeNet on MNIST with Caffe](http://caffe.berkeleyvision.org/gathered/examples/mnist.html) to train your LeNet Model on MNIST. Then copy the model file `caffe/examples/mnist/lenet.prototxt` and the trained weight file `caffe/examples/mnist/lenet_iter_10000.caffemodel` to CaffeSimple app directory.
Expand All @@ -31,9 +31,8 @@ $ cp $CAFFE/examples/mnist/lenet_iter_10000.caffemodel $CAFFE_MOBILE/examples/io
- Load the Xcode project inside the `$CAFFE_MOBILE/examples/ios/simple/` folder, and press Command-R to build and run it on the simulator.

# For iPhone
==================

## Step 1: Build Caffe-Mobile Lib with cmake&make
## Step 1: Build Caffe-Mobile Lib with cmake

```
$ git clone --recursive https://github.com/solrex/caffe-mobile.git
Expand All @@ -46,7 +45,7 @@ $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../third_party/ios-cmake/toolchain/iOS.cmake \
$ make -j 4
```

## Step 2: Build Example iOS App: CaffeSimple with Xcode
## Step 2: Build iOS App: CaffeSimple with Xcode

- For CaffeSimple to run, you need a pre-trained LeNet on MNIST caffe model and the weight file.
Follow the instructions in [Training LeNet on MNIST with Caffe](http://caffe.berkeleyvision.org/gathered/examples/mnist.html) to train your LeNet Model on MNIST. Then copy the model file `caffe/examples/mnist/lenet.prototxt` and the trained weight file `caffe/examples/mnist/lenet_iter_10000.caffemodel` to CaffeSimple app directory.
Expand All @@ -58,34 +57,37 @@ $ cp $CAFFE/examples/mnist/lenet_iter_10000.caffemodel $CAFFE_MOBILE/examples/io

- Load the Xcode project inside the `$CAFFE_MOBILE/examples/ios/simple/` folder, and press Command-R to build and run it on your connected device.

# For OSX Check built
# For MacOSX & Ubuntu
==================

## Step 1: Build Caffe-Mobile Lib with cmake&make

### OSX 1: Use brew installed protobuf
## Step 1: Install dependency

```
$ brew install protobuf
$ cd build
$ cmake ..
$ make -j 4
$ brew install protobuf # MacOSX
$ sudo apt install libprotobuf-dev protobuf-compiler libatlas-dev # Ubuntu
```

### OSX 2: Use self built protobuf
## Step 2: Build Caffe-Mobile Lib with cmake

```
$ cd third_party
$ ./build-protobuf-3.1.0.sh
$ git clone --recursive https://github.com/solrex/caffe-mobile.git
$ mkdir build
$ cd ../build
$ cmake .. -DCMAKE_PREFIX_PATH=$PWD/../third_party/protobuf
$ cmake ..
$ make -j 4
```

## Step 2: Build Caffe-bin with cmake&make
## Step 3: Build Caffe-bin with cmake

```
$ brew install gflags
$ cmake .. -DCMAKE_PREFIX_PATH=$PWD/../third_party/protobuf -DTOOLS
$ cmake .. -DTOOLS
$ make -j 4
```

# Thanks

- Based on https://github.com/BVLC/caffe
- Inspired by https://github.com/chyh1990/caffe-compact
- Use https://github.com/Yangqing/ios-cmake
- Use https://gist.github.com/TyGuy/e814d23046772a98ae437270e8aaaf08

0 comments on commit c91e9e3

Please sign in to comment.