Ultrasonic ranging and direction finding method based on deep learning

Through the improved ResNet50 model and CBAM attention module, the problem of lack of object orientation perception in ultrasonic environmental perception is solved, and the accuracy and wide application of ultrasonic ranging and direction finding are achieved, which is suitable for fields such as unmanned vehicles.

CN118534468APending Publication Date: 2024-08-23JILIN UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410575487.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-10
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, ultrasonic environmental perception based on deep learning mainly focuses on signal classification, lacking the perception of the specific orientation of objects, and there are few applications of ultrasonic ranging and direction finding, making it difficult to achieve more accurate and extensive environmental detection.

Method used

The improved ResNet50 model is used to simulate the ultrasonic echo signal waveform, add the CBAM attention module and Dropout layer, and train the model to identify distance and direction to achieve ultrasonic ranging and direction finding.

Benefits of technology

It achieves accurate analysis and determination of ultrasonic echo signals, can initially determine the direction of obstacles, expands the scope and accuracy of ultrasonic environmental perception, and is suitable for unmanned vehicles, drones and other fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118534468A
    Figure CN118534468A
Patent Text Reader

Abstract

The invention relates to the technical field of ultrasonic detection, and particularly discloses an ultrasonic distance and direction finding method based on deep learning, and the method comprises the steps: processing an ultrasonic echo signal through employing an improved ResNet50 model: replacing the original 7 * 7 convolution of the stage0 of ResNet50 with three 3 * 3 convolutions; a CBAM attention module is added behind each of stage1 to stage4 in the ResNet50 model, and a CBAM attention module is added behind each of stage1 to stage4 in the ResNet50 model; a full connection layer is added at the last of the model, and a dropout layer is added between the two full connection layers. The problem of gradient disappearance caused by increase of the depth of the network is effectively prevented, the nonlinear expression ability of the network is improved, the size of a receptive field is kept, the calculated amount is reduced while information transmission is ensured, and the over-fitting phenomenon is effectively inhibited.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of ultrasonic detection technology, and in particular to an ultrasonic ranging and direction finding method based on deep learning. Background Art

[0002] With the continuous progress and development of science and technology, research on ultrasonic detection has received more and more attention, and related technologies have also developed rapidly. Ultrasonic detection refers to the continuous collection and detection of external environmental information through the installation of ultrasonic sensors, and the processing of the collected information, so as to achieve real-time detection, perception, positioning and tracking of objects.

[0003] Ultrasonic detection has strong anti-interference capabilities and is not easily affected by common environmental factors. For example, it can work normally in foggy weather when lidar and visual detection cannot function.

[0004] In recent years, with the rapid development of computer artificial intelligence, deep learning has made rapid progress in most fields and has been widely used. Acoustic wave positioning algorithms based on deep learning have also begun to attract the attention of relevant researchers. Compared with traditional algorithms, algorithms based on deep learning have higher recognition accuracy and stronger robustness, which provides research conditions for the development of this field.

[0005] Research on the classification of ultrasonic signals based on deep learning technology is currently mainly in the field of material detection. For example, deep learning models are used to classify detection signals to determine features such as defect location or size. There are few applications of ultrasonic detection of the surrounding environment, and the detection of the environment only classifies the types of the environment and objects. There is a lack of research on the perception of the specific location of surrounding objects.

[0006] According to the propagation characteristics of ultrasound, the echo characteristics of ultrasound are related to factors such as propagation distance, transmission and reception angles, and detection targets. For example, the longer the propagation distance, the weaker the echo intensity. It is for these reasons that the application of deep learning in ultrasonic environmental perception is possible. This research can improve the accuracy of ultrasonic environmental perception and expand its scope of application. It can be used as an auxiliary technology for detection and positioning technologies such as lidar, vision, and millimeter-wave radar in the fields of unmanned vehicles, drones, and detection robots, so as to achieve a more universal, more accurate, and wider range of applications. Summary of the invention

[0007] In view of the above-mentioned problems in the prior art and the excellent performance of deep learning in image processing, the present invention utilizes a deep learning model to process the echo signal waveform received by the ultrasonic ranging and direction finding system to achieve the purpose of ultrasonic ranging and direction finding.

[0008] The technical solution adopted by the present invention is as follows:

[0009] An ultrasonic ranging and direction finding method based on deep learning comprises the following steps:

[0010] S1, simulate the echo signal waveform when the ultrasonic transducer detects an object, and create waveform data sets with distance and direction as labels respectively;

[0011] S2. Take the ResNet50 model as the basic model and improve it according to the characteristics of the waveform dataset with distance and direction as labels to obtain the improved ResNet50 network:

[0012] Replace the 7*7 convolution kernel of the first layer of ResNet50 with three 3*3 convolution kernels, add a CBAM attention module at the end of Stage1, stage2, stage3, and stage4 of the ResNet50 model, add another fully connected layer after the last fully connected layer of the model, and add a Dropout layer between the two fully connected layers;

