Deep Learning-Based Intelligent Analysis of Rock Thin Sections: From Cross-Scale Lithology Classification to Grain Segmentation for Quantitative Fabric Characterization
Abstract
1. Introduction
2. Methods
2.1. Automated Analysis Workflow
2.2. Rock-PLionNet for Lithology Classification
2.2.1. Overall Framework
2.2.2. PWC-Fusion Module
2.2.3. Lion Optimizer
2.3. Sandstone Grain Segmentation Method
2.3.1. Image Preprocessing
2.3.2. Segmentation Result Refinement
2.4. Quantitative Analysis of Sandstone Fabric
3. Experimental Setup
3.1. Dataset
3.2. Implementation Details
3.3. Evaluation Metrics
3.3.1. Evaluation Metrics for Lithology Classification
3.3.2. Evaluation Metrics for Grain Segmentation
4. Experimental Results and Analysis
4.1. Performance Evaluation of Lithology Classification
4.1.1. Comparative Experiments
4.1.2. Ablation Experiments
4.2. Performance Evaluation of Grain Segmentation
4.2.1. Comparative Experiments
4.2.2. Geological Parameter-Based Evaluation of Segmentation
4.3. Sample-Based Workflow Demonstration
4.3.1. Automatic Measurement of Grain Size
4.3.2. Grain-Size Distribution
4.3.3. Grain Shape Analysis
5. Discussion
5.1. Geological Implications
5.2. Grain-Size Interpretation
5.3. Scope and Validation Boundaries
5.4. Limitations of Segmentation and Quantitative Evaluation
5.5. Methodological Contribution and Computational Efficiency
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
| PWC-Fusion | Partial-to-Whole Context Fusion |
| DenseCRF | Dense Conditional Random Field |
| CNN | Convolutional Neural Network |
| ViT | Vision Transformer |
| SAM | Segment Anything Model |
| AI | Artificial Intelligence |
| Fused-MBConv | Fused Mobile Inverted Bottleneck Convolution |
| GAP | Global Average Pooling |
| ReLU | Rectified Linear Unit |
| HSV | Hue, Saturation, Value |
| CLAHE | Contrast Limited Adaptive Histogram Equalization |
| FLOPs | Floating Point Operations |
| PA | Pixel Accuracy |
| IOU | Intersection over Union |
| ASSD | Average Symmetric Surface Distance |
| HD95 | 95% Hausdorff Distance |
| GT | Ground Truth |
Appendix A. Evaluation Metrics
Appendix A.1. Evaluation Metrics for Lithology Classification
- Accuracy: Measures the overall proportion of correctly classified samples across all lithology categories:where N is the total number of samples, is the ground-truth label of the n-th sample, is the predicted label, and is the indicator function.
- Precision: Quantifies the proportion of correctly predicted samples among all samples predicted as a specific lithology. For multi-class classification, the reported Precision is the macro-averaged Precision across all lithology classes:where K is the number of lithology classes, denotes the number of true positives for the k-th class, and denotes the number of false positives for the k-th class.
- Recall: Indicates the proportion of actual samples of a specific lithology that are correctly identified by the network. For multi-class classification, the reported Recall is the macro-averaged Recall across all lithology classes:where denotes the number of false negatives for the k-th class.
- F1-Score: The harmonic mean of Precision and Recall, serving as a comprehensive metric that balances the trade-off between the two. For multi-class classification, the reported F1-Score is the macro-averaged F1 value across all lithology classes:wherewhere , , and represent the numbers of true positives, false positives, and false negatives for the k-th lithology class, respectively. For multi-class lithology classification, Precision, Recall, and F1-Score are first computed for each class and then macro-averaged to evaluate the overall model performance. When the denominator of any class-specific metric equals zero, the corresponding metric is set to 0.
Appendix A.2. Evaluation Metrics for Grain Segmentation
- Pixel Accuracy (PA): Measures the overall proportion of correctly classified pixels in the segmentation result:where TP, TN, FP, and FN represent the numbers of true positive, true negative, false positive, and false negative pixels, respectively. In this study, the grain region is treated as the foreground class and the non-grain region is treated as the background class.
- Intersection over Union (IoU): Quantifies the overlap between the predicted grain region and the ground-truth grain region:where TP, FP, and FN represent the numbers of true positive, false positive, and false negative pixels for the foreground grain class, respectively.
- Dice Coefficient: Measures the similarity between the predicted grain mask and the ground-truth mask, serving as a robust overlap metric for binary segmentation:where TP, FP, and FN denote the numbers of true positive, false positive, and false negative pixels for the foreground grain class, respectively. A larger Dice value indicates better agreement between the predicted mask and the ground-truth mask.
- Average Symmetric Surface Distance (ASSD): Measures the average bidirectional boundary distance between the predicted mask and the ground-truth mask:where and denote the boundary-point sets of the ground-truth mask and the predicted mask, respectively; and denote the number of boundary points in the two sets; and is the shortest Euclidean distance from boundary point x to the boundary set , defined as:The term is defined analogously. A smaller ASSD value indicates better boundary alignment.
- 95% Hausdorff Distance (HD95): Evaluates boundary discrepancy by computing the 95th percentile of all bidirectional nearest-boundary distances:where denotes the 95th percentile operator, and denote the boundary-point sets of the ground-truth mask and the predicted mask, respectively, and and denote the shortest Euclidean distances from a boundary point to the opposite boundary set. A smaller HD95 value indicates better boundary precision.
References
- Avseth, P.; Mukerji, T.; Mavko, G.; Dvorkin, J. Rock-physics diagnostics of depositional texture, diagenetic alterations, and reservoir heterogeneity in high-porosity siliciclastic sediments and rocks—A review of selected models and suggested work flows. Geophysics 2010, 75, 75A31–75A47. [Google Scholar] [CrossRef]
- Worden, R.H.; Utley, J.E. Automated mineralogy (SEM-EDS) approach to sandstone reservoir quality and diagenesis. Front. Earth Sci. 2022, 10, 794266. [Google Scholar] [CrossRef]
- Payton, R.L.; Chiarella, D.; Kingdon, A. The influence of grain shape and size on the relationship between porosity and permeability in sandstone: A digital approach. Sci. Rep. 2022, 12, 7531. [Google Scholar] [CrossRef] [PubMed]
- Torskaya, T.; Shabro, V.; Torres-Verdín, C.; Salazar-Tio, R.; Revil, A. Grain shape effects on permeability, formation factor, and capillary pressure from pore-scale modeling. Transp. Porous Media 2014, 102, 71–90. [Google Scholar] [CrossRef]
- Liu, H.; Ren, Y.-L.; Li, X.; Hu, Y.-X.; Wu, J.-P.; Li, B.; Luo, L.; Tao, Z.; Liu, X.; Liang, J. Rock thin-section analysis and identification based on artificial intelligent technique. Pet. Sci. 2022, 19, 1605–1621. [Google Scholar] [CrossRef]
- Niegel, S.; Franz, M. Depositional and diagenetic controls on porosity evolution in sandstone reservoirs of the Stuttgart Formation (North German Basin). Mar. Pet. Geol. 2023, 151, 106157. [Google Scholar] [CrossRef]
- Zhang, K.; Wang, C.; Tan, F.; Sun, M. The research progress on shale oil geological analysis driven by big data: Multisource integration methods, key applications, and technical challenges. Adv. Resour. Res. 2025, 5, 2702–2742. [Google Scholar]
- Umoren, N.; Odum, M.I. Exploring the Role of Big Data in Petroleum Exploration: Using Advanced Analytics for More Efficient Decision-Making in Exploration Projects. Int. J. Multidiscip. Res. Growth Eval. 2020, 1, 173–179. [Google Scholar] [CrossRef]
- Fan, J.; Yu, X.; Di, Y.; Lv, T.; Zhang, R.; Bao, J.; Liu, Y.; Li, L.; Pan, X. A foundation model for rock thin-section images analysis. Commun. Eng. 2025, 5, 9. [Google Scholar] [CrossRef]
- Rubo, R.A.; de Carvalho Carneiro, C.; Michelon, M.F.; dos Santos Gioria, R. Digital petrography: Mineralogy and porosity identification using machine learning algorithms in petrographic thin section images. J. Pet. Sci. Eng. 2019, 183, 106382. [Google Scholar] [CrossRef]
- Külekçi, G. Geological thin sections and mineral analysis using light microscopy a comprehensive study. Bull. Miner. Res. Explor. 2025, 177, 1–2. [Google Scholar] [CrossRef]
- Ali, J.; Ansari, U.; Ali, F.; Javed, T.; Hullio, I.A. Application of Machine Learning for Effective Screening of Enhanced Oil Recovery Methods. Reserv. Sci. 2026, 2, 65–80. [Google Scholar] [CrossRef]
- Hu, Y.; Yang, Y. A comparative study on drag reduction methods for continental shale drilling in the Fuxing Block, southeastern Sichuan Basin. Reserv. Sci. 2026, 2, 81–96. [Google Scholar] [CrossRef]
- Yang, Y.; Huang, F.; Kang, S. Mechanism of Penetration Rate Improvement in Hot Dry Rock Under the Coupling of Impact Load and Confining Pressure Release. Reserv. Sci. 2026, 2, 52–64. [Google Scholar] [CrossRef]
- Külekçi, G. Madencilik Operasyonlarında Segmentasyon Teknolojileri: Uydu ve Dron Verilerinden Bilgi Çıkarmada Derin Öğrenme Yaklaşımları. Int. J. Adv. Soc. Sci. Educ. (IJASSE) 2024, 8, 732–740. [Google Scholar]
- Wang, C.; Li, P.; Long, Q.; Chen, H.; Wang, P.; Meng, Z.; Wang, X.; Zhou, Y. Deep learning for refined lithology identification of sandstone microscopic images. Minerals 2024, 14, 275. [Google Scholar] [CrossRef]
- Guo, X.; Chen, Y.; He, S.; Zhang, X.; Zhou, J.; Bao, X. Multi-scale channel enhanced transformer for rock thin sections identification and sequence consistency optimization. Comput. Geosci. 2025, 29, 19. [Google Scholar] [CrossRef]
- Lv, P.; Chen, W.; Zou, X. Precision recognition of rock thin section images with multi-head self-attention convolutional neural networks. J. Geophys. Res. Mach. Learn. Comput. 2025, 2, e2025JH000617. [Google Scholar] [CrossRef]
- Van den Berg, E.; Meesters, A.; Kenter, J.; Schlager, W. Automated separation of touching grains in digital images of thin sections. Comput. Geosci. 2002, 28, 179–190. [Google Scholar] [CrossRef]
- Polat, Ö.; Polat, A.; Ekici, T. Automatic classification of volcanic rocks from thin section images using transfer learning networks. Neural Comput. Appl. 2021, 33, 11531–11540. [Google Scholar] [CrossRef]
- Xu, Z.; Ma, W.; Lin, P.; Shi, H.; Pan, D.; Liu, T. Deep learning of rock images for intelligent lithology identification. Comput. Geosci. 2021, 154, 104799. [Google Scholar] [CrossRef]
- Wu, H.; Dai, Y.-J.; Liu, X.-Y. Efficient Sedimentary Facies Recognition Using Vision Transformer and Weakly Supervised Deep Multi-View Clustering. IEEE Access 2025, 13, 77522–77538. [Google Scholar] [CrossRef]
- Koeshidayatullah, A.; Al-Azani, S.; Baraboshkin, E.E.; Alfarraj, M. FaciesViT: Vision transformer for an improved core lithofacies prediction. Front. Earth Sci. 2022, 10, 992442. [Google Scholar] [CrossRef]
- Cao, Z.; Ma, C.; Tang, W.; Zhou, Y.; Zhong, H.; Ye, S.; Wu, K.; Chen, X.; Zheng, D.; Hou, L. CoreViT: A new vision transformer model for lithofacies identification in cores. Geoenergy Sci. Eng. 2024, 240, 213012. [Google Scholar] [CrossRef]
- Aydın, İ.; Kılıç, A.D.; Şener, T.K. Improving Rock Type Identification Through Advanced Deep Learning-Based Segmentation Models: A Comparative Study. Appl. Sci. 2025, 15, 1630. [Google Scholar] [CrossRef]
- Khan, A.; Rauf, Z.; Sohail, A.; Khan, A.R.; Asif, H.; Asif, A.; Farooq, U. A survey of the vision transformers and their CNN-transformer based variants. Artif. Intell. Rev. 2023, 56, 2917–2970. [Google Scholar] [CrossRef]
- Wang, M.; Guo, W.; Yang, F.; Yan, B.; Xu, Y.; Jiang, J.; Huang, J. Rock thin section image classification in low data scenarios using few-shot learning. Comput. Geosci. 2025, 203, 105962. [Google Scholar] [CrossRef]
- Liu, T.; Liu, Z.; Zhang, K.; Li, C.; Zhang, Y.; Mu, Z.; Mu, M.; Xu, M.; Zhang, Y.; Li, X. Research on the generation and annotation method of thin section images of tight oil reservoir based on deep learning. Sci. Rep. 2024, 14, 12805. [Google Scholar] [CrossRef]
- Lu, K.; Xu, Y.; Yang, Y. Comparison of the potential between transformer and CNN in image classification. In Proceedings of the ICMLCA 2021, 2nd International Conference on Machine Learning and Computer Application, Shenyang, China, 17–19 December 2021; pp. 1–6. [Google Scholar]
- Appiah-Twum, M.; Xu, W.; Acheampong, E.M. DenseViT: A Hybrid CNN-Vision Transformer Model for an Improved Multisensor Lithological Classification. In Proceedings of the IGARSS 2024—2024 IEEE International Geoscience and Remote Sensing Symposium, Athens, Greece, 7–12 July 2024; pp. 3418–3422. [Google Scholar]
- Zhang, D.; Qian, X.; Shi, C.; Zhang, Y.; Qian, Y.; Zhou, S. Iron Ore Image Recognition Through Multi-View Evolutionary Deep Fusion Method. Future Internet 2025, 17, 553. [Google Scholar] [CrossRef]
- Singh, N.; Singh, T.; Tiwary, A.; Sarkar, K.M. Textural identification of basaltic rock mass using image processing and neural network. Comput. Geosci. 2010, 14, 301–310. [Google Scholar] [CrossRef]
- Tan, M.; Le, Q. EfficientNetV2: Smaller Models and Faster Training. In Proceedings of the 38th International Conference on Machine Learning, Online, 18–24 July 2021; pp. 10096–10106. [Google Scholar]
- Chen, X.; Liang, C.; Huang, D.; Real, E.; Wang, K.; Pham, H.; Dong, X.; Luong, T.; Hsieh, C.-J.; Lu, Y. Symbolic discovery of optimization algorithms. Adv. Neural Inf. Process. Syst. 2023, 36, 49205–49233. [Google Scholar]
- Saxena, N.; Day-Stirrat, R.J.; Hows, A.; Hofmann, R. Application of deep learning for semantic segmentation of sandstone thin sections. Comput. Geosci. 2021, 152, 104778. [Google Scholar] [CrossRef]
- Das, R.; Mondal, A.; Chakraborty, T.; Ghosh, K. Deep neural networks for automatic grain-matrix segmentation in plane and cross-polarized sandstone photomicrographs. Appl. Intell. 2022, 52, 2332–2345. [Google Scholar] [CrossRef]
- Karimpouli, S.; Tahmasebi, P. Segmentation of digital rock images using deep convolutional autoencoder networks. Comput. Geosci. 2019, 126, 142–150. [Google Scholar] [CrossRef]
- Yu, J.; Wellmann, F.; Virgo, S.; von Domarus, M.; Jiang, M.; Schmatz, J.; Leibe, B. Superpixel segmentations for thin sections: Evaluation of methods to enable the generation of machine learning training data sets. Comput. Geosci. 2023, 170, 105232. [Google Scholar] [CrossRef]
- Kirillov, A.; Mintun, E.; Ravi, N.; Mao, H.; Rolland, C.; Gustafson, L.; Xiao, T.; Whitehead, S.; Berg, A.C.; Lo, W.-Y. Segment anything. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Paris, France, 2–3 October 2023; pp. 4015–4026. [Google Scholar]
- Sylvester, Z.; Stockli, D.F.; Howes, N.; Roberts, K.; Malkowski, M.A.; Poros, Z.; Martindale, R.C.; Bai, W. Segmenteverygrain: A Python module for segmentation of grains in images. J. Open Source Softw. 2025, 10, 7953. [Google Scholar] [CrossRef]
- Zhang, Y.; Konz, N.; Kramer, K.; Mazurowski, M.A. Quantifying the Limits of Segmentation Foundation Models: Modeling Challenges in Segmenting Tree-Like and Low-Contrast Objects. arXiv 2024, arXiv:2412.04243. [Google Scholar]
- Krähenbühl, P.; Koltun, V. Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials. In Proceedings of the 25th International Conference on Neural Information Processing Systems, Granada, Spain, 12–14 December 2011; pp. 109–117. [Google Scholar]
- Azzam, F.; Blaise, T.; Brigaud, B. Automated petrographic image analysis by supervised and unsupervised machine learning methods. Sedimentologika 2024, 2, 1594. [Google Scholar] [CrossRef]
- Barbosa, R.T.; Faria, E.; Klatt, M.; Silva, T.C.; Coelho, J.M.; Matos, T.F.; Santos, B.C.; Gonzalez, J.; Bom, C.R.; de Albuquerque, M.P. Unsupervised segmentation for sandstone thin section image analysis. Comput. Geosci. 2024, 28, 1049–1057. [Google Scholar] [CrossRef]
- Ren, Y.; Zeng, C.; Li, X.; Liu, X.; Hu, Y.; Su, Q.; Wang, X.; Lin, Z.; Zhou, Y.; Hu, H. Intelligent evaluation of sandstone rock structure based on a visual large model. Pet. Explor. Dev. 2025, 52, 548–558. [Google Scholar] [CrossRef]
- SY/T 5368-2016; Identification for Thin Section of Rocks. Petroleum Industry Press: Beijing, China, 2016.
- Lai, W.; Jiang, J.; Qiu, J.; Yu, J.; Hu, X. A photomicrograph dataset of rocks for petrology teaching at Nanjing University. China Sci. Data 2020, 5, 26–38. [Google Scholar] [CrossRef]
- Li, P.; Li, Y.; Chen, X.; Wang, Y.; Li, C.; Liu, Z. A photomicrograph dataset of Upper Paleozoic tight sandstone from Linxing block, eastern margin of Ordos Basin. China Sci. Data 2020, 5, 163–169. [Google Scholar] [CrossRef]
- Zhang, S.; Hu, X. Polarized light micrograph dataset of Late Cretaceous-Eocene rock thin sections from western Tarim Basin, Xinjiang. China Sci. Data 2020, 5, 59–69. [Google Scholar] [CrossRef]
- Wentworth, C.K. A Scale of Grade and Class Terms for Clastic Sediments. J. Geol. 1922, 30, 377–392. [Google Scholar] [CrossRef]
- Külekçi, G.; Hacıefendioğlu, K.; Başağa, H.B. Enhancing mineral processing with deep learning: Automated quartz identification using thin section images. Int. J. Miner. Metall. Mater. 2025, 32, 802–816. [Google Scholar] [CrossRef]
- Zheng, D.; Hou, L.; Hu, X.; Hou, M.; Dong, K.; Hu, S.; Teng, R.; Ma, C. Sediment grain segmentation in thin-section images using dual-modal Vision Transformer. Comput. Geosci. 2024, 191, 105664. [Google Scholar] [CrossRef]


















