mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2026-04-19 02:30:22 +00:00
27 lines
1.0 KiB
Matlab
27 lines
1.0 KiB
Matlab
function [ out_prob, out_correction ] = PNet( im_data, PNet_mlab )
|
|
%PNET Summary of this function goes here
|
|
% Detailed explanation goes here
|
|
|
|
% Pass through the first convolution layer
|
|
out = convolution(im_data, PNet_mlab.weights_conv1, PNet_mlab.biases_conv1);
|
|
out = PReLU(out, PNet_mlab.prelu_weights_1);
|
|
out = max_pooling2(out, 2, 2);
|
|
out = convolution(out, PNet_mlab.weights_conv2, PNet_mlab.biases_conv2);
|
|
out = PReLU(out, PNet_mlab.prelu_weights_2);
|
|
out = convolution(out, PNet_mlab.weights_conv3, PNet_mlab.biases_conv3);
|
|
out = PReLU(out, PNet_mlab.prelu_weights_3);
|
|
|
|
% The fully connected layer
|
|
out_fc = zeros(size(out,1)*size(out,2), size(out,3));
|
|
out_fc(:) = out(:);
|
|
out_fc = out_fc * PNet_mlab.w + PNet_mlab.b';
|
|
out = reshape(out_fc, size(out,1), size(out,2), size(out_fc,2));
|
|
|
|
% The alignment probabilities (face heat map)
|
|
out_prob = 1./(1+exp(out(:,:,1)-out(:,:,2)));
|
|
|
|
% The correction of the detection
|
|
out_correction = out(:,:,3:end);
|
|
end
|
|
|