|
a |
|
b/combinedDeepLearningActiveContour/functions/normalizeData.m |
|
|
1 |
function patches = normalizeData(patches) |
|
|
2 |
|
|
|
3 |
% Squash data to [0.1, 0.9] since we use sigmoid as the activation |
|
|
4 |
% function in the output layer |
|
|
5 |
|
|
|
6 |
% Remove DC (mean of images). |
|
|
7 |
patches = bsxfun(@minus, patches, mean(patches)); |
|
|
8 |
|
|
|
9 |
% Truncate to +/-3 standard deviations and scale to -1 to 1 |
|
|
10 |
pstd = 3 * std(patches(:)); |
|
|
11 |
patches = max(min(patches, pstd), -pstd) / pstd; |
|
|
12 |
|
|
|
13 |
% Rescale from [-1,1] to [0.1,0.9] |
|
|
14 |
patches = (patches + 1) * 0.4 + 0.1; |
|
|
15 |
|
|
|
16 |
end |