| Method | Accuracy | Precision | Recall | F1-Score | Loss | Parameters (M) | FLOPs (G) |
|---|---|---|---|---|---|---|---|
| ResNet50 | 0.9467 | 0.9473 | 0.9457 | 0.9464 | 0.6364 | 23.51 | 4.13 |
| VGG19 | 0.9219 | 0.9280 | 0.9136 | 0.9189 | 0.6602 | 139.58 | 19.63 |
| ConvNeXt-Base | 0.9086 | 0.9088 | 0.9111 | 0.9086 | 0.6785 | 87.55 | 15.37 |
| Swin-T | 0.9314 | 0.9296 | 0.9350 | 0.9319 | 0.6593 | 27.52 | 2.98 |
| ViT-Base | 0.8533 | 0.8532 | 0.8627 | 0.8537 | 0.7426 | 85.61 | 16.85 |
| EfficientNetV2-S + PWC-Fusion (AdamW) | 0.9638 | 0.9638 | 0.9645 | 0.9641 | 0.6235 | 20.47 | 2.90 |
| Method | Optimizer | Learning Rate | Weight Decay | Accuracy | Precision | Recall | F1-Score | Loss |
|---|---|---|---|---|---|---|---|---|
| EfficientNet (Baseline) | AdamW | 1 × 10−4 | 0.01 | 0.9543 | 0.9540 | 0.9540 | 0.9540 | 0.6425 |
| EfficientNet + PWC-Fusion | AdamW | 1 × 10−4 | 0.01 | 0.9638 | 0.9638 | 0.9645 | 0.9641 | 0.6235 |
| EfficientNet + PWC-Fusion | AdamW | 1× 10−5 | 0.1 | 0.9314 | 0.9301 | 0.9322 | 0.9310 | 0.6467 |
| EfficientNet + PWC-Fusion (Rock-PLionNet) | Lion | 1 × 10−5 | 0.1 | 0.9657 | 0.9691 | 0.9625 | 0.9655 | 0.6098 |
| Method | |||||
|---|---|---|---|---|---|
| K-means | 0.8547 | 0.7665 | 0.8657 | 11.41 | 58.89 |
| Otsu | 0.8572 | 0.7683 | 0.8668 | 10.76 | 56.70 |
| Watershed | 0.8637 | 0.7725 | 0.8694 | 9.19 | 41.60 |
| Unsup-CNN | 0.7623 | 0.6620 | 0.7915 | 13.32 | 58.74 |
| SAM | 0.8620 | 0.7777 | 0.8670 | 7.42 | 29.84 |
| PetroSAM-CRF | 0.9113 | 0.8531 | 0.9185 | 5.73 | 23.19 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Yang, W.; Li, A.; Zhang, L.; Qin, X. Deep Learning-Based Intelligent Analysis of Rock Thin Sections: From Cross-Scale Lithology Classification to Grain Segmentation for Quantitative Fabric Characterization. Electronics 2026, 15, 1509. https://doi.org/10.3390/electronics15071509
Yang W, Li A, Zhang L, Qin X. Deep Learning-Based Intelligent Analysis of Rock Thin Sections: From Cross-Scale Lithology Classification to Grain Segmentation for Quantitative Fabric Characterization. Electronics. 2026; 15(7):1509. https://doi.org/10.3390/electronics15071509
Chicago/Turabian StyleYang, Wenhao, Ang Li, Liyan Zhang, and Xiaoyao Qin. 2026. "Deep Learning-Based Intelligent Analysis of Rock Thin Sections: From Cross-Scale Lithology Classification to Grain Segmentation for Quantitative Fabric Characterization" Electronics 15, no. 7: 1509. https://doi.org/10.3390/electronics15071509
APA StyleYang, W., Li, A., Zhang, L., & Qin, X. (2026). Deep Learning-Based Intelligent Analysis of Rock Thin Sections: From Cross-Scale Lithology Classification to Grain Segmentation for Quantitative Fabric Characterization. Electronics, 15(7), 1509. https://doi.org/10.3390/electronics15071509
