## 3 Implementation
### Algorithm and Model Training
Upon acquiring the pixel coordinates of actual damage points, a deep neural network utilizing U-Net++ architecture estimated the size of  
Figure 12: This figure illustrates the ResNet-18-based model proposed for real damage target recognition. These boxes correspond to the multichannel feature map, and the side length of the box represents the pixel resolution. Figure 13: The overall architecture to train the model for the detection of optical defects in real time. each damage point. The structure of U-Net++ consisted of encoder and decoder modules, with each module containing multiple convolutional layers, pooling layers (in the encoder), or upsampling layers (in the decoder), along with skip connections to preserve and integrate feature information from different levels. The FODI image was grayscale, with pixel values ranging from 0 to 255. Next, the number of pixels with values \(\geq\) 128 was counted within the 32 \(\times\) 32 resolution offline image, with the additional criterion that the pixel values at the four corners were >0 (to mitigate noise), thereby estimating the area of damaged pixels. This area value served as the label for the corresponding damage point in the online image and was incorporated into the training set of the U-Net++ neural network to derive the area estimation model, as illustrated in Figure 14. Thus, the pixel area of each damage point could be determined by inputting the online image annotated with actual damage into the model. To detect multiple online images collected at different times after the same element was put online, we created a file for each damage point and associated each damage point with the time dimension. This allowed us to track the development of the damage area for each specific damage point over time, as illustrated in Figure 15.  
To obtain the specific physical location and size of each damage, we utilized affine transformation to convert the detection result data (pixel coordinates) into physical coordinates. This allowed us to determine the precise physical location and size of each damage. Figure 16a illustrates this process, where the damage area is represented on the ordinate axis, and the accumulated energy value from the experiment is represented on the abscissa axis, establishing a coordinate system. According to the numerical fitting results, the growth pattern of tiny damages from the initial stage approximates linearity over a period of time. Figure 14: The overall architecture to train the model for estimation of damage area. Figure 11:0 The development law of single damage with the number of experiments. We then performed a numerical fit on the damage situation and plotted the damage development curve. By summing the areas of all damage points within the same element, we examined the correlation between the overall damage development of the optic and the experimental parameters (experimental energy). This analysis provided valuable insights into the relationship between damage accumulation and experimental energy. With this information, we read the parameters of future experimental plans and input the corresponding energy value to predict the damage area of the optics during that specific time period. This predictive capability is depicted in Figure 16b. By establishing different damage thresholds for each optic, we could determine the latest shelf removal date. This approach effectively prevents irreparable serious damage caused by overload, ensuring the integrity and safety of the optics. To assess the accuracy of the predicted damage area, we selected five components and predicted their total damage areas for the upcoming period at each time node. Subsequently, we compared these predicted areas with the actual damage areas observed after completing the experiments in the next period, which spanned over a month. The results of this comparison are presented in Table 1 and Figure 11:1  
In Table 1, there are predicted values and actual values on different dates for each object (Optics A, B, C, D, and E).