A method, device and equipment for target detection based on underwater blurred images
By combining the neural network models of EfficientNet, SFPN and Linformer, feature extraction, fusion and self-attention processing of underwater blurred images is solved, and the problems of low accuracy and large calculation volume are achieved, and high efficiency and high accuracy underwater target detection are achieved.
Patent Information
- Application Number
- CN202411958306.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The existing underwater target detection methods have low detection accuracy and high calculation amounts in complex underwater environments with poor visibility, making it difficult to effectively process underwater blurred images.
A neural network model based on EfficientNet, synthetic fusion pyramid network SFPN and Linformer is used to perform feature extraction, feature fusion and self-attention mechanism processing on underwater fuzzy images, and images with bounding boxes and target categories are output.
It realizes high-efficiency and high-precision detection of underwater blurred images, with small calculation amounts, and can capture complex spatial relationships in a global scope, improving detection accuracy and simplifying the detection process.
Smart Images

Figure CN119380005B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and in particular relates to a target detection method, device and equipment based on underwater blurred images. Background Art
[0002] The effective development and utilization of marine resources plays an important role in improving people's livelihood and promoting social and economic development. With the increasing demand for marine resources, underwater biological fishing technology also needs to be further developed. In the past, the collection of underwater resources mainly relied on manual operations in underwater environments. However, the underwater environment is often very complex. As the depth of the water increases, the underwater pressure also increases, there is less light, and the temperature is lower. This brings more unknown risks to manual operations. Using underwater robots instead of manual fishing operations can not only avoid the safety hazards caused by manual operations, but also greatly improve fishing efficiency and economic benefits. Therefore, developing better object detectors that are more suitable for underwater scenes and accurately detecting underwater objects can ensure the smooth operation of underwater robots and provide more comprehensive safety guarantees for underwater fishing.
[0003] In recent years, artificial intelligence technology and deep learning technology have developed rapidly, and more and more target detection methods have been applied to underwater environments, such as YOLO, Faster R-CNN, etc. These methods can learn the characteristics of complex targets and provide help for underwater image detection. However, these methods still have certain limitations in complex underwater environments with poor visibility, and the detection accuracy is greatly reduced.
[0004] In addition, unlike target detection in ordinary environments, underwater target detection faces challenges such as environmental complexity, data scarcity, and target diversity. Currently, common underwater target detection tasks still have problems such as high complexity, large amount of calculation, and low detection accuracy. Summary of the invention
[0005] The present invention provides a target detection method, device and equipment based on underwater blurred images, which can realize high-efficiency and high-precision detection of targets in underwater blurred images.
[0006] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:
[0007] A target detection method based on underwater blurred images, comprising:
[0008] Step 1: Collect an underwater blurred image dataset, annotate the categories and bounding boxes of the objects in the images, and obtain an annotated dataset;
[0009] Step 2: Build a neural network model and use unlabeled data sets and labeled data sets to train the built neural network model to obtain a target detection model;
[0010] The neural network model: firstly uses EfficientNet as the backbone network to extract features of the input image without bounding boxes to obtain several intermediate layer features; then uses the synthetic fusion pyramid network SFPN to fuse the intermediate layer features; finally uses Linformer to perform self-attention mechanism processing to output the image with bounding boxes and the target category in the bounding boxes;
[0011] Step 3: Use the trained target detection model to perform target detection on the underwater blurred image to be detected, and output an image with a bounding box and the target category within the bounding box.
[0012] Furthermore, the EfficientNet simultaneously adjusts the depth, width and resolution of the input image of the network, which is expressed as:
[0013] , ,
[0014] in, , , are the scaling factors for depth, width, and resolution, respectively. , , They are the initial depth, width and resolution of the original EfficientNet model before adjustment. , , They are the depth, width and resolution of the adjusted model respectively.
[0015] Furthermore, the EfficientNet uses depth-wise separable convolution to split the standard convolution into two parts: depth-wise convolution and point-wise convolution.
[0016] The depthwise convolution is expressed as:
[0017]
[0018] in, Indicates the specific location and channel index of the feature map, represents the pixel value of the input image, Indicates the spatial position of the deep convolution kernel Place opposite The weight of each channel, Represents the pixel value of the output feature map after deep convolution, is the number of channels of the input image;
[0019] The point-by-point convolution is expressed as:
[0020]
[0021] in, Indicates the specific position and channel index of the feature map after point-by-point convolution processing. is the number of channels of the feature map after deep convolution processing, Represents the pixel value of the output feature map after deep convolution processing and serves as the input of point-by-point convolution. The convolution kernel of size 1×1 is transformed in the channel dimension. Represents the pixel value of the output feature map after point-by-point convolution.
[0022] Furthermore, EfficientNet extracts three intermediate layer feature maps SFPN first splits each intermediate layer feature into multiple branches, then uses convolution operation to process each split feature map independently, and then fuses the processed feature maps and obtains the output feature map of SFPN after normalization. , each operation is expressed as:
[0023]
[0024]
[0025]
[0026]
[0027] in, Indicates The intermediate layer feature map, The middle layer feature The split feature map, Represents the middle layer features The number of branches to split, represents the convolution operation, represent The feature map obtained by convolution processing, Is The feature map composed of Represents splicing and fusion, Is The concatenated feature map, Is The concatenated feature map, It is a feature map The mean value in It is a feature map The standard deviation of .
[0028] Furthermore, the self-attention mechanism processing using Linformer includes:
[0029] (1) The three-dimensional feature map obtained by SFPN Reshape into a two-dimensional sequence , and add position code To preserve the sequence Location information, location coding is a The same length and dimension vector, encoding the position Add to the reshaped sequence Get the input processed by the self-attention mechanism ;
[0030]
[0031]
[0032]
[0033] in, Represents the three-dimensional feature map Reshape into a two-dimensional sequence; They are feature maps The height, width, and number of channels; is the position index, is the channel index, It is positional encoding The dimension of , which is the length of the vector at each position in the positional encoding; and It is positional encoding The two components of The sine function is used to encode the position index and channel index , The cosine function is used to encode the position index and channel index ;
[0034] (2) By introducing the linear projection matrix Perform self-attention calculation, then normalize it through Softmax, and get it through weighted summation , and then the output processed by the self-attention mechanism is obtained through layer normalization ;
[0035]
[0036]
[0037]
[0038]
[0039] In the formula, is the query matrix, is the key matrix, is the value matrix, is the dimension of the key; is the attention weight matrix, which indicates the degree of attention each element in the input sequence pays to other elements; Represents the result of weighted summation, that is, each query vector is calculated by the corresponding attention weight With value matrix Multiply them together to get a weighted value vector; is the output processed by the self-attention mechanism; Normalization of the representative layer;
[0040] (3) Processing using a feedforward network yields , output a sequence result :
[0041]
[0042]
[0043] In the formula, Represents the feedforward neural network operation process, is the weight bias, is the bias term, is the activation function, Indicates from The element with the largest probability is selected from the output to determine the predicted category of each position and obtain the prediction result.
[0044] A target detection device based on underwater blurred images, comprising:
[0045] The data collection and annotation module is used to: collect underwater blurry image data sets, annotate the categories and bounding boxes of the objects in the images, and obtain annotated data sets;
[0046] The model training module is used to: train the constructed neural network model using a data set without bounding boxes and a data set with labeled bounding boxes to obtain a target detection model;
[0047] The neural network model: firstly uses EfficientNet as the backbone network to extract features of the input image without bounding boxes to obtain several intermediate layer features; then uses the synthetic fusion pyramid network SFPN to fuse the intermediate layer features; finally uses Linformer to perform self-attention mechanism processing to output the image with bounding boxes and the target category in the bounding boxes;
[0048] The target detection module is used to configure the trained target detection model to perform target detection on the underwater blurred image to be detected, and output an image with a bounding box and a target category within the bounding box.
[0049] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor implements any of the above-mentioned target detection methods based on underwater blurred images.
[0050] The target detection method, device and equipment based on underwater blurred images proposed in the present invention can enable the target detection model to capture complex spatial relationships in the global range of the input image, realize high-efficiency and high-precision detection of underwater blurred images, and have a small amount of calculation. Compared with the existing underwater image detection technology, the present invention has the following advantages:
[0051] (1) The network model has low computational complexity and high model efficiency. EfficientNet effectively extracts multi-scale features with low model parameters and computational complexity; SFPN, as a feature fusion module, effectively combines high-level semantic features and low-level detail information, retaining the spatial information of the input feature map and the flexibility of the network while reducing computational complexity. Linformer has low self-attention computation complexity, but can retain the powerful features of the traditional Transformer and show higher efficiency and scalability.
[0052] (2) End-to-end object detection method with a simple detection process. Linformer is an end-to-end architecture that avoids the candidate box generation and post-processing steps in traditional methods. It converts the object detection problem into a set prediction, does not rely on post-processing techniques such as non-maximum suppression, simplifies the entire detection process, can process long-distance context information, and improves detection accuracy.
[0053] (3) It has strong practicality and generalization ability. The combination of CNN and Transformer enables the model to capture complex spatial relationships in a global scope and achieve high-efficiency and high-precision detection of underwater blurred images. It achieves good results on the public dataset urpc2018 and the dataset PLUTD built in this paper. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 This is a high-efficiency and high-precision network flow chart for underwater blurred image target detection according to an embodiment of the present invention.
[0055] Figure 2 Schematic diagram of the target detection network principle of an embodiment of the present invention.
[0056] Figure 3 The figure shows the effect of comparing different deep learning methods on the PLUTD test set in an embodiment of the present invention, where (a) to (j) correspond to Faster R-CNN, TridentNet, Spare R-CNN, CornerNet, RetianNet, DETR, CO-DETR, YOLOv7, YOLOv8, and the method of the present invention, and (k) is a true label map.
[0057] Figure 4 The figure shows the effect of comparing different deep learning methods on the urpc2018 test set according to the embodiments of the present invention, where (a) to (j) correspond to Faster R-CNN, TridentNet, Spare R-CNN, CornerNet, RetianNet, DETR, CO-DETR, YOLOv7, YOLOv8, and the method of the present invention, and (k) is a true label map.
[0058] Figure 5 3 is a performance diagram of an embodiment of the present invention on the PLUTD test set, wherein (a1) to (h1) are true label images of different images, and (a2) to (h2) are detection effect diagrams of different images using the method of the present invention. DETAILED DESCRIPTION
[0059] The following is a detailed description of an embodiment of the present invention. This embodiment is based on the technical solution of the present invention, and provides a detailed implementation method and a specific operation process to further explain the technical solution of the present invention.
[0060] The technical solution of the present invention is to realize underwater blurred image detection based on a high-efficiency and high-precision network combining CNN and Transformer architectures. The Python programming language can be used for experiments, and the C / C++ programming language can also be used for engineering applications.
[0061] The present invention provides a high-efficiency and high-precision underwater blur image target detection method. Figure 1 , including the following steps:
[0062] Step 1: construct an underwater blurred image dataset PLUTD collected in a real underwater scene, and perform category and bounding box annotation on the objects in the image to obtain a labeled dataset;
[0063] The data described in the embodiment was captured and collected at Taozi Lake in Yuelu District, Changsha City, Hunan Province. The 813 underwater blurred images obtained completed the production of the PLUTD dataset. The PLUTD dataset is taken from real scenes and has strong engineering application significance. The specific target of the embodiment of the present invention is underwater garbage, which comprehensively includes common types of underwater garbage. By screening the image data and annotating it with labelimg, we finally obtained a dataset of 813 fully annotated underwater garbage blurred images containing five categories, which are divided into 731 training sets and 82 test sets. The resolution of the image is 1920×1080.
[0064] At the same time, verification was performed on the urpc2018 dataset, which is widely used in the field of underwater image research. The urpc2018 dataset contains a total of 3701 images, covering four categories of underwater organisms, including 2901 training sets and 800 test sets. The image resolution is 586×480.
[0065] Step 2: Build a neural network model and use unlabeled data sets and labeled data sets to train the built neural network model to obtain a target detection model.
[0066] Among them, the neural network model: first uses EfficientNet as the backbone network to extract features of the input image without a bounding box to obtain several intermediate layer features; then uses the synthetic fusion pyramid network SFPN to fuse the intermediate layer features; finally uses Linformer to perform self-attention mechanism processing to output the image with a bounding box and the target category in the bounding box.
[0067] 1. Feature extraction network: Use EfficientNet to extract features.
[0068] This embodiment uses the EfficientNet network as the feature extraction network. In order to adapt to the neural network model of the present invention, the original image resolution of 1920×1080 is adjusted to 1024×1024. The input image is randomly cropped, center cropped, and randomly enhanced. The data enhancement operations include horizontal flipping, vertical flipping, and rotation. Some hyperparameters in the training process are set as follows: AdamW optimizer is used. AdamW is a variant of the Adam optimizer, which is suitable for tasks with weight decay. The weight decay coefficient is 0.0001 and the learning rate is 0.0002. Batch_size is set to 1, with a total of 12 epochs, and the learning rate is reduced to the original 0.1 at the 11th epoch. During training, Ubuntu 16.04LTS system or above is required, and the system environment requires Pytorch 1.6, Python3.6 or above. The hardware platform includes graphics card NVIDIA GeForce RTX 4060Ti, CUDA11.7, while the CPU memory is not less than 64G and the solid-state hard disk is not less than 512G.
[0069] EfficientNet achieves higher accuracy and lower computational cost based on compound scaling and efficient convolution. Compound scaling means that EfficientNet optimizes model performance by simultaneously adjusting the depth, width, and resolution of the input image of the network. The following formula is used:
[0070]
[0071] in, , , are the scaling factors for depth, width and resolution respectively, , , They are the initial depth, width and resolution of the original EfficientNet model before adjustment. , , They are the adjusted depth, width and resolution of the original EfficientNet model. The initial depth of the original EfficientNet model represents the number of layers in each stage. EfficientNet has 9 stages, and the model of the number of layers in each stage is automatically extracted and calculated; its initial width is the number of convolution kernels, and there are 32 convolution kernels in each stage; its resolution is 380×380.
[0072] The EfficientNet network uses a deep separable convolution, splitting the standard convolution into two parts: deep convolution and point-by-point convolution, where the deep convolution is expressed as:
[0073]
[0074] Point-wise convolution is expressed as:
[0075]
[0076] In the formula, Indicates the specific location and channel of the feature map, is the number of channels, Indicates the index of the channel. After EfficientNet extracts features, it will output three feature maps , low-level features, mid-level features and high-level features are extracted respectively, with shapes of (batch_size, 48, 128, 128), (batch_size, 136, 64, 64), and (batch_size, 384, 32, 32).
[0077] 2. Feature fusion network: Use synthetic fusion pyramid network SFPN for feature fusion and unify the number of channels.
[0078] The enhanced pyramid network architecture SFPN in this embodiment can effectively fuse multi-scale features through a self-fusion strategy. Split it into multiple branches:
[0079]
[0080] in, Represents each feature map The number of split branches.
[0081] Then for each split feature map Perform separate processing and use convolution operations to extract features:
[0082]
[0083] Use the concatenation operation to fuse the processed feature maps:
[0084]
[0085] After further processing, the feature map is obtained :
[0086]
[0087] in is the mean value in the feature map, is the standard deviation of the feature map.
[0088] 3. Self-attention mechanism: Use Linformer to perform self-attention mechanism on the fused feature map.
[0089] Use Linformer to fused feature maps The self-attention mechanism is processed and finally detected after post-processing.
[0090] The Linformer described in this embodiment optimizes the self-attention mechanism by using low-rank approximation technology, greatly reducing the time and space complexity of the Transformer model. It includes the following steps:
[0091] (1) The three-dimensional feature map obtained by SFPN Flatten to a sequence:
[0092]
[0093] Get sequence The dimension is .
[0094] Then use position encoding Preserve the information position of the input sequence. Position encoding is usually generated based on sine and cosine functions and is expressed as:
[0095]
[0096] in, is the position index, is the channel index, It is a dimensional feature. and It is positional encoding The two components of The sine function is used to encode the position index and channel index , The cosine function is used to encode the position index and channel index .
[0097] Combined with position encoding, we get :
[0098]
[0099] (3) The low-rank approximation is achieved by introducing the linear projection matrix Perform self-attention calculation:
[0100]
[0101] in, is the query matrix, is the key matrix, is a matrix of values.
[0102] Linformer's self-attention mechanism calculates the attention score and normalizes it through the Softmax function:
[0103]
[0104] In the formula, is the query matrix, is the key matrix, is the value matrix, is the dimension of the key. is the attention weight matrix, which indicates the degree of attention each element in the input sequence pays to other elements.
[0105] Each query vector is passed through the corresponding attention weight With value matrix Multiply them together to get a weighted value vector , and then the output processed by the self-attention mechanism is obtained through layer normalization :
[0106]
[0107]
[0108] (4) After each self-attention layer, a feedforward network is used to further process the features to obtain :
[0109]
[0110] in, Represents the feedforward neural network operation process, is the weight bias, is the bias term, is the activation function.
[0111] After multiple layers of self-attention and feedforward networks, a sequence is finally output :
[0112]
[0113] In the formula, Indicates from The element with the largest probability is selected from the output to determine the predicted category of each position and obtain the prediction result. The dimension is , the schematic diagram of the entire network can be found in Figure 2 .
[0114] Step 3: Verify on the test set. That is, use the trained object detection model to perform object detection on the underwater blurred image to be detected, and output an image with a bounding box and the object category within the bounding box.
[0115] This embodiment tests the trained target detection model on the created data set and the public data set. To facilitate understanding of the technical effect of the present invention, the application comparison between the present invention and the traditional method is provided as follows:
[0116] Table 1 and Figure 3 The experimental results of the method of the present invention and other detection methods (using different network architectures) on the PLUTD test set are shown. The average precision (AP), that is, the AP value of the method of the present invention is superior to other methods. mAP (mean Average Precision) is the average of the AP values of all categories, which is used to evaluate the overall performance of the model on all categories. Intersection over Union (IoU) is an indicator used to measure the overlap between the predicted result and the true result in the target detection task. It is obtained by calculating the ratio of the intersection and union of the predicted bounding box and the true bounding box. mAP_50 represents the mAP when the IoU threshold is 0.5, and mAP_75 represents the mAP when the IoU threshold is 0.75. The mAP_50 of the method of the present invention is improved to 91.7%, and the mAP_75 is improved to 86.3%. The detection time is the detection time of each picture. For the detection of each picture, the method of the present invention only needs 0.2123s. This proves the high efficiency and effectiveness of the method of the present invention on the PLUTD dataset.
[0117]
[0118] Table 2 and Figure 4 The experimental results of the method of the present invention and other detection methods on the urpc2018 test set are shown. The AP value of the method of the present invention is superior to that of other methods, with mAP_50 increased to 87.7% and mAP_75 increased to 82.4%. This proves the effectiveness of the method of the present invention on the urpc2018 dataset.
[0119]
[0120] Figure 5 The experimental results of the method of the present invention on the self-built data set PLUTD are compared with the real labels. It can be seen that the method of the present invention has high accuracy and good detection effect.
[0121] The above embodiments are preferred embodiments of the present application. Ordinary technicians in this field can also make various changes or improvements on this basis. Without departing from the overall concept of the present application, these changes or improvements should fall within the scope of protection required by the present application.
Claims
1. A target detection method based on underwater blurred images, characterized in that: include: Step 1: Collect an underwater blurred image dataset, annotate the categories and bounding boxes of the objects in the images, and obtain an annotated dataset; Step 2: Build a neural network model and use unlabeled data sets and labeled data sets to train the built neural network model to obtain a target detection model; The neural network model: firstly uses EfficientNet as the backbone network to extract features of the input image without bounding boxes to obtain several intermediate layer features; then uses the synthetic fusion pyramid network SFPN to fuse the intermediate layer features; finally uses Linformer to perform self-attention mechanism processing to output the image with bounding boxes and the target category in the bounding boxes; The use of Linformer for self-attention mechanism processing includes: (1) The three-dimensional feature map obtained by SFPN Reshape into a two-dimensional sequence , and add position code To preserve the sequence Location information, location coding is a of the same length and dimension vector, encoding the position Add to the reshaped sequence Get the input processed by the self-attention mechanism ; ; ; ; in, Represents the three-dimensional feature map Reshape into a two-dimensional sequence; They are feature maps The height, width, and number of channels; is the position index, is the channel index, It is positional encoding The dimension of , which is the length of the vector at each position in the positional encoding; and It is positional encoding The two components of The sine function is used to encode the position index and channel index , The cosine function is used to encode the position index and channel index ; (2) By introducing the linear projection matrix Perform self-attention calculation, then normalize it through Softmax, and get it through weighted summation , and then the output processed by the self-attention mechanism is obtained through layer normalization ; ; ; ; ; In the formula, is the query matrix, is the key matrix, is the value matrix, is the dimension of the key; is the attention weight matrix, which indicates the degree of attention each element in the input sequence pays to other elements; Represents the result of weighted summation, that is, each query vector is calculated by the corresponding attention weight With value matrix Multiply them together to get a weighted value vector; is the output processed by the self-attention mechanism; Normalization of the representative layer; (3) Use the feedforward network to process , output a sequence result : ; ; In the formula, Represents the feedforward neural network operation process, is the weight bias, is the bias term, is the activation function, Indicates from Select the element with the maximum probability from the output to determine the predicted category of each position and obtain the predicted result; Step 3: Use the trained target detection model to perform target detection on the underwater blurred image to be detected, and output an image with a bounding box and the target category within the bounding box.
2. The target detection method based on underwater blurred images according to claim 1 is characterized in that: The EfficientNet simultaneously adjusts the depth, width and resolution of the input image of the network, using the formula: , , ; in, , , are the scaling factors for depth, width, and resolution, respectively. , , They are the initial depth, width and resolution of the original EfficientNet model before adjustment. , , They are the depth, width and resolution of the adjusted model respectively.
3. The target detection method based on underwater blurred images according to claim 1, characterized in that: The EfficientNet uses depth-wise separable convolution, splitting the standard convolution into two parts: depth-wise convolution and point-wise convolution; The depthwise convolution is expressed as: ; in, Indicates the specific location and channel index of the feature map, represents the pixel value of the input image, Indicates the spatial position of the deep convolution kernel Place opposite The weight of each channel, Represents the pixel value of the output feature map after deep convolution, is the number of channels of the input image; The point-by-point convolution is expressed as: ; in, Indicates the specific position and channel index of the feature map after point-by-point convolution processing. is the number of channels of the feature map after deep convolution processing, Represents the pixel value of the output feature map after deep convolution processing and serves as the input of point-by-point convolution. The convolution kernel of size 1×1 is transformed in the channel dimension. Represents the pixel value of the output feature map after point-by-point convolution.
4. The target detection method based on underwater blurred images according to claim 1 is characterized in that: EfficientNet extracts three intermediate layer feature maps SFPN first splits each intermediate layer feature into multiple branches, then uses convolution operation to process each split feature map independently, and then fuses the processed feature maps and obtains the output feature map of SFPN after normalization. , each operation is expressed as: ; ; ; ; in, Indicates The intermediate layer feature map, The middle layer feature The split feature map, Represents the middle layer features The number of branches to split, represents the convolution operation, represent The feature map obtained by convolution processing, Is The feature map composed of Represents splicing and fusion, Is The concatenated feature map, Is The concatenated feature map, It is a feature map The mean value in It is a feature map The standard deviation of .
5. A target detection device based on underwater blurred images, characterized in that: include: The data collection and annotation module is used to: collect underwater blurry image data sets, annotate the categories and bounding boxes of the objects in the images, and obtain annotated data sets; The model training module is used to: train the constructed neural network model using a data set without bounding boxes and a data set with labeled bounding boxes to obtain a target detection model; The neural network model: firstly uses EfficientNet as the backbone network to extract features of the input image without bounding boxes to obtain several intermediate layer features; then uses the synthetic fusion pyramid network SFPN to fuse the intermediate layer features; finally uses Linformer to perform self-attention mechanism processing to output the image with bounding boxes and the target category in the bounding boxes; The use of Linformer for self-attention mechanism processing includes: (1) The three-dimensional feature map obtained by SFPN Reshape into a two-dimensional sequence , and add position code To preserve the sequence Location information, location coding is a of the same length and dimension vector, encoding the position Add to the reshaped sequence Get the input processed by the self-attention mechanism ; ; ; ; in, Represents the three-dimensional feature map Reshape into a two-dimensional sequence; They are feature maps The height, width, and number of channels; is the position index, is the channel index, It is positional encoding The dimension of , which is the length of the vector at each position in the positional encoding; and It is positional encoding The two components of The sine function is used to encode the position index and channel index , The cosine function is used to encode the position index and channel index ; (2) By introducing the linear projection matrix Perform self-attention calculation, then normalize it through Softmax, and get it through weighted summation , and then the output processed by the self-attention mechanism is obtained through layer normalization ; ; ; ; ; In the formula, is the query matrix, is the key matrix, is the value matrix, is the dimension of the key; is the attention weight matrix, which indicates the degree of attention each element in the input sequence pays to other elements; Represents the result of weighted summation, that is, each query vector is calculated by the corresponding attention weight With value matrix Multiply them together to get a weighted value vector; is the output processed by the self-attention mechanism; Normalization of the representative layer; (3) Use the feedforward network to process , output a sequence result : ; ; In the formula, Represents the feedforward neural network operation process, is the weight bias, is the bias term, is the activation function, Indicates from Select the element with the maximum probability from the output to determine the predicted category of each position and obtain the predicted result; The target detection module is used to configure the trained target detection model to perform target detection on the underwater blurred image to be detected, and output an image with a bounding box and a target category within the bounding box.
6. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Underwater target detection algorithm based on image enhancement and attention mechanism
CN117372853A
Three-dimensional object detection method based on multi-modal fusion and deep attention mechanism
WO2024217115A1