[0013] S3. Divide the distance data set and the direction data set into a training set and a test set, set the network model hyperparameters, select the loss function and optimizer, input the training set into the corresponding improved ResNet50 model for model training, and then input the test set into the model for testing after the training is completed.

[0014] Preferably, the waveform diagram in step S1 includes:

[0015] The waveform diagram of the echo signal reflected back after the ultrasonic wave propagates at different distances, and the waveform diagram of the echo signal reflected back after the ultrasonic wave is emitted by the ultrasonic transducer at different angles away from the central axis of the transducer.

[0016] Preferably, the waveform data set in step S1 includes:

[0017] The distance data set includes 11 categories. The signal transmission deviation angles of each category are the same, and the propagation distances are 100mm, 105mm, 110mm, 115mm, 120mm, 125mm, 130mm, 135mm, 140mm, 145mm, and 150mm respectively;

[0018] The direction dataset includes 11 categories. The signal propagation distance of each category is the same, and the transmission deviation angles are 0°, 1°, 2°, 3°, 4°, 5°, 6°, 7°, 8°, 9°, and 10° respectively.

[0019] Preferably, the improved ResNet50 network in step S2 includes:

[0020] 5 stages, namely stage0-stage4, a global average pooling layer, a fully connected layer 1, a Dropout layer, and a fully connected layer 2;

[0021] Stage 0: Replace the original 7*7 convolution with three 3*3 convolution layers, batch normalization layer, ReLU activation function, and maximum pooling layer; the convolution step size of the first and second convolution layers is 1, that is, stride = 1, and the convolution step size of the third convolution layer is 2, that is, stride = 2, that is, the third convolution layer reduces the spatial dimension of the feature map by one half; the batch normalization layer, also known as the BN layer, is a regularization technology that can accelerate training and make the back propagation of gradients more stable; the ReLU activation function converts input to output, introduces nonlinearity, and increases the network's expression ability; the pooling kernel of the maximum pooling layer is 3*3, and the pooling step size is 2, that is, stride = 2, which reduces the spatial dimension of the feature map by another half;

[0022] The calculation formula of the convolutional layer is as follows:

[0023]

[0024] Where X represents the input shape is a tensor of shape (C, H, W), p represents the padding value, k represents the size of the convolution kernel, and s represents the convolution step size;

[0025] The calculation formula of the batch normalization layer is as follows:

[0026]

[0027]

[0028]

[0029]

[0030] Among them, μ B represents the mean, x i represents input, m represents mini-batchsize, represents the variance, represents the normalized input, y i represents the output, γ represents the scaling value, and β represents the bias value;

[0031] The calculation formula of the ReLU activation function is:

[0032]

[0033] The calculation formula of the maximum pooling layer is:

[0034] Y(c,h,w)=max{X[(h-1)*s:h*s,w-1:w,c]} (7)

[0035] Where Y(c, h, w) represents the element of the cth channel, hth row, and wth column of the output data, X[(h-1)*s:h*s,w-1:w,c] represents the window from the h-1th row to the h*sth row and the w-1th column to the wth column of the cth channel of the input data, and s represents the stride;

[0036] In general, an input image of shape (C, H, W) passes through stage0 and finally obtains an output of shape (64, H / 2, W / 2);

[0037] Stage 1: It consists of three Bottleneck modules and one CBAM attention module. The three Bottleneck modules are divided into two different structures, named Bottleneck1 and Bottleneck2. Bottleneck1 is used to change the network dimension, and Bottleneck2 is used to deepen the network.

[0038] Bottleneck1 consists of 4 convolutional layers, 4 batch normalization layers and 3 ReLU activation functions. After Bottleneck1, the number of output channels is changed again; Bottleneck2 consists of 3 convolutional layers, 3 batch normalization layers and 3 ReLU activation functions. After Bottleneck2, the number of channels remains unchanged; CBAM is a lightweight convolutional attention module that combines the channel attention module and the spatial attention module. The CBAM attention module helps to enhance the feature representation of different channels and extract key information at different positions in the space;

[0039] Stage2-stage4: The structures of stage2, stage3, and stage4 are similar to that of stage1, all of which are composed of Bottleneck1 and Bottleneck2. Stage2 consists of 1 Bottleneck1 and 3 Bottleneck2s, stage3 consists of 1 Bottleneck1 and 5 Bottleneck2s, and stage4 consists of 1 Bottleneck1 and 2 Bottleneck2s.

[0040] Average pooling layer: add all pixel values ​​of the feature map and average them, and use the average value to represent the corresponding feature map. The calculation formula is:

[0041] Y(c,h,w)=mean{X[(h-1)*s:h*s,w-1:w,c]} (8)

