You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/installation.md
+9-7
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Caffe depends on several software packages.
18
18
*[CUDA](https://developer.nvidia.com/cuda-zone) library version 6.5 (recommended), 6.0, 5.5, or 5.0 and the latest driver version for CUDA 6 or 319.* for CUDA 5 (and NOT 331.*)
19
19
*[BLAS](http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) (provided via ATLAS, MKL, or OpenBLAS).
20
20
*[OpenCV](http://opencv.org/).
21
-
*[Boost](http://www.boost.org/) (>= 1.55, although only 1.55 is tested)
21
+
*[Boost](http://www.boost.org/) (>= 1.55, although only 1.55 and 1.56 are tested)
for req in $(cat requirements.txt); do sudo pip install $req; done
63
63
64
64
but we highly recommend first installing the [Anaconda](https://store.continuum.io/cshop/anaconda/) Python distribution, which provides most of the necessary packages, as well as the `hdf5` library dependency.
65
65
@@ -141,11 +141,13 @@ Do `brew edit opencv` and change the lines that look like the two lines below to
141
141
**NOTE**: We find that everything compiles successfully if `$LD_LIBRARY_PATH` is not set at all, and `$DYLD_FALLBACK_LIBRARY_PATH` is set to to provide CUDA, Python, and other relevant libraries (e.g. `/usr/local/cuda/lib:$HOME/anaconda/lib:/usr/local/lib:/usr/lib`).
142
142
In other `ENV` settings, things may not work as expected.
143
143
144
+
**NOTE**: There is currently a conflict between boost 1.56 and CUDA in some configurations. Check the [conflict description](https://github.com/BVLC/caffe/issues/1193#issuecomment-57491906) and try downgrading to 1.55.
**Note** that Homebrew maintains itself as a separate git repository and making the above `brew edit FORMULA` changes will change files in your local copy of homebrew's master branch. By default, this will prevent you from updating Homebrew using `brew update`, as you will get an error message like the following:
Copy file name to clipboardexpand all lines: docs/tutorial/net_layer_blob.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Note that although we have designed blobs with its dimensions corresponding to i
26
26
27
27
Caffe operations are general with respect to the channel dimension / K. Grayscale and hyperspectral imagery are fine. Caffe can likewise model and process arbitrary vectors in blobs with singleton. That is, the shape of blob holding 1000 vectors of 16 feature dimensions is 1000 x 16 x 1 x 1.
28
28
29
-
Parameter blob dimensions vary according to the type and configuration of the layer. For a convolution layer with 96 filters of 11 x 11 spatial dimension and 3 inputs the blob is 96 x 3 x 11 x 11. For an inner product / fully-connected layer with 1000 output channels and 1024 input channels the parameter blob is 1 x 1 x 1000 x 4096.
29
+
Parameter blob dimensions vary according to the type and configuration of the layer. For a convolution layer with 96 filters of 11 x 11 spatial dimension and 3 inputs the blob is 96 x 3 x 11 x 11. For an inner product / fully-connected layer with 1000 output channels and 1024 input channels the parameter blob is 1 x 1 x 1000 x 1024.
30
30
31
31
For custom data it may be necessary to hack your own input preparation tool or data layer. However once your data is in your job is done. The modularity of layers accomplishes the rest of the work for you.
32
32
@@ -85,7 +85,7 @@ Developing custom layers requires minimal effort by the compositionality of the
85
85
86
86
The net jointly defines a function and its gradient by composition and auto-differentiation. The composition of every layer's output computes the function to do a given task, and the composition of every layer's backward computes the gradient from the loss to learn the task. Caffe models are end-to-end machine learning engines.
87
87
88
-
The net is a set of layers connected in a computation graph -- a DAG / directed acyclic graph to be exact. Caffe does all the bookkeeping for any DAG of layers to ensure correctness of the forward and backward passes. A typical net begins with a data layer that loads from disk and ends with a loss layer that computes the objective for a task such as classification or reconstruction.
88
+
The net is a set of layers connected in a computation graph -- a directed acyclic graph (DAG) to be exact. Caffe does all the bookkeeping for any DAG of layers to ensure correctness of the forward and backward passes. A typical net begins with a data layer that loads from disk and ends with a loss layer that computes the objective for a task such as classification or reconstruction.
89
89
90
90
The net is defined as a set of layers and their connections in a plaintext modeling language.
Copy file name to clipboardexpand all lines: examples/finetune_flickr_style/readme.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -13,14 +13,14 @@ Let's fine-tune the BVLC-distributed CaffeNet model on a different dataset, [Fli
13
13
14
14
## Explanation
15
15
16
-
The Flickr-sourced images of the Style dataset are visually very similar to the ImageNet dataset, on which the `caffe_reference_imagenet_model` was trained.
16
+
The Flickr-sourced images of the Style dataset are visually very similar to the ImageNet dataset, on which the `bvlc_reference_caffenet` was trained.
17
17
Since that model works well for object category classification, we'd like to use it architecture for our style classifier.
18
18
We also only have 80,000 images to train on, so we'd like to start with the parameters learned on the 1,000,000 ImageNet images, and fine-tune as needed.
19
19
If we give provide the `weights` argument to the `caffe train` command, the pretrained weights will be loaded into our model, matching layers by name.
20
20
21
21
Because we are predicting 20 classes instead of a 1,000, we do need to change the last layer in the model.
22
22
Therefore, we change the name of the last layer from `fc8` to `fc8_flickr` in our prototxt.
23
-
Since there is no layer named that in the `caffe_reference_imagenet_model`, that layer will begin training with random weights.
23
+
Since there is no layer named that in the `bvlc_reference_caffenet`, that layer will begin training with random weights.
24
24
25
25
We will also decrease the overall learning rate `base_lr` in the solver prototxt, but boost the `blobs_lr` on the newly introduced layer.
26
26
The idea is to have the rest of the model change very slowly with new data, but let the new layer learn fast.
@@ -34,7 +34,7 @@ All steps are to be done from the caffe root directory.
34
34
The dataset is distributed as a list of URLs with corresponding labels.
35
35
Using a script, we will download a small subset of the data and split it into train and val sets.
Writing train/val for 1939 successfully downloaded images.
54
54
55
55
This script downloads images and writes train/val file lists into `data/flickr_style`.
56
-
With this random seed there are 1,557 train images and 382 test images.
57
56
The prototxts in this example assume this, and also assume the presence of the ImageNet mean file (run `get_ilsvrc_aux.sh` from `data/ilsvrc12` to obtain this if you haven't yet).
58
57
59
58
We'll also need the ImageNet-trained model, which you can obtain by running `./scripts/download_model_binary.py models/bvlc_reference_caffenet`.
@@ -106,7 +105,8 @@ Now we can train! (You can fine-tune in CPU mode by leaving out the `-gpu` flag.
106
105
I0828 22:23:17.438894 11510 solver.cpp:302] Test net output #0: accuracy = 0.2356
107
106
108
107
Note how rapidly the loss went down. Although the 23.5% accuracy is only modest, it was achieved in only 1000, and evidence that the model is starting to learn quickly and well.
109
-
Once the model is fully fine-tuned on the whole training set over 100,000 iterations the final validation accuracy is 91.64%. This takes ~7 hours in Caffe on a K40 GPU.
108
+
Once the model is fully fine-tuned on the whole training set over 100,000 iterations the final validation accuracy is 39.16%.
109
+
This takes ~7 hours in Caffe on a K40 GPU.
110
110
111
111
For comparison, here is how the loss goes down when we do not start with a pre-trained model:
112
112
@@ -155,7 +155,7 @@ Now try fine-tuning to your own tasks and data!
155
155
156
156
## Trained model
157
157
158
-
We provide a model trained on all 80K images, with final accuracy of 98%.
158
+
We provide a model trained on all 80K images, with final accuracy of 39%.
159
159
Simply do `./scripts/download_model_binary.py models/finetune_flickr_style` to obtain it.
Copy file name to clipboardexpand all lines: examples/mnist/readme.md
+8-9
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,22 @@
1
1
---
2
-
title: MNIST Tutorial
3
-
description: Train and test "LeNet" on MNIST data.
2
+
title: LeNet MNIST Tutorial
3
+
description: Train and test "LeNet" on the MNIST handwritten digit data.
4
4
category: example
5
5
include_in_docs: true
6
6
priority: 1
7
7
---
8
8
9
-
# Training MNIST with Caffe
9
+
# Training LeNet on MNIST with Caffe
10
10
11
11
We will assume that you have Caffe successfully compiled. If not, please refer to the [Installation page](/installation.html). In this tutorial, we will assume that your Caffe installation is located at `CAFFE_ROOT`.
12
12
13
13
## Prepare Datasets
14
14
15
15
You will first need to download and convert the data format from the MNIST website. To do this, simply run the following commands:
16
16
17
-
cd $CAFFE_ROOT/data/mnist
18
-
./get_mnist.sh
19
-
cd $CAFFE_ROOT/examples/mnist
20
-
./create_mnist.sh
17
+
cd $CAFFE_ROOT
18
+
./data/mnist/get_mnist.sh
19
+
./examples/mnist/create_mnist.sh
21
20
22
21
If it complains that `wget` or `gunzip` are not installed, you need to install them respectively. After running the script there should be two datasets, `mnist_train_lmdb`, and `mnist_test_lmdb`.
23
22
@@ -228,8 +227,8 @@ Check out the comments explaining each line in the prototxt `$CAFFE_ROOT/example
228
227
229
228
Training the model is simple after you have written the network definition protobuf and solver protobuf files. Simply run `train_lenet.sh`, or the following command directly:
230
229
231
-
cd $CAFFE_ROOT/examples/mnist
232
-
./train_lenet.sh
230
+
cd $CAFFE_ROOT
231
+
./examples/mnist/train_lenet.sh
233
232
234
233
`train_lenet.sh` is a simple script, but here is a quick explanation: the main tool for training is `caffe` with action `train` and the solver protobuf text file as its argument.
0 commit comments