Capsule Neural Network Guided by Compact Convolutional Transformer for Discriminating Earthquakes from Quarry Blasts Omar M. Saad *1 , M. S. Soliman 1 , Yangkang Chen 2 , Abutaleb A. Amin 1 , and H. E. Abdelhafiez 1 Abstract Cite this article as Saad, O. M., M. S. Soliman, Y. Chen, A. A. Amin, and H. E. Abdelhafiez (2023). Capsule Neural Network Guided by Compact Convolutional Transformer for Discriminating Earthquakes from Quarry Blasts, Seismol. Res. Lett. XX,111, doi: 10.1785/0220230101. Misclassified nonearthquake seismic events like quarry blasts can contaminate the earthquake catalog. The local earthquakes sometimes have similar features as the quarry blasts, which makes manual discrimination difficult and unreliable. Thus, we pro- pose to use the compact convolutional transformer (CCT) and capsule neural network to discriminate between earthquakes and quarry blasts. First, we extract 60 s three-chan- nel seismograms, that is, 10 and 50 s before and after the P-wave arrival time. Then, we transform the time-series data into a timefrequency domain (scalogram) using the con- tinuous wavelet transform. Afterward, we utilize the CCT network to extract the most significant features from the input scalograms. The capsule neural network is utilized to extract the spatial relation between the extracted features using the routing-by-agree- ment approach (dynamic routing). The capsule neural network extracts different digit vectors for the earthquake and the quarry blast classes, allowing a robust classification accuracy. The proposed algorithm is evaluated using the seismic dataset recorded by the Egyptian Seismic Network. The dataset is divided into 80% for training and 20% for testing. Although the dataset is unbalanced, the proposed algorithm shows promising results. The testing accuracy of the proposed algorithm is 97.31%. The precision, recall, and F1-score are 97.23%, 98.83%, and 98.02%, respectively. In addition, the proposed algorithm outperforms the traditional deep learning models, for example, convolu- tional neural network, ResNet, VGG, and AlexNet networks. Finally, the proposed method is demonstrated to enjoy a high-generalization ability through a real-time mon- itoring experiment. Introduction The role of any seismic network is to monitor the seismic activ- ity in a particular region. The seismic network consists of sev- eral seismic stations, where each station records the ground motion continuously. This record contains noise and seismic events, which can be classified as natural (earthquakes) and nonearthquakes. The nonearthquake events can be triggered due to mining activity, hydraulic fracture, traffic flow, quarry blasts, or any other sources rather than earthquakes. The non- earthquake events can be manually misclassified as earth- quakes, which contaminates the seismic catalog. Thus, nonearthquake events should be eliminated from the seismic catalog to facilitate high-fidelity seismological studies such as tomography, seismic hazard study, and so forth. Discrimination between earthquakes and nonearthquake events becomes more challenging due to the increase in the volume of the seismic database. In addition, nonearthquake events can occur in the same location with similar magnitude and depth to shallow earthquakes. Accordingly, the discrimi- nation process is not reliable using the earthquake parameters, that is, epicenter, magnitude, and depth. Thus, a more intelli- gent methodology is necessary to distinguish between the two classes, in which this method should make the decision based on the waveform features of the seismic data. 1 1. Seismology Department, National Research Institute of Astronomy and Geophysics (NRIAG), Helwan, Egypt, https://orcid.org/0000-0002-9989-8070 (OMS); https://orcid.org/0000-0003-1387-6522 (MSS); https://orcid.org/0000-0003- 4997-1310 (HEA); 2. TexNet Research and the Center for Integrated Seismicity Research, Bureau of Economic Geology, Jackson School of Geosciences, The University of Texas at Austin, Austin, Texas, U.S.A., https://orcid.org/0000-0001- 6429-4261 (YC) *Corresponding author: engomar@gmail.com © Seismological Society of America 2 Volume XX Number XX XXXX XXXX www.srl-online.org Seismological Research Letters 1