|
18 | 18 |
|
19 | 19 | # Commandline usage |
20 | 20 |
|
| 21 | +## Training |
| 22 | + |
| 23 | +Use `train` to run training. |
| 24 | + |
21 | 25 | * Syntax is based on that specified in Ciresan et al's [Multi-column Deep Neural Networks for Image Classification](http://arxiv.org/pdf/1202.2745.pdf), section 3, first paragraph: |
22 | 26 | * network is defined by a string like: `100C5-MP2-100C5-MP2-100C4-MP2-300N-100N-6N` |
23 | 27 | * `100c5` means: a convolutional layer, with 100 filters, each 5x5 |
|
28 | 32 | * `tanh` means a tanh layer |
29 | 33 | * Thus, you can do, for example: |
30 | 34 | ```bash |
31 | | -./deepclrun netdef=8c5z-relu-mp2-16c5z-relu-mp3-150n-tanh-10n learningrate=0.002 dataset=mnist |
| 35 | +./train netdef=8c5z-relu-mp2-16c5z-relu-mp3-150n-tanh-10n learningrate=0.002 dataset=mnist |
32 | 36 | ``` |
33 | 37 | ... in order to learn mnist, using the same neural net architecture as used in the [convnetjs mnist demo](http://cs.stanford.edu/people/karpathy/convnetjs/demo/mnist.html) |
34 | 38 | * Similarly, you can learn NORB, using approximately the architecture specified in [lecun-04](http://yann.lecun.com/exdb/publis/pdf/lecun-04.pdf), by doing: |
35 | 39 | ```bash |
36 | | -./deepclrun netdef=8c5-relu-mp4-24c6-relu-mp3-80c6-relu-5n learningrate=0.0001 dataset=norb |
| 40 | +./train netdef=8c5-relu-mp4-24c6-relu-mp3-80c6-relu-5n learningrate=0.0001 dataset=norb |
37 | 41 | ``` |
38 | 42 | * Or, you can train NORB using the very deep, broad architecture specified by Ciresan et al in [Flexible, High Performance Convolutional Neural Networks for Image Classification](http://ijcai.org/papers11/Papers/IJCAI11-210.pdf): |
39 | 43 | ```bash |
40 | | -./deepclrun netdef=MP3-300C6-RELU-MP2-500C4-RELU-MP4-500N-TANH-5N learningrate=0.0001 dataset=norb |
| 44 | +./train netdef=MP3-300C6-RELU-MP2-500C4-RELU-MP4-500N-TANH-5N learningrate=0.0001 dataset=norb |
41 | 45 | ``` |
42 | 46 |
|
43 | | -## Convolutional |
| 47 | +### Convolutional |
44 | 48 |
|
45 | 49 | * eg `-32c5` is a convolutional layer with 32 filters of 5x5 |
46 | 50 | * `-32c5z` is a convolutional layer with zero-padding, of 32 filters of 5x5 |
47 | 51 |
|
48 | | -## Fully-connected |
| 52 | +### Fully-connected |
49 | 53 |
|
50 | 54 | * eg `-150n` is a fully connected layer, with 150 neurons. |
51 | 55 |
|
52 | | -## Max-pooling |
| 56 | +### Max-pooling |
53 | 57 |
|
54 | 58 | * Eg `-mp3` will add a max-pooling layer, over 3x3 non-overlapping regions. The number is the size of the regions, and can be modified |
55 | 59 |
|
56 | | -## Dropout layers |
| 60 | +### Dropout layers |
57 | 61 |
|
58 | 62 | * Simply add `-drop` into the netdef string |
59 | 63 | * this will use a dropout ratio of 0.5 |
60 | 64 |
|
61 | | -## Activation layers |
| 65 | +### Activation layers |
62 | 66 |
|
63 | 67 | * Simply add any of the following into the netdef string: |
64 | 68 | * `-tanh` |
65 | 69 | * `-sigmoid` |
66 | 70 | * `-relu` |
67 | 71 |
|
68 | | -### Random patches |
| 72 | +#### Random patches |
69 | 73 |
|
70 | 74 | * `RP24` means a random patch layer, which will cut a 24x24 patch from a random position in each incoming image, and send that to its output |
71 | 75 | * during testing, the patch will be cut from the centre of each image |
72 | 76 |
|
73 | | -### Random translations |
| 77 | +#### Random translations |
74 | 78 |
|
75 | 79 | * `RT2` means a random translations layer, which will translate the image randomly during training, up to 2 pixels, in either direction, along both axes |
76 | 80 | * Can specify any non-negative integer, less than the image size |
77 | 81 | * During testing, no translation is done |
78 | 82 |
|
79 | | -## Multi-column deep neural network "MultiNet" |
| 83 | +### Multi-column deep neural network "MultiNet" |
80 | 84 |
|
81 | 85 | * You can train several neural networks at the same time, and predict using the average output across all of them using the `multinet` option |
82 | 86 | * Simply add eg `multinet=3` in the commandline, to train across 3 nets in parallel, or put a number of your choice |
83 | 87 |
|
84 | | -## Repeated layers |
| 88 | +### Repeated layers |
85 | 89 |
|
86 | 90 | * simply prefix a layer with eg `3*` to repeat it. `3*` will repeat the layer 3 times, and similar for other numbers, eg: |
87 | 91 | ``` |
88 | | -./deepclrun netdef=6*(32c5z-relu)-500n-361n learningrate=0.0001 dataset=kgsgoall |
| 92 | +./train netdef=6*(32c5z-relu)-500n-361n learningrate=0.0001 dataset=kgsgoall |
89 | 93 | ``` |
90 | 94 | ... will create 6 convolutional layers of 32 5x5 filters each. |
91 | 95 | * you can also use parentheses `(...)` to repeat multiple layers, eg: |
92 | 96 | ``` |
93 | | -./deepclrun netdef=3*(32c5z-relu-mp2)-150n-10n |
| 97 | +./train netdef=3*(32c5z-relu-mp2)-150n-10n |
94 | 98 | ``` |
95 | 99 | ... will be expanded to: |
96 | 100 | ``` |
97 | | -./deepclrun netdef=32c5z-relu-mp2-32c5z-relu-mp2-32c5z-relu-mp2-150n-10n |
| 101 | +./train netdef=32c5z-relu-mp2-32c5z-relu-mp2-32c5z-relu-mp2-150n-10n |
98 | 102 | ``` |
99 | 103 |
|
100 | | -## File types |
| 104 | +### File types |
101 | 105 |
|
102 | 106 | * Simply pass in the filename of the data file with the images in |
103 | 107 | * Filetype will be detected automatically |
104 | 108 | * See [Loaders](loaders.md) for information on available loaders |
105 | 109 |
|
106 | | -## Weight persistence |
| 110 | +### Weight persistence |
107 | 111 |
|
108 | 112 | * By default, weights will be written to `weights.dat`, after each epoch |
109 | 113 | * You can add option `writeweightsinterval=5` to write weights every 5 minutes, even if the epoch hasnt finished yet. Just replace `5` with the number of minutes between each write |
|
113 | 117 | * Epoch number, batch number, batch loss, and batch numcorrect will all be loaded from where they left off, from the weights file, so you can freely stop and start training, without losing the training |
114 | 118 | * be sure to use the `writeweightsinterval=5` option if you are going to stop/start often, with long epochs, to avoid losing hours/days of training! |
115 | 119 |
|
116 | | -## Command-line options |
| 120 | +### Command-line options |
117 | 121 |
|
118 | 122 | | Option | Description | |
119 | 123 | |----|----| |
|
145 | 149 | | writeweightsinterval=5 | write the weights to file every 5 minutes of training, even if epoch hasnt finished yet. Default is 0, ie only write weights after each epoch | |
146 | 150 | | loadweights=1 | load weights at start, from weightsfile. Current training config, ie netdef and trainingfile, should match that used to create the weightsfile. Note that epoch number will continue from file, so make sure to increase numepochs sufficiently | |
147 | 151 |
|
| 152 | +## Prediction |
| 153 | + |
| 154 | +Use `predict to run prediction |
148 | 155 |
|
149 | 156 |
|
0 commit comments