Skip to content

Commit f2fc582

Browse files
committed
cnn_triplet
1 parent ff16f6e commit f2fc582

16 files changed

Lines changed: 2074 additions & 0 deletions
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: "3d_triplet"
2+
input: "data"
3+
input_dim: 9720
4+
input_dim: 1
5+
input_dim: 64
6+
input_dim: 64
7+
layer {
8+
name: "conv1"
9+
type: "Convolution"
10+
bottom: "data"
11+
top: "conv1"
12+
param {
13+
lr_mult: 1
14+
}
15+
param {
16+
lr_mult: 2
17+
}
18+
convolution_param {
19+
num_output: 16
20+
kernel_size: 8
21+
stride: 1
22+
}
23+
}
24+
layer {
25+
name: "pool1"
26+
type: "Pooling"
27+
bottom: "conv1"
28+
top: "pool1"
29+
pooling_param {
30+
pool: MAX
31+
kernel_size: 2
32+
stride: 2
33+
}
34+
}
35+
layer {
36+
name: "relu1"
37+
type: "ReLU"
38+
bottom: "pool1"
39+
top: "pool1"
40+
}
41+
layer {
42+
name: "conv2"
43+
type: "Convolution"
44+
bottom: "pool1"
45+
top: "conv2"
46+
param {
47+
lr_mult: 1
48+
}
49+
param {
50+
lr_mult: 2
51+
}
52+
convolution_param {
53+
num_output: 7
54+
kernel_size: 5
55+
stride: 1
56+
}
57+
}
58+
layer {
59+
name: "pool2"
60+
type: "Pooling"
61+
bottom: "conv2"
62+
top: "pool2"
63+
pooling_param {
64+
pool: MAX
65+
kernel_size: 2
66+
stride: 2
67+
}
68+
}
69+
layer {
70+
name: "relu2"
71+
type: "ReLU"
72+
bottom: "pool2"
73+
top: "pool2"
74+
}
75+
layer {
76+
name: "ip1"
77+
type: "InnerProduct"
78+
bottom: "pool2"
79+
top: "ip1"
80+
param {
81+
lr_mult: 1
82+
}
83+
param {
84+
lr_mult: 2
85+
}
86+
inner_product_param {
87+
num_output: 256
88+
}
89+
}
90+
layer {
91+
name: "relu3"
92+
type: "ReLU"
93+
bottom: "ip1"
94+
top: "ip1"
95+
}
96+
layer {
97+
name: "feat"
98+
type: "InnerProduct"
99+
bottom: "ip1"
100+
top: "feat"
101+
param {
102+
lr_mult: 1
103+
}
104+
param {
105+
lr_mult: 2
106+
}
107+
inner_product_param {
108+
num_output: 3
109+
}
110+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# The train/test net protocol buffer definition
2+
net: "examples/triplet/3d_triplet_train_test.prototxt"
3+
# test_iter specifies how many forward passes the test should carry out.
4+
# In the case of 3d database, we have test batch size 250 and 250 test iterations: 50*(2+3)=250,
5+
# covering the full 9720 testing images:162*6*10=9720.
6+
test_iter: 100
7+
# Carry out testing every 500 training iterations.
8+
test_interval: 100
9+
# The base learning rate, momentum and the weight decay of the network.
10+
base_lr: 0.001
11+
momentum: 0.9
12+
weight_decay: 0.0000
13+
# The learning rate policy
14+
lr_policy: "inv"
15+
gamma: 0.0001
16+
power: 0.75
17+
# Display every 100 iterations
18+
display: 100
19+
# The maximum number of iterations
20+
max_iter: 80000
21+
# snapshot intermediate results
22+
snapshot: 5000
23+
snapshot_prefix: "examples/triplet/3d_triplet"
24+
# solver mode: CPU or GPU
25+
solver_mode: CPU
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
name: "3d_triplet_train_test"
2+
layer {
3+
name: "data"
4+
type: "Data"
5+
top: "data"
6+
top: "sim"
7+
include {
8+
phase: TRAIN
9+
}
10+
transform_param {
11+
scale: 0.00390625
12+
}
13+
data_param {
14+
source: "examples/triplet/3d_triplet_train_leveldb"
15+
batch_size: 250
16+
}
17+
}
18+
layer {
19+
name: "data"
20+
type: "Data"
21+
top: "data"
22+
top: "sim"
23+
include {
24+
phase: TEST
25+
}
26+
transform_param {
27+
scale: 0.00390625
28+
}
29+
data_param {
30+
source: "examples/triplet/3d_triplet_test_leveldb"
31+
batch_size: 250
32+
}
33+
}
34+
layer {
35+
name: "conv1"
36+
type: "Convolution"
37+
bottom: "data"
38+
top: "conv1"
39+
param {
40+
name: "conv1_w"
41+
lr_mult: 1
42+
}
43+
param {
44+
name: "conv1_b"
45+
lr_mult: 2
46+
}
47+
convolution_param {
48+
num_output: 16
49+
kernel_size: 8
50+
stride: 1
51+
weight_filler {
52+
type: "xavier"
53+
}
54+
bias_filler {
55+
type: "constant"
56+
}
57+
}
58+
}
59+
layer {
60+
name: "pool1"
61+
type: "Pooling"
62+
bottom: "conv1"
63+
top: "pool1"
64+
pooling_param {
65+
pool: MAX
66+
kernel_size: 2
67+
stride: 2
68+
}
69+
}
70+
layer {
71+
name: "relu1"
72+
type: "ReLU"
73+
bottom: "pool1"
74+
top: "pool1"
75+
}
76+
layer {
77+
name: "conv2"
78+
type: "Convolution"
79+
bottom: "pool1"
80+
top: "conv2"
81+
param {
82+
name: "conv2_w"
83+
lr_mult: 1
84+
}
85+
param {
86+
name: "conv2_b"
87+
lr_mult: 2
88+
}
89+
convolution_param {
90+
num_output: 7
91+
kernel_size: 5
92+
stride: 1
93+
weight_filler {
94+
type: "xavier"
95+
}
96+
bias_filler {
97+
type: "constant"
98+
}
99+
}
100+
}
101+
layer {
102+
name: "pool2"
103+
type: "Pooling"
104+
bottom: "conv2"
105+
top: "pool2"
106+
pooling_param {
107+
pool: MAX
108+
kernel_size: 2
109+
stride: 2
110+
}
111+
}
112+
layer {
113+
name: "relu2"
114+
type: "ReLU"
115+
bottom: "pool2"
116+
top: "pool2"
117+
}
118+
layer {
119+
name: "ip1"
120+
type: "InnerProduct"
121+
bottom: "pool2"
122+
top: "ip1"
123+
param {
124+
name: "ip1_w"
125+
lr_mult: 1
126+
}
127+
param {
128+
name: "ip1_b"
129+
lr_mult: 2
130+
}
131+
inner_product_param {
132+
num_output: 256
133+
weight_filler {
134+
type: "xavier"
135+
}
136+
bias_filler {
137+
type: "constant"
138+
}
139+
}
140+
}
141+
layer {
142+
name: "relu3"
143+
type: "ReLU"
144+
bottom: "ip1"
145+
top: "ip1"
146+
}
147+
layer {
148+
name: "feat"
149+
type: "InnerProduct"
150+
bottom: "ip1"
151+
top: "feat"
152+
param {
153+
name: "feat_w"
154+
lr_mult: 1
155+
}
156+
param {
157+
name: "feat_b"
158+
lr_mult: 2
159+
}
160+
inner_product_param {
161+
num_output: 3
162+
weight_filler {
163+
type: "xavier"
164+
}
165+
bias_filler {
166+
type: "constant"
167+
}
168+
}
169+
}
170+
layer {
171+
name: "loss"
172+
type: "TripletLoss"
173+
bottom: "feat"
174+
bottom: "sim"
175+
top: "loss"
176+
triplet_loss_param {
177+
margin: 1
178+
losstype: 0
179+
num_triplets: 3
180+
}
181+
}

0 commit comments

Comments
 (0)