[0042] Fully connected layer 1: halve the number of channels;

[0043] Dropout layer: Temporarily and randomly removes some neural network training units to prevent overfitting;

[0044] Fully connected layer 2: Converts the output of the above network into prediction result output.

[0045] Preferably, the parameters of Bottleneck 1 in stage 1 and Bottleneck 1 in stage 2-4 are different:

[0046] Step size s: The s of Bottleneck1 in stage1 is 1, which means no downsampling is performed and the input size and output size are the same; the s of Bottleneck1 in stage2-stage4 is 2, which means downsampling is performed and the output size is half of the input size;

[0047] Number of channels C1: The C1 of Bottleneck1 in stage1 is equal to the number of input channels C, which means that the corresponding convolution operation does not reduce the number of channels; the C1 of Bottleneck1 in stage2-stage4 is half of C, which means that the corresponding convolution reduces the number of channels.

[0048] Preferably, the stage0 changes the number of channels from 3 to 64, the stage1 changes the number of channels from 64 to 256, the stage2 changes the number of channels from 64 to 512, the stage3 changes the number of channels from 512 to 1024, the stage4 changes the number of channels from 1024 to 2048, the fully connected layer 1 changes the number of channels from 2048 to 1024, and the fully connected layer 2 changes the number of channels from 1024 to 11.

[0049] Preferably, the CBAM attention module is specifically composed of a channel attention module and a spatial attention module:

[0050] Channel attention module: It consists of a maximum pooling layer, an average pooling layer, a fully connected layer, and a sigmoid activation function. Its structural diagram is shown in the attached figure, and its calculation formula is as follows:

[0051]

[0052] The input feature map is passed through a parallel maximum pooling layer and an average pooling layer to change the feature map size to (C, 1, 1); then it passes through a shared multi-layer perceptron sharedMLP to first reduce the number of channels and then expand it to the original number of channels; then it passes through a ReLU activation function to obtain two different results, and then these two results are added; then it passes through a sigmoid activation function to obtain the output result; then this output result is multiplied by the original feature map as the input of the spatial attention module;

[0053] Spatial attention module: It consists of a maximum pooling layer, an average pooling layer, a convolutional layer, and a sigmoid activation function. Its structural diagram is shown in the attached figure, and its calculation formula is as follows:

[0054]

[0055] The previous output is passed through the maximum pooling layer and the average pooling layer to obtain two (1, H, W) feature maps; the two feature maps are then concatenated; the number of feature map channels is changed to 1 through convolution; a sigmoid activation function is then used to obtain the output feature map; and finally the result is multiplied by the original feature map to change the size back to (C, H, W).

[0056] Preferably, the dropout layer parameter values ​​take different values ​​according to the different characteristics of the distance data set and the direction data set:

[0057] When training the distance dataset, the value is 0.49, and when training the direction dataset, the value is 0.41.

[0058] Preferably, the information of the model training described in step S3 is:

[0059] Use the improved ResNet50 network described in step S2, set the learning rate to 0.001, select the SGDM optimizer as the optimizer, and select the cross entropy loss function as the loss function;

[0060] The calculation formula of SGDM is as follows:

[0061] θ t+1 =θ t -ηm t (11)

[0062] in:

[0063]

[0064] Among them, for each optimization t, the network parameter is specified as θ t , the loss function is J(θ t ), η represents the learning rate, m t represents momentum, β 1is a constant of 0.9;

[0065] The calculation formula of the cross entropy loss function is as follows:

[0066] For a discrete random variable x~p(x), its discrete entropy can be defined as:

[0067] H(x)=-∑ x∈x p(x)log 2 p(x) (13)

[0068] Where x is a discrete random variable, p(x) is the probability mass function of x;

[0069] The calculation formula of the cross entropy loss function is:

[0070]

[0071] Among them, y i is the true label of class i, p i is the probability value of class i, k is the number of classes, and N is the number of samples.

[0072] Preferably, L2 regularization is enabled in the SGDM optimizer, and the L2 regularization coefficient is set to 0.001. Each time the parameters are updated, the optimizer automatically adds the L2 regularization term to the gradient.

[0073] The present invention has the following characteristics and advantages:

[0074] 1. The present invention analyzes and determines the ultrasonic echo signal waveform based on deep learning, provides a software judgment method for the propagation time of ultrasonic waves, and realizes the use of a single ultrasonic transducer to make a preliminary judgment on the direction of the obstacle, thereby further realizing the azimuth detection of the object.

[0075] 2. The deep learning model adopted in the present invention is improved based on the residual network ResNet50, which can effectively prevent the gradient vanishing problem caused by the increase of network depth.

[0076] 3. The original 7*7 convolution of ResNet50 is replaced by three 3*3 convolutions, which increases the nonlinear expression ability of the network and maintains the receptive field size.

