Rock classification method, device, equipment and storage medium based on multi-scale and dual attention feature fusion
The rock classification method that integrates multi-scale and dual attention features solves the problem of low rock classification accuracy, achieves efficient classification of rock images, and improves classification accuracy.
Patent Information
- Application Number
- CN202510941332.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-07-09
AI Technical Summary
Existing rock classification algorithms suffer from low classification accuracy due to the high complexity and diversity of rock samples.
A rock classification method based on multi-scale and dual attention feature fusion is adopted. The original rock image is received for initial feature extraction to generate an initial rock feature map. The dual attention mechanism and multi-scale feature extraction module are then used for feature fusion to gradually capture multi-level feature representations from local details to global semantics.
The accuracy of rock classification is improved, the microstructural characteristics of rock images are fully explored, and the macroscopic lithofacies distribution pattern is effectively modeled.
Smart Images

Figure CN120472245B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of rock classification, and in particular to a rock classification method, apparatus, device and storage medium based on multi-scale and dual attention feature fusion. Background Art
[0002] Rock type detection has important applications in geological exploration, mineral resource assessment, engineering geological surveys, and geological disaster early warning. Currently, deep learning-based rock classification methods rely primarily on multimodal data sources such as high-resolution rock images, multispectral or hyperspectral remote sensing data, and microscopic images. However, due to the inherent complexity and diversity of rock samples, existing rock classification algorithms often exhibit low accuracy in practical applications. Therefore, improving rock classification accuracy remains an unresolved issue.
[0003] The above content is only used to assist in understanding the technical solution of this application and does not constitute an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a rock classification method, device, equipment and storage medium based on the fusion of multi-scale and dual attention features, aiming to solve the technical problem of how to improve the accuracy of rock classification.
[0005] To achieve the above objectives, this application proposes a rock classification method based on the fusion of multi-scale and dual attention features, the method comprising:
[0006] receiving an original rock image, performing initial feature extraction on the original rock image, and generating an initial rock feature map;
[0007] Generate a current-level dual attention feature based on the rock initial feature map, and generate a current-level multi-scale context feature based on the rock initial feature map;
[0008] fusing the current-level dual attention feature with the current-level multi-scale context feature to obtain a current-level fused feature;
[0009] generating a subsequent dual attention feature based on the current-level dual attention feature, and generating a subsequent multi-scale context feature based on the current-level multi-scale context feature;
[0010] A subsequent fusion feature is obtained according to the current-level fusion feature, the subsequent dual attention feature, and the subsequent multi-scale context feature, and a rock classification result is obtained according to the subsequent fusion feature.
[0011] In one embodiment, the step of performing initial feature extraction on the original rock image to generate an initial rock feature map includes:
[0012] Performing dimension expansion processing on the original rock image through a convolutional layer;
[0013] Outputs the initial rock feature map with the preset number of channels.
[0014] In one embodiment, the step of generating a current-level dual attention feature according to the initial rock feature map includes:
[0015] Performing layer normalization processing on the initial rock feature map to obtain channel normalized features and space normalized features;
[0016] Mapping the channel normalized features into a channel query matrix, a channel key matrix, and a channel value matrix, and mapping the spatial normalized features into a spatial query matrix, a spatial key matrix, and a spatial value matrix;
[0017] Multiplying the channel query matrix by the channel key matrix to obtain a channel attention matrix, and multiplying the channel attention matrix by the channel value matrix to obtain a channel attention feature;
[0018] Multiplying the spatial query matrix by the spatial key matrix to obtain a spatial attention matrix, and multiplying the spatial attention matrix by the spatial value matrix to obtain a spatial attention feature;
[0019] The channel attention feature and the spatial attention feature are concatenated along the channel dimension to obtain the current-level dual attention feature.
[0020] In one embodiment, the step of generating the current-level multi-scale context features according to the initial rock feature map includes:
[0021] Using the first convolution kernel and the second convolution kernel to extract the initial rock feature map respectively to obtain micro texture features and lithofacies structure features;
[0022] Splitting and cross-recombining the microtexture features and the petrographic structural features according to the channel dimension to obtain recombined features;
[0023] Performing secondary convolution extraction on the recombined features using the real-time first convolution kernel and the second convolution kernel to obtain initial multi-scale context features;
[0024] Channel concatenation and dimensionality reduction are performed on the initial multi-scale context features to obtain current-level multi-scale context features.
[0025] In one embodiment, the step of fusing the current-level dual attention feature with the current-level multi-scale context feature to obtain the current-level fused feature includes:
[0026] splicing the current-level dual attention features and the current-level multi-scale context features according to the channel dimension to obtain high-dimensional features;
[0027] The high-dimensional features are subjected to nonlinear transformation and dimensionality compression through the convolution layer to obtain the current-level fusion features.
[0028] In one embodiment, the step of obtaining a subsequent fusion feature based on the current-level fusion feature, the subsequent dual attention feature, and the subsequent multi-scale context feature includes:
[0029] splicing the subsequent dual attention features and the subsequent multi-scale context features according to the channel dimension to obtain subsequent high-dimensional features;
[0030] Perform nonlinear transformation and dimensionality compression on the high-dimensional features through the convolution layer to obtain subsequent fusion features;
[0031] The current-level fusion feature and the subsequent fusion feature are added element by element, local feature refinement is performed, and cross-channel information interaction and feature reorganization are performed to obtain subsequent fusion features.
[0032] In one embodiment, the step of obtaining a rock classification result based on the subsequent fusion features includes:
[0033] Performing global average pooling and layer normalization on the subsequent fused features to obtain standardized features;
[0034] The standardized features are input into the fully connected layer and mapped to the target classification space to obtain the rock classification results.
[0035] In addition, to achieve the above objectives, the present application also proposes a rock classification device based on the fusion of multi-scale and dual-attention features, the rock classification device based on the fusion of multi-scale and dual-attention features comprising:
[0036] A receiving module is used to receive an original rock image, perform initial feature extraction on the original rock image, and generate an initial rock feature map;
[0037] A generation module, configured to generate a current-level dual attention feature based on the rock initial feature map, and generate a current-level multi-scale context feature based on the rock initial feature map;
[0038] a fusion module, configured to fuse the current-level dual attention feature with the current-level multi-scale context feature to obtain a current-level fusion feature;
[0039] an iterative module, configured to generate subsequent dual attention features based on the current-level dual attention features, and generate subsequent multi-scale context features based on the current-level multi-scale context features;
[0040] A classification module is used to obtain subsequent fusion features based on the current-level fusion features, the subsequent dual attention features, and the subsequent multi-scale context features, and to obtain a rock classification result based on the subsequent fusion features.
[0041] In addition, to achieve the above-mentioned purpose, the present application also proposes a rock classification device based on the fusion of multi-scale and dual attention features, the device comprising: a memory, a processor, and a computer program stored on the memory and runnable on the processor, the computer program being configured to implement the steps of the rock classification method based on the fusion of multi-scale and dual attention features as described above.
[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the rock classification method based on multi-scale and dual attention feature fusion as described above are implemented.
[0043] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the rock classification method based on multi-scale and dual attention feature fusion as described above.
[0044] The present application provides a rock classification method based on the fusion of multi-scale and dual-attention features. The present application receives an original rock image, performs initial feature extraction on the original rock image, and generates an initial rock feature map; generates a current-level dual-attention feature based on the initial rock feature map, and generates a current-level multi-scale context feature based on the initial rock feature map; fuses the current-level dual-attention feature with the current-level multi-scale context feature to obtain a current-level fusion feature; generates a subsequent dual-attention feature based on the current-level dual-attention feature, and generates a subsequent multi-scale context feature based on the current-level multi-scale context feature; obtains a subsequent fusion feature based on the current-level fusion feature, the subsequent dual-attention feature, and the subsequent multi-scale context feature, and obtains a rock classification result based on the subsequent fusion feature.
[0045] In summary, this application performs feature extraction through a dual attention mechanism and a multi-scale feature extraction module, and performs hierarchical feature extraction, thereby gradually capturing multi-level feature representations from local details to global semantics, which can fully explore the microstructural characteristics of rock images and effectively model macroscopic lithofacies distribution patterns, thereby improving the accuracy of rock classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0048] Figure 1 A flowchart of the first embodiment of the rock classification method based on multi-scale and dual attention feature fusion provided in this application;
[0049] Figure 2 Schematic diagram of a rock image classification model provided in Example 1 of the rock classification method based on multi-scale and dual attention feature fusion of this application;
[0050] Figure 3 A flowchart of the second embodiment of the rock classification method based on multi-scale and dual attention feature fusion provided in this application;
[0051] Figure 4 This is a schematic diagram of the module structure of a rock classification device based on multi-scale and dual attention feature fusion according to an embodiment of the present application;
[0052] Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the rock classification method based on multi-scale and dual attention feature fusion in the embodiment of the present application.
[0053] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.
[0055] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0056] The main solution of this application is to receive the original rock image, perform initial feature extraction on the original rock image, and generate an initial rock feature map; generate a current-level dual attention feature based on the initial rock feature map, and generate a current-level multi-scale context feature based on the initial rock feature map; fuse the current-level dual attention feature with the current-level multi-scale context feature to obtain a current-level fusion feature; generate a subsequent dual attention feature based on the current-level dual attention feature, and generate a subsequent multi-scale context feature based on the current-level multi-scale context feature; obtain a subsequent fusion feature based on the current-level fusion feature, the subsequent dual attention feature and the subsequent multi-scale context feature, and obtain a rock classification result based on the subsequent fusion feature.
[0057] Currently, deep learning-based rock classification methods primarily rely on multimodal data sources such as high-resolution rock images, multispectral or hyperspectral remote sensing data, and microscopic images. However, due to the inherent complexity and diversity of rock samples, existing rock classification algorithms often exhibit low accuracy in practical applications. Therefore, improving rock classification accuracy remains an unresolved issue.
[0058] This application uses a dual attention mechanism and a multi-scale feature extraction module to extract features, and performs hierarchical feature extraction, thereby gradually capturing multi-level feature representations from local details to global semantics. It can fully explore the microstructural characteristics of rock images and effectively model macroscopic lithofacies distribution patterns, thereby improving the accuracy of rock classification.
[0059] Based on this, the embodiment of the present application provides a rock classification method based on the fusion of multi-scale and dual attention features. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the rock classification method based on multi-scale and dual attention feature fusion in this application.
[0060] In this embodiment, the rock classification method based on multi-scale and dual attention feature fusion includes steps S10 to S50:
[0061] Step S10: receiving an original rock image, performing initial feature extraction on the original rock image, and generating an initial rock feature map;
[0062] It should be noted that the execution entity of this embodiment can be a computing service device with data processing, network communication, and program execution capabilities, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of implementing the aforementioned functions, or a rock classification device based on multi-scale and dual-attention feature fusion. This embodiment and the following embodiments will be described below using a rock classification device based on multi-scale and dual-attention feature fusion as an example.
[0063] It can be understood that the original rock image includes an RGB image. The initial feature extraction and dimension expansion of the original rock image are performed through a 3×3 convolution layer, and the original pixel space is mapped to a high-dimensional feature space to obtain the initial feature map of the rock.
[0064] The step of extracting initial features from the original rock image to generate an initial rock feature map comprises:
[0065] Performing dimension expansion processing on the original rock image through a convolutional layer;
[0066] Outputs the initial rock feature map with the preset number of channels.
[0067] It is understandable that by performing dimensionality expansion on the original rock image through the convolutional layer, the three channels of the original image can be expanded into more feature channels, generating an initial rock feature map. This process preserves the original texture information of the rock while enhancing the expressiveness of the features.
[0068] Step S20: generating a current-level dual attention feature according to the initial rock feature map, and generating a current-level multi-scale context feature according to the initial rock feature map;
[0069] It should be noted that the initial rock feature map is processed by a dual-attention module and a multi-scale feature extraction module. In the dual-attention module, an embedded downsampling mechanism is used to maintain the structural integrity of the features, while in the multi-scale feature extraction module, a convolutional downsampling operation is used to achieve scale transformation.
[0070] In a feasible manner, the step of generating the current-level dual attention feature according to the initial rock feature map includes:
[0071] Performing layer normalization processing on the initial rock feature map to obtain channel normalized features and space normalized features;
[0072] Mapping the channel normalized features into a channel query matrix, a channel key matrix, and a channel value matrix, and mapping the spatial normalized features into a spatial query matrix, a spatial key matrix, and a spatial value matrix;
[0073] Multiplying the channel query matrix by the channel key matrix to obtain a channel attention matrix, and multiplying the channel attention matrix by the channel value matrix to obtain a channel attention feature;
[0074] Multiplying the spatial query matrix by the spatial key matrix to obtain a spatial attention matrix, and multiplying the spatial attention matrix by the spatial value matrix to obtain spatial attention features;
[0075] The channel attention feature and the spatial attention feature are concatenated along the channel dimension to obtain the current-level dual attention feature.
[0076] It should be noted that dual attention refers to channel self-attention and spatial self-attention. Therefore, the framework of this embodiment is a parallel structure of the channel self-attention module and the spatial self-attention model, which effectively obtains global context features from both the channel level and the image level at the same time.
[0077] Channel self-attention module: Through layer normalization and linear layer mapping, we first transform the input features The features of are mapped into sequences (Q), keys (K), and values (V), where R is a set of real numbers, H is the height of the feature, W is the width of the feature, and C is the number of channels of the feature. The sizes of Q, K, and V are , , . is the number of features in a single channel in the feature map. Then we perform matrix multiplication on Q and K to get a Finally, the attention matrix is multiplied by V to obtain the channel attention feature.
[0078] Spatial Self-Attention Module: The execution of the spatial attention module is not much different from the channel attention model, but when the features are mapped into sequence (Q), key (K), and value (V), their sizes become , , , and finally the product of Q and K is The attention matrix of different sizes is the essential difference between the spatial attention module and the channel self-attention module. Finally, the obtained attention matrix is matrix multiplied with V to obtain the spatial attention feature.
[0079] Both the channel attention module and the spatial attention module can be expressed by the following formula:
[0080]
[0081]
[0082] in and The input features and output features are They are mapped from the input features through the linear layer. is a learnable scaling parameter that controls the size of the dot product of K and Q before applying the softmax function. are the parameters of the linear layer, and the overall dual attention module can be summarized as:
[0083]
[0084]
[0085]
[0086] in and They are channel attention features and spatial attention features, It is to concatenate two features along the channel dimension.
[0087] In a feasible manner, the step of generating the current-level multi-scale context features according to the initial rock feature map includes:
[0088] Using the first convolution kernel and the second convolution kernel to extract the initial rock feature map respectively to obtain micro texture features and lithofacies structure features;
[0089] Splitting and cross-recombining the microtexture features and the petrographic structural features according to the channel dimension to obtain recombined features;
[0090] Performing secondary convolution extraction on the recombined features using the real-time first convolution kernel and the second convolution kernel to obtain initial multi-scale context features;
[0091] Channel concatenation and dimensionality reduction are performed on the initial multi-scale context features to obtain current-level multi-scale context features.
[0092] It should be noted that the multi-scale extraction module generates current-level multi-scale contextual features based on the initial rock feature map. This module employs a dual-branch parallel design, using 3×3 and 5×5 convolutional kernels for feature extraction. The 3×3 convolutional kernel focuses on capturing the microtexture characteristics of mineral grains (such as the wavy extinction of quartz and the zoning structure of feldspar), while the 5×5 convolutional kernel is responsible for extracting broader petrographic structural information (such as the distribution pattern of phenocrysts and the degree of matrix crystallization). During the feature fusion stage, we propose a feature recombination strategy: first, the feature maps at the two scales are split and cross-combined along the channel dimension. This structured feature interaction achieves deep coupling of receptive fields at different scales. Subsequently, the recombined features are refined again using 3×3 and 5×5 convolutional kernels, respectively. This process not only preserves the original scale characteristics but also enhances the synergistic expression of features across scales. Ultimately, through channel concatenation and dimensionality reduction using 1×1 convolution, we obtained a unified feature representation that integrates microstructure and macroscopic distribution. This design significantly improves the model's ability to discriminate between mineral assemblages of varying particle sizes, particularly when processing igneous and metamorphic rock samples with complex structures. The specific implementation details are as follows:
[0093]
[0094]
[0095]
[0096]
[0097]
[0098] in and Respectively represent and convolution. Refers to splitting features along the channel dimension. and Represents the two features after splitting.
[0099] Step S30: fusing the current-level dual attention feature with the current-level multi-scale context feature to obtain a current-level fusion feature;
[0100] Step S40: generating subsequent dual attention features based on the current-level dual attention features, and generating subsequent multi-scale context features based on the current-level multi-scale context features;
[0101] It can be understood that the current level dual attention feature is used as the input feature map and then the dual attention mechanism is used to extract features to obtain subsequent dual attention features; the current level multi-scale context feature is used as the input feature map and then the multi-scale extraction module is used to extract features to obtain subsequent multi-scale context features;
[0102] Step S50: obtaining subsequent fusion features according to the current-level fusion features, the subsequent dual attention features, and the subsequent multi-scale context features, and obtaining a rock classification result according to the subsequent fusion features.
[0103] It should be noted that this embodiment obtains subsequent fusion features through the current-level fusion features, the subsequent dual attention features, and the subsequent multi-scale context features, which reflects an iterative process. The model of this embodiment adopts a four-level pyramid structure for hierarchical feature extraction. At each stage, the feature map size is reduced to 1 / 2 of the previous stage through a downsampling operation with a step size of 2, thereby gradually capturing multi-level feature representations from local details to global semantics. In the dual attention module, we use an embedded downsampling mechanism to maintain the structural integrity of the features; while in the multi-scale feature extraction module, scale transformation is achieved through convolutional downsampling operations. After each stage, the features output by the two modules will be cross-modally integrated through the feature fusion module to achieve collaborative modeling of local details and global context. Finally, the features after global average pooling and layer normalization are sent to the fully connected layer, mapped to the target classification space, and the final rock type prediction results are output. This design ensures that the model can not only fully explore the microstructural characteristics of rock images, but also effectively model the macroscopic lithologic distribution patterns. Please refer to Figure 2 , Figure 2 Schematic diagram of the rock image classification model. Figure 2 After the original rock image is processed by the convolution kernel, the processing results are input into the dual attention module and the multi-scale feature extraction module respectively. The features extracted by these two modules are input into the feature fusion module for feature fusion on the one hand, and on the other hand, they are input into the dual attention module and multi-scale feature extraction module of the next level for iteration to obtain subsequent dual attention features and subsequent multi-scale context features. Therefore, the first feature fusion module only fuses feature information from two different sources, namely the current-level dual attention features and the current-level multi-scale context features, while each subsequent feature fusion module fuses feature information from three different sources, namely historical fusion features, multi-scale context features and self-attention features.
[0104] In a feasible manner, the step of obtaining a rock classification result according to the subsequent fusion features includes:
[0105] Performing global average pooling and layer normalization on the subsequent fused features to obtain standardized features;
[0106] The standardized features are input into the fully connected layer and mapped to the target classification space to obtain the rock classification results.
[0107] It is understandable that after obtaining the subsequent fusion features, the subsequent fusion features can be subjected to global average pooling and layer normalization processing, the standardized features can be input into the fully connected layer, and mapped to the target classification space, so as to obtain the rock type probability output result, thereby obtaining the rock classification result.
[0108] It should be noted that a comparison of the classification performance of this embodiment on a rock dataset can be found in Table 1. The primary comparison metrics are accuracy, precision, F1 score, and recall. The results show that the method of this embodiment significantly improves classification performance. Table 1 shows that it outperforms the other comparison models in all metrics, with particularly strong performance in accuracy (63.31%) and precision (60.25%), demonstrating that this model has advantages in overall classification accuracy and reliability of positive class predictions.
[0109]
[0110] Table 1
[0111] This embodiment receives an original rock image, performs initial feature extraction on the original rock image, and generates an initial rock feature map; generates a current-level dual-attention feature based on the initial rock feature map, and generates a current-level multi-scale context feature based on the initial rock feature map; fuses the current-level dual-attention feature with the current-level multi-scale context feature to obtain a current-level fused feature; generates a subsequent dual-attention feature based on the current-level dual-attention feature, and generates a subsequent multi-scale context feature based on the current-level multi-scale context feature; obtains a subsequent fused feature based on the current-level fused feature, the subsequent dual-attention feature, and the subsequent multi-scale context feature, and obtains a rock classification result based on the subsequent fused feature.
[0112] In summary, this embodiment performs feature extraction through a dual attention mechanism and a multi-scale feature extraction module, and performs hierarchical feature extraction, thereby gradually capturing multi-level feature representations from local details to global semantics. It can fully explore the microstructural characteristics of rock images and effectively model macroscopic lithofacies distribution patterns, thereby improving the accuracy of rock classification.
[0113] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 3, step S50 further includes steps S501 to S503:
[0114] Step S501: splicing the subsequent dual attention features and the subsequent multi-scale context features according to the channel dimension to obtain subsequent high-dimensional features;
[0115] It should be noted that channel-wise concatenation involves concatenating two feature maps along the channel dimension, while leaving all other dimensions unchanged. The output of channel concatenation is a new feature map with an increased number of channels, while its spatial dimensions remain unchanged and the number of channels equals the sum of the channels of all input feature maps. By leveraging attention-heavy features and multi-scale contextual features, overall performance can be improved.
[0116] Step S502: performing nonlinear transformation and dimensionality compression on the high-dimensional features through a convolutional layer to obtain subsequent fusion features;
[0117] It is understandable that nonlinear transformation processes high-dimensional features through weighted summation of convolution kernels and activation functions, which can enhance the feature expression ability. For example, dimensionality compression reduces the feature dimension by reducing the number of output channels.
[0118] Step S503: Add the current-level fusion feature and the subsequent fusion feature element by element, perform local feature refinement, and perform cross-channel information interaction and feature reorganization to obtain subsequent fusion features.
[0119] It is understandable that in order to effectively integrate feature information from three different sources, namely the current-level fusion features, the subsequent dual attention features, and the subsequent multi-scale contextual features, this module adopts a hierarchical feature fusion strategy. First, the three features are preliminarily fused through the channel dimension splicing operation to retain the original information of each feature. Subsequently, the 3×3 convolution layer is used to perform nonlinear transformation and dimensionality compression on the spliced high-dimensional features, and map them back to the original channel dimension. In order to enhance feature propagation and alleviate the gradient vanishing problem, we introduced a residual connection mechanism to add the current fusion feature to the previous fusion result element by element. On this basis, the local features are further refined through the 3×3 convolution layer, and the 1×1 convolution layer is used to realize cross-channel information interaction and feature reorganization, and finally output the fusion features with rich semantic information and spatial details. This design not only realizes the full interaction of multi-source features, but also effectively improves the discriminative expression ability of the features through cascaded convolution operations. The specific operations are as follows:
[0120]
[0121] in Represents fusion features, and Represent multi-scale features and fusion features respectively, Representative It is worth noting that the input of the first stage does not contain fusion features, and only operates on multi-scale features and fusion features.
[0122] This embodiment splices the subsequent dual attention features and the subsequent multi-scale context features according to the channel dimension to obtain subsequent high-dimensional features; performs nonlinear transformation and dimensionality compression on the high-dimensional features through the convolution layer to obtain subsequent fusion features; adds the current-level fusion features and the subsequent fusion features element by element, performs local feature refinement, and performs cross-channel information interaction and feature reorganization to obtain subsequent fusion features.
[0123] In summary, this embodiment fuses features from multiple sources to obtain fused features with rich semantic information and spatial details. It not only achieves full interaction of multi-source features, but also effectively improves the discriminative expression ability of features through cascaded convolution operations, thereby improving the accuracy of rock classification.
[0124] This application also provides a rock classification device based on multi-scale and dual attention feature fusion, please refer to Figure 4 The rock classification device based on multi-scale and dual attention feature fusion includes:
[0125] The receiving module 10 is used to receive the original rock image, perform initial feature extraction on the original rock image, and generate an initial rock feature map;
[0126] A generating module 20 is configured to generate a current-level dual attention feature based on the rock initial feature map, and to generate a current-level multi-scale context feature based on the rock initial feature map;
[0127] a fusion module 30 for fusing the current-level dual attention feature with the current-level multi-scale context feature to obtain a current-level fused feature;
[0128] an iterative module 40 for generating subsequent dual attention features based on the current-level dual attention features, and generating subsequent multi-scale context features based on the current-level multi-scale context features;
[0129] The classification module 50 is configured to obtain subsequent fusion features based on the current-level fusion features, the subsequent dual attention features, and the subsequent multi-scale context features, and obtain a rock classification result based on the subsequent fusion features.
[0130] This application uses a dual attention mechanism and a multi-scale feature extraction module to extract features, and performs hierarchical feature extraction, thereby gradually capturing multi-level feature representations from local details to global semantics. It can fully explore the microstructural characteristics of rock images and effectively model macroscopic lithofacies distribution patterns, thereby improving the accuracy of rock classification.
[0131] In one embodiment, the receiving module 10 is further configured to perform dimension expansion processing on the original rock image through a convolutional layer; and output an initial rock feature map having a preset number of channels.
[0132] In one embodiment, the generation module 20 is also used to perform layer normalization processing on the initial feature map of the rock to obtain channel normalization features and spatial normalization features; map the channel normalization features into a channel query matrix, a channel key matrix and a channel value matrix, and map the spatial normalization features into a spatial query matrix, a spatial key matrix and a spatial value matrix; multiply the channel query matrix and the channel key matrix to obtain a channel attention matrix, and multiply the channel attention matrix and the channel value matrix to obtain a channel attention feature; multiply the spatial query matrix and the spatial key matrix to obtain a spatial attention matrix, and multiply the spatial attention matrix and the spatial value matrix to obtain a spatial attention feature; splice the channel attention feature and the spatial attention feature along the channel dimension to obtain the current level dual attention feature.
[0133] In one embodiment, the generation module 20 is also used to extract the initial feature map of the rock using the first convolution kernel and the second convolution kernel respectively to obtain microtexture features and lithologic structure features; split and cross-recombine the microtexture features and the lithologic structure features according to the channel dimension to obtain recombined features; use the real-time first convolution kernel and the second convolution kernel to perform secondary convolution extraction on the recombined features to obtain initial multi-scale context features; perform channel splicing and dimensionality reduction processing on the initial multi-scale context features to obtain current-level multi-scale context features.
[0134] In one embodiment, the fusion module 30 is further used to splice the current-level dual attention features and the current-level multi-scale context features according to the channel dimension to obtain high-dimensional features; and perform nonlinear transformation and dimensional compression on the high-dimensional features through the convolution layer to obtain the current-level fusion features.
[0135] In one embodiment, the classification module 50 is also used to splice the subsequent dual attention features and the subsequent multi-scale context features according to the channel dimension to obtain subsequent high-dimensional features; perform nonlinear transformation and dimensional compression on the high-dimensional features through the convolution layer to obtain subsequent fusion features; add the current-level fusion features and the subsequent fusion features element by element, perform local feature refinement, and perform cross-channel information interaction and feature reorganization to obtain subsequent fusion features.
[0136] In one embodiment, the classification module 50 is further used to perform global average pooling and layer normalization on the subsequent fusion features to obtain standardized features; input the standardized features into the fully connected layer and map them to the target classification space to obtain rock classification results.
[0137] The rock classification device based on multi-scale and dual-attention feature fusion provided in this application adopts the rock classification method based on multi-scale and dual-attention feature fusion in the above-mentioned embodiment, which can solve the technical problem of how to improve the accuracy of rock classification. Compared with the existing technology, the beneficial effects of the rock classification device based on multi-scale and dual-attention feature fusion provided in this application are the same as the beneficial effects of the rock classification method based on multi-scale and dual-attention feature fusion provided in the above-mentioned embodiment, and the other technical features of the rock classification device based on multi-scale and dual-attention feature fusion are the same as the features disclosed in the above-mentioned embodiment method, and are not further described here.
[0138] The present application provides a rock classification device based on multi-scale and dual-attention feature fusion. The rock classification device based on multi-scale and dual-attention feature fusion includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the rock classification method based on multi-scale and dual-attention feature fusion in the above-mentioned embodiment one.
[0139] Reference below Figure 5, which shows a schematic diagram of the structure of a rock classification device based on multi-scale and dual-attention feature fusion suitable for implementing the embodiments of the present application. The rock classification device based on multi-scale and dual-attention feature fusion in the embodiments of the present application can include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The rock classification device based on multi-scale and dual attention feature fusion shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0140] like Figure 5 As shown, a rock classification device based on multi-scale and dual-attention feature fusion may include a processing device 1001 (e.g., a central processing unit, graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in ROM (Read Only Memory) 1002 or programs loaded from storage device 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the rock classification device based on multi-scale and dual-attention feature fusion. Processing device 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, hard disk, etc.; and communication devices 1009. Communication devices 1009 can allow the rock classification device based on multi-scale and dual-attention feature fusion to communicate wirelessly or wired with other devices to exchange data. While the figure shows a rock classification device based on multi-scale and dual-attention feature fusion with various systems, it should be understood that implementation or presence of all the illustrated systems is not required. More or fewer systems may alternatively be implemented or present.
[0141] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0142] The rock classification device based on multi-scale and dual-attention feature fusion provided in this application, which employs the rock classification method based on multi-scale and dual-attention feature fusion in the above-mentioned embodiment, can solve the technical problem of how to improve the accuracy of rock classification. Compared with the prior art, the beneficial effects of the rock classification device based on multi-scale and dual-attention feature fusion provided in this application are the same as the beneficial effects of the rock classification method based on multi-scale and dual-attention feature fusion provided in the above-mentioned embodiment. The other technical features of the rock classification device based on multi-scale and dual-attention feature fusion are the same as those disclosed in the above-mentioned embodiment and are not further described here.
[0143] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0144] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
[0145] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, and the computer-readable program instructions are used to execute the rock classification method based on multi-scale and dual attention feature fusion in the above-mentioned embodiment.
[0146] The computer-readable storage medium provided herein may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including, but not limited to, wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0147] The above-mentioned computer-readable storage medium can be included in the rock classification device based on the fusion of multi-scale and dual-attention features; or it can exist independently without being assembled into the rock classification device based on the fusion of multi-scale and dual-attention features.
[0148] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by a rock classification device based on the fusion of multi-scale and dual-attention features, the rock classification device based on the fusion of multi-scale and dual-attention features: receives an original rock image, performs initial feature extraction on the original rock image, and generates an initial rock feature map; generates a current-level dual-attention feature based on the initial rock feature map, and generates a current-level multi-scale context feature based on the initial rock feature map; fuses the current-level dual-attention feature with the current-level multi-scale context feature to obtain a current-level fusion feature; generates a subsequent dual-attention feature based on the current-level dual-attention feature, and generates a subsequent multi-scale context feature based on the current-level multi-scale context feature; obtains a subsequent fusion feature based on the current-level fusion feature, the subsequent dual-attention feature and the subsequent multi-scale context feature, and obtains a rock classification result based on the subsequent fusion feature.
[0149] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0150] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0151] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.
[0152] The computer-readable storage medium provided in this application stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned rock classification method based on the fusion of multi-scale and dual-attention features. This computer-readable storage medium can address the technical problem of improving the accuracy of rock classification. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are similar to those of the rock classification method based on the fusion of multi-scale and dual-attention features provided in the aforementioned embodiments, and are not further elaborated here.
[0153] The present application also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the rock classification method based on multi-scale and dual attention feature fusion as described above.
[0154] The computer program product provided in this application can solve the technical problem of improving the accuracy of rock classification. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the rock classification method based on multi-scale and dual-attention feature fusion provided in the above-mentioned embodiment, and will not be elaborated here.
[0155] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A rock classification method based on multi-scale and dual attention feature fusion, characterized in that: The method includes: receiving an original rock image, performing initial feature extraction on the original rock image, and generating an initial rock feature map; Generate a current-level dual attention feature based on the rock initial feature map, and generate a current-level multi-scale context feature based on the rock initial feature map; fusing the current-level dual attention feature with the current-level multi-scale context feature to obtain a current-level fused feature; generating a subsequent dual attention feature based on the current-level dual attention feature, and generating a subsequent multi-scale context feature based on the current-level multi-scale context feature; Obtaining subsequent fusion features according to the current-level fusion features, the subsequent dual attention features, and the subsequent multi-scale context features, and obtaining a rock classification result according to the subsequent fusion features; The step of generating a current-level dual attention feature according to the initial rock feature map includes: Performing layer normalization processing on the initial rock feature map to obtain channel normalized features and space normalized features; Mapping the channel normalized features into a channel query matrix, a channel key matrix, and a channel value matrix, and mapping the spatial normalized features into a spatial query matrix, a spatial key matrix, and a spatial value matrix; Multiplying the channel query matrix by the channel key matrix to obtain a channel attention matrix, and multiplying the channel attention matrix by the channel value matrix to obtain a channel attention feature; Multiplying the spatial query matrix by the spatial key matrix to obtain a spatial attention matrix, and multiplying the spatial attention matrix by the spatial value matrix to obtain spatial attention features; Concatenate the channel attention feature and the spatial attention feature along the channel dimension to obtain the current-level dual attention feature; The step of generating the current-level multi-scale context features according to the initial rock feature map includes: Using the first convolution kernel and the second convolution kernel to extract the initial rock feature map respectively to obtain micro texture features and lithofacies structure features; Splitting and cross-recombining the microtexture features and the petrographic structural features according to the channel dimension to obtain recombined features; Performing secondary convolution extraction on the recombined features using the real-time first convolution kernel and the second convolution kernel to obtain initial multi-scale context features; Channel concatenation and dimensionality reduction are performed on the initial multi-scale context features to obtain current-level multi-scale context features.
2. The method according to claim 1, wherein The step of extracting initial features from the original rock image to generate an initial rock feature map comprises: Performing dimension expansion processing on the original rock image through a convolutional layer; Outputs the initial rock feature map with the preset number of channels.
3. The method according to claim 1, wherein The step of fusing the current-level dual attention feature with the current-level multi-scale context feature to obtain the current-level fusion feature comprises: splicing the current-level dual attention features and the current-level multi-scale context features according to the channel dimension to obtain high-dimensional features; The high-dimensional features are subjected to nonlinear transformation and dimensionality compression through the convolution layer to obtain the current-level fusion features.
4. The method according to claim 1, wherein The step of obtaining a subsequent fusion feature according to the current-level fusion feature, the subsequent dual attention feature, and the subsequent multi-scale context feature comprises: splicing the subsequent dual attention features and the subsequent multi-scale context features according to the channel dimension to obtain subsequent high-dimensional features; Perform nonlinear transformation and dimensionality compression on the high-dimensional features through the convolution layer to obtain subsequent fusion features; The current-level fusion feature and the subsequent fusion feature are added element by element, local feature refinement is performed, and cross-channel information interaction and feature reorganization are performed to obtain subsequent fusion features.
5. The method according to claim 1, wherein The step of obtaining rock classification results according to the subsequent fusion features includes: Performing global average pooling and layer normalization on the subsequent fused features to obtain standardized features; The standardized features are input into the fully connected layer and mapped to the target classification space to obtain the rock classification results.
6. A rock classification device based on multi-scale and dual attention feature fusion, characterized in that: The device comprises: A receiving module is used to receive an original rock image, perform initial feature extraction on the original rock image, and generate an initial rock feature map; A generation module, configured to generate a current-level dual attention feature based on the rock initial feature map, and generate a current-level multi-scale context feature based on the rock initial feature map; a fusion module, configured to fuse the current-level dual attention feature with the current-level multi-scale context feature to obtain a current-level fusion feature; an iterative module, configured to generate subsequent dual attention features based on the current-level dual attention features, and generate subsequent multi-scale context features based on the current-level multi-scale context features; a classification module, configured to obtain subsequent fusion features based on the current-level fusion features, the subsequent dual attention features, and the subsequent multi-scale context features, and obtain a rock classification result based on the subsequent fusion features; The step of generating a current-level dual attention feature according to the initial rock feature map includes: Performing layer normalization processing on the initial rock feature map to obtain channel normalized features and space normalized features; Mapping the channel normalized features into a channel query matrix, a channel key matrix, and a channel value matrix, and mapping the spatial normalized features into a spatial query matrix, a spatial key matrix, and a spatial value matrix; Multiplying the channel query matrix by the channel key matrix to obtain a channel attention matrix, and multiplying the channel attention matrix by the channel value matrix to obtain a channel attention feature; Multiplying the spatial query matrix by the spatial key matrix to obtain a spatial attention matrix, and multiplying the spatial attention matrix by the spatial value matrix to obtain spatial attention features; Concatenate the channel attention feature and the spatial attention feature along the channel dimension to obtain the current-level dual attention feature; The step of generating the current-level multi-scale context features according to the initial rock feature map includes: Using the first convolution kernel and the second convolution kernel to extract the initial rock feature map respectively to obtain micro texture features and lithofacies structure features; Splitting and cross-recombining the microtexture features and the petrographic structural features according to the channel dimension to obtain recombined features; Performing secondary convolution extraction on the recombined features using the real-time first convolution kernel and the second convolution kernel to obtain initial multi-scale context features; Channel concatenation and dimensionality reduction are performed on the initial multi-scale context features to obtain current-level multi-scale context features.
7. A rock classification device based on multi-scale and dual attention feature fusion, characterized in that: The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the rock classification method based on multi-scale and dual attention feature fusion as described in any one of claims 1 to 5.
8. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the rock classification method based on multi-scale and dual attention feature fusion as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Ground feature classification method and device based on multi-scale attention mechanism, electronic equipment and medium
CN114913436A
Remote sensing small target detection method, system and device based on fusion cascade attention mechanism and medium
CN116385896A