## 4 The Detection Results of P-Wave First-Motion Polarity  
The experts from the Yunnan Earthquake Agency processed 2389 P-wave first-motion polarities of 112 earthquakes, of which 1360 polarities were upward and 1029 polarities were downward. To ensure the reliability of the first-motion polarities, we conducted a review and corrected 13 polarities with obvious errors. The detection results of DiTingMotion showed that 2353 polarities were consistent and 36 polarities were inconsistent, with an accuracy rate of 98.49% (Table 1). Among them, there were 1376 polarities detected as upward, with an accuracy rate of 99.19%; there were 1013 polarities recognized as downward, with an accuracy rate of 97.38%. After visual inspection, the 36 waveforms that were identified incorrectly were mainly due to the low signal-to-noise ratio and difficulty in distinguishing first-motion polarity, which led to the inconsistency between DiTingMotion and manual picks (Supplementary Figure S1).  
Figure 2: Seismic stations, faults, and epicenters of the Yangbi earthquake sequence. (**a**) The tectonic setting of the Yangbi earthquake. Black lines indicate faults [58], blue triangles indicate seismic stations, and red dots represent the epicenters of the sequence. The blue line in the inset indicates the boundary of the active block, and the yellow five-pointed star indicates the mainshock. (**b**) The distribution of the Yangbi earthquake sequence (red dots), the epicenters of 112 earthquakes used for focal mechanism inversion (blue dots), and the focal mechanism solutions of large earthquakes.  
In order to compare the advantages and disadvantages of different methods for identifying the first-motion polarity of the P-wave, we selected the PhasePApy [23] and the Network for Polarity Classification (NPC) [59] model, and compared the detection results with DiTingMotion (Table 1). PhasePApy uses a rule-based automatic algorithm to distinguish P-wave first-motion polarities and divides them into three categories: upward, downward, and uncertain. The NPC model is developed on the basis of a convolutional neural network and attention mechanism, and outputs upward and downward results. The NPC model used in this study was trained with data from Southern California and Oklahoma, Japan, Italy, and Taiwan, Chinese Mainland.  
It can be seen from Table 1 that the two models trained by deep learning have accuracy higher than 90% in the classification of the P-wave polarity. DiTingMotion used 641,025 P-wave first-motion polarity data from the Chinese Mainland in the past 10 years for training. It had the highest accuracy and was more suitable for detecting earthquakes in China. The NPC model used only part of the DiTing dataset, and the detection accuracy was slightly lower than that of DiTingMotion. However, PhasePApy discriminated the polarity according to the threshold given manually, and its ability to distinguish the characteristics of different waveforms was weak, which led to misdetection in nearly half of all cases. It can be seen that the deep learning models have obvious advantages over traditional rule-based methods in the detection of the P-wave first-motion polarity.