[0077] 4. The present invention adds a CBAM attention module after each stage1-stage4 in the ResNet50 model, which can be used to focus on more useful features, help extract key features and suppress useless information, ensure information transmission while reducing the amount of calculation.

[0078] 5. Adding the dropout layer and introducing L2 regularization in the optimizer can effectively suppress overfitting. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] Figure 1 It is the ultrasonic transducer and its hardware structure;

[0080] Figure 2 It is the MCU system workflow diagram;

[0081] Figure 3 This is the original ResNet50 network structure diagram;

[0082] Figure 4 It is a network structure diagram of the improved ResNet50 described in the present invention;

[0083] Figure 5 It is a diagram of the Bottleneck1 network structure in the ResNet50 model of the present invention;

[0084] Figure 6 It is a diagram of the Bottleneck2 network structure in the ResNet50 model of the present invention;

[0085] Figure 7 It is a schematic diagram of the structure of the CBAM attention module of the present invention;

[0086] Figure 8 It is a schematic diagram of the structure of the channel attention in the CBAM attention module of the present invention;

[0087] Fig. 9 It is a schematic diagram of the structure of spatial attention in the CBAM attention module of the present invention;

[0088] Fig.10 is an example diagram of an echo signal waveform in the distance data set described in the present invention;

[0089] Fig.11 is an example diagram of an echo signal waveform in the directional data set described in the present invention;

[0090] Fig.12 is a Loss result graph of the training set of the distance data set of the test example of the present invention;

[0091] Fig.13 is an Accuracy result graph of the training set of the distance data set of the test example of the present invention;

[0092] Fig.14 is a Loss result graph of the training set of the directional data set of the test example of the present invention;

[0093] Fig.15 is an Accuracy result graph of the training set of the direction data set of the test example of the present invention;

[0094] Fig.16 is an Accuracy result graph of the validation set of the distance data set of the test example of the present invention;

[0095] Fig.17 It is an Accuracy result diagram of the verification set of the direction data set of the test example of the present invention. DETAILED DESCRIPTION

[0096] The present invention will be further described below in conjunction with the accompanying drawings. It should be noted that this embodiment is based on the technical solution and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to this embodiment.

[0097] Ultrasonic transducer and its hardware structure in ultrasonic ranging and direction finding system Figure 1 As shown, the control and acquisition interface leads to the system control mainboard. The power supply unit is responsible for providing appropriate voltage to the drive unit and the analog signal processing unit. The drive unit is responsible for receiving the control of the mainboard and using high voltage to drive the ultrasonic transducer to send ultrasonic waves. The analog signal processing unit is responsible for processing the waveform information output by the ultrasonic transducer, converting it into a signal suitable for ADC acquisition, and connecting it to the control mainboard for acquisition and analysis.

[0098] The overall MCU system implementation process is as follows Figure 2 shown.

[0099] The data processed by the present invention is the ultrasonic echo signal collected by the above system.

[0100] The deep learning model of the present invention adopts the ResNet50 model and improves it: the CBAM attention mechanism is added to the model to focus on more useful features, which helps to extract key features and suppress useless information; the dropout layer is introduced to randomly inactivate some neurons to achieve the purpose of suppressing overfitting. During the model training process, the learning rate is set to 0.001, the SGDM optimizer is selected, and L2 regularization is enabled in the SGDM optimizer to further suppress overfitting, and the L2 regularization coefficient is set to 0.001.

[0101] Invention point:

[0102] 1. The present invention adopts deep learning technology and utilizes the improved ResNet50 model to realize ultrasonic ranging and direction finding.

[0103] 2. The improved ResNet50 model is used to process ultrasonic echo signals, which improves the ranging accuracy. The average absolute error of ranging is less than 0.91mm; at the same time, the average absolute error of direction finding is less than 0.21°.

[0104] 3. The improvement method of the ResNet50 model in the present invention is: replace the original 7*7 convolution of ResNet50 with three 3*3 convolutions, which increases the nonlinear expression ability of the network; add a CBAM attention module after each stage1-4 in the ResNet50 model; add a fully connected layer at the end of the model, and add a dropout layer between the two fully connected layers. Fig.16 and Fig.17 As shown in the figure, adding the CBAM attention module speeds up the convergence speed and improves the accuracy stability of the validation set. Adding a fully connected layer at the end of the model and adding a dropout layer between the two fully connected layers eliminates the overfitting phenomenon of the distance model and weakens the overfitting phenomenon of the direction model. The validation set accuracy of the distance model is improved from about 0.75 to above 0.81, which is the same level as the test set accuracy. The validation set accuracy of the direction model is improved from about 0.78 to above 0.81.

[0105] The ultrasonic ranging and direction finding method based on deep learning includes the following steps:

[0106] S1, simulate the echo signal waveform when the ultrasonic transducer detects an object, and create waveform data sets with distance and direction as labels respectively;

