Skip to content

Commit a6cb8ec

Browse files
committed
[examples] sequence and revise notebooks
- combine classification + filter visualization - order by classification, learning LeNet, brewing logreg, and fine-tuning to flickr style - improve flow of content in classification + filter visualization - include solver needed for learning LeNet - edit notebook descriptions for site catalogue
1 parent b8cc297 commit a6cb8ec

19 files changed

+22296
-26009
lines changed

examples/00-classification.ipynb

+13,187
Large diffs are not rendered by default.

examples/python_solving.ipynb examples/01-learning-lenet.ipynb

+2,231-2,183
Large diffs are not rendered by default.

examples/02-brewing-logreg.ipynb

+5,771
Large diffs are not rendered by default.

examples/03-fine-tuning.ipynb

+947
Large diffs are not rendered by default.

examples/Finetune with Flickr Style Data.ipynb

-951
This file was deleted.

examples/classification.ipynb

-3,342
This file was deleted.

examples/detection.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8385,7 +8385,7 @@
83858385
"pygments_lexer": "ipython2",
83868386
"version": "2.7.9"
83878387
},
8388-
"priority": 3
8388+
"priority": 6
83898389
},
83908390
"nbformat": 4,
83918391
"nbformat_minor": 0

examples/filter_visualization.ipynb

-13,214
This file was deleted.

examples/hdf5_classification.ipynb

