vgg-16网络结构 matlab程序

lr = [.1 2] ;
net.layers = {} ;
% cbr1
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.01*randn(3,3,3,64, 'single'), zeros(1, 64, 'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 1) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(64,1, 'single'), zeros(1, 64, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr2
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.01*randn(3,3,64,64, 'single'), zeros(1, 64, 'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 1) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(64,1, 'single'), zeros(1, 64, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;

net.layers{end+1} = struct('type', 'pool', ...
    'method', 'max', ...
    'pool', [2 2], ...
    'stride', 2, ...
    'pad', 0) ; 
% cbr3
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,64,128, 'single'), zeros(1,128,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 1) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(128,1, 'single'), zeros(1, 128, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr4
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,128,128, 'single'), zeros(1,128,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 1) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(128,1, 'single'), zeros(1, 128, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;

net.layers{end+1} = struct('type', 'relu') ;

net.layers{end+1} = struct('type', 'pool', ...

    'method', 'max', ...
    'pool', [2 2], ...
    'stride', 2, ...

    'pad', 0) ; 

% cbr5
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,128,256, 'single'), zeros(1,256,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(256,1, 'single'), zeros(1, 256, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr6
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,256,256, 'single'), zeros(1,256,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(256,1, 'single'), zeros(1, 256, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr7
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,256,256, 'single'), zeros(1,256,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(256,1, 'single'), zeros(1, 256, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
net.layers{end+1} = struct('type', 'pool', ...
    'method', 'max', ...
    'pool', [2 2], ...
    'stride', 2, ...
    'pad', 0) ;
% cbr8
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,256,512, 'single'), zeros(1,512,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(512,1, 'single'), zeros(1, 512, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr9
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,512,512, 'single'), zeros(1,512,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(512,1, 'single'), zeros(1, 512, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr10
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,512,512, 'single'), zeros(1,512,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(512,1, 'single'), zeros(1, 512, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
net.layers{end+1} = struct('type', 'pool', ...
    'method', 'max', ...
    'pool', [2 2], ...
    'stride', 2, ...
    'pad', 0) ; 
%cbr11
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,512,512, 'single'), zeros(1,512,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(512,1, 'single'), zeros(1, 512, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr12
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,512,512, 'single'), zeros(1,512,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(512,1, 'single'), zeros(1, 512, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
% cbr13
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(3,3,512,512, 'single'), zeros(1,512,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 2) ;
net.layers{end+1} = struct('type', 'bnorm', ...
    'weights', {{ones(512,1, 'single'), zeros(1, 512, 'single')}}, ...
    'learningRate', [.1 .1 1], ...
    'weightDecay', [0 0]) ;
net.layers{end+1} = struct('type', 'relu') ;
net.layers{end+1} = struct('type', 'pool', ...
    'method', 'max', ...
    'pool', [2 2], ...
    'stride', 2, ...
    'pad', 0) ; 
%fc1
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(7,7,512,4096, 'single'), zeros(1,4096,'single')}}, ...
    'learningRate', lr, ...
    'stride', 1, ...
    'pad', 0) ;
% fc2
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(1,1,4096,4096, 'single'), zeros(1,4096,'single')}}, ...
    'learningRate', .1*lr, ...
    'stride', 1, ...
    'pad', 0) ;
% fc3
net.layers{end+1} = struct('type', 'conv', ...
    'weights', {{0.05*randn(1,1,4096,1000, 'single'), zeros(1,1000,'single')}}, ...
    'learningRate', .1*lr, ...
    'stride', 1, ...
    'pad', 0) ;
% Loss layer
net.layers{end+1} = struct('type', 'softmaxloss') ;

你可能感兴趣的:(神经网络,MATLAB程序)