A method for underwater acoustic biological target recognition based on attention mechanism
Through a convolutional neural network model based on the attention mechanism, the problem of inaccurate feature extraction under noise interference in underwater acoustic biological target recognition is solved, and higher recognition accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202510421665.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-04-07
AI Technical Summary
Existing underwater acoustic biological target recognition methods have difficulty in effectively distinguishing key sounds from noise in complex noise environments, resulting in deviations in recognition accuracy.
A convolutional neural network model based on the attention mechanism is adopted to extract the underwater acoustic signal features of different scale spaces through the channel attention mechanism, enhance the attention to key audio features, and construct an ACNN model for feature extraction and classification.
It improves the target recognition accuracy under complex noise interference conditions, enhances the robustness and generalization ability of the model, and improves the classification performance.
Smart Images

Figure CN120126489B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of underwater acoustic biological target recognition, and in particular relates to an underwater acoustic biological target recognition method based on an attention mechanism. Background Art
[0002] Sound waves are widely considered the best information carrier for sensing and identifying underwater targets. They are the only known form of energy that can propagate long distances in water. Underwater acoustic biotarget recognition technology has important applications in marine ecological protection, fisheries management, and marine biodiversity research, and has become a hot topic of research. However, the high noise and interference environment of the ocean, the complex underwater acoustic propagation channels, and the scarcity of data resources pose significant challenges to underwater acoustic target recognition.
[0003] Early underwater acoustic target recognition was primarily achieved using machine learning algorithms, including hidden Markov models (HMMs), support vector machines (SVMs), Gaussian mixture models (GMMs), and decision trees (DTs). In 2018, Shameer K. Mohammed et al. proposed an underwater target classifier based on GTCC and a 20-state HMM and evaluated it on measured data. However, the HMM parameter estimation process is complex and requires a large number of data samples, making it unlikely to meet the requirements for practical target recognition tasks. In 2014, Parada et al. used an unpredictability measure and the MUSIC algorithm to extract features and improve the recognition performance of the GMM. However, for large-scale underwater biological audio datasets, GMM training can be very lengthy and may not meet real-time requirements in real-time classification scenarios. In 2015, Moura et al. applied a single-class support vector machine (SVM) to passive sonar system detection to address the classification problem of sparse negative samples. However, SVM training speed is significantly slowed when processing large-scale underwater biological audio datasets. The structure of a decision tree is similar to a flowchart. It can naturally process audio data with multiple features and perform classification by sequentially judging different features. However, decision trees are prone to overfitting, and the local optimality of feature principles will affect the classification effect.
[0004] In recent years, research in deep learning theory has advanced rapidly, providing new insights for underwater biological target recognition. In 2019, Yang et al. proposed a new end-to-end neural network model for underwater acoustic target recognition—an auditory perception-inspired deep neural network. This model is used to decompose, extract features, and classify ship-radiated noise for underwater acoustic target recognition. In 2020, to reduce network complexity, Miao et al. designed a deep convolutional neural network architecture suitable for underwater acoustic signal classification, called the TF feature network, and evaluated the network's performance on two underwater acoustic target recognition datasets. In 2021, Panetta et al. proposed an underwater image enhancement network based on a generative adversarial network. This network improves the performance of trackers on underwater data by transforming the visual representation of the underwater area into an enhanced / cleared underwater domain. In 2021, Liu et al. proposed a convolutional recurrent neural network model for underwater target recognition that involves three steps: extracting three channels from the mel-spectrum log as input; employing data augmentation to expand the data in the time and time-frequency domains; and using the proposed model for automatic feature learning to identify target categories. In 2021, Xiao et al. proposed an attention-based neural network for target recognition in multi-source interference pressure spectrograms, using an attention module to detect the internal workings of the neural network. In 2023, Hauer et al. proposed the ORCA-SPY framework for fully automatic source simulation, classification, and localization of passive killer whale acoustic monitoring. By embedding this framework into PAMGuard, ORCA-SPY can be used to detect and track target signals even in noisy environments. In 2023, Xue et al. added a channel attention mechanism to the residual neural network. This channel attention mechanism can enhance stable spectral features and eliminate unstable signals caused by Doppler frequency shift. In the same year, Tang et al. proposed a new method for converting mel-spectrograms into three-dimensional data and introduced an efficient three-dimensional spectrogram network that processes the time and frequency dimensions separately. Feng et al. proposed a Transformer-based underwater acoustic target recognition model and experimentally verified that the proposed model has good accuracy performance.
[0005] In summary, the above method has achieved good performance in underwater acoustic target recognition. However, it does not distinguish between key sounds and noise when extracting features. Therefore, there is a large deviation for data interfered by complex noise in the actual ocean. Summary of the Invention
[0006] The purpose of the present invention is to provide an underwater acoustic biological target recognition method based on an attention mechanism to make up for the shortcomings of the existing technology.
[0007] The real ocean environment is complex and changeable, so the acoustic signal data obtained from the ocean environment is interfered by complex environmental noise, and there are problems such as uneven resolution, too weak target signal, uneven intensity, etc. The existing target recognition method does not distinguish between the key information of the acoustic signal and irrelevant noise when performing feature extraction. Although the results obtained when training the model have achieved good recognition performance, there is still a large deviation in target recognition under actual complex noise interference. The present invention proposes a convolutional neural network model assisted by an attention mechanism for underwater acoustic signal target recognition. Through the channel attention mechanism, the feature information of underwater acoustic signals in different scale spaces is extracted to improve the target recognition accuracy under noise interference; the audio features that are most critical to the classification task are extracted, thereby improving the classification performance.
[0008] To achieve the above object, the present invention adopts the following technical solutions:
[0009] A method for underwater acoustic biological target recognition based on an attention mechanism includes the following steps:
[0010] S1: Acquire underwater biological audio data and perform preprocessing;
[0011] S2: Extract the Mel spectrum features of the audio data and perform data enhancement using data enhancement methods;
[0012] S3: Divide the processed dataset into training set, validation set and test set;
[0013] S4: Construct an attention-based neural network model, the ACNN model, which includes an input layer, a convolutional block, an adaptive average pooling layer, a fully connected layer, a regularization layer, and an output layer. The convolutional block contains four layers, each of which includes an attention module, a convolutional layer, a ReLU activation layer, and a batch normalization layer.
[0014] S5: ACNN model validation and parameter update: Evaluate model performance on the validation set, calculate loss function and accuracy, and adjust ACNN model parameters and architecture based on the validation set results to optimize performance;
[0015] S6: Test the ACNN model after training and optimization, and compare the predicted labels with the true labels to test the recognition accuracy of the ACNN model.
[0016] Furthermore, the S1 includes:
[0017] S1-1: Acquire underwater biological audio data in WAV format; then read the audio file to obtain the audio signal and sampling rate;
[0018] S1-2: Use spectral subtraction to denoise, estimate the noise power spectrum, subtract it from the power spectrum of the audio signal, and restore the pure signal; the spectral subtraction formula is:
[0019] ;
[0020] in, is the power spectrum containing the noise frequency, is the noise power spectrum, To adjust the parameters, is the estimated pure signal power;
[0021] S1-3: Use the fixed length segmentation method to split the long audio into short segments, split the audio by a fixed length (0.02 seconds), and for the sampling rate The audio is split at ×2 sampling points;
[0022] S1-4: Use the Librosa library to implement sampling rate conversion and unify the sampling rate to ensure data consistency.
[0023] Furthermore, the S2 specifically includes:
[0024] S2-1: The audio data file is first normalized to a sampling rate so that all arrays have the same size, the audio samples are resized to have the same length, and then the original audio signal is randomly augmented.
[0025] S2-2: Convert the augmented audio into a Mel-spectrogram. The conversion formula is:
[0026] ;
[0027] ;
[0028] in Represents the original frequency, Represents the converted Mel frequency; the calculation formula of the Mel filter is as follows:
[0029] ;
[0030] in Represents the filter number, and 、 The corresponding The starting point, middle point and end point of each filter;
[0031] S2-3: When extracting audio features, each audio segment can be represented by a corresponding Mel spectrum, and a frequency band corresponding to each frame is a feature;
[0032] S2-4: After extracting the Mel spectrum features of the audio sample, it is processed using data augmentation technology, using frequency shifting and time masking.
[0033] Furthermore, in S3, the leave-one-out method is used to partition the data set, that is, when the number of samples in each category is very limited, one sample is reserved as a validation set and the rest are used for training.
[0034] Furthermore, in the S4, the convolution block contains four layers: the convolution layer (Conv1) in the first layer is set to 2 input channels, 8 output channels, and a 3×3 convolution kernel, where the height (height) and width (width) are the spatial dimensions of the convolution layer output, corresponding to the time step t and frequency dimension f of the audio feature map; the convolution layer (Conv2) in the second layer is set to 8 input channels and 16 output channels; the convolution layer (Conv3) in the third layer is set to 16 input channels and 32 output channels; the convolution layer (Conv4) in the fourth layer is set to 32 input channels and 64 output channels.
[0035] Furthermore, in S4, the data processing process includes the following steps:
[0036] S4-1: Input the data processed by S1 to S3 into the ACNN model through the input layer. The shape of the input data is: batch size × number of channels × time step × feature dimension;
[0037] S4-2: Data reaches the convolutional block: In each layer, the data first passes through the attention module, then gradually extracts audio features through the convolution layer, then introduces nonlinearity through the ReLU activation layer, and finally standardizes the output through the batch normalization layer;
[0038] S4-3: After the convolution block, the data enters the adaptive average pooling layer to reduce the spatial dimension of the feature map;
[0039] S4-4: After flattening the feature map of the pooling layer, it is mapped to the output of the number of categories through a fully connected layer;
[0040] S4-5: After the fully connected layer, a regularization layer is used to prevent overfitting.
[0041] S4-6: Finally, output through the output layer.
[0042] Furthermore, in the attention module, the audio feature data First, the input is input through the input layer. The input shape size is batch size × number of channels × time step × feature dimension. The input features are preliminarily processed through the attention vector layer to generate the attention score matrix ; After activating the dense layer, use Activation function attention score matrix Weighted, generate attention weight vector ; After activating the dense layer, there is a Gaussian layer, which converts the attention weight vector Multiply with the Gaussian kernel function to generate the Gaussian layer output vector Then, the attention module merges the output sequence of the Gaussian layer with the input sequence mask by merging the fusion layer to generate the final output vector .
[0043] Furthermore, the attention module includes:
[0044] (1) Soft mask pass The dense layer activated is implemented so that each input data sample is a length of A vector of size The attention weight vector Expressed as:
[0045] ;
[0046] in For size The attention score matrix, By CNN and Function to learn, representation The correlation between each input feature and the event of interest;
[0047] (2) Define the Gaussian layer, multiply the above with the Gaussian kernel function, and express it using matrix operations:
[0048] ;
[0049] ;
[0050] in Is the size of The output vector of the Gaussian layer, is the standard deviation of the Gaussian function;
[0051] (3) Output vector of the attention module is a vector of size f, which can be expressed by Hadamar multiplication (denoted as ⊙):
[0052] .
[0053] Furthermore, in S5, cross entropy loss is used as the loss function. There are N samples, each sample has C categories, and the predicted output of the model is , the true label is , then the calculation formula of the cross entropy loss function L is:
[0054] ;
[0055] in It is The samples belong to The true label of the class (0 or 1), The model predicts The samples belong to The probability of the class is calculated as follows:
[0056] Propagate the input data forward through the model to obtain the predicted output for each sample ; Apply softmax activation to convert the logits output by the model into a probability distribution:
[0057] ;
[0058] in The model output is Sample No. The logits value of the class; then for each sample , calculate the cross entropy loss between its predicted probability distribution and the true label distribution:
[0059] ;
[0060] The loss of all samples is averaged to get the final loss value:
[0061] ;
[0062] The gradient of the loss function with respect to the model parameters is calculated through backpropagation, and the optimizer is used to update the model parameters according to the gradient.
[0063] Compared with the prior art, the present invention has at least the following beneficial effects:
[0064] The present invention can extract key area features of audio samples when the audio samples contain complex noise, improve the robustness and generalization ability of the model, achieve a higher accuracy rate for target recognition tasks, and provide technical support for marine target recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 It is an audio classification process based on underwater acoustic target signals.
[0066] Figure 2 It is a flow chart for implementing the present invention.
[0067] Figure 3 This is a waveform diagram of an audio sample of a marine organism.
[0068] Figure 4 This is the Mel spectrum of an audio sample of a marine organism.
[0069] Figure 5 It is an attention-based model architecture for underwater biological audio classification.
[0070] Figure 6 is the confusion matrix obtained after the model is trained. DETAILED DESCRIPTION
[0071] In order to make the objectives, technical solutions and advantages disclosed in the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0072] Example 1:
[0073] The existing mainstream underwater acoustic target recognition system framework is as follows: Figure 1 As shown in the figure, the entire work process includes target signal acquisition, database creation, data preprocessing, feature extraction, and target recognition.
[0074] This embodiment provides an underwater acoustic biological target recognition method based on the attention mechanism. Figure 2 As shown, the following steps are included:
[0075] Step 1: Dataset Preparation
[0076] Collect underwater biological audio data and pre-process the audio files, perform denoising, segmentation, sampling rate conversion, etc. Take the audio dataset containing 32 kinds of marine biological sound signal files as an example, read the audio files and draw the waveform of the audio files to save them. Figure 3 This is an example waveform of an audio sample of a marine organism.
[0077] First, underwater biological audio data, namely marine biological sound signal files, are obtained from public datasets. These files cover a variety of marine life such as whales and dolphins. The audio data is in WAV format. Then, the audio processing library Librosa (Python) is used to read the audio files and obtain the audio signal and sampling rate.
[0078] Due to the complex ocean environment, underwater biological audio data is often interfered with by background noise, such as ship noise and water flow noise. This appears as a random or periodic signal, which can mask the target biological sounds and reduce recognition accuracy. Therefore, denoising is performed. The denoising method uses spectral subtraction to estimate the noise power spectrum, subtract it from the power spectrum of the audio signal, and restore the pure signal. The spectral subtraction formula is:
[0079] ;
[0080] in, is the power spectrum containing the noise frequency, is the noise power spectrum, To adjust the parameters, is the estimated pure signal power.
[0081] In order to facilitate model processing and feature extraction, a fixed-length segmentation method is used to segment long audio into short segments, and the audio is segmented by a fixed length (0.02 seconds). The audio is split at ×2 sampling points.
[0082] Since audio sampling rates vary from source to source, the Librosa library is used to implement sampling rate conversion and unify the sampling rates to ensure data consistency and facilitate model input.
[0083] Step 2: Feature Extraction
[0084] Extracts Mel-spectrogram features from audio files and performs data augmentation using data augmentation methods. During audio preprocessing, the loaded audio data files are first normalized to the sampling rate so that all arrays have the same size. After this, all audio samples are resized to the same length using either silent padding or length truncation. Finally, the original audio signal is randomly augmented by applying a time offset to shift the audio to the left or right by a random amount.
[0085] Convert the augmented audio to a Mel-scale spectrogram. The Mel-scale is a linear transformation of Hertz. For signals with Mel-scale as the unit, people can perceive signals with the same frequency difference almost the same. A commonly used conversion formula is:
[0086] ;
[0087] ;
[0088] in Represents the original frequency, Represents the converted Mel frequency. The Mel spectrum is a spectrum on the Mel scale. The original signal is preprocessed, framed and windowed, and finally obtained by multiplying the spectrum with several Mel filters. The Mel filter bank is a triangular filter bank of equal height, with the starting point of each filter at the midpoint of the previous filter. The specific calculation formula of the Mel filter is as follows:
[0089] ;
[0090] in Represents the filter number, and 、 The corresponding The starting point, middle point and end point of each filter. When extracting audio features, each audio segment can be represented by the corresponding Mel spectrum, and a frequency band corresponding to each frame is a feature. After extracting the Mel spectrum features of the audio sample, it is processed using data enhancement technology, which uses frequency shifting (randomly masking a series of continuous frequencies by adding horizontal bars to the spectrum graph) and time masking (using vertical lines to randomly block the time range from the spectrum graph). The Mel spectrum of an audio sample of a certain marine organism is as follows: Figure 4 shown.
[0091] Mel-spectrogram features are designed based on the perceptual characteristics of the human auditory system. They simulate the human ear's sensitivity to sounds of different frequencies, making the features more consistent with human perception of sound. Mel-spectrograms convert audio signals from the time domain to the frequency domain and use mel-spectrogram filter banks to reduce the dimensionality of the data, which helps reduce computational complexity and improve processing speed. Mel-spectrograms capture the global characteristics of audio signals and are robust to noise and variations in the audio signal, enabling the model to maintain good performance even in complex noisy environments.
[0092] Step 3: Dataset Partitioning
[0093] The dataset is divided into training, validation, and test sets. This paper uses the leave-one-out method for dataset partitioning. That is, when the number of samples per category is very limited, one sample is reserved for validation and the rest are used for training. This method is particularly useful when there are many categories but few samples per category.
[0094] Step 4: Build an attention-based neural network model - ACNN model
[0095] like Figure 5As shown, the ACNN model consists of an input layer, a convolutional block, an adaptive average pooling layer, a fully connected layer, a regularization layer, and an output layer. Data passes through the input layer, convolutional block, adaptive average pooling layer, fully connected layer, regularization layer, and finally output through the output layer. Data processed in steps 1, 2, and 3 is fed into the model through the input layer. The input data has the shape of batch size × number of channels × time step × feature dimension. The data then reaches the convolutional block, which contains four layers: an attention module, a convolutional layer, a ReLU activation layer, and a batch normalization layer (BatchNorm2D). In the first layer, the data first passes through the attention module to focus on important features, then through the convolutional layers to gradually extract audio features. A ReLU activation layer introduces nonlinearity, and finally a batch normalization layer normalizes the output. The convolutional layer (Conv1) in this layer is configured with 2 input channels, 8 output channels, and a 3×3 convolution kernel. The height and width represent the spatial dimensions of the convolutional layer output, corresponding to the time step t and frequency dimension f of the audio feature map. The data then enters the second layer of the convolutional block, where it again passes through the attention module, followed by the convolutional layer, activation layer, and batch normalization layer. The convolutional layer (Conv2) in the second layer is configured with 8 input channels and 16 output channels. After the output of the second layer, the data enters the third layer of the convolutional block, where the convolutional layer (Conv3) is configured with 16 input channels and 32 output channels. Finally, the data enters the fourth layer of the convolutional block, where the convolutional layer (Conv4) is configured with 32 input channels and 64 output channels. After the convolutional operations in the convolutional block, the data enters an adaptive average pooling layer to reduce the spatial dimensionality of the feature map. After flattening the feature map in the pooling layer, a fully connected layer maps the feature map to the number of class outputs. After the fully connected layer, a regularization (Dropout) layer is used to prevent overfitting. Finally, the number of categories is output through the output layer.
[0096] This model architecture progressively extracts audio features through multiple convolutional layers and uses an attention module to enhance focus on important features. Finally, classification is performed through fully connected layers and regularization (dropout) layers to improve the model's generalization and prevent overfitting. This architecture is suitable for processing time-series audio data, such as object recognition tasks. This paper will specifically describe the implementation of the attention module.
[0097] exist Figure 5 In the ACNN model architecture, is the batch size, c is the number of channels, t is the time step, f is the frequency dimension size, =16, number of task categories =32, the attention module is located in the convolution block of the model and is the first module of each layer in the convolution block. In this module, the audio feature data First, the input is input through the input layer, and the input shape and size are (batch size × number of channels × time step × feature dimension). The input features are preliminarily processed through the attention vector layer to generate the attention score matrix , this matrix is used to measure the importance of each frequency component in the input feature. Then it is activated by the dense layer using Activation function attention score matrix Weighted, generate attention weight vector , which is used to control the sensitivity of the frequency component. To prevent over-concentration, the dense layer is activated followed by a Gaussian layer, which converts the attention weight vector Multiply with the Gaussian kernel function to generate the Gaussian layer output vector The role of the Gaussian kernel function is to prevent excessive concentration of attention on a single frequency point, thereby improving the model's robustness to frequency fluctuations. For underwater organisms, in addition to continuous broadband line spectra, it also reduces the impact of Doppler shift, measurement errors and other factors on random changes in features. The attention module then merges the output sequence of the Gaussian layer with the input sequence mask to generate the final output vector The attention layer acts like a mask, retaining only features relevant to the target.
[0098] In order to build an attention module using the mask mechanism of soft attention, the most basic soft mask can be Each input data sample is realized by the activation of the dense layer. is a length of A vector of size The attention weight vector Expressed as:
[0099] ;
[0100] in For size The attention score matrix, By CNN and Function to learn, representation The correlation between each input feature and the event of interest. The stronger the correlation, the higher the score. Then define the Gaussian layer, multiply the above with the Gaussian kernel function, and express it using matrix operations:
[0101] ;
[0102] ;
[0103] in Is the size of The output vector of the Gaussian layer, that is, the attention weight layer, is the standard deviation of the Gaussian function, The larger the value, the more dispersed the attention, which helps the attention not to be overly focused on a single frequency point, thereby improving the robustness to frequency fluctuations. Finally, the output vector of the attention module is is a vector of size f, which can be expressed by Hadamar multiplication (denoted as ⊙):
[0104] .
[0105] In this model, in order to reduce overfitting, Dropout regularization is used. A Dropout layer is added after the fully connected layer of the model. During the training process, a certain proportion of neurons are randomly inactivated so that the model uses a different subset of neurons in each training iteration, thereby enhancing the generalization ability of the model.
[0106] To prevent overlearning and avoid local minima, the present invention uses the Adam optimizer to dynamically adjust the learning rate. During model training, the Adam optimizer is used to update the model parameters. The Adam optimizer automatically adjusts the learning rate for each parameter by calculating the first- and second-order moment estimates of the gradient. This allows the model to better adapt to the distribution characteristics of the data when handling classification tasks, improving the model's training efficiency and performance.
[0107] Step 5. Model validation and parameter update
[0108] Evaluate model performance on the validation set, calculate loss function and accuracy, and adjust model parameters and architecture to optimize performance based on the validation set results.
[0109] In the classification task, cross entropy loss is used as the loss function. There are N samples, each sample has C categories, and the model's predicted output is , the true label is , then the calculation formula of the cross entropy loss function L is:
[0110] ;
[0111] in It is The samples belong to The true label of the class (0 or 1), The model predicts The samples belong to The probability of the class. The calculation process is:
[0112] Propagate the input data forward through the model to obtain the predicted output for each sample ; Apply softmax activation to convert the logits output by the model into a probability distribution:
[0113] ;
[0114] in The model output is Sample No. The logits value of the class; then for each sample , calculate the cross entropy loss between its predicted probability distribution and the true label distribution:
[0115] ;
[0116] The loss of all samples is averaged to get the final loss value:
[0117] ;
[0118] The gradient of the loss function with respect to the model parameters is calculated through backpropagation, and the optimizer is used to update the model parameters according to the gradient.
[0119] Step 6. Model testing
[0120] Test the model on the test set. After processing the audio of a certain type of marine life as described in the steps, input it into the model as the test set for testing. Compare the predicted labels with the true labels to test the classification accuracy of the model.
[0121] Step 7. Performance evaluation, use indicators such as accuracy, F1 score, confusion matrix, etc. to evaluate model performance.
[0122] The accuracy rate reflects the overall accurate classification ratio. The F1 score is the harmonic mean of the precision rate and the recall rate. The confusion matrix shows the prediction and actual results of each category, thereby discovering the model's recognition problems for certain categories. The accuracy rate mentioned in this step ( ) is calculated as:
[0123] ; Accuracy ) is calculated as:
[0124] ; Recall rate ) is calculated as:
[0125] ; The F1 score calculation formula is:
[0126] ;
[0127] The calculation of these indicators can more comprehensively evaluate the performance of the model in the underwater acoustic biological target recognition task.
[0128] Example 2:
[0129] Because the cost function for target classification can be nonconvex and can become stuck in local minima due to ambient noise, reverberation, and multipath interference in underwater acoustic channels, the proposed model employs the Adam optimizer to dynamically adjust the learning rate to prevent overlearning and avoid local minima. Deep neural network methods often suffer from overfitting due to their sensitivity to environmental changes and signal distortion. Therefore, dropout regularization is employed to reduce network parameters before output.
[0130] In this example, the processed dataset is trained on CAMPPlus, ERes2Net, ResNetSE, CNN models, and the ACNN model proposed in this paper. The classification accuracy is shown in the following table:
[0131] surface The classification task accuracy and F1 score of different deep neural networks. The F1 score is the harmonic mean of the model's precision and recall.
[0132] .
[0133] Table 1 shows the classification accuracy of our dataset trained on other models and the proposed model. The dataset used in this paper contains 32 species of underwater creatures, with approximately 5 audio samples for each species.
[0134] Figure 6 The classification confusion matrix obtained by training the model proposed in the present invention shows the accuracy between the predicted labels and the true labels, indicating that the model proposed in the present invention has good performance and high accuracy, and can be widely used in underwater biological target recognition tasks in complex noise scenes.
[0135] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects disclosed in the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for underwater acoustic biological target recognition based on attention mechanism, characterized in that: The following steps are involved: S1: Acquire underwater biological audio data and perform preprocessing; S1 includes: S1-1: Acquire underwater biological audio data in WAV format; then read the audio file to obtain the audio signal and sampling rate; S1-2: Use spectral subtraction to denoise. The spectral subtraction formula is: ; in, is the power spectrum containing the noise frequency, is the noise power spectrum, To adjust the parameters, is the estimated pure signal power; S1-3: Use fixed length segmentation method to split long audio into short segments. The audio is split at ×2 sampling points; S1-4: Use the Librosa library to implement sampling rate conversion and unify the sampling rate to ensure data consistency; S2: Extract the Mel spectrum features of the audio data and perform data enhancement using data enhancement methods; S3: Divide the processed dataset into training set, validation set and test set; S4: Construct an attention-based neural network model, the ACNN model, which includes an input layer, a convolution block, an adaptive average pooling layer, a fully connected layer, a regularization layer, and an output layer. The convolution block contains four layers, each of which includes an attention module, a convolution layer, a ReLU activation layer, and a batch normalization layer. In S4, the data processing process includes the following steps: S4-1: Input the data processed by S1 to S3 into the ACNN model through the input layer. The shape of the input data is: batch size × number of channels × time step × feature dimension; S4-2: Data reaches the convolutional block: In each layer, the data first passes through the attention module, then gradually extracts audio features through the convolution layer, then introduces nonlinearity through the ReLU activation layer, and finally standardizes the output through the batch normalization layer; S4-3: After the convolution block, the data enters the adaptive average pooling layer to reduce the spatial dimension of the feature map; S4-4: After flattening the feature map of the pooling layer, it is mapped to the output of the number of categories through a fully connected layer; S4-5: After the fully connected layer, a regularization layer is used to prevent overfitting. S4-6: Finally, output through the output layer; S5: ACNN model validation and parameter update: Evaluate model performance on the validation set, calculate loss function and accuracy, and adjust ACNN model parameters and architecture based on the validation set results to optimize performance; S6: Test the ACNN model after training and optimization, and compare the predicted labels with the true labels to test the recognition accuracy of the ACNN model.
2. The underwater acoustic biological target identification method according to claim 1, characterized in that: The S2 includes: S2-1: First, the sampling rate of the audio data file is standardized, and then the original audio signal is randomly augmented; S2-2: Convert the augmented audio into a Mel-spectrogram. The conversion formula is: ; ; in Represents the original frequency, Represents the converted Mel frequency; the calculation formula of the Mel filter is as follows: ; in Represents the filter number, and 、 The corresponding The starting point, middle point and end point of each filter; S2-3: When extracting audio features, each audio segment can be represented by a corresponding Mel spectrum, and a frequency band corresponding to each frame is a feature; S2-4: After extracting the Mel spectrum features of the audio sample, it is processed using data augmentation technology, using frequency shifting and time masking.
3. The underwater acoustic biological target identification method according to claim 1, characterized in that: In S3, the leave-one-out method is used to partition the data set, that is, when the samples of each category are very limited, one sample is reserved as a validation set and the rest are used for training.
4. The underwater biological target identification method according to claim 1, characterized in that: In the S4, the convolution block contains four layers: the convolution layer in the first layer is set to 2 input channels, 8 output channels, and a 3×3 convolution kernel, where the height and width are the spatial dimensions of the convolution layer output, corresponding to the time step t and frequency dimension f of the audio feature map; the convolution layer in the second layer is set to 8 input channels and 16 output channels; the convolution layer in the third layer is set to 16 input channels and 32 output channels; the convolution layer in the fourth layer is set to 32 input channels and 64 output channels.
5. The underwater acoustic biological target identification method according to claim 1, characterized in that: In the attention module, audio feature data First, the input is input through the input layer. The input shape size is batch size × number of channels × time step × feature dimension. The input features are preliminarily processed through the attention vector layer to generate the attention score matrix ; After activating the dense layer, use Activation function attention score matrix Weighted, generate attention weight vector ; After activating the dense layer, there is a Gaussian layer, which converts the attention weight vector Multiply with the Gaussian kernel function to generate the Gaussian layer output vector Then, the attention module merges the output sequence of the Gaussian layer with the input sequence mask by merging the fusion layer to generate the final output vector .
6. The underwater acoustic biological target identification method according to claim 5, characterized in that: The attention module includes: (1) Soft mask pass The dense layer activated is implemented so that each input data sample is a length of A vector of size The attention weight vector Expressed as: ; in For size The attention score matrix, By CNN and Function to learn, representation The correlation between each input feature and the event of interest; (2) Define the Gaussian layer, multiply the above with the Gaussian kernel function, and express it using matrix operations: ; ; in Is the size of The output vector of the Gaussian layer, is the standard deviation of the Gaussian function; (3) Output vector of the attention module is a vector of size f, which can be expressed as ⊙ by Hadamar multiplication: 。 7. The underwater acoustic biological target identification method according to claim 1, characterized in that: In S5, cross entropy loss is used as the loss function. There are N samples, each sample has C categories, and the model's predicted output is , the true label is , then the calculation formula of the cross entropy loss function L is: ; in It is The samples belong to The true label of the class, The model predicts The samples belong to The probability of the class is calculated as follows: Propagate the input data forward through the model to obtain the predicted output for each sample ; Apply softmax activation to convert the logits output by the model into a probability distribution: ; in The model output is Sample No. The logits value of the class; then for each sample , calculate the cross entropy loss between its predicted probability distribution and the true label distribution: ; The loss of all samples is averaged to get the final loss value: ; The gradient of the loss function with respect to the model parameters is calculated through backpropagation, and the optimizer is used to update the model parameters according to the gradient.
Citation Information
Patent Citations
Underwater sound target identification method and system based on Mel-cepstrum and attention residual network
CN116310770A
Ship radiation noise target identification method fusing attention mechanism
CN118262741A