Skip to content

Commit

Permalink
force normalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
happynear committed Aug 27, 2017
1 parent 1bc78f4 commit 2a1112a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 50 deletions.
34 changes: 9 additions & 25 deletions prototxt/normalized_Euclidean_contrastive.prototxt
Expand Up @@ -4,39 +4,23 @@ layer {
bottom: "last_ip_layer"
top: "norm1"
}
layer {
name: "id_weight_l2"
type: "Parameter"
top: "id_weight_l2"
param {
lr_mult: 1
decay_mult: 0
}
parameter_param {
shape {
dim: 10572 # class number
dim: 512 # feature dimension
}
blob_filler {
type: "gaussian_unitball"
}
}
}
layer {
name: "id_weight_l2_normalize"
type: "Normalize"
bottom: "id_weight_l2"
top: "id_weight_l2_normalize"
}
layer {
name: "normalized_Euclidean"
type: "InnerDistance"
bottom: "norm1"
bottom: "id_weight_l2_normalize"
top: "normalized_Euclidean"
param {
lr_mult: 100
decay_mult: 0
}
inner_distance_param{
bias_term: false
distance_type: "L2"
normalize: true
num_output: 10572
weight_filler {
type: "gaussian_unitball"
}
}
}
layer {
Expand Down
35 changes: 10 additions & 25 deletions prototxt/scaled_cosine_softmax.prototxt
Expand Up @@ -4,38 +4,22 @@ layer {
bottom: "last_ip_layer"
top: "norm1"
}
layer {
name: "id_weight_ip"
type: "Parameter"
top: "id_weight_ip"
param {
lr_mult: 1
decay_mult: 1
}
parameter_param {
shape {
dim: 10572 # class number
dim: 512 # feature dimension
}
blob_filler {
type: "gaussian_unitball"
}
}
}
layer {
name: "id_weight_ip_normalize"
type: "Normalize"
bottom: "id_weight_ip"
top: "id_weight_ip_normalize"
}
layer {
name: "cosine_layer"
type: "InnerProduct"
bottom: "norm1"
bottom: "id_weight_ip_normalize"
top: "cosine"
param {
lr_mult: 100
decay_mult: 0
}
inner_product_param{
bias_term: false
normalize: true
num_output: 10572
weight_filler {
type: "gaussian_unitball"
}
}
}
layer {
Expand All @@ -46,6 +30,7 @@ layer {
scale_param {
num_axes: 0
bias_term: false
min_value: 0.01
filler{
value: 10
}
Expand Down

0 comments on commit 2a1112a

Please sign in to comment.