Skip to content

Commit 636ee6e

Browse files
committed
update descriptions and traning scripts to latest version
1 parent 35f9f9c commit 636ee6e

6 files changed

Lines changed: 306 additions & 34 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Launch matalb and run `run_cifar10.m` to perform the evaluation of `precision at
6161

6262
Then, you will get the `mAP` result as follows.
6363

64-
>> MAP = 0.899731
64+
>> MAP = 0.897165
6565

6666
Moreover, simply run the following commands to generate the `precision at k` curves:
6767

@@ -75,20 +75,20 @@ used in the evaluation.
7575

7676
Simply run the following command to train SSDH:
7777

78+
$ cd /examples/SSDH
79+
$ ./train.sh
7880

79-
$ ./examples/SSDH/train.sh
8081

81-
82-
After 50,000 iterations, the top-1 error is 9.7% on the test set of CIFAR10 dataset:
82+
After 50,000 iterations, the top-1 error is around 10% on the test set of CIFAR10 dataset:
8383
```
84-
I0107 19:24:32.258903 23945 solver.cpp:326] Iteration 50000, loss = 0.0274982
85-
I0107 19:24:32.259012 23945 solver.cpp:346] Iteration 50000, Testing net (#0)
86-
I0107 19:24:36.696506 23945 solver.cpp:414] Test net output #0: accuracy = 0.903125
87-
I0107 19:24:36.696543 23945 solver.cpp:414] Test net output #1: loss: 50%-fire-rate = 1.47562e-06 (* 1 = 1.47562e-06 loss)
88-
I0107 19:24:36.696552 23945 solver.cpp:414] Test net output #2: loss: classfication-error = 0.332657 (* 1 = 0.332657 loss)
89-
I0107 19:24:36.696559 23945 solver.cpp:414] Test net output #3: loss: forcing-binary = -0.00317774 (* 1 = -0.00317774 loss)
90-
I0107 19:24:36.696565 23945 solver.cpp:331] Optimization Done.
91-
I0107 19:24:36.696570 23945 caffe.cpp:214] Optimization Done.
84+
I1109 20:36:30.962478 25398 solver.cpp:326] Iteration 50000, loss = -0.114461
85+
I1109 20:36:30.962507 25398 solver.cpp:346] Iteration 50000, Testing net (#0)
86+
I1109 20:36:45.218626 25398 solver.cpp:414] Test net output #0: accuracy = 0.8979
87+
I1109 20:36:45.218660 25398 solver.cpp:414] Test net output #1: loss: 50%-fire-rate = 0.0005225 (* 1 = 0.0005225 loss)
88+
I1109 20:36:45.218668 25398 solver.cpp:414] Test net output #2: loss: classfication-error = 0.368178 (* 1 = 0.368178 loss)
89+
I1109 20:36:45.218675 25398 solver.cpp:414] Test net output #3: loss: forcing-binary = -0.114508 (* 1 = -0.114508 loss)
90+
I1109 20:36:45.218682 25398 solver.cpp:331] Optimization Done.
91+
I1109 20:36:45.218686 25398 caffe.cpp:214] Optimization Done.
9292
```
9393

9494
The training process takes roughly 2~3 hours on a desktop with Titian X GPU. You will finally get your model named `SSDH48_iter_xxxxxx.caffemodel` under folder `/examples/SSDH/`
@@ -118,7 +118,7 @@ It should be easy to train the model using another dataset as long as that datas
118118

119119
If `./prepare.sh` fails to download data, you may manually download the resouces from:
120120

121-
0. 48-bit SSDH model: [MEGA](https://mega.nz/#!kJ1jwDpJ!X4dVUeWJ7Eqg9L8bhJaGbr9l5-HS3ccudbjIjIbYNpk), [DropBox](https://www.dropbox.com/s/6iqyz1mdhadhzbu/SSDH48_iter_50000.caffemodel?dl=0), [BaiduYun](http://pan.baidu.com/s/1nurCaJR)
121+
0. 48-bit SSDH model: [MEGA](https://mega.nz/#!9JMBlCaS!zsTl7eZRMdi25gkLWpj_Uv8LfN_2gQ-UF8OBMhio_3s), [DropBox](https://www.dropbox.com/s/6iqyz1mdhadhzbu/SSDH48_iter_50000.caffemodel?dl=0), [BaiduYun coming soon]
122122

123123
0. CIFAR10 dataset (jpg format): [MEGA](https://mega.nz/#!RENV1bhZ!x0uFnAkqUSTJzKr6HzeeNV9mtDjlgQ0x6ZaXfpxbJkw), [DropBox](https://www.dropbox.com/s/f7q3bbgvat2q1u2/cifar10-dataset.zip?dl=0), [BaiduYun](http://pan.baidu.com/s/1pKsSK7h)
124124

examples/SSDH/deploy.prototxt

Lines changed: 143 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CaffeNet"
1+
name: "SSDH"
22
input: "data"
33
input_shape {
44
dim: 10
@@ -11,10 +11,26 @@ layer {
1111
type: "Convolution"
1212
bottom: "data"
1313
top: "conv1"
14+
param {
15+
lr_mult: 1
16+
decay_mult: 1
17+
}
18+
param {
19+
lr_mult: 2
20+
decay_mult: 0
21+
}
1422
convolution_param {
1523
num_output: 96
1624
kernel_size: 11
1725
stride: 4
26+
weight_filler {
27+
type: "gaussian"
28+
std: 0.01
29+
}
30+
bias_filler {
31+
type: "constant"
32+
value: 0
33+
}
1834
}
1935
}
2036
layer {
@@ -50,11 +66,27 @@ layer {
5066
type: "Convolution"
5167
bottom: "norm1"
5268
top: "conv2"
69+
param {
70+
lr_mult: 1
71+
decay_mult: 1
72+
}
73+
param {
74+
lr_mult: 2
75+
decay_mult: 0
76+
}
5377
convolution_param {
5478
num_output: 256
5579
pad: 2
5680
kernel_size: 5
5781
group: 2
82+
weight_filler {
83+
type: "gaussian"
84+
std: 0.01
85+
}
86+
bias_filler {
87+
type: "constant"
88+
value: 1
89+
}
5890
}
5991
}
6092
layer {
@@ -90,10 +122,26 @@ layer {
90122
type: "Convolution"
91123
bottom: "norm2"
92124
top: "conv3"
125+
param {
126+
lr_mult: 1
127+
decay_mult: 1
128+
}
129+
param {
130+
lr_mult: 2
131+
decay_mult: 0
132+
}
93133
convolution_param {
94134
num_output: 384
95135
pad: 1
96136
kernel_size: 3
137+
weight_filler {
138+
type: "gaussian"
139+
std: 0.01
140+
}
141+
bias_filler {
142+
type: "constant"
143+
value: 0
144+
}
97145
}
98146
}
99147
layer {
@@ -107,11 +155,27 @@ layer {
107155
type: "Convolution"
108156
bottom: "conv3"
109157
top: "conv4"
158+
param {
159+
lr_mult: 1
160+
decay_mult: 1
161+
}
162+
param {
163+
lr_mult: 2
164+
decay_mult: 0
165+
}
110166
convolution_param {
111167
num_output: 384
112168
pad: 1
113169
kernel_size: 3
114170
group: 2
171+
weight_filler {
172+
type: "gaussian"
173+
std: 0.01
174+
}
175+
bias_filler {
176+
type: "constant"
177+
value: 1
178+
}
115179
}
116180
}
117181
layer {
@@ -125,11 +189,27 @@ layer {
125189
type: "Convolution"
126190
bottom: "conv4"
127191
top: "conv5"
192+
param {
193+
lr_mult: 1
194+
decay_mult: 1
195+
}
196+
param {
197+
lr_mult: 2
198+
decay_mult: 0
199+
}
128200
convolution_param {
129201
num_output: 256
130202
pad: 1
131203
kernel_size: 3
132204
group: 2
205+
weight_filler {
206+
type: "gaussian"
207+
std: 0.01
208+
}
209+
bias_filler {
210+
type: "constant"
211+
value: 1
212+
}
133213
}
134214
}
135215
layer {
@@ -154,8 +234,24 @@ layer {
154234
type: "InnerProduct"
155235
bottom: "pool5"
156236
top: "fc6"
237+
param {
238+
lr_mult: 1
239+
decay_mult: 1
240+
}
241+
param {
242+
lr_mult: 2
243+
decay_mult: 0
244+
}
157245
inner_product_param {
158246
num_output: 4096
247+
weight_filler {
248+
type: "gaussian"
249+
std: 0.005
250+
}
251+
bias_filler {
252+
type: "constant"
253+
value: 1
254+
}
159255
}
160256
}
161257
layer {
@@ -178,8 +274,24 @@ layer {
178274
type: "InnerProduct"
179275
bottom: "fc6"
180276
top: "fc7"
277+
param {
278+
lr_mult: 1
279+
decay_mult: 1
280+
}
281+
param {
282+
lr_mult: 2
283+
decay_mult: 0
284+
}
181285
inner_product_param {
182286
num_output: 4096
287+
weight_filler {
288+
type: "gaussian"
289+
std: 0.005
290+
}
291+
bias_filler {
292+
type: "constant"
293+
value: 1
294+
}
183295
}
184296
}
185297
layer {
@@ -189,18 +301,42 @@ layer {
189301
top: "fc7"
190302
}
191303
layer {
192-
name: "latent_layer"
304+
name: "drop7"
305+
type: "Dropout"
306+
bottom: "fc7"
307+
top: "fc7"
308+
dropout_param {
309+
dropout_ratio: 0.5
310+
}
311+
}
312+
layer {
313+
name: "latent"
193314
type: "InnerProduct"
194315
bottom: "fc7"
195-
top: "latent_layer"
316+
top: "latent"
317+
param {
318+
lr_mult: 1
319+
decay_mult: 1
320+
}
321+
param {
322+
lr_mult: 2
323+
decay_mult: 0
324+
}
196325
inner_product_param {
197326
num_output: 48
327+
weight_filler {
328+
type: "gaussian"
329+
std: 0.01
330+
}
331+
bias_filler {
332+
type: "constant"
333+
value: 0
334+
}
198335
}
199336
}
200337
layer {
201-
name: "encode_neuron"
338+
bottom: "latent"
339+
top: "latent_sigmoid"
340+
name: "latent_sigmoid"
202341
type: "Sigmoid"
203-
bottom: "latent_layer"
204-
top: "encode_neuron"
205342
}
206-

examples/SSDH/solver.prototxt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
net: "./examples/SSDH/train_val.prototxt"
1+
net: "train_val.prototxt"
22
test_iter: 200
33
test_interval: 1000
44
base_lr: 0.001
@@ -10,6 +10,6 @@ max_iter: 50000
1010
momentum: 0.9
1111
weight_decay: 0.0005
1212
snapshot: 50000
13-
snapshot_prefix: "./examples/SSDH/SSDH48"
13+
snapshot_prefix: "SSDH48"
1414
random_seed: 42
1515
solver_mode: GPU

examples/SSDH/train.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
./build/tools/caffe train -solver ./examples/SSDH/solver.prototxt -weights ./models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel -gpu 0 2>&1 | tee ./examples/SSDH/log.txt
1+
../../build/tools/caffe train -solver solver.prototxt -weights ../../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel -gpu 0 2>&1 | tee log.txt

examples/SSDH/train_val.prototxt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ layer {
1010
transform_param {
1111
mirror: true
1212
crop_size: 227
13-
mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
13+
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
1414
}
1515
data_param {
16-
source: "data/cifar10/cifar10_train_leveldb"
16+
source: "../../data/cifar10/cifar10_train_leveldb"
1717
batch_size: 32
1818
}
1919
}
@@ -28,10 +28,10 @@ layer {
2828
transform_param {
2929
mirror: false
3030
crop_size: 227
31-
mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
31+
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
3232
}
3333
data_param {
34-
source: "data/cifar10/cifar10_val_leveldb"
34+
source: "../../data/cifar10/cifar10_val_leveldb"
3535
batch_size: 50
3636
}
3737
}

0 commit comments

Comments
 (0)