-6,290
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
layer {
2+
name: "data"
3+
type: "HDF5Data"
4+
top: "data"
5+
top: "label"
6+
hdf5_data_param {
7+
source: "examples/hdf5_classification/data/test.txt"
8+
batch_size: 10
9+
}
10+
}
11+
layer {
12+
name: "ip1"
13+
type: "InnerProduct"
14+
bottom: "data"
15+
top: "ip1"
16+
inner_product_param {
17+
num_output: 40
18+
weight_filler {
19+
type: "xavier"
20+
}
21+
}
22+
}
23+
layer {
24+
name: "relu1"
25+
type: "ReLU"
26+
bottom: "ip1"
27+
top: "ip1"
28+
}
29+
layer {
30+
name: "ip2"
31+
type: "InnerProduct"
32+
bottom: "ip1"
33+
top: "ip2"
34+
inner_product_param {
35+
num_output: 2
36+
weight_filler {
37+
type: "xavier"
38+
}
39+
}
40+
}
41+
layer {
42+
name: "accuracy"
43+
type: "Accuracy"
44+
bottom: "ip2"
45+
bottom: "label"
46+
top: "accuracy"
47+
}
48+
layer {
49+
name: "loss"
50+
type: "SoftmaxWithLoss"
51+
bottom: "ip2"
52+
bottom: "label"
53+
top: "loss"
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
layer {
2+
name: "data"
3+
type: "HDF5Data"
4+
top: "data"
5+
top: "label"
6+
hdf5_data_param {
7+
source: "examples/hdf5_classification/data/train.txt"
8+
batch_size: 10
9+
}
10+
}
11+
layer {
12+
name: "ip1"
13+
type: "InnerProduct"
14+
bottom: "data"
15+
top: "ip1"
16+
inner_product_param {
17+
num_output: 40
18+
weight_filler {
19+
type: "xavier"
20+
}
21+
}
22+
}
23+
layer {
24+
name: "relu1"
25+
type: "ReLU"
26+
bottom: "ip1"
27+
top: "ip1"
28+
}
29+
layer {
30+
name: "ip2"
31+
type: "InnerProduct"
32+
bottom: "ip1"
33+
top: "ip2"
34+
inner_product_param {
35+
num_output: 2
36+
weight_filler {
37+
type: "xavier"
38+
}
39+
}
40+
}
41+
layer {
42+
name: "accuracy"
43+
type: "Accuracy"
44+
bottom: "ip2"
45+
bottom: "label"
46+
top: "accuracy"
47+
}
48+
layer {
49+
name: "loss"
50+
type: "SoftmaxWithLoss"
51+
bottom: "ip2"
52+
bottom: "label"
53+
top: "loss"
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
train_net: "examples/hdf5_classification/nonlinear_auto_train.prototxt"
2+
test_net: "examples/hdf5_classification/nonlinear_auto_test.prototxt"
3+
test_iter: 250
4+
test_interval: 1000
5+
base_lr: 0.01
6+
lr_policy: "step"
7+
gamma: 0.1
8+
stepsize: 5000
9+
display: 1000
10+
max_iter: 10000
11+
momentum: 0.9
12+
weight_decay: 0.0005
13+
snapshot: 10000
14+
snapshot_prefix: "examples/hdf5_classification/data/train"
15+
solver_mode: CPU

examples/hdf5_classification/train_val2.prototxt examples/hdf5_classification/nonlinear_train_val.prototxt

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layer {
88
phase: TRAIN
99
}
1010
hdf5_data_param {
11-
source: "hdf5_classification/data/train.txt"
11+
source: "examples/hdf5_classification/data/train.txt"
1212
batch_size: 10
1313
}
1414
}
@@ -21,7 +21,7 @@ layer {
2121
phase: TEST
2222
}
2323
hdf5_data_param {
24-
source: "hdf5_classification/data/test.txt"
24+
source: "examples/hdf5_classification/data/test.txt"
2525
batch_size: 10
2626
}
2727
}
@@ -41,8 +41,7 @@ layer {
4141
inner_product_param {
4242
num_output: 40
4343
weight_filler {
44-
type: "gaussian"
45-
std: 0.01
44+
type: "xavier"
4645
}
4746
bias_filler {
4847
type: "constant"
@@ -72,8 +71,7 @@ layer {
7271
inner_product_param {
7372
num_output: 2
7473
weight_filler {
75-
type: "gaussian"
76-
std: 0.01
74+
type: "xavier"
7775
}
7876
bias_filler {
7977
type: "constant"

examples/hdf5_classification/solver.prototxt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
net: "hdf5_classification/train_val.prototxt"
1+
train_net: "examples/hdf5_classification/logreg_auto_train.prototxt"
2+
test_net: "examples/hdf5_classification/logreg_auto_test.prototxt"
23
test_iter: 250
34
test_interval: 1000
45
base_lr: 0.01
@@ -10,5 +11,5 @@ max_iter: 10000
1011
momentum: 0.9
1112
weight_decay: 0.0005
1213
snapshot: 10000
13-
snapshot_prefix: "hdf5_classification/data/train"
14+
snapshot_prefix: "examples/hdf5_classification/data/train"
1415
solver_mode: CPU

examples/hdf5_classification/solver2.prototxt

-14
This file was deleted.

examples/hdf5_classification/train_val.prototxt

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layer {
88
phase: TRAIN
99
}
1010
hdf5_data_param {
11-
source: "hdf5_classification/data/train.txt"
11+
source: "examples/hdf5_classification/data/train.txt"
1212
batch_size: 10
1313
}
1414
}
@@ -21,7 +21,7 @@ layer {
2121
phase: TEST
2222
}
2323
hdf5_data_param {
24-
source: "hdf5_classification/data/test.txt"
24+
source: "examples/hdf5_classification/data/test.txt"
2525
batch_size: 10
2626
}
2727
}
@@ -41,8 +41,7 @@ layer {
4141
inner_product_param {
4242
num_output: 2
4343
weight_filler {
44-
type: "gaussian"
45-
std: 0.01
44+
type: "xavier"
4645
}
4746
bias_filler {
4847
type: "constant"
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# The train/test net protocol buffer definition
2+
train_net: "examples/mnist/lenet_auto_train.prototxt"
3+
test_net: "examples/mnist/lenet_auto_test.prototxt"
4+
# test_iter specifies how many forward passes the test should carry out.
5+
# In the case of MNIST, we have test batch size 100 and 100 test iterations,
6+
# covering the full 10,000 testing images.
7+
test_iter: 100
8+
# Carry out testing every 500 training iterations.
9+
test_interval: 500
10+
# The base learning rate, momentum and the weight decay of the network.
11+
base_lr: 0.01
12+
momentum: 0.9
13+
weight_decay: 0.0005
14+
# The learning rate policy
15+
lr_policy: "inv"
16+
gamma: 0.0001
17+
power: 0.75
18+
# Display every 100 iterations
19+
display: 100
20+
# The maximum number of iterations
21+
max_iter: 10000
22+
# snapshot intermediate results
23+
snapshot: 5000
24+
snapshot_prefix: "examples/mnist/lenet"

examples/net_surgery.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6884,7 +6884,7 @@
68846884
}
68856885
],
68866886
"metadata": {
6887-
"description": "How to do net surgery and manually change model parameters, making a fully-convolutional classifier for dense feature extraction.",
6887+
"description": "How to do net surgery and manually change model parameters for custom use.",
68886888
"example_name": "Editing model parameters",
68896889
"include_in_docs": true,
68906890
"kernelspec": {

examples/siamese/mnist_siamese.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,7 @@
19021902
"pygments_lexer": "ipython2",
19031903
"version": "2.7.9"
19041904
},
1905-
"priority": 6
1905+
"priority": 7
19061906
},
19071907
"nbformat": 4,
19081908
"nbformat_minor": 0

0 commit comments

Comments
 (0)