Two-dimensional (2D) materials possess exceptional electrical, mechanical, thermal, and optical properties, making them widely applicable in fields of electronics, energy, optoelectronics, and medicine. The geometry of 2D materials at the nanoscale, such as the number of layers, interlayer spacing, and thickness of the layers are of particular interest, as they have great influence to the properties of the material. Transmission electron microscopy (TEM) with atomic resolution is an ideal research method for 2D materials. However, analyzing the properties of 2D materials by interpreting the high-resolution TEM images not only require rich expertise but also is a time-consuming and labor-intensive task. In this work, we propose a neural network based on the U-Net architecture for high efficiency TEM image analysis of the geometry of 2D materials. The effectiveness of this method is verified on MoS2 image datasets and obtained dice coefficients of 0.92. The physical parameters such as layer number, thickness, and interlayer spacing information of 2D materials can be analyzed subsequently. Our results provide an artificial intelligent approach to analyze 2D materials.