TensorFlow Code
MATLAB Code
main.m
ccc
%% LOAD TENSORFLOW WEIGHTS
ccc
% LOAD TRAINED NETWORK PARAMETERS
l = load('data/mlp.mat');
% MLP FORWARD PATH
out = mlp(l.testimg, l.w1, l.w2, l.wout ...
, l.b1, l.b2, l.bout);
[~, pred] = max(out, [], 2);
[~, answ] = max(l.testlabel, [], 2);
% CHECK TEST ACCUARACY
iseq = (answ == pred);
acc = mean(iseq);
fprintf('TEST ACCURACY IS %.2f%% \n', acc*100);
mlp.m
function out = mlp(x, w1, w2, wout, b1, b2, bout)
% MLP FORWARD PATH
n = size(x, 1);
l1 = sigmoid(x*w1 + repmat(b1, n, 1));
l2 = sigmoid(l1*w2 + repmat(b2, n, 1));
out = l2*wout + repmat(bout, n, 1);
function out = sigmoid(in)
% SIGMOID FUNCTION
out = 1./ (1+exp(-in));
'Enginius > Python&TensorFlow' 카테고리의 다른 글
SUPER GPU MACHINE 만들기 (0) | 2017.08.11 |
---|---|
Simple Handshaking between Matlab and TensorFlow (0) | 2017.04.17 |
도커와 텐서플로우 설치하기 (0) | 2016.11.30 |
GPU 머신 조립하기 (2) | 2016.11.25 |
Docker 사용하기 (0) | 2016.11.22 |