Flowchart of sobel operator program



















LeNet Neural Network

The LeNet neural network was proposed by Yan LeCun, one of the trio of deep learning giants, who is also the father of convolutional neural networks (CNNs, Convolutional Neural Networks).LeNet was mainly used for handwritten character recognition and classification, and was put into use in banks in the United States. The implementation of LeNet established the structure of CNNs, and much of what is now in neural networks can be seen in the network structure of LeNet, such as the convolutional layer, the Pooling layer, and the ReLU layer. Although LeNet was proposed back in the 1990s, LeNet neural networks were not as effective in dealing with complex problems due to the lack of large-scale training data and the low performance of computer hardware at that time. Although the LeNet network structure is relatively simple, it is just right for introductory learning of neural networks.

The structure of LeNet neural network is as follows:

The execution flow chart of LeNet network is as follows:

Next, let’s analyze the network structure of LeNet layer by layer. The first step is to understand the representation of the image (input data). In the LeNet network, the input image is a handwritten character, and the image is represented as a two-dimensional data matrix, as shown in the following figure:

The LeNet network has a total of six layers of the network, excluding the input and output layers. The first layer is the convolution layer (C1 layer), the size of the convolution kernel is 5\*5, the number of convolution kernels is 6, the size of the input image is 32 * 32, so the input data in the first layer of convolution, the output result is the size of 28 * 28, the number of 6 featuremap. convolution operation is shown in the following two diagrams:

Convolution operation process can be described as follows: convolution kernel sliding on the image, the sliding step is 1 (that is, each time to move a grid, horizontal direction from left to right, to the rightmost and then from the leftmost start, move down a grid, repeat from left to right sliding), when the convolution kernel and a local block of the image when the convolution of the run, convolution is calculated for the number of the corresponding position of the image block with the convolution kernel corresponding to the number of the position of the multiplier, and then all the results of the multiplication of the value for the The value of the featuremap, after the multiplication and accumulation of the result is located in the position of the center point of the convolution kernel, so if it is a 3\*3 convolution kernel, the featuremap is reduced by two rows (one row for each top and bottom) and two columns (one column for each left and right) in the horizontal and vertical directions respectively compared to the original image, so the original image of the above image is 5\5, and the convolution kernel is 3\3, and the size of the convolution result is 3\3, i.e.( 5-2)*(5-2), if the convolution kernel is 5*5, the convolution result size is (5-4)*(5-4). The convolution kernel in the above figure is:

Urgent sobel operator to detect edge Matlab program code

f=imread(‘peppers.png’);%Read image

f=rgb2gray(f);%Gray scale conversion

f=im2double(f);%Data type conversion

%Use vertical Sobel operator to automatically select the threshold

[VSFATThreshold]=edge(f,’sobel’,’vertical’);%Edge detection

figure,imshow(f),title(‘OriginalImage’),%Show original image

figure,imshow(VSFAT),title(‘SobelFilter-AutomaticThreshold’);%Display edge detection image

%Automatically selects thresholds using horizontal and vertical Sobel operators

SFST=edge(f,’sobel’, Threshold);

figure,imshow(SFST),title(‘SobelFilter(HorizontalandVertical)’);%Show the edge detection image

%Use the specified 45-degree angular Sobel operator filter with the specified threshold




figure,imshow(SFST45),. title(‘SobelFilter(45Degree)’);%Show the edge detection image

%Use the specified -45 degree angle Sobel operator filter with the specified threshold


SFSTM45=imfilter(f, sm45,’replicate’);


figure,imshow(SFSTM45),title(‘SobelFilter(-45Degree)’);%Show edge detection image