[0107] Preferably, step S1 specifically includes the following steps:

[0108] According to the propagation characteristics of ultrasound, Matlab is used to simulate the waveform of the echo signal reflected after ultrasound propagates at different distances and the waveform of the echo signal reflected by the ultrasound transducer at different angles away from the central axis of the transducer. The distance data set includes 11 categories, and the distances are 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, and 150 mm respectively; the direction data set includes 11 categories, and the signal propagation distances of each category are the same, and the emission deviation angles are 0°, 1°, 2°, 3°, 4°, 5°, 6°, 7°, 8°, 9°, and 10° respectively. In the data set, all images are 875*656*3 in size. Before training, the images in the dataset are preprocessed. First, the image size is adjusted to 219*164*3 to reduce the image size and shorten the training time. Then the image is converted into a PyTorch tensor and the image channel dimension is changed from 219*164*3 to 3*219*164 to adapt to the network model input format.

[0109] S2. Take the ResNet50 model as the basic model and improve it according to the characteristics of the two datasets:

[0110] Replace the 7*7 convolution kernel of the first layer of ResNet50 with three 3*3 convolution kernels, add a CBAM attention module at the end of Stage1, stage2, stage3, and stage4 of the ResNet50 model, add another fully connected layer after the last fully connected layer of the model, and add a Dropout layer between the two fully connected layers.

[0111] Preferably, the improved ResNet50 network described in step S2 includes 5 stages, a global average pooling layer, a fully connected layer 1, a Dropout layer, and a fully connected layer 2 in sequence:

[0112] Stage 0: Replace the original 7*7 convolution with three 3*3 convolution layers, batch normalization layer, ReLU activation function, and maximum pooling layer. The convolution step size of the first and second convolution layers is 1, i.e., stride=1, and the convolution step size of the third convolution layer is 2, i.e., stride=2, which means that the third convolution layer reduces the spatial dimension of the feature map by half; the batch normalization layer, also known as the BN layer, is a regularization technology that can accelerate training and make the back propagation of gradients more stable; the ReLU activation function converts input to output, introduces nonlinearity, and increases the network's expressiveness; the pooling kernel of the maximum pooling layer is 3*3, and the pooling step size is 2, i.e., stride=2, which reduces the spatial dimension of the feature map by half again.

[0113] The calculation formula of the convolutional layer is as follows:

[0114]

[0115] Where X represents the input shape as a tensor of shape (C, H, W), p represents the padding value, k represents the size of the convolution kernel, and s represents the convolution step.

[0116] The calculation formula of the batch normalization layer is as follows:

[0117]

[0118]

[0119]

[0120]

[0121] Among them, μ B represents the mean, x i represents input, m represents mini-batchsize, represents the variance, represents the normalized input, y irepresents the output, γ represents the scaling value, and β represents the bias value.

[0122] The calculation formula of the ReLU activation function is:

[0123]

[0124] The calculation formula of the maximum pooling layer is:

[0125] Y(c,h,w)=max{X[(h-1)*s:h*s,w-1:w,c]} (21)

[0126] Among them, Y(c, h, w) represents the element of the cth channel, hth row, and wth column of the output data, X[(h-1)*s:h*s,w-1:w,c] represents the window from the h-1th row to the h*sth row and the w-1th column to the wth column of the cth channel of the input data, and s represents the stride.

[0127] In general, an input image of shape (3, 219, 164) passes through stage0 and finally obtains an output of shape (64, 219 / 2, 164 / 2).

[0128] Stage1: stage1 consists of 3 Bottleneck modules and 1 CBAM attention module. The 3 Bottleneck modules are divided into two different structures, named Bottleneck1 and Bottleneck2. Bottleneck1 is used to change the network dimension, and Bottleneck2 is used to deepen the network. Bottleneck1 consists of 4 convolutional layers, 4 batch normalization layers, and 3 ReLU activation functions. After Bottleneck1, the number of output channels is changed again; Bottleneck2 consists of 3 convolutional layers, 3 batch normalization layers, and 3 ReLU activation functions. After Bottleneck2, the number of channels remains unchanged. CBAM is a lightweight convolutional attention module that combines the channel attention module and the spatial attention module. The CBAM attention module helps to enhance the feature representation of different channels and extract key information at different positions in space.

[0129] Stage2-stage4: The structures of stage2, stage3, and stage4 are similar to that of stage1, all of which are composed of Bottleneck1 and Bottleneck2. Stage2 consists of 1 Bottleneck1 and 3 Bottleneck2s, stage3 consists of 1 Bottleneck1 and 5 Bottleneck2s, and stage4 consists of 1 Bottleneck1 and 2 Bottleneck2s.

[0130] Average pooling layer: add all pixel values ​​of the feature map and average them, and use the average value to represent the corresponding feature map. The calculation formula is:

