Porosity is one of the most serious defects in laser powder bed fusion (LPBF). Reducing porosity is essential to improve the mechanical properties of parts in high-end applications. It is found that the spatter dynamic status is closely related to the porosity, giving an idea to identify. In this study, we propose a novel approach for in-situ identification of porosity in the LPBF with spatter features. To achieve efficient and accurate detection, segmentation, and motion tracking of spatters from captured high-speed images during the LPBF process, YOLO and DeepSORT algorithms are employed. Subsequently, a two-staged attention-based recurrent neural network (TARNN) method is proposed to realize the classification of porosity. The input to TARNN consists of both static and dynamic spatter features extracted from every 10 consecutive frames. Leveraging the RNN architecture enables us to effectively exploit temporal information. Moreover, we introduce an attention-aware linear layer and an attention-based RNN to enhance the extraction of representative features related to porosity characteristics. Through the analysis of the attention mechanism, we can explicitly assess the importance ranking of input features, providing a deeper understanding of spatter features. Experimental results demonstrate the superior performance of the proposed TARNN, with an accuracy of 99.50 % at an inference time of 6.5 milliseconds. The proposed method offers a promising avenue for advancing the understanding and characterization of porosity using spatter features in the LPBF process.