forked from happynear/NormFace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
539 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
log | ||
log | ||
mnist_train_lmdb | ||
mnist_test_lmdb | ||
*.caffemodel | ||
*.solverstate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
caffe.set_mode_gpu(); | ||
caffe.reset_all(); | ||
net = caffe.Net('lenet_train_test.prototxt','lenet_iter_25000.caffemodel','train'); | ||
batch_size = 128; | ||
all_feature = zeros(batch_size*100,3); | ||
all_label = zeros(batch_size*100,1); | ||
|
||
for i=1:100 | ||
f = net.forward({}); | ||
data_blob = net.blobs('ip1').get_data(); | ||
label_blob = net.blobs('label').get_data(); | ||
if size(data_blob,1) == 1 && size(data_blob,2) == 1 | ||
data_blob = reshape(data_blob,[size(data_blob,3) size(data_blob,4)]); | ||
end; | ||
all_feature((i-1)*batch_size+1:i*batch_size,:) = data_blob'; | ||
all_label((i-1)*batch_size+1:i*batch_size) = label_blob; | ||
end; | ||
% weight = reshape(net.blobs('id_weight').get_data(), [2,10]); | ||
|
||
cc = colormap(jet); | ||
close(1); | ||
figure(1); | ||
hold on; | ||
for l=0:9 | ||
scatter3(all_feature(all_label==l,1), all_feature(all_label==l,2),all_feature(all_label==l,3), ones(sum(all_label==l),1)*5,'MarkerFaceColor',cc(l * 6 + 1,:),'MarkerEdgeColor',cc(l * 6 + 1,:)); | ||
end; | ||
legend('0','1','2','3','4','5','6','7','8','9'); | ||
upper_bound = max(abs(all_feature(:))) * 1.2; | ||
|
||
% for l=0:9 | ||
% plot(weight(1,l+1) * upper_bound /2 , weight(2,l+1) * upper_bound / 2,'x','MarkerSize',10); | ||
% end; | ||
hold off; | ||
axis([-upper_bound upper_bound -upper_bound upper_bound]); | ||
|
||
|
||
% distance = pdist2(all_feature, weight'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# The train/test net protocol buffer definition | ||
net: "lenet_train_test.prototxt" | ||
# test_iter specifies how many forward passes the test should carry out. | ||
# In the case of MNIST, we have test batch size 100 and 100 test iterations, | ||
# covering the full 10,000 testing images. | ||
test_iter: 100 | ||
# Carry out testing every 500 training iterations. | ||
test_interval: 500 | ||
# The base learning rate, momentum and the weight decay of the network. | ||
base_lr: 0.1 | ||
momentum: 0.9 | ||
#weight_decay: 0 | ||
weight_decay: 0.0005 | ||
# The learning rate policy | ||
lr_policy: "multistep" | ||
gamma: 0.1 | ||
power: 0.75 | ||
# Display every 100 iterations | ||
display: 100 | ||
# The maximum number of iterations | ||
stepvalue: 15000 | ||
stepvalue: 20000 | ||
stepvalue: 25000 | ||
max_iter: 25000 | ||
# snapshot intermediate results | ||
snapshot: 5000 | ||
snapshot_prefix: "lenet" | ||
# solver mode: CPU or GPU | ||
solver_mode: GPU |
Oops, something went wrong.