TensorFlow-trained network in MATLAB

Posted 2017.01.10 12:49

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' 카테고리의 다른 글

python plot  (0) 07:06:56
Simple Handshaking between Matlab and TensorFlow  (0) 2017.04.17
TensorFlow-trained network in MATLAB  (0) 2017.01.10
도커와 텐서플로우 설치하기  (0) 2016.11.30
GPU 머신 조립하기  (2) 2016.11.25
Docker 사용하기  (0) 2016.11.22
« PREV : 1 : ··· : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 : 20 : ··· : 574 : NEXT »