Lithology identification method, lithology identification equipment and medium
By converting rock images to grayscale and introducing physical constraints and illumination invariance loss during model training, the problem of insufficient generalization of lithology identification models under varying illumination conditions is solved, achieving high accuracy and robust identification under different illumination conditions.
Patent Information
- Application Number
- CN202610126506.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-26
AI Technical Summary
Existing lithology identification methods lack the ability to effectively model changes in illumination, resulting in severely inadequate generalization performance of the models under complex illumination environments.
By converting rock images to grayscale and introducing physical constraint loss and illumination invariance loss during the training of the lithology identification model, the model is forced to learn the decomposition of rock surface reflectivity and illumination intensity, ensuring that the model outputs consistent feature representations under different illumination conditions, which conforms to the principle of optical reflection.
This improved the accuracy and robustness of the lithology identification model under different lighting conditions, reduced the interference caused by changes in lighting, and enhanced the model's identification performance under extreme lighting conditions.
Smart Images

Figure CN122090135A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer vision and geological identification technology, and in particular to a method, device and medium for lithology identification. Background Technology
[0002] Lithology identification is a core technology in geological exploration, mineral resource assessment, and geological hazard prediction. Traditional methods mainly rely on geological experts to classify rock samples by visually observing their texture, color, and structure. With the development of remote sensing technology, rock images acquired by satellites and drones have become important data sources for lithology identification. However, the imaging characteristics of rocks vary significantly under different lighting conditions, leading to a substantial decrease in the accuracy of image-based identification methods. This is especially true under extreme lighting conditions, such as direct sunlight or low-light environments, where the accuracy can drop by more than 40%, severely impacting the efficiency and accuracy of geological exploration.
[0003] In recent years, deep learning technology has made significant progress in the field of image recognition. In particular, models such as the Visual Transformer (ViT) have shown great potential in lithology identification due to their powerful feature extraction capabilities. However, most existing deep learning methods are based on training data under ideal lighting conditions and lack the ability to effectively model changes in lighting, resulting in severely inadequate generalization performance of the models in complex lighting environments. Summary of the Invention
[0004] This application provides a lithology identification method, device, and medium to solve the following technical problem: the existing lithology identification methods use lithology identification models that lack effective modeling capabilities for changes in illumination, resulting in severely insufficient generalization performance of the models under complex illumination environments.
[0005] In a first aspect, embodiments of this application provide a method comprising: performing grayscale processing on a rock image to be identified to obtain a grayscale image corresponding to the rock image; inputting the grayscale image into a trained lithology identification model to obtain an identification result corresponding to the grayscale image output by the lithology identification model; wherein the lithology identification model is used to determine the identification result corresponding to the grayscale image based on the grayscale image; during the training process of the lithology identification model, the optimization objectives are classification loss and regularization loss, wherein the classification loss is used to enable the lithology identification model to correctly predict the rock category; the regularization loss includes physical constraint loss and illumination invariance loss, the physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and illumination intensity to conform to the principle of optical reflection; the illumination invariance loss is used to enable the lithology identification model to output consistent feature representations for images of the same rock under different simulated illumination conditions.
[0006] Secondly, embodiments of this application also provide a lithology identification device, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a lithology identification method as described in the first aspect above.
[0007] Thirdly, embodiments of this application also provide a computer storage medium storing computer-executable instructions, which, when executed, implement a lithology identification method as described in the first aspect above.
[0008] The lithology identification method, device, and medium provided in this application have the following beneficial effects: In this embodiment, the rock image to be identified can be grayscaled to obtain a corresponding grayscale image, which is then input into the lithology identification model to obtain the identification result corresponding to the grayscale image. In the training process, the lithology identification model needs to train regularization loss in addition to classification loss. The physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and light intensity. The light invariance loss is used to make the lithology identification model output consistent feature representations for the same rock under different simulated lighting conditions. In this way, the features learned by the lithology identification model not only have light invariance but also conform to the physical optics principle, which can fundamentally solve the interference problem caused by light changes. Attached Figure Description
[0009] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart of a lithology identification method provided in this application embodiment; Figure 2 A schematic diagram of the structure of an illumination invariance regularization module provided in an embodiment of this application; Figure 3 This is a schematic diagram of the internal structure of a lithology identification device provided in an embodiment of this application. Detailed Implementation
[0010] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0011] This application provides a lithology identification method. The technical solution proposed in this application will be described in detail below with reference to the accompanying drawings.
[0012] Figure 1 This is a flowchart illustrating a lithology identification method provided in an embodiment of this application. Figure 1 As shown in the figure, a method provided in this application embodiment specifically includes the following steps: Step 101: Perform grayscale processing on the rock image to be identified to obtain the grayscale image corresponding to the rock image.
[0013] In practical applications, rock lithology identification primarily relies on geometric features such as texture, structure, grain size, and bedding, rather than color. Grayscale conversion transforms the RGB three channels of a color image into a single channel (brightness value), directly removing color interference while preserving the rock's morphological and structural information. This allows lithology identification models to focus more on essential lithology-related features. For example, in grayscale images, features such as bedding, cracks, and grain boundaries are clearly presented through contrasting light and dark areas, facilitating model extraction.
[0014] In this embodiment, the rock image to be identified can be converted to grayscale to obtain a corresponding grayscale image. This eliminates color deviation, allowing the lithology identification model to focus more on the spatial structural features of the rock, thereby improving its adaptability to different lighting conditions and shooting environments.
[0015] Step 102: Input the grayscale image into the trained lithology identification model to obtain the identification result corresponding to the grayscale image output by the lithology identification model.
[0016] The lithology identification model is used to determine the identification result corresponding to the grayscale image based on the grayscale image.
[0017] In this embodiment, a grayscale image can be input into a trained lithology identification model to obtain the identification result corresponding to the grayscale image output by the model. Grayscale images have fewer channels than color images. Therefore, during the inference phase of the lithology identification model, grayscale images reduce computational load, shorten the processing time for a single image, and improve real-time performance (e.g., rapid identification in the field). Furthermore, the lithology identification model is designed for grayscale images, with significantly fewer parameters than models processing color images (which require separate processing of RGB channels), simplifying the model's structure. Grayscale images, stripped of color information, avoid misclassification due to color deviations, improving classification accuracy.
[0018] During the training process of the lithology identification model, classification loss and regularization loss are trained, wherein, The classification loss is used to enable the lithology identification model to correctly predict the rock category; The regularization loss includes physical constraint loss and illumination invariance loss. The physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and illumination intensity, so as to conform to the principle of optical reflection. The illumination invariance loss is used to ensure that the lithology identification model outputs consistent feature representations for images of the same rock under different simulated illumination conditions.
[0019] In practical applications, unlike existing technologies where the training of lithology identification models only involves classification loss, the lithology identification model in this application requires training a regularization loss in addition to the classification loss during the training process. The physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and light intensity, and the light invariance loss is used to ensure that the lithology identification model outputs consistent feature representations for images of the same rock under different simulated lighting conditions. In this way, the features learned by the lithology identification model not only have light invariance but also conform to the principles of physical optics, which can fundamentally solve the interference problem caused by changes in lighting.
[0020] In this embodiment, the rock image to be identified can be grayscaled to obtain a corresponding grayscale image, which is then input into the lithology identification model to obtain the identification result corresponding to the grayscale image. In the training process, the lithology identification model needs to train regularization loss in addition to classification loss. The physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and light intensity. The light invariance loss is used to make the lithology identification model output consistent feature representations for the same rock under different simulated lighting conditions. In this way, the features learned by the lithology identification model not only have light invariance but also conform to the physical optics principle, which can fundamentally solve the interference problem caused by light changes.
[0021] In one possible implementation, the above-mentioned lithology identification model is trained in the following way: Preprocessing is performed on sample rock images with precise illumination parameter annotations to obtain preprocessed images; The lithology identification model is constructed based on the preset structure; The sample grayscale image corresponding to the preprocessed image is input into the lithology identification model to obtain the classification loss and the regularization loss. The parameters of the lithology identification model are adjusted based on the classification loss and the regularization loss. Repeat the above steps to obtain the trained lithology identification model under the preset conditions.
[0022] In practical applications, a multimodal data fusion strategy can be adopted when collecting data, mainly for rock images with precise illumination parameter annotations. Data sources include field collection, controlled laboratory photography, and professional geological databases. Field collection utilized a high dynamic range (HDR) camera system (Sony A7R IV, 61 megapixels) and a spherical photometer to record ambient lighting parameters in real time. The collection covered six typical lithologies: granite, limestone, sandstone, shale, basalt, and gneiss, with at least 30 samples for each lithology. Each sample was at least 25cm x 25cm in size, with no obvious weathering or contamination on its surface. During photography, the sample was ensured to occupy the center of the image with a neutral gray background. Laboratory photography was conducted using an integrating sphere lighting system with a D65 standard light source and a programmable LED light array. Precise control of light intensity (0-100,000 lux), direction (0-360 degrees), and color temperature (3000K-10000K) was achieved. Fifteen images were captured for each sample under each lighting condition. Simultaneously, images were collected from a professional geological database (GeoImage). 15,000 rock images with precise illumination parameters were selected from the database, resulting in a dataset of 90,000 images in total. Among them, 50,000 images were collected in the field, 15,000 were taken in the laboratory, and 25,000 were from a professional database. All images were double-labeled by geological experts to classify the rock type and recorded precise illumination parameters (including light intensity, direction, color temperature, and environmental reflectivity).
[0023] The data acquisition process begins with establishing a sample library. Three-dimensional scanning and spectral analysis are performed on the collected rock samples, recording the reflectance distribution curves. For field photography, a multi-angle shooting strategy is employed, with each sample photographed from three main angles (0°, 45°, and 90°), each angle covering different time periods (morning, noon, and evening). A three-axis stabilized gimbal ensures consistent shooting height (1.5 meters) and angle. Laboratory photography utilizes an automated turntable system, taking 15 images of each sample under 20 preset lighting conditions, while a high-precision spectroradiometer records ambient lighting parameters. After all images are captured, they are imported into a professional image processing workstation. HDR technology is used to merge multi-exposure images, preserving highlight and shadow details. Ambient lighting parameters are calculated using professional spectral analysis software (ASD ViewSpec). Finally, two geological experts independently review the image quality and label accuracy to ensure the high quality and diversity of the dataset.
[0024] After data acquisition is completed, the images can be preprocessed. The entire preprocessing process is automated, ensuring that all training and testing images undergo the same processing steps while preserving the original image's illumination information.
[0025] In the above embodiments, a lithology identification model can be constructed according to a preset structure. Subsequently, a grayscale image can be input into the lithology identification model to obtain classification loss and regularization loss. Then, the parameters of the lithology identification model can be adjusted until the preset conditions are met to obtain a trained lithology identification model.
[0026] In one possible implementation, the structure of the above lithology identification model is as follows: The lithology identification model includes: a feature extraction network, an illumination invariance regularization module, and a classification head; The illumination invariance regularization module is used to ensure that the features learned by the lithology identification model are invariant to changes in illumination and conform to the principles of physical optics during the training process of the lithology identification model. In the inference process of the lithology identification model, the feature extraction network is used to generate lithology identification features based on the grayscale image, and the classification head is used to generate at least one candidate result corresponding to the grayscale image and the probability of the candidate result based on the lithology identification features. The feature extraction network is constructed based on the Vision Transformer (ViT).
[0027] In the above embodiments, the lithology identification model includes: a feature extraction network, an illumination invariance regularization module, and a classification head. It should be noted that the illumination invariance regularization module (PCN) only appears during the training process of the lithology identification model and is discarded during the inference process. This PCN module ensures that the features learned by the lithology identification model are invariant to changes in illumination and conform to the principles of physical optics. In practical applications, this PCN module can utilize the physical optics principles of the Lambertian reflection model, assuming that the rock surface mainly follows diffuse reflection characteristics, and using mathematical constraints to ensure that the model focuses on the inherent properties of the rock rather than illumination conditions.
[0028] In practical applications, the feature extraction network can be a Vision Transformer (ViT), for example, ViT-B / 16 Large, and the classification head can be an MLP, with no specific restrictions.
[0029] In practical applications, the illumination invariance regularization module can also be used as an external tool for training lithology identification models to ensure that the features learned by the model are invariant to changes in illumination and conform to the principles of physical optics.
[0030] In one possible implementation, the illumination invariance regularization module includes a physical constraint layer, an illumination simulator, and an illumination invariance loss function; The physical constraint layer is used to apply physical constraints during feature extraction to ensure that the feature representation conforms to the principle of optical reflection. The illumination simulator is used to generate image pairs of the same rock sample under different illumination conditions, providing training data for the illumination invariance loss function; The illumination invariance loss function is designed based on the Lambert reflection model and is used to force the lithology identification model to learn features that are insensitive to changes in illumination.
[0031] In practical applications, the aforementioned illumination invariance regularization module includes a physical constraint layer and an illumination simulator. The physical constraint layer, located after the ViT feature extraction network, applies physical constraints to the feature space to ensure that the feature representation conforms to the principles of optical reflection. The illumination simulator generates image pairs of the same rock sample under different illumination conditions, providing training data for the illumination invariance loss function.
[0032] In one possible implementation, the lithology identification model further includes Reinterpret, wherein the Reinterpret is used to convert the lithology identification features into feature maps; The physical constraint layer includes a reflectance estimation network and an illumination intensity estimation network, wherein the reflectance estimation network is used to generate a reflectance estimation grayscale map based on the feature map, and the illumination intensity estimation network is used to generate an illumination intensity distribution map based on the feature map. The lighting simulator includes: a lighting parameter generator and a lighting transformation network; The illumination parameter generator is used to generate an illumination parameter vector based on the grayscale image, wherein the parameter vector includes illumination direction, intensity and color temperature; The illumination transformation network is used to perform illumination transformation on the simulated grayscale image according to the illumination parameter vector, so as to generate simulated images of the same rock sample under different illumination conditions.
[0033] In practical applications, the feature extraction network can be ViT. ViT outputs a serialized feature vector. The ViT processing flow is as follows: Input image → Segmented into 16×16 image patches → Each patch becomes a vector → Encoded by Transformer → Output a feature sequence of [N+1, D] (N = number of image patches, D = feature dimension). ViT uses a special [CLS] marker at the beginning of the sequence to summarize global information for classification.
[0034] The process by which Reinterpret converts lithology identification features into feature maps is as follows. The lithology identification features input to Reinterpret can be the feature sequence [N+1, D] output by ViT. First, the [CLS] markers are separated → global features used for classification are retained; then, patch features are extracted → only features from Patch1 to PatchN [N, D] are taken; finally, spatial reconstruction → the sequence is rearranged into feature maps according to the spatial arrangement of the original image patches; thus, the feature maps are obtained. [H', W', D]. In practical applications, the Reinterpret structure is consistent with the Reinterpret structure of ACT-FRCNN.
[0035] In practical applications, this layer contains a reflectivity estimation network. and light intensity estimation network Two key components ensure conformity to the physical model by calculating the difference between the estimated reflectance and illumination intensity and the actual image. and The network can be a lightweight CNN, and both can receive feature maps. Output grayscale images of estimated reflectance respectively. And light intensity estimation grayscale image . The network consists of cascaded 1×1 extended convolutions, 3×3 depthwise separable convolutions, SE modules, and 1×1 projection layers. The projection layers are followed by a sigmoid function to ensure that the reflectance values are in the range [0,1]. Network structure and Consistent, the projection layer is followed by a ReLU function to ensure that the illumination intensity is non-negative.
[0036] In practical applications, a lighting simulator includes a lighting parameter generator and a lighting transformation network, generating images that conform to actual lighting changes based on physical optics principles. The lighting parameter generator is a lightweight network consisting of Flatten layers and an MLP (Multilayer Perceptron). The MLP contains a seven-layer fully connected structure with hidden layer dimensions of 10240, 5120, 2560, 1280, 512, 64, and 4, respectively. The input is the original grayscale image. The output is a vector of lighting parameters. This includes 2D illumination direction, 1D illumination intensity, and 1D color temperature represented in spherical coordinates. The illumination transformation network is an image transformation network based on the U-Net architecture. The encoder consists of four downsampling blocks, each containing two 3×3 convolutional layers, a batch normalization layer, and a ReLU activation function; the decoder consists of four upsampling blocks, each containing a transposed convolutional layer, two 3×3 convolutional layers, a batch normalization layer, and a ReLU activation function; the network preserves detail information through skip connections, and the input is... and The output is a simulated grayscale image. .
[0037] In one possible implementation, the regularization loss further includes: illumination simulation loss and contrast quantity learning constraint loss; The step of inputting the sample grayscale image corresponding to the preprocessed image into the lithology identification model to obtain the classification loss and the regularization loss includes: The physical constraint loss is obtained based on the sample grayscale image, the reflectance estimation grayscale image, and the illumination intensity estimation grayscale image. The illumination simulation loss is obtained based on the sample grayscale image, the new illumination intensity distribution generated based on the illumination parameters, and the original illumination intensity distribution; The illumination invariance loss is obtained based on the feature maps, reflectance estimation network, and illumination intensity estimation network corresponding to any two simulated images. Based on the feature map corresponding to the sample grayscale image, the contrast quantity learning constraint loss is obtained.
[0038] In the above embodiment, the physical constraint loss function is: In the formula: The grayscale image is the input to the feature extraction network, representing brightness; The feature map obtained from Patches output by the Reinterpret feature extraction network; For reflectivity estimation network, For light intensity estimation network; The grayscale image of reflectance estimation output by the reflectance estimation network represents the estimate of the reflectance of the rock surface; The output of the light intensity estimation network is a grayscale image representing the estimated light intensity. This is an element-wise multiplication operation; In image distribution Expected operation on; Using the L2 norm, the squared Euclidean distance between the vectors is calculated. This loss function is based on the Lambert reflection model. Construct, where: For the image at points Brightness at that location; Reflectivity; The light intensity is used as the threshold. By minimizing this loss function, the physical constraint layer forces the feature extraction network to learn the features. It can be decomposed into reflectivity and illumination intensity, thus ensuring that the feature representation conforms to the principles of physical optics. This constraint helps the model learn the essential rock features independent of illumination, improving the model's robustness under different illumination conditions.
[0039] In practical applications, physical grayscale images can be calculated based on the Lambertian reflection model. ,right Constraints are imposed, and illumination simulation loss is constructed. , Depend on The calculation yields the following formula: For the original grayscale image at points Brightness at that location; To be based on lighting parameters The generated new light intensity distribution is calculated using spherical harmonic functions; The original light intensity distribution was estimated from the image. For physical grayscale images at points The brightness at that location.
[0040] In practical applications, the illumination invariance loss function can be designed based on the Lambertian reflection model. Its core objective is to ensure that the features extracted by the model are invariant to changes in illumination. This function can include two parts: feature consistency loss. This directly constrains the feature representation of the same object to remain consistent under different lighting conditions, forcing the model to learn features that are insensitive to changes in lighting; reflectivity and light intensity consistency loss. This ensures that the estimates of reflectivity and light intensity under different lighting conditions conform to physical laws. Depend on The calculation yields the following formula: , Two grayscale images of the same rock sample under different lighting conditions were generated by a lighting simulator. This is a cascaded feature extraction network and Reinterpret, with a grayscale image as input and a feature map as output. ; Given the L2 norm, calculate the square of the Euclidean distance between the vectors; To the image of illumination change The expected operation on. Depend on The calculation yields the following formula: A reflectivity estimation network for the physical constraint layer; This is a network for estimating the illumination intensity of the physical constraint layer. It should be noted that only one of the loss functions mentioned above may be included.
[0041] In practical applications, a schematic diagram of the PCN module is shown below. Figure 2 As shown, a metric learning mechanism can be introduced during the model training process, by learning a transformation matrix. By learning a transformation matrix, two different feature spaces are mapped to a new metric space, making the features of the same rock sample more clustered and the features of different rock samples more separated, thereby improving the distinguishability and robustness of the features. The learning constraint loss function is optimized by adjusting the contrast ratio. Learning has yielded the following formula: , This represents the characteristics of the same rock sample under different lighting conditions. Characteristic representation of different rock samples; The characteristic Euclidean distance function; For features of samples of the same class and samples of different classes Expected operation on; This is a boundary value, which can be set to 1.0 to control the minimum distance between samples of the same class and samples of different classes; This is for retrieving the maximum value.
[0042] In practical applications, for example, the regularization loss can be: ,in , , , and It is the balance coefficient.
[0043] In practical applications, loss is an abstract measure of the difference between the model's predictions and the true labels, reflecting the model's performance. As an optimization objective, loss guides the model to minimize prediction error by adjusting its parameters. The loss function is a mathematical formula that concretizes the loss; the loss value is the calculated result of the loss function on the current batch of data, a specific scalar value that reflects the magnitude of the model's prediction error on that batch, thus allowing for the adjustment of the model's parameters.
[0044] In one possible implementation, the preprocessing of the sample rock image to obtain a preprocessed image includes: The sample rock image is decomposed into reflectance component and illumination component using an illumination decomposition network, and illumination correction is performed on the sample rock image based on the illumination component. The sample rock images were converted to the HSV color space and the luminance channel was enhanced based on Retinex theory. Contrast was further enhanced using a limited contrast adaptive histogram equalization technique. The noise in the sample rock image is removed using a nonlocal mean denoising algorithm to obtain a preprocessed image.
[0045] In practical applications, data preprocessing primarily employs a physics-driven preprocessing workflow. First, all images are converted to a linear RGB color space to ensure color accuracy. The preprocessing workflow includes four main stages: illumination parameter estimation, image illumination normalization, feature enhancement, and data balancing. The illumination parameter estimation stage uses a physics-based illumination decomposition algorithm to decompose the image into reflectance and illumination components. The illumination parameter estimation network adopts a U-Net architecture, taking the original sample rock image as input and outputting an illumination intensity map and a direction map. The image illumination normalization stage performs illumination correction based on the Lambertian reflection model, eliminating the impact of illumination variations on image appearance. The feature enhancement stage applies physics-based contrast enhancement techniques, including Adaptive Histogram Equalization (CLAHE) and Retinex-based image enhancement, specifically targeting brightness enhancement for images under low-light conditions. Simultaneously, a Non-Local Means (NLM) denoising algorithm is used to remove image noise while maintaining edge sharpness. The data balancing stage employs oversampling and undersampling techniques to ensure a balanced number of samples for each rock type and illumination condition, preventing the model from being biased towards specific categories.
[0046] The entire preprocessing process is automated, ensuring that all training and testing images undergo the same processing steps. It also preserves the original image's illumination information for illumination parameter estimation in the physical constraint layer. Preprocessed images are stored in TIFF format with lossless compression to maintain image quality. The specific steps of data preprocessing begin with image reading. The original image is read using a professional image processing library (GDAL) and converted to a linear RGB color space. Illumination parameter estimation is then performed, using a pre-trained illumination decomposition network to decompose the image into reflectance and illumination components. Illumination parameters include global illumination intensity, illumination pattern, and illumination color temperature. Next, illumination normalization is performed, using the estimated illumination components to correct the image's illumination and eliminate the effects of illumination variations. Then, feature enhancement is performed, converting the image to the HSV color space and applying a Retinex-based enhancement algorithm to the V channel (brightness) to enhance dark details while avoiding over-enhancement. Simultaneously, the CLAHE technique is applied to enhance contrast using adaptive contrast limiting and histogram equalization. Finally, denoising is performed using the NLM algorithm (h=15, templateWindowSize=9). (searchWindowSize=35) Remove image noise, especially preserving edge information; finally, perform data balancing, calculate the number of samples in each category, oversample a few categories (generate new samples by random rotation, translation and scaling), and undersample the majority categories (randomly select some samples) to ensure that the difference in the number of samples for each lithology and each lighting condition does not exceed 20%.
[0047] It should be noted that for the validation and test sets, only illumination parameter estimation, illumination normalization, and feature enhancement are performed; data balancing is not applied to maintain data consistency and comparability.
[0048] In practical applications, the training process of the above-mentioned lithology identification model can be carried out on a server equipped with an NVIDIA H200 GPU, using the PyTorch 1.10.0 deep learning framework, the AdamW optimizer, an initial learning rate of 2e-4, a cosine annealing learning rate scheduling strategy, a total of 250 training epochs, a batch size of 64, a weight decay coefficient of 0.01, a gradient clipping threshold of 1.0, and mixed precision training (AMP) technology to accelerate the training process and reduce GPU memory usage. In practical applications, other learning rates can also be used for training, and there are no specific restrictions.
[0049] In one possible implementation, the method further includes: The lithology identification model is trained in stages. In the first stage, the parameters of the feature extraction network are frozen, and only the physical constraint layer and the lighting simulator are trained using a first learning rate so that the model can initially adapt to the physical constraint task. In the second stage, all network parameters are unfrozen, and end-to-end joint training is performed using a second learning rate, wherein the second learning rate is greater than the first learning rate. In the third stage, based on the joint training, a hard sample mining strategy is introduced to weight the training samples that are incorrectly predicted by the lithology identification model.
[0050] In practical applications, in the first stage (e.g., the first 50 rounds), only the physical constraint layer and the lighting simulator are trained, the parameters of the feature extraction network (e.g., the ViT backbone network) are frozen, and fine-tuning is performed using a small learning rate (e.g., 5e-6) to allow the model to initially adapt to the physical constraint task. In the second stage (e.g., rounds 51-200), all parameters are unfrozen, and end-to-end training is performed using a standard learning rate, allowing for a focus on optimizing lighting invariant features. In the third stage (e.g., rounds 201-250), a hard sample mining strategy is introduced, weighting samples that the model mispredicts to improve the model's ability to distinguish difficult samples. Attention level; In each training batch, the input image is first fed into the model, and features conforming to physical principles are extracted through the physical constraint layer. Then, it is fed into the classification head for lithology category prediction. At the same time, physical constraint loss, illumination simulation loss, illumination invariance loss, and contrast learning loss are calculated. Finally, backpropagation and parameter updates are performed based on the composite loss function. During training, validation is performed every 10 rounds. The best model is selected based on the accuracy on the validation set, and an early stopping strategy (patience=30) is adopted to prevent overfitting. Training is stopped when the validation accuracy does not improve for 30 consecutive rounds.
[0051] In practical applications, various training techniques can be used to improve training efficiency and model performance.
[0052] In one possible implementation, one or more of the following training techniques can be employed during the training process of the lithology identification model: Progressive data augmentation gradually increases the intensity of data augmentation with each training epoch. Label smoothing converts hard labels into soft labels for training. Gradient accumulation effectively increases batch size by accumulating gradients from multiple batches. Residual connections are introduced into the physical constraint layer to alleviate the gradient vanishing problem.
[0053] To improve training efficiency and model performance, several training techniques were employed: First, a progressive training strategy was used, gradually increasing the intensity of data augmentation from simple to complex to avoid the model being interfered with by overly complex data distributions in the early stages. Second, label smoothing techniques were used, replacing hard labels with soft labels (e.g., replacing one-hot labels with a distribution of 0.9 and 0.1) to reduce the model's sensitivity to noisy labels. Third, gradient accumulation was implemented, updating parameters every four iterations, effectively increasing the batch size to 256 to obtain more stable gradient estimates. Finally, residual connections were introduced into the physical constraint layer to alleviate the gradient vanishing problem and ensure the effective propagation of deep features. The combined application of these techniques significantly improved the model's convergence speed and final performance, enabling the model to reach a stable convergence state within 250 epochs.
[0054] To comprehensively evaluate model performance, multiple evaluation metrics were employed: the main metrics included accuracy, precision, recall, and F1 score; a Light Robustness Score (LRS) was specifically designed to address illumination invariance, quantifying the decrease in classification accuracy under different illumination conditions; in addition, a Physical Consistency Index (PCI) was calculated, which assesses the effectiveness of physical constraints by comparing the estimated reflectance and illumination intensity with the true values, with a PCI value closer to 1 indicating a better physical constraint effect.
[0055] In practical applications, the evaluation dataset can include three parts: the Main Test Set contains 8,000 images, covering 6 main lithologies and 5 lighting conditions, with each combination of lithology and lighting condition containing approximately 267 images; the Extreme Lighting Test Set contains 3,000 images, focusing on lithology identification under extreme lighting conditions (direct sunlight and low light); and the Professional Database Validation Set contains 4,000 images from a professional geological database, used to validate the model's generalization ability in real-world field scenarios.
[0056] The evaluation process strictly follows a standardized procedure. First, the test set images are fed into the trained model to obtain the lithology category prediction probability for each image. Then, for image subsets under different lighting conditions, classification accuracy, precision, recall, and F1 score are calculated respectively. Next, the illumination robustness index LRS and physical consistency index PCI are calculated. Finally, the generalization ability of the model is evaluated on a professional database validation set, and the mean and standard deviation of each index are calculated.
[0057] In practical applications, to ensure the reliability of the evaluation results, five independent experiments were conducted. Each experiment used a different random seed to initialize the model, and the mean and standard deviation of all indicators were recorded. Experimental results show that the physically constrained illumination invariance regularization module proposed in this patent achieved excellent performance in lithology identification tasks. The average accuracy on the main test set reached 96.5%, an improvement of 2.3 percentage points compared to the baseline model (ViT-Large without PCN). Precision, recall, and F1 score reached 96.2%, 96.7%, and 96.4%, respectively. On the extreme illumination test set, the model accuracy reached 93.8%, and even under extreme conditions such as direct sunlight and low light, the performance degradation was controlled within 3%. On the professional database validation set, the model accuracy reached 94.2%, verifying its generalization ability in real-world field scenarios. The illumination robustness index (LRS) is 0.041, indicating that the model's performance fluctuates little under different illumination conditions and has excellent illumination invariance. The physical consistency index (PCI) reaches 0.92, proving that the physical constraint layer can accurately estimate reflectivity and illumination intensity.
[0058] Ablation experiments further confirmed the effectiveness of the PCN module. When the physical constraint layer was removed, the model performance significantly decreased, with accuracy dropping to 94.2%, LRS increasing to 0.068, and PCI decreasing to 0.85. When the illumination invariance loss was removed, accuracy dropped to 95.1%, and LRS increased to 0.052. When the contrast learning constraint was removed, accuracy dropped to 95.6%, and LRS increased to 0.048. These results fully demonstrate the crucial role of the illumination invariance regularization module in improving lithology identification performance.
[0059] The above are embodiments of the method proposed in this application. Based on the same inventive concept, embodiments of this application also provide a lithology identification device, the structure of which is as follows: Figure 3 As shown.
[0060] Figure 3 This is a schematic diagram of the internal structure of a lithology identification device provided in an embodiment of this application. Figure 2 As shown, the device includes: At least one processor 301; And a memory 302 that is communicatively connected to at least one processor; The memory 302 stores instructions that can be executed by at least one processor, which are executed by at least one processor 301 to enable at least one processor 301 to perform the above-described lithology identification method.
[0061] In one possible implementation, the processor performs grayscale processing on the rock image to be identified, obtaining a grayscale image corresponding to the rock image; inputs the grayscale image into a trained lithology identification model, and obtains the identification result corresponding to the grayscale image output by the lithology identification model; wherein, the lithology identification model is used to determine the identification result corresponding to the grayscale image based on the grayscale image; during the training process of the lithology identification model, the optimization objectives are classification loss and regularization loss, wherein, the classification loss is used to enable the lithology identification model to correctly predict the rock category; the regularization loss includes physical constraint loss and illumination invariance loss, the physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and illumination intensity, so as to conform to the principle of optical reflection; the illumination invariance loss is used to enable the lithology identification model to output consistent feature representations for images of the same rock under different simulated illumination conditions.
[0062] Some embodiments of this application provide corresponding to Figure 1 A non-volatile computer storage medium stores computer-executable instructions, which are configured to execute the above-described lithology identification method.
[0063] In one possible implementation, the computer-executable instructions are configured to perform grayscale processing on the rock image to be identified, obtaining a grayscale image corresponding to the rock image; input the grayscale image into a trained lithology identification model, obtaining the identification result corresponding to the grayscale image output by the lithology identification model; wherein, the lithology identification model is used to determine the identification result corresponding to the grayscale image based on the grayscale image; during the training process of the lithology identification model, the optimization objectives are classification loss and regularization loss, wherein, the classification loss is used to enable the lithology identification model to correctly predict the rock category; the regularization loss includes physical constraint loss and illumination invariance loss, the physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and illumination intensity, in accordance with the principle of optical reflection; the illumination invariance loss is used to enable the lithology identification model to output consistent feature representations for images of the same rock under different simulated illumination conditions.
[0064] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for IoT devices and media are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0065] The systems, media, and methods provided in this application are one-to-one correspondences. Therefore, the systems and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the systems and media will not be repeated here.
[0066] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0067] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0068] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0069] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0070] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0071] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0072] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0073] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0074] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A lithology identification method characterized by, The method comprises: gray processing is performed on a rock image to be identified to obtain a gray image corresponding to the rock image; inputting the gray image into a trained lithology identification model to obtain an identification result corresponding to the gray image output by the lithology identification model; wherein the lithology identification model is used to determine the identification result corresponding to the gray image based on the gray image; in the training process of the lithology identification model, the optimization target is a classification loss and a regularization loss, wherein the classification loss is used to make the lithology identification model correctly predict the rock category; the regularization loss includes a physical constraint loss and an illumination invariance loss, the physical constraint loss is used to force the features learned by the lithology identification model to be decomposed into rock surface reflectivity and illumination intensity to conform to the optical reflection principle; the illumination invariance loss is used to make the lithology identification model output consistent feature representations for images of the same rock under different simulated illumination conditions.
2. The method of claim 1, wherein, The lithology identification model is trained in the following way: preprocessing a sample rock image with accurate illumination parameter annotation to obtain a preprocessed image; constructing the lithology identification model based on a preset structure; inputting a sample gray image corresponding to the preprocessed image into the lithology identification model to obtain the classification loss and the regularization loss; adjusting the parameters of the lithology identification model based on the classification loss and the regularization loss; repeat the above steps, and obtain the trained lithology identification model under the condition that the preset condition is met.
3. The method of claim 1, wherein, The lithology identification model comprises a feature extraction network, an illumination invariance regularization module, and a classification head; the illumination invariance regularization module is used to ensure that the features learned by the lithology identification model are invariant to illumination changes and conform to the physical optical principle during the training process of the lithology identification model; in the inference process of the lithology identification model, the feature extraction network is used to generate lithology identification features based on the gray image, and the classification head is used to generate at least one candidate result corresponding to the gray image and the probability of the candidate result based on the lithology identification features, and the feature extraction network is constructed based on a visual transformer (ViT).
4. The method of claim 3, wherein, The illumination invariance regularization module includes a physical constraint layer, an illumination simulator, and an illumination invariance loss function; the physical constraint layer is used to apply physical constraints during feature extraction to ensure that the feature representation conforms to the optical reflection principle; the illumination simulator is used to generate image pairs of the same rock sample under different illumination conditions to provide training data for the illumination invariance loss function; the illumination invariance loss function is designed based on the Lambertian reflection model and is used to force the lithology identification model to learn features that are not sensitive to illumination changes.
5. The method of claim 4, wherein, The lithology identification model further comprises Reinterpret, wherein the Reinterpret is used to convert the lithology identification features into a feature map; The physical constraint layer comprises a reflectivity estimation network and an illumination intensity estimation network, wherein the reflectivity estimation network is configured to generate a reflectivity estimation grayscale image based on the feature map, and the illumination intensity estimation network is configured to generate an illumination intensity distribution map based on the feature map; The illumination simulator comprises an illumination parameter generator and an illumination transformation network; The illumination parameter generator is configured to generate an illumination parameter vector according to the grayscale image, and the parameter vector comprises an illumination direction, an intensity and a color temperature; The illumination transformation network is configured to perform illumination transformation on the simulated grayscale image according to the illumination parameter vector to generate a simulated image of the same rock sample under different illumination conditions.
6. The method of claim 5, wherein, The regularization loss further comprises an illumination simulation loss and a contrast metric learning constraint loss; The inputting of the sample grayscale image corresponding to the preprocessed image into the lithology identification model to obtain the classification loss and the regularization loss comprises: obtaining the physical constraint loss according to the sample grayscale image, the reflectivity estimation grayscale image and the illumination intensity estimation grayscale image; obtaining the illumination simulation loss according to the sample grayscale image, a new illumination intensity distribution generated based on the illumination parameter and an illumination intensity distribution of the sample grayscale image; obtaining the illumination invariance loss according to the feature maps corresponding to any two simulated images, the reflectivity estimation network and the illumination intensity estimation network; obtaining the contrast metric learning constraint loss based on the feature map corresponding to the sample grayscale image.
7. The method of claim 2, wherein, The preprocessing of the sample rock image to obtain a preprocessed image comprises: decomposing the sample rock image into a reflectivity component and an illumination component using an illumination decomposition network, and performing illumination correction on the sample rock image based on the illumination component; converting the sample rock image to an HSV color space, enhancing the brightness channel based on the Retinex theory and enhancing the contrast using a limited contrast adaptive histogram equalization technology; adopting a non-local mean denoising algorithm to remove noise in the sample rock image to obtain a preprocessed image.
8. The method of claim 2, wherein, The method further comprises: training the lithology identification model in stages, in the first stage, freezing the parameters of the feature extraction network, training only the physical constraint layer and the illumination simulator, and using a first learning rate for training to enable the model to preliminarily adapt to the physical constraint task; in the second stage, unfreezing all network parameters, using a second learning rate for end-to-end joint training, wherein the second learning rate is greater than the first learning rate; in the third stage, introducing a difficult sample mining strategy on the basis of the joint training to weight the training samples predicted incorrectly by the lithology identification model.
9. A lithology identification device characterized by, The device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform a lithology identification method according to any one of claims 1-8.
10. A computer storage medium storing computer-executable instructions, which, when executed by a processor, cause the processor to perform acts comprising: The computer executable instructions, when executed, implement a lithology identification method according to any one of claims 1-8.