The pore structure is an important factor in determining the productivity of shale, which can help us make better operational decisions. Shale formations have an extremely complex pore structure with a wide range of pore sizes, shapes, orientations, and connectivity. Advanced imaging techniques, such as focused ion beam scanning electron microscopes (FIB-SEM), contribute significantly to the analysis and understanding of complex pore networks in shale, but they are time-consuming. Developing new methods and techniques to capture the spatial distribution and connectivity of pores at various scales is essential to understanding pore structure and its impact on fluid flow. This study aims to analyze the pore characteristics of shale reservoirs by using artificial intelligence (AI) and FIB-SEM. We applied a novel attention gate (AG) model to FIB-SEM images that automatically learns to focus on target structures of varying pores’ shape and size. AG can be fully incorporated into the U-Net model with minimal computational impact. The AG improved prediction accuracy by making the U-Net model more sensitive to essential features in the input images and achieved a precision of 97%, recall of 71%, and F1 score of 81% at a confidence threshold of 1. Experimental results show that Attention U-Net outperformed in predicting the pore structures in shale samples from Longmaxi Formation, Qingshankou Formation, Cambrian Niutitang Formation, Yanchang shale oil, and Bakken shale while obtaining optimal performance without requiring multiple convolutional neural network (CNN) models. Additionally, Attention U-Net addresses some of the limitations of the Edge-Threshold Automatic Processing (ETAP) method, including the limited ability to obtain a complete description of the pore space as well as the low segmentation accuracy and sensitivity. The proposed workflow offers a promising solution for optimizing the automatic processing of microscopic images for pores and microfractures identification. Researchers and industry professionals can improve their understanding of shale properties and applications in various fields by maximizing the benefits of our workflow.