赞
踩
#二、举例说明
##2、 将步骤1中所得结果(一个矩阵)的每个元素都加上b(偏置值),并将所得结果(矩阵)中的每个元素都输入到激活函数,这里取sigmoid函数如下式所示
clear clc imgRGB = imread('lena.jpg'); imgGray = double(rgb2gray(imgRGB)); Gx = [-1 0 1;-2 0 2;-1 0 1]; convImg = conv2(imgGray,Gx,'valid'); whos convImg figure subplot(1,2,1); imshow(uint8(convImg)); title('Sobel-Gx卷积结果') b = 0.2; sigmImg = 1./(1+exp(-convImg)) + b; subplot(1,2,2); imshow(sigmImg); title('Sobel-Gx-sigmoid函数激活结果') Gy = [-1 0 1;-2 0 2;-1 0 1]'; convImg = conv2(imgGray,Gy,'valid'); whos convImg figure subplot(1,2,1); imshow(uint8(convImg)); title('Sobel-Gy卷积结果') b = 0.2; sigmImg = 1./(1+exp(-convImg)) + b; subplot(1,2,2); imshow(sigmImg); title('Sobel-Gy-sigmoid函数激活结果')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。