[0131] Y(c,h,w)=mean{X[(h-1)*s:h*s,w-1:w,c]} (22)

[0132] Fully connected layer 1: The number of channels is halved.

[0133] Dropout layer: Temporarily and randomly removes a portion of the neural network training units to prevent overfitting.

[0134] Fully connected layer 2: Converts the output of the above network into prediction result output.

[0135] Preferably, the original 7*7 convolution of ResNet50 is replaced with three 3*3 convolutions, which increases the nonlinear expression ability of the network and maintains the receptive field size.

[0136] Preferably, the parameters of Bottleneck1 in stage1 and Bottleneck1 in stage2-4 are different:

[0137] Step size s: The s of Bottleneck1 in stage1 is 1, which means no downsampling is performed and the input size and output size are the same; the s of Bottleneck1 in stage2-stage4 is 2, which means downsampling is performed and the output size is half of the input size.

[0138] Number of channels C1: The C1 of Bottleneck1 in stage1 is equal to the number of input channels C, which means that the corresponding convolution operation does not reduce the number of channels; the C1 of Bottleneck1 in stage2-stage4 is half of C, which means that the corresponding convolution reduces the number of channels.

[0139] Preferably, stage0 changes the number of channels from 3 to 64, stage1 changes the number of channels from 64 to 256, stage2 changes the number of channels from 64 to 512, stage3 changes the number of channels from 512 to 1024, stage4 changes the number of channels from 1024 to 2048, fully connected layer 1 changes the number of channels from 2048 to 1024, and fully connected layer 2 changes the number of channels from 1024 to 11.

[0140] Preferably, the added CBAM attention module is specifically composed of a channel attention module and a spatial attention module:

[0141] Channel attention module: It consists of a maximum pooling layer, an average pooling layer, a fully connected layer, and a sigmoid activation function. The calculation formula is as follows:

[0142]

[0143] The input feature map is passed through parallel maximum pooling layers and average pooling layers to change the feature map size to (C, 1, 1); then it passes through a shared multi-layer perceptron (sharedMLP) to first reduce the number of channels and then expand it to the original number of channels; then it passes through a ReLU activation function to obtain two different results, and then these two results are added; then it passes through a sigmoid activation function to obtain the output result; then this output result is multiplied by the original feature map as the input of the spatial attention module.

[0144] Spatial attention module: It consists of a maximum pooling layer, an average pooling layer, a convolutional layer, and a sigmoid activation function. The calculation formula is as follows:

[0145]

[0146] The previous output is passed through the maximum pooling layer and the average pooling layer to obtain two (1, H, W) feature maps; the two feature maps are then concatenated; the number of feature map channels is changed to 1 through convolution; a sigmoid activation function is then used to obtain the output feature map; and finally the result is multiplied by the original feature map to change the size back to (C, H, W).

[0147] Preferably, the dropout layer parameter value takes different values ​​according to the different characteristics of the distance dataset and the direction dataset: 0.49 is taken when training the distance dataset, and 0.41 is taken when training the direction dataset.

[0148] S3. Set the network model hyperparameters, select the loss function and optimizer, input the distance dataset training set and the direction dataset training set into the corresponding improved ResNet50 model for model training, and obtain the distance training model and the direction training model.

[0149] Preferably, the model training information described in step S3 is to use the improved ResNet50 network described in step S2, set the learning rate to 0.001, select the SGDM optimizer as the optimizer, and select the cross entropy loss function as the loss function.

[0150] The calculation formula of SGDM is as follows:

[0151] θ t+1 =θ t -ηm t (25)

[0152] in:

[0153]

[0154] Among them, for each optimization t, the network parameter is specified as θ t , the loss function is J(θ t ), η represents the learning rate, m t represents momentum, β 1 is a constant (0.9).

[0155] The calculation formula of the cross entropy loss function is as follows:

[0156] For a discrete random variable x~p(x), its discrete entropy can be defined as:

[0157] H(x)=-∑ x∈x p(x)log 2 p(x) (27)

[0158] Where x is a discrete random variable and p(x) is the probability mass function of x.

[0159] The calculation formula of the cross entropy loss function is:

[0160]

[0161] Among them, y i is the true label of class i, p i is the probability value of class i, k is the number of classes, and N is the number of samples.

[0162] Preferably, L2 regularization is enabled in the SGDM optimizer, and the L2 regularization coefficient is set to 0.001. Each time the parameters are updated, the optimizer automatically adds the L2 regularization term to the gradient, thereby achieving the effect of suppressing overfitting.

[0163] Test Case

[0164] In this experiment, the training initialized the model weights and the hyperparameters were set as follows: the learning rate was set to 0.001, the training batch size was set to 10, and the number of iterations was set to 50.

