Carbonate rock thin section identification intelligent generation method based on CLIP large language model
Patent Information
- Application Number
- CN202410034502.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-10
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2044-01-10
AI Technical Summary
现有技术难以快速且准确地鉴定复杂岩性碳酸盐岩石薄片,且传统方法效率低、易受专家经验影响,无法生成完整的岩石薄片鉴定报告。
An intelligent generation method for carbonate rock thin section identification based on the CLIP large language model is adopted. By constructing a text generation model for carbonate rock thin section identification, and using sample data from the training set, validation set and test set, identification reports of rock thin sections are generated, realizing multi-factor identification of lithology, composition and structural type.
It enables rapid and accurate identification of thin sections of complex lithology rocks, has zero-sample learning capability, can be applied to unseen results, and provides a basis for the exploration and development of complex lithological reservoirs.
Smart Images

Figure CN118097401B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of oil and gas exploration technology, specifically to an intelligent generation method for identifying carbonate rock thin sections based on the CLIP large language model. Background Technology
[0002] Rock thin sections are crucial tools for analyzing pore structure in geophysics and petroleum science. Previously, rock thin section identification primarily relied on image analysis combined with expert experience. This method suffers from drawbacks such as high workload, low efficiency, and susceptibility to expert bias. Meanwhile, carbonate rocks play a vital role in oil and gas exploration, containing abundant oil and gas resources. However, the complex composition of carbonate rocks increases the difficulty of their thin section identification. Therefore, research into methods for identifying carbonate rock thin sections is particularly important.
[0003] With the development of deep learning and multimodal intelligence, the interaction of various data information has provided new directions for rock thin section identification. Currently, domestic and international research on intelligent rock thin section identification is still based on image classification. This type of method is supervised learning, meaning that the rock thin section type needs to be determined before model training. This method is difficult to apply to the identification of complex lithologies such as carbonate rock thin sections. Furthermore, current rock thin section identification methods remain at the level of category identification, only able to determine the rock thin section type based on the image, and unable to generate a complete rock thin section identification report. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention proposes an intelligent generation method for identifying carbonate thin sections based on the CLIP large language model. This method generates unsupervised text from rock thin section images, enabling rapid identification of thin sections with complex lithologies. It facilitates the quick and accurate acquisition of lithology, composition, and structural type of rock thin sections, providing a basis for the exploration and development of complex lithological reservoirs.
[0005] The present invention adopts the following technical solution:
[0006] A smart generation method for identifying carbonate rock thin sections based on the CLIP large language model includes the following steps:
[0007] Step 1: Acquire multiple carbonate rock thin section images, determine the identification text corresponding to each carbonate rock thin section image and perform template processing to generate a carbonate rock text library and obtain multiple sample data. Use the sample data to construct a rock thin section identification text generation dataset including a training set, a validation set and a test set.
[0008] Step 2: Construct a text generation model for carbonate rock thin section identification based on the CLIP large language model;
[0009] Step 3: Train the carbonate rock thin section identification text generation model using the sample data in the training set. After obtaining the trained carbonate rock thin section identification text generation model, verify the carbonate rock thin section identification text generation model using the training samples in the validation set.
[0010] Step 4: Randomly select carbonate rock thin section images from the test set and input them into the validated carbonate rock thin section identification text generation model. Use the validated carbonate rock thin section identification text generation model to generate the identification text corresponding to each carbonate rock thin section, and obtain the rock thin section identification report.
[0011] Preferably, step 1 includes the following steps:
[0012] Step 1.1: Obtain multiple thin section images of carbonate rocks in the carbonate rock reservoir. After determining the identification text corresponding to each thin section image of carbonate rocks, perform template processing on each identification text, retaining only the lithology, composition and structural type in the identification text, and obtain multiple image samples marked with the templated identification text. Then, use the lithology, composition and structural type extracted from each identification text to establish a carbonate rock text library.
[0013] Step 1.2: Using each image sample as sample data, after determining the number of each sample data, the sample data are randomly assigned to the training set, validation set, and test set to construct a rock thin section identification text generation database.
[0014] Preferably, the ratio of the number of sample data in the training set, validation set, and test set is 6:3:1.
[0015] Preferably, the text generation model for carbonate rock thin section identification is constructed based on the CLIP large language model, including two image encoders, two text encoders and one text generator;
[0016] The two image encoders are a first image encoder and a second image encoder. The first image encoder and the second image encoder have the same structure, consisting of four downsampling modules and a fully connected layer connected in sequence, which are used to convert carbonate rock thin section images into image feature vectors.
[0017] The downsampling module includes a convolutional layer, an average pooling layer, an activation function layer, and a normalization layer connected in sequence. The convolutional layer is used to perform two-dimensional convolution operations. The convolutional kernel size in the convolutional layer is 5×5, the stride is 2, and the padding is 1. The average pooling layer is used to perform average two-dimensional pooling. The activation function layer contains a ReLU function. The normalization layer is used to perform normalization processing.
[0018] The two text encoders are a first text encoder and a second text encoder. The first text encoder and the second text encoder have the same structure and are built based on the Transformer network. They are composed of a positional encoding layer, three self-attention mechanism modules with the same structure and a fully connected layer connected in sequence. They are used to convert the identification text of carbonate rock thin section images into text feature vectors.
[0019] The positional encoding layer is used to assign numerical values to text words in the identified text to generate text feature vectors; the self-attention mechanism module is provided with a self-attention mechanism layer and a normalization layer, wherein the self-attention mechanism layer is used to determine the weight of each text word according to the importance of each text word in the identified text, and the normalization layer is used to perform normalization processing.
[0020] The fully connected layers in both the image encoder and the text encoder are used to adjust the dimension of the feature vectors so that the dimension of the image feature vectors output by the image encoder is the same as the dimension of the text feature vectors output by the text encoder.
[0021] The text generator is used to randomly generate identification text according to a preset text template. The text template includes important words and prompt words. The important words are randomly generated based on a carbonate rock text library, and the prompt words are preset text content.
[0022] Preferably, when sample data from the rock thin section identification text generation dataset is input into the carbonate rock thin section identification text generation model, the carbonate rock thin section images in the sample data are respectively input into the first image encoder and the second image encoder. The carbonate rock thin section images input into the first image encoder are processed by the first image encoder to obtain the image feature vector corresponding to the carbonate rock thin section images. At the same time, the identification text in the sample data is input into the first text encoder and processed by the first text encoder to obtain the text feature vector corresponding to the identification text.
[0023] The image feature vector output by the first image encoder and the text feature vector output by the first text encoder are projected together. The original similarity matrix is generated by calculating the cosine similarity of the feature vectors at each projection position.
[0024] The carbonate rock thin section image input to the second image encoder is processed by the second image encoder to obtain the image feature vector corresponding to the carbonate rock thin section image. At the same time, according to the preset text template, the identification text is generated by the text generator and input into the second text encoder. The identification text of the carbonate rock thin section image is processed by the second text encoder and converted into a text feature vector.
[0025] The image feature vector output by the second image encoder and the text feature vector output by the second text encoder are projected together. By calculating the cosine similarity of the feature vectors at each projection position, a similarity matrix is generated.
[0026] After label hardening of the original similarity matrix and the generated similarity matrix, the loss function value between the original similarity matrix and the generated similarity matrix is calculated.
[0027] Preferably, the self-attention mechanism used in the self-attention mechanism layer is:
[0028]
[0029] In the formula, Attention(·) is the attention mechanism, Q is the query vector, K is the relevance vector, and V is the query information vector; softmax(·) is the normalized exponential function, T is the transpose matrix, and d K √(variance) is the square root of the correlation vector.
[0030] Preferably, the cosine similarity calculation formula is:
[0031]
[0032]
[0033] In the formula, i is the sequence number of the carbonate rock thin section image, l i For the i-th carbonate rock thin section image input to the first image encoder, x i For the i-th carbonate rock thin section image input to the second image encoder, t j Let y be the text feature vector corresponding to the j-th original identified text. j Let C be the text feature vector corresponding to the j-th generated identification text. i,j D represents the cosine similarity between the image feature vector corresponding to the carbonate rock thin section image and the original identification text. i,j The cosine similarity between the image feature vector corresponding to the thin section image of carbonate rock and the identification text generated by the text generator;
[0034] In the label hardening process, the correct identification text corresponding to the carbonate rock thin section image is used as a positive sample, and the incorrect identification text corresponding to the carbonate rock thin section image is used as a negative sample. The original similarity matrix and the generated similarity matrix are processed based on the Softmax function. The label hardening process increases the similarity difference between positive and negative samples.
[0035] The Softmax function is:
[0036]
[0037]
[0038] In the formula, E(i,j) is the original similarity matrix after label hardening, P(i,j) is the generated similarity matrix after label hardening, and N is the total number of sample data.
[0039] Preferably, the loss function is set as the cross-entropy function, as shown in formula (6):
[0040]
[0041] In the formula, Loss is the value of the loss function.
[0042] Preferably, step 3 includes the following steps:
[0043] Step 3.1: Set the hyperparameters, training batches, and preset loss function values for the carbonate rock thin section identification text generation model, and preset the prompt words for the text template;
[0044] Step 3.2: Randomly select multiple sample data from the training set according to the training batch and input them into the carbonate rock thin section identification text generation model to train the carbonate rock thin section identification text generation model to generate identification text. In each training process, calculate the loss function value based on the original similarity matrix and the generated similarity matrix after label hardening processing of the carbonate rock thin section identification text generation model.
[0045] Step 3.3: Compare the calculated loss function value with the preset loss function value. If the calculated loss function value is greater than the preset loss function value, adjust the hyperparameters of the carbonate rock thin section identification text generation model and return to step 3.2 to continue training the carbonate rock thin section identification text generation model. Otherwise, stop training the carbonate rock thin section identification text generation model and proceed to step 3.4.
[0046] Step 3.4: Randomly select multiple sample data from the validation set and input them into the trained carbonate rock thin section identification text generation model to generate identification text. Obtain the loss function value of the carbonate rock thin section identification text generation model. If the loss function value of the carbonate rock thin section identification text generation model is greater than the preset loss function value, return to step 3.2; otherwise, proceed to step 3.5.
[0047] Step 3.5: Stop the verification of the text generation model for carbonate rock thin section identification, and obtain the verified text generation model for carbonate rock thin section identification.
[0048] The present invention has the following beneficial effects:
[0049] This invention proposes an intelligent text generation method for carbonate rock thin section identification based on the CLIP large language model. A text generation model for carbonate rock thin section identification is constructed based on the CLIP large language model. The trained and validated text generation model is used to generate identification text. Compared to traditional rock thin section text generation models that can only identify a single rock category, the carbonate rock thin section identification text generation model constructed in this invention achieves multi-factor identification of lithology, composition, and structural type in rock thin sections, possesses rich text generation capabilities, and enables rapid and accurate acquisition of rock thin section information.
[0050] Meanwhile, the carbonate rock thin section identification text generation model constructed in this invention has zero-sample learning capability. By calling the matching carbonate rock text library, it can be applied to results that did not appear in the original identification text. Through unsupervised text generation of rock thin section images, it achieves accurate acquisition of lithology, composition and structural type in rock thin section images, providing a basis for the exploration and development of complex lithological reservoirs. Attached Figure Description
[0051] Figure 1 This is a schematic diagram of the intelligent generation method for carbonate rock thin section identification based on the CLIP large language model of the present invention.
[0052] Figure 2 This is a schematic diagram of the structure of a text generation model for carbonate rock thin section identification based on the CLIP large language model.
[0053] Figure 3 This is a schematic diagram of the structure of an image encoder.
[0054] Figure 4 This is a schematic diagram of the structure of a text encoder.
[0055] Figure 5 The diagram illustrates the identification of text. In the diagram, (a) is a thin section image of carbonate rock, and (b) is an activation feature map for generating identification text. Detailed Implementation
[0056] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings:
[0057] Example 1
[0058] This invention proposes an intelligent generation method for identifying thin sections of carbonate rocks based on the CLIP large language model, such as... Figure 1 As shown, the specific steps include:
[0059] Step 1: Acquire multiple carbonate rock thin section images, determine the identification text corresponding to each carbonate rock thin section image and perform template processing to generate a carbonate rock text library and obtain multiple sample data. Use the sample data to construct a rock thin section identification text generation dataset including a training set, a validation set, and a test set, including the following steps:
[0060] Step 1.1: Obtain multiple thin section images of carbonate rocks in the carbonate rock reservoir. After determining the identification text corresponding to each thin section image of carbonate rocks, perform template processing on each identification text, retaining only the lithology, composition and structural type in the identification text, and obtain multiple image samples marked with the templated identification text. Then, use the lithology, composition and structural type extracted from each identification text to establish a carbonate rock text library.
[0061] Step 1.2: Using each image sample as sample data, after determining the number of each sample data, the sample data are randomly assigned to the training set, validation set, and test set to construct a rock thin section identification text generation database.
[0062] Step 2: Construct a text generation model for carbonate rock thin section identification based on the CLIP large language model, such as... Figure 2 As shown.
[0063] The text generation model for carbonate rock thin section identification is based on the CLIP (Contrastive Language-Image Pre-Training) large language model, which includes two image encoders, two text encoders and one text generator.
[0064] The two image encoders are a first image encoder and a second image encoder. The first and second image encoders have identical structures, consisting of four downsampling modules and a fully connected layer connected sequentially. Figure 3 As shown, this is used to convert thin section images of carbonate rocks into image feature vectors.
[0065] The downsampling module includes a convolutional layer, an average pooling layer, an activation function layer, and a normalization layer connected in sequence. The convolutional layer is used to perform two-dimensional convolution operations. The convolutional kernel size in the convolutional layer is 5×5, the stride is 2, and the padding is 1. The average pooling layer is used to perform average two-dimensional pooling. The activation function layer contains a ReLU function. The normalization layer is used to perform normalization processing, which enables the feature vectors of each training batch to conform to a normal distribution.
[0066] The two text encoders are a first text encoder and a second text encoder. The first and second text encoders have the same structure and are built based on a Transformer network, such as... Figure 4As shown, it consists of a location encoding layer, three identical self-attention mechanism modules, and a fully connected layer connected in sequence, and is used to convert the identification text of carbonate rock thin section images into text feature vectors.
[0067] The positional encoding layer is used to assign numerical values to text words in the identification text to generate text feature vectors, thereby representing the text as a high-dimensional vector. This achieves the learnability of the text encoder while ensuring the positional information of words in the identification text. The self-attention mechanism module includes a self-attention mechanism layer and a normalization layer. The self-attention mechanism layer is used to determine the weight of each text word based on its importance in the identification text. The normalization layer is used to perform normalization processing, which can ensure that the weights in the feature vector conform to a normal distribution and avoid the gradient explosion phenomenon in the later stage of training.
[0068] In this embodiment, a self-attention mechanism layer is used to measure the importance of different words in the rock thin section identification text. The self-attention mechanism used in the self-attention mechanism layer is as follows:
[0069]
[0070] In the formula, Attention(·) is the attention mechanism, Q is the query vector, K is the relevance vector, and V is the query information vector; softmax(·) is the normalized exponential function, T is the transpose matrix, and d K √(variance) is the square root of the correlation vector.
[0071] The fully connected layers in both the image encoder and the text encoder are used to adjust the dimension of the feature vectors so that the dimension of the image feature vectors output by the image encoder is the same as the dimension of the text feature vectors output by the text encoder.
[0072] The text generator is used to randomly generate identification text according to a preset text template. The text template includes important words and prompt words. The important words are randomly generated based on a carbonate rock text library, and the prompt words are preset text content.
[0073] In this embodiment, when sample data from the rock thin section identification text generation dataset is input into the carbonate rock thin section identification text generation model, the carbonate rock thin section images in the sample data are respectively input into the first image encoder and the second image encoder. The carbonate rock thin section images input into the first image encoder are processed by the first image encoder to obtain the image feature vector corresponding to the carbonate rock thin section images. At the same time, the identification text in the sample data is input into the first text encoder and processed by the first text encoder to obtain the text feature vector corresponding to the identification text.
[0074] The image feature vector output by the first image encoder is then projected onto the text feature vector output by the first text encoder. The original similarity matrix is generated by calculating the cosine similarity of the feature vectors at each projection position.
[0075] Simultaneously, the carbonate rock thin section image input to the second image encoder is processed by the second image encoder to obtain the image feature vector corresponding to the carbonate rock thin section image. At the same time, according to the preset text template, the identification text is generated by the text generator and input into the second text encoder. The identification text of the carbonate rock thin section image is processed by the second text encoder and converted into a text feature vector.
[0076] Next, the image feature vector output by the second image encoder and the text feature vector output by the second text encoder are projected together. By calculating the cosine similarity of the feature vectors at each projection position, a similarity matrix is generated.
[0077] Finally, after label hardening of the original similarity matrix and the generated similarity matrix, the loss function value between the original similarity matrix and the generated similarity matrix is calculated.
[0078] In this embodiment, the cosine similarity calculation formula is:
[0079]
[0080]
[0081] In the formula, i is the sequence number of the carbonate rock thin section image, l i For the i-th carbonate rock thin section image input to the first image encoder, x i For the i-th carbonate rock thin section image input to the second image encoder, t j Let y be the text feature vector corresponding to the j-th original identified text. j Let C be the text feature vector corresponding to the j-th generated identification text. i,j D represents the cosine similarity between the image feature vector corresponding to the carbonate rock thin section image and the original identification text. i,j Cosine similarity between the image feature vector corresponding to the carbonate rock thin section image and the identification text generated by the text generator.
[0082] In the label hardening process, the correct identification text corresponding to the carbonate rock thin section image is used as a positive sample, and the incorrect identification text corresponding to the carbonate rock thin section image is used as a negative sample. The original similarity matrix and the generated similarity matrix are processed based on the Softmax function. The label hardening process increases the similarity difference between positive and negative samples.
[0083] The formula for the Softmax function is:
[0084]
[0085]
[0086] In the formula, E(i,j) is the original similarity matrix after label hardening, P(i,j) is the generated similarity matrix after label hardening, and N is the total number of sample data.
[0087] In this embodiment, the loss function is set as the cross-entropy function, as shown in formula (6):
[0088]
[0089] In the formula, Loss is the value of the loss function.
[0090] Step 3: Train the carbonate rock thin section identification text generation model using sample data from the training set. After obtaining the trained carbonate rock thin section identification text generation model, validate the model using training samples from the validation set. This includes the following steps:
[0091] Step 3.1: Set the hyperparameters, training batches, and preset loss function values for the carbonate rock thin section identification text generation model, and preset the prompt words for the text template.
[0092] Step 3.2: Randomly select multiple sample data from the training set according to the training batch and input them into the carbonate rock thin section identification text generation model to train the carbonate rock thin section identification text generation model to generate identification text. During each training process, calculate the loss function value based on the original similarity matrix and the generated similarity matrix after label hardening processing of the carbonate rock thin section identification text generation model.
[0093] Step 3.3: Compare the calculated loss function value with the preset loss function value. If the calculated loss function value is greater than the preset loss function value, adjust the hyperparameters of the carbonate rock thin section identification text generation model and return to step 3.2 to continue training the carbonate rock thin section identification text generation model. Otherwise, stop training the carbonate rock thin section identification text generation model and proceed to step 3.4.
[0094] Step 3.4: Randomly select multiple sample data from the validation set and input them into the trained carbonate rock thin section identification text generation model to generate identification text. Obtain the loss function value of the carbonate rock thin section identification text generation model. If the loss function value of the carbonate rock thin section identification text generation model is greater than the preset loss function value, return to step 3.2; otherwise, proceed to step 3.5.
[0095] Step 3.5: Stop the verification of the text generation model for carbonate rock thin section identification, and obtain the verified text generation model for carbonate rock thin section identification.
[0096] Step 4: Randomly select carbonate rock thin section images from the test set and input them into the validated carbonate rock thin section identification text generation model. Use the validated carbonate rock thin section identification text generation model to generate identification texts corresponding to each carbonate rock thin section, and obtain the lithology, composition and structural type of the carbonate rock thin section.
[0097] Example 2
[0098] This embodiment uses the intelligent generation method for carbonate rock thin section identification based on CLIP large language model described in Embodiment 1 to identify the carbonate rock thin sections obtained in study area A. The specific steps include:
[0099] Step 1: Obtain 136,132 carbonate rock thin section images from study area A, determine the identification text corresponding to each carbonate rock thin section image and perform template processing, retaining only the lithology, composition, and structural type in the identification text, resulting in 136,132 image samples labeled with the templated identification text. After establishing a carbonate rock text library using the lithology, composition, and structural type extracted from each identification text, use the Dataset class in the PYTORCH library to number each sample data, generating a carbonate rock text library with 136,132 sample data. Randomly allocate the sample data to the training set, validation set, and test set to construct a rock thin section identification text generation dataset. The ratio of the number of sample data in the training set, validation set, and test set in the rock thin section identification text generation dataset is 6:3:1.
[0100] Step 2: Construct a text generation model for carbonate rock thin section identification based on the CLIP large language model.
[0101] Step 3: Train the carbonate rock thin section identification text generation model using sample data from the training set. After obtaining the trained carbonate rock thin section identification text generation model, validate the model using training samples from the validation set. This includes the following steps:
[0102] Step 3.1: Set the hyperparameters, training batches, and preset loss function values for the carbonate rock thin section identification text generation model, and preset the prompt words for the text template.
[0103] In this embodiment, the hyperparameters of the text generation model for carbonate rock thin section identification are set to an initial learning rate of 1×10⁻⁶. -4The training batch size is 16, meaning that 16 sample data points are input into the carbonate rock thin section identification text generation model during each training process. Each sample data point includes a carbonate rock thin section image and the corresponding identification text, such as... Figure 2 As shown, Figure 2 The identification text corresponding to the thin section image of the medium carbonate rock is "argillaceous coarse-grained limestone, the rock composition is mainly calcite and argillaceous, with a layered structure."
[0104] During each training process, when the carbonate rock thin section image is input into the image encoder of the carbonate rock thin section identification text generation model for each sample data, the carbonate rock thin section image input into the first image encoder is processed by the first image encoder to obtain the image feature vector corresponding to the carbonate rock thin section image. The image encoder projects the carbonate rock thin section image into a high-dimensional feature space to obtain an image feature vector of size (16, 256, 64). At the same time, the identification text in the sample data is input into the first text encoder and processed by the first text encoder to obtain the text feature vector corresponding to the identification text. The text feature vector of size (16, 256, 64) is then used for feature projection between the image feature vector output by the first image encoder and the text feature vector output by the first text encoder to obtain a feature vector matrix of size (16, 256, [64, 64]). By calculating the cosine similarity of the feature vectors at each projection position in the feature vector matrix, an original similarity matrix of size (16, 256, 64) is generated.
[0105] Simultaneously, the carbonate rock thin section image input to the second image encoder is processed by the second image encoder to obtain the image feature vector corresponding to the carbonate rock thin section image. At the same time, a text template is set. In this embodiment, the content of the text template is "The main rock components are, structure.", where the underlined part is the keyword and the other part is the prompt word. The text generator randomly generates keywords for the underlined part to obtain the identification text, which is input into the second text encoder. The identification text of the carbonate rock thin section image is processed by the second text encoder and converted into a text feature vector. The image feature vector output by the second image encoder and the text feature vector output by the second text encoder are subjected to feature projection. By calculating the cosine similarity of the feature vectors at each projection position, a generated similarity matrix with size (16, 256, 64) is obtained.
[0106] Finally, after label hardening of the original similarity matrix and the generated similarity matrix, the loss function value between the original similarity matrix and the generated similarity matrix is calculated, and the convergence of the loss function value of the carbonate rock thin section identification text generation model is controlled by the preset loss function value.
[0107] Step 3.3: Compare the calculated loss function value with the preset loss function value. If the calculated loss function value is greater than the preset loss function value, adjust the hyperparameters of the carbonate rock thin section identification text generation model and return to step 3.2 to continue training the carbonate rock thin section identification text generation model. Otherwise, stop training the carbonate rock thin section identification text generation model and proceed to step 3.4.
[0108] Step 3.4: Randomly select multiple sample data from the validation set and input them into the trained carbonate rock thin section identification text generation model to generate identification text. Obtain the loss function value of the carbonate rock thin section identification text generation model. If the loss function value of the carbonate rock thin section identification text generation model is greater than the preset loss function value, return to step 3.2; otherwise, proceed to step 3.5.
[0109] Step 3.5: Stop the verification of the text generation model for carbonate rock thin section identification, and obtain the verified text generation model for carbonate rock thin section identification.
[0110] Step 4: Randomly select carbonate rock thin sections from the test set and input them into the validated carbonate rock thin section identification text generation model. Use the validated carbonate rock thin section identification text generation model to generate the identification text corresponding to each carbonate rock thin section.
[0111] In this embodiment, 16 carbonate rock thin sections are randomly selected from the test set. The images of the 16 carbonate rock thin sections are input into the validated carbonate rock thin section identification text generation model. The model is then used to generate identification texts for the 16 rock thin sections. Figure 5 The image shows one of the identification results. By comparing it with the activated feature map of the generated identification text, the text "mudstone" in lithology was correctly generated, the text "argillaceous and calcite" in composition was correctly generated, and the text "laminated" in structural type was correctly generated. This verifies that the method of the present invention has good accuracy. Further analysis of the activated feature map of the generated identification text shows that the laminae, calcite, argillaceous and other features in the carbonate thin section image have been identified by the carbonate thin section identification text generation model. This verifies that the method of the present invention is beneficial for lithological identification, compositional analysis and structural identification of thin sections of complex lithologies, and provides a basis for guiding the exploration and development of complex reservoirs.
[0112] Of course, the above description is not intended to limit the present invention, and the present invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of the present invention should also fall within the protection scope of the present invention.
Claims
1. A smart generation method for identifying thin sections of carbonate rocks based on the CLIP large language model, characterized in that, Specifically, the following steps are included: Step 1: Acquire multiple carbonate rock thin section images, determine the identification text corresponding to each carbonate rock thin section image and perform template processing to generate a carbonate rock text library and obtain multiple sample data. Use the sample data to construct a rock thin section identification text generation dataset including a training set, a validation set and a test set. Step 2: Construct a text generation model for carbonate rock thin section identification based on the CLIP large language model; Step 3: Train the carbonate rock thin section identification text generation model using the sample data in the training set. After obtaining the trained carbonate rock thin section identification text generation model, verify the carbonate rock thin section identification text generation model using the training samples in the validation set. Step 4: Randomly select carbonate rock thin section images from the test set and input them into the validated carbonate rock thin section identification text generation model. Use the validated carbonate rock thin section identification text generation model to generate identification text corresponding to each carbonate rock thin section, and obtain a rock thin section identification report. The text generation model for carbonate rock thin section identification is based on the CLIP large language model and includes two image encoders, two text encoders and one text generator. The two image encoders are a first image encoder and a second image encoder. The first image encoder and the second image encoder have the same structure, consisting of four downsampling modules and a fully connected layer connected in sequence, which are used to convert carbonate rock thin section images into image feature vectors. The downsampling module includes a convolutional layer, an average pooling layer, an activation function layer, and a normalization layer connected in sequence. The convolutional layer is used to perform two-dimensional convolution operations. The convolutional kernel size in the convolutional layer is 5×5, the stride is 2, and the padding is 1. The average pooling layer is used to perform average two-dimensional pooling. The activation function layer contains a ReLU function. The normalization layer is used to perform normalization processing. The two text encoders are a first text encoder and a second text encoder. The first text encoder and the second text encoder have the same structure and are built based on the Transformer network. They are composed of a positional encoding layer, three self-attention mechanism modules with the same structure, and a fully connected layer connected in sequence. They are used to convert the identification text of carbonate rock thin section images into text feature vectors. The positional encoding layer is used to assign numerical values to text words in the identified text to generate text feature vectors; the self-attention mechanism module is provided with a self-attention mechanism layer and a normalization layer, wherein the self-attention mechanism layer is used to determine the weight of each text word according to the importance of each text word in the identified text, and the normalization layer is used to perform normalization processing. The fully connected layers in both the image encoder and the text encoder are used to adjust the dimension of the feature vectors so that the dimension of the image feature vectors output by the image encoder is the same as the dimension of the text feature vectors output by the text encoder. The text generator is used to randomly generate identification text according to a preset text template. The text template includes important words and prompt words. The important words are randomly generated based on a carbonate rock text library, and the prompt words are preset text content. When sample data from the rock thin section identification text generation dataset is input into the carbonate rock thin section identification text generation model, the carbonate rock thin section images in the sample data are respectively input into the first image encoder and the second image encoder. The carbonate rock thin section images input into the first image encoder are processed by the first image encoder to obtain the image feature vector corresponding to the carbonate rock thin section images. At the same time, the identification text in the sample data is input into the first text encoder and processed by the first text encoder to obtain the text feature vector corresponding to the identification text. The image feature vector output by the first image encoder and the text feature vector output by the first text encoder are projected together. The original similarity matrix is generated by calculating the cosine similarity of the feature vectors at each projection position. The carbonate rock thin section image input to the second image encoder is processed by the second image encoder to obtain the image feature vector corresponding to the carbonate rock thin section image. At the same time, according to the preset text template, the identification text is generated by the text generator and input into the second text encoder. The identification text of the carbonate rock thin section image is processed by the second text encoder and converted into a text feature vector. The image feature vector output by the second image encoder and the text feature vector output by the second text encoder are projected together. By calculating the cosine similarity of the feature vectors at each projection position, a similarity matrix is generated. After label hardening of the original similarity matrix and the generated similarity matrix, the loss function value between the original similarity matrix and the generated similarity matrix is calculated.
2. The intelligent generation method for carbonate rock thin section identification based on CLIP large language model according to claim 1, characterized in that, Step 1 includes the following steps: Step 1.1: Obtain multiple thin section images of carbonate rocks in the carbonate rock reservoir. After determining the identification text corresponding to each thin section image of carbonate rocks, perform template processing on each identification text, retaining only the lithology, composition and structural type in the identification text, and obtain multiple image samples marked with the templated identification text. Then, use the lithology, composition and structural type extracted from each identification text to establish a carbonate rock text library. Step 1.2: Using each image sample as sample data, after determining the number of each sample data, the sample data are randomly assigned to the training set, validation set, and test set to construct a rock thin section identification text generation database.
3. The intelligent generation method for carbonate rock thin section identification based on CLIP large language model according to claim 2, characterized in that, The ratio of the number of sample data in the training set, validation set, and test set is 6:3:
1.
4. The intelligent generation method for carbonate rock thin section identification based on CLIP large language model according to claim 1, characterized in that, The self-attention mechanism used in the self-attention mechanism layer is as follows: (1) In the formula, For attention mechanisms, For query vector, For the correlation vector, The vector of the queried information; For normalized exponential functions, It is the transpose matrix. √(variance) is the square root of the correlation vector.
5. The intelligent generation method for carbonate rock thin section identification based on CLIP large language model according to claim 1, characterized in that, The formula for calculating cosine similarity is: (2) (3) In the formula, i is the sequence number of the carbonate rock thin section image. For the i-th carbonate rock thin section image input to the first image encoder, For the i-th carbonate rock thin section image input to the second image encoder, Let be the text feature vector corresponding to the j-th original identified text. Let j be the text feature vector corresponding to the generated identification text. Cosine similarity between the image feature vector corresponding to the carbonate rock thin section image and the original identification text. The cosine similarity between the image feature vector corresponding to the carbonate rock thin section image and the identification text generated by the text generator; In the label hardening process, the correct identification text corresponding to the carbonate rock thin section image is used as a positive sample, and the incorrect identification text corresponding to the carbonate rock thin section image is used as a negative sample. The original similarity matrix and the generated similarity matrix are processed based on the Softmax function. The label hardening process increases the similarity difference between positive and negative samples. The Softmax function is: (4) (5) In the formula, This is the original similarity matrix after label hardening. The generated similarity matrix is the result of label hardening, where N is the total number of sample data.
6. The intelligent generation method for carbonate rock thin section identification based on CLIP large language model according to claim 5, characterized in that, The loss function is set as the cross-entropy function, as shown in formula (6): (6) In the formula, This represents the loss function value.
7. The intelligent generation method for carbonate rock thin section identification based on CLIP large language model according to claim 1, characterized in that, Step 3 includes the following steps: Step 3.1: Set the hyperparameters, training batches, and preset loss function values for the carbonate rock thin section identification text generation model, and preset the prompt words for the text template; Step 3.2: Randomly select multiple sample data from the training set according to the training batch and input them into the carbonate rock thin section identification text generation model to train the carbonate rock thin section identification text generation model to generate identification text. In each training process, calculate the loss function value based on the original similarity matrix and the generated similarity matrix after label hardening processing of the carbonate rock thin section identification text generation model. Step 3.3: Compare the calculated loss function value with the preset loss function value. If the calculated loss function value is greater than the preset loss function value, adjust the hyperparameters of the carbonate rock thin section identification text generation model and return to step 3.2 to continue training the carbonate rock thin section identification text generation model. Otherwise, stop training the carbonate rock thin section identification text generation model and proceed to step 3.
4. Step 3.4: Randomly select multiple sample data from the validation set and input them into the trained carbonate rock thin section identification text generation model to generate identification text. Obtain the loss function value of the carbonate rock thin section identification text generation model. If the loss function value of the carbonate rock thin section identification text generation model is greater than the preset loss function value, return to step 3.2; otherwise, proceed to step 3.
5. Step 3.5: Stop the verification of the carbonate rock thin section identification text generation model and obtain the verified carbonate rock thin section identification text generation model.
Citation Information
Patent Citations
Rock slice bonding device
CN105181415A
Method and system for determining anisotropic permeability of interlayer-shaped shale
CN113188976A
