Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed a bug which is caused in the previous merge.
  • Loading branch information
niuzhiheng committed May 14, 2014
1 parent 4488dd8 commit 814de31
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 153 deletions.
152 changes: 37 additions & 115 deletions README.md
@@ -1,115 +1,37 @@
[Caffe: Convolutional Architecture for Fast Feature Extraction](http://caffe.berkeleyvision.org)

Created by [Yangqing Jia](http://daggerfs.com), UC Berkeley EECS department.
In active development by the Berkeley Vision and Learning Center ([BVLC](http://bvlc.eecs.berkeley.edu/)).

## Introduction

Caffe aims to provide computer vision scientists with a **clean, modifiable
implementation** of state-of-the-art deep learning algorithms. Network structure
is easily specified in separate config files, with no mess of hard-coded
parameters in the code. Python and Matlab wrappers are provided.

At the same time, Caffe fits industry needs, with blazing fast C++/Cuda code for
GPU computation. Caffe is currently the fastest GPU CNN implementation publicly
available, and is able to process more than **40 million images per day** on a
single NVIDIA K40 GPU (or 20 million per day on a K20)\*.

Caffe also provides **seamless switching between CPU and GPU**, which allows one
to train models with fast GPUs and then deploy them on non-GPU clusters with one
line of code: `Caffe::set_mode(Caffe::CPU)`.

Even in CPU mode, computing predictions on an image takes only 20 ms when images
are processed in batch mode.

* [Caffe introductory presentation](https://www.dropbox.com/s/10fx16yp5etb8dv/caffe-presentation.pdf)
* [Installation instructions](http://caffe.berkeleyvision.org/installation.html)

\* When measured with the [SuperVision](http://www.image-net.org/challenges/LSVRC/2012/supervision.pdf) model that won the ImageNet Large Scale Visual Recognition Challenge 2012.

## License

Caffe is BSD 2-Clause licensed (refer to the
[LICENSE](http://caffe.berkeleyvision.org/license.html) for details).

The pretrained models published by the BVLC, such as the
[Caffe reference ImageNet model](https://www.dropbox.com/s/n3jups0gr7uj0dv/caffe_reference_imagenet_model)
are licensed for academic research / non-commercial use only. However, Caffe is
a full toolkit for model training, so start brewing your own Caffe model today!

## Citing Caffe

Please kindly cite Caffe in your publications if it helps your research:

@misc{Jia13caffe,
Author = {Yangqing Jia},
Title = { {Caffe}: An Open Source Convolutional Architecture for Fast Feature Embedding},
Year = {2013},
Howpublished = {\url{http://caffe.berkeleyvision.org/}}
}

## Documentation

Tutorials and general documentation are written in Markdown format in the `docs/` folder.
While the format is quite easy to read directly, you may prefer to view the whole thing as a website.
To do so, simply run `jekyll serve -s docs` and view the documentation website at `http://0.0.0.0:4000` (to get [jekyll](http://jekyllrb.com/), you must have ruby and do `gem install jekyll`).

We strive to provide provide lots of usage examples, and to document all code in docstrings.
We'd appreciate your contribution to this effort!

## Development

Caffe is developed with active participation of the community by the [Berkeley Vision and Learning Center](http://bvlc.eecs.berkeley.edu/).
We welcome all contributions!

### The release cycle

- The `dev` branch is for new development, including community contributions. We aim to keep it in a functional state, but large changes may occur and things may get broken every now and then. Use this if you want the "bleeding edge".
- The `master` branch is handled by BVLC, which will integrate changes from `dev` on a roughly monthly schedule, giving it a release tag. Use this if you want more stability.

### Setting priorities

- Make GitHub Issues for bugs, features you'd like to see, questions, etc.
- Development work is guided by [milestones](https://github.com/BVLC/caffe/issues?milestone=1), which are sets of issues selected for concurrent release (integration from `dev` to `master`).
- Please note that since the core developers are largely researchers, we may work on a feature in isolation from the open-source community for some time before releasing it, so as to claim honest academic contribution. We do release it as soon as a reasonable technical report may be written about the work, and we still aim to inform the community of ongoing development through Issues.

### Contibuting

- Do new development in [feature branches](https://www.atlassian.com/git/workflows#!workflow-feature-branch) with descriptive names.
- Bring your work up-to-date by [rebasing](http://git-scm.com/book/en/Git-Branching-Rebasing) onto the latest `dev`. (Polish your changes by [interactive rebase](https://help.github.com/articles/interactive-rebase), if you'd like.)
- [Pull request](https://help.github.com/articles/using-pull-requests) your contribution to BVLC/caffe's `dev` branch for discussion and review.
* PRs should live fast, die young, and leave a beautiful merge. Pull request sooner than later so that discussion can guide development.
* Code must be accompanied by documentation and tests at all times.
* Only fast-forward merges will be accepted.

See our [development guidelines](http://caffe.berkeleyvision.org/development.html) for further details–the more closely these are followed, the sooner your work will be merged.

#### [Shelhamer's](https://github.com/shelhamer) “life of a branch in four acts”

Make the `feature` branch off of the latest `bvlc/dev`
```
git checkout dev
git pull upstream dev
git checkout -b feature
# do your work, make commits
```

Prepare to merge by rebasing your branch on the latest `bvlc/dev`
```
# make sure dev is fresh
git checkout dev
git pull upstream dev
# rebase your branch on the tip of dev
git checkout feature
git rebase dev
```

Push your branch to pull request it into `dev`
```
git push origin feature
# ...make pull request to dev...
```

Now make a pull request! You can do this from the command line (`git pull-request -b dev`) if you install [hub](https://github.com/github/hub).

The pull request of `feature` into `dev` will be a clean merge. Applause.
# Windows Installation
This is not the original [Caffe Readme](https://github.com/BVLC/caffe/blob/master/README.md) but an installation guide for windows version.

#### Want to run first before build by yourself?
You can download the windows x64 [standalone package](https://dl.dropboxusercontent.com/u/3466743/caffe-vs2012/standalone.7z) and run directly on MNIST dataset.

#### Prerequisites
You may need the followings to build the code:
- Windows 64-bit
- MS Visual Studio 2012
- CUDA toolkit 6.0
- Other dependencies which you can directly download from [here](http://dl.dropboxusercontent.com/u/3466743/caffe-vs2012/dependency-20140514.7z).

#### Build Steps
Currently it can be built by VS2012 for x64 flatform only. This is because the dependencies mentioned above is cross-compiled to support x64 only. If you want to build on 32bit windows, you need to rebuild your own 3rd-party libraries.
- Check out the code and switch to *windows* branch
- Download the dependency file and extract the folders inside to project root directory.
- Include any .cpp you want to build in the `./tools` directory to MainCaller.cpp.
- Open the solution file in `./build/MSVC`
- Switch build target to x64 platform (Both debug and release are OK).
- Build the code and you may find the `./bin/MainCaller.exe`

#### Train MNIST dataset
- Suppose you choose to build train_net.cpp which is the default one in MainCaller.cpp
- If you do not have GPU, please change it to CPU in `lenet_solver.prototxt`
- Goto directory `./examples/mnist`
- Double click `get_mnist_leveldb.bat` to download the dataset in leveldb format.
- Double click `train_lenet.bat` to see the training progress .

#### Known Issues
I have trained on ImageNet with this windows porting as well. And some Issues found are:
- Batch size of 256 exceeds the maximum block number for cuda on my GTX Titan. So using size of 200 is fine.
- The speed is much slower than the one build on Ubuntu. 20 iterations take 79s on Windows, whereas same number of iterations take about 30s on Ubuntu.

#### Bug Report
- Please create new issues in [github](https://github.com/niuzhiheng/caffe/issues) if you find any bug.
- If you have new pull requests, they are very welcome.
36 changes: 0 additions & 36 deletions docs/INSTALL.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/caffe/layers/image_data_layer.cpp
Expand Up @@ -249,7 +249,7 @@ void ImageDataLayer<Dtype>::CreatePrefetchThread() {
// Create the thread.
//CHECK(!pthread_create(&thread_, NULL, ImageDataLayerPrefetch<Dtype>,
// static_cast<void*>(this))) << "Pthread execution failed.";
thread_ = thread(DataLayerPrefetch<Dtype>,reinterpret_cast<void*>(this));
thread_ = thread(ImageDataLayerPrefetch<Dtype>,reinterpret_cast<void*>(this));
}

template <typename Dtype>
Expand Down
7 changes: 6 additions & 1 deletion src/caffe/layers/window_data_layer.cpp
Expand Up @@ -11,6 +11,7 @@
#include <map>
#include <fstream> // NOLINT(readability/streams)
#include <utility>
#include <math.h>

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
Expand All @@ -26,6 +27,10 @@ using std::string;
using std::map;
using std::pair;

double round(double r)
{
return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
}
// caffe.proto > LayerParameter > WindowDataParameter
// 'source' field specifies the window_file
// 'crop_size' indicates the desired warped size
Expand Down Expand Up @@ -422,7 +427,7 @@ void WindowDataLayer<Dtype>::CreatePrefetchThread() {
// Create the thread.
//CHECK(!pthread_create(&thread_, NULL, WindowDataLayerPrefetch<Dtype>,
// static_cast<void*>(this))) << "Pthread execution failed.";
thread_ = thread(DataLayerPrefetch<Dtype>,reinterpret_cast<void*>(this));
thread_ = thread(WindowDataLayerPrefetch<Dtype>,reinterpret_cast<void*>(this));
}

template <typename Dtype>
Expand Down

0 comments on commit 814de31

Please sign in to comment.