[0165] like Fig.10 and Fig.11 As shown in , as the number of iterations increases, the loss value decreases, the accuracy increases, and finally stabilizes. After 50 iterations, the final loss and accuracy of the training set are 0.5593 and 0.8177 respectively. Fig.14 As shown in Table 1, the final accuracy of the validation set is 0.8173. The data category judgment of the validation set using the model after 50 training iterations is shown in Table 1:

[0166] Table 1

[0167]

[0168]

[0169] like Fig.12 and Fig.13 As shown in , as the number of iterations increases, the loss value decreases, the accuracy increases, and finally stabilizes. After 100 iterations, the final loss and accuracy of the training set are 0.0009 and 1.0000 respectively. Fig.15 As shown in Table 2, the final accuracy of the validation set is 0.8127. The data category judgment of the validation set using the model after 100 training iterations is shown in Table 2:

[0170] Table 2

[0171]

[0172] The embodiments described above are only descriptions of the preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.

Claims

1. An ultrasonic ranging and direction finding method based on deep learning, It is characterized in that The following steps are involved: S1, simulate the echo signal waveform when the ultrasonic transducer detects an object, and create waveform data sets with distance and direction as labels respectively; S2, taking the ResNet50 model as the basic model, and improving it according to the characteristics of the waveform dataset with distance and direction as labels, to obtain the improved ResNet50 network; S3. Divide the distance data set and the direction data set into a training set and a test set, set the network model hyperparameters, select the loss function and optimizer, input the training set into the corresponding improved ResNet50 model for model training, and then input the test set into the model for testing after the training is completed.

2. The method according to claim 1, It is characterized in that The waveform diagram in step S1 includes: The waveform diagram of the echo signal reflected back after the ultrasonic wave propagates at different distances, and the waveform diagram of the echo signal reflected back after the ultrasonic wave is emitted by the ultrasonic transducer at different angles away from the central axis of the transducer.

3. The method according to claim 1, It is characterized in that The waveform data set in step S1 includes: The distance data set includes 11 categories. The signal transmission deviation angles of each category are the same, and the propagation distances are 100mm, 105mm, 110mm, 115mm, 120mm, 125mm, 130mm, 135mm, 140mm, 145mm, and 150mm respectively; The direction dataset includes 11 categories. The signal propagation distance of each category is the same, and the transmission deviation angles are 0°, 1°, 2°, 3°, 4°, 5°, 6°, 7°, 8°, 9°, and 10° respectively.

4. The method according to claim 1, It is characterized in that The improved ResNet50 network in step S2 includes: 5 stages, namely stage0-stage4, a global average pooling layer, a fully connected layer 1, a Dropout layer, and a fully connected layer 2; Stage 0: Replace the original 7*7 convolution with three 3*3 convolution layers, batch normalization layer, ReLU activation function, and maximum pooling layer; the convolution step size of the first and second convolution layers is 1, that is, stride = 1, and the convolution step size of the third convolution layer is 2, that is, stride = 2, that is, the third convolution layer reduces the spatial dimension of the feature map by one half; the batch normalization layer, also known as the BN layer, is a regularization technology that can accelerate training and make the back propagation of gradients more stable; the ReLU activation function converts input to output, introduces nonlinearity, and increases the network's expression ability; the pooling kernel of the maximum pooling layer is 3*3, and the pooling step size is 2, that is, stride = 2, which reduces the spatial dimension of the feature map by another half; The calculation formula of the convolutional layer is as follows: Where X represents the input shape as a tensor of shape (C, H, W), p represents the padding value, k represents the size of the convolution kernel, and s represents the convolution step size; The calculation formula of the batch normalization layer is as follows: Among them, μ B represents the mean, x i represents input, m represents mini-batch size, represents the variance, represents the normalized input, y i represents the output, γ represents the scaling value, and β represents the bias value; The calculation formula of the ReLU activation function is: The calculation formula of the maximum pooling layer is: Y(c,h,w)=max{X[(h-1)*s:h*s,w-1:w,c]} (7) Where Y(c, h, w) represents the element of the cth channel, hth row, and wth column of the output data, X[(h-1)*s:h*s,w-1:w,c] represents the window from the h-1th row to the h*sth row and the w-1th column to the wth column of the cth channel of the input data, and s represents the stride; In general, an input image of shape (C, H, W) passes through stage0 and finally obtains an output of shape (64, H / 2, W / 2); Stage 1: It consists of three Bottleneck modules and one CBAM attention module. The three Bottleneck modules are divided into two different structures, named Bottleneck1 and Bottleneck2. Bottleneck1 is used to change the network dimension, and Bottleneck2 is used to deepen the network. Bottleneck1 consists of 4 convolutional layers, 4 batch normalization layers and 3 ReLU activation functions. After Bottleneck1, the number of output channels is changed again; Bottleneck2 consists of 3 convolutional layers, 3 batch normalization layers and 3 ReLU activation functions. After Bottleneck2, the number of channels remains unchanged; CBAM is a lightweight convolutional attention module that combines the channel attention module and the spatial attention module. The CBAM attention module helps to enhance the feature representation of different channels and extract key information at different positions in the space; Stage2-stage4: The structures of stage2, stage3, and stage4 are similar to those of stage1, all of which are composed of Bottleneck1, Bottleneck2, and CBAM attention modules. Stage2 consists of 1 Bottleneck1 and 3 Bottleneck2s, stage3 consists of 1 Bottleneck1 and 5 Bottleneck2s, and stage4 consists of 1 Bottleneck1 and 2 Bottleneck2s. Average pooling layer: add all pixel values ​​of the feature map and average them, and use the average value to represent the corresponding feature map. The calculation formula is: Y(c,h,w)=mean{X[(h-1)*s:h*s,w-1:w,c]} (8) Fully connected layer 1: halve the number of channels; Dropout layer: Temporarily and randomly removes some neural network training units to prevent overfitting; Fully connected layer 2: Converts the output of the above network into prediction result output.

5. The method according to claim 4, It is characterized in that The parameters of Bottleneck1 in stage1 and Bottleneck1 in stage2-stage4 are different: Step size s: The s of Bottleneck1 in stage1 is 1, which means no downsampling is performed and the input size and output size are the same; the s of Bottleneck1 in stage2-stage4 is 2, which means downsampling is performed and the output size is half of the input size; Number of channels C1: The C1 of Bottleneck1 in stage1 is equal to the number of input channels C, which means that the corresponding convolution operation does not reduce the number of channels; the C1 of Bottleneck1 in stage2-stage4 is half of C, which means that the corresponding convolution reduces the number of channels.

6. The method according to claim 4, It is characterized in that The stage0 changes the number of channels from 3 to 64, the stage1 changes the number of channels from 64 to 256, the stage2 changes the number of channels from 64 to 512, the stage3 changes the number of channels from 512 to 1024, the stage4 changes the number of channels from 1024 to 2048, the fully connected layer 1 changes the number of channels from 2048 to 1024, and the fully connected layer 2 changes the number of channels from 1024 to 11.

7. The method according to claim 4, It is characterized in that The CBAM attention module is specifically composed of a channel attention module and a spatial attention module: Channel attention module: It consists of a maximum pooling layer, an average pooling layer, a fully connected layer, and a sigmoid activation function. Its structural diagram is shown in the attached figure, and its calculation formula is as follows: The input feature map is passed through a parallel maximum pooling layer and an average pooling layer to change the feature map size to (C, 1, 1); then it passes through a shared multi-layer perceptron sharedMLP to first reduce the number of channels and then expand it to the original number of channels; then it passes through a ReLU activation function to obtain two different results, and then these two results are added; then it passes through a sigmoid activation function to obtain the output result; then this output result is multiplied by the original feature map as the input of the spatial attention module; Spatial attention module: It consists of a maximum pooling layer, an average pooling layer, a convolutional layer, and a sigmoid activation function. Its structural diagram is shown in the attached figure, and its calculation formula is as follows: The previous output is passed through the maximum pooling layer and the average pooling layer to obtain two (1, H, W) feature maps; the two feature maps are then concatenated; the number of feature map channels is changed to 1 through convolution; a sigmoid activation function is then used to obtain the output feature map; and finally the result is multiplied by the original feature map to change the size back to (C, H, W).

8. The method according to claim 4, It is characterized in that The dropout layer parameter takes different values ​​according to different characteristics of the distance data set and the direction data set.

9. The method according to claim 1, It is characterized in that The information of the model training described in step S3 is: Use the improved ResNet50 network described in step S2, set the learning rate to 0.001, select the SGDM optimizer as the optimizer, and select the cross entropy loss function as the loss function; The calculation formula of SGDM is as follows: i t+1 =θ t -m t (11) in: Among them, for each optimization t, the network parameters are specified as θ t , the loss function is J(θ t ), η represents the learning rate, m t represents momentum, β 1 is a constant of 0.9; The calculation formula of the cross entropy loss function is as follows: For a discrete random variable x~p(x), its discrete entropy can be defined as: H(x)=-∑ x∈x p(x)log 2 p(x) (13) Where x is a discrete random variable, p(x) is the probability mass function of x; The calculation formula of the cross entropy loss function is: Among them, y i is the true label of class i, p i is the probability value of class i, k is the number of classes, and N is the number of samples.

10. The method according to claim 9, It is characterized in that L2 regularization is enabled in the SGDM optimizer, and the L2 regularization coefficient is set to 0.

001. Each time the parameters are updated, the optimizer automatically adds the L2 regularization term to the gradient.

Citation Information

Cited By

  • RPA automation method, system and equipment based on improved fast regional convolutional neural network model, and medium

    CN119863689A