## 2 Methods  
### Workflow  
The machine-learning-based hotspot-detection method obtains a hotspot detection model through model training based on layout data. The CNN has good image-classification performance, and layout data can be converted to pattern data, so CNN can be used for hotspot detection [19]. The CNN-based hotspot-detection method is shown in Figure 1. In the model-training phase, the layout pattern data are used to train a model suitable for hotspot detection. When performing hotspot detection, the trained model takes the layout pattern as input, and the trained model will identify whether the input layout pattern is a hotspot pattern or not.  
The workflow of the proposed lithography hotspot detection method based on transfer learning using pre-trained deep CNN is shown in Figure 2. The proposed method includes three phases: preparation, model training, and model verification. In the preparation phase, both the data and model are prepared. In order to reduce the cost of model training, after the input layout data are converted to pattern data, data compression is required. In addition, it is necessary to deal with the problem of imbalance between positive and negative samples of the training data. The pre-trained VGG13 model based on the ImageNet dataset is open access. In the model-training phase, it is necessary to modify the pre-trained VGG13 network architecture to make it suitable for hotspot detection, and then the model is trained with the training data. In the model-verification phase, the test layout data are used to evaluate the performance of the trained model. In order to evaluate the performance of the proposed hotspot-detection method, it is necessary to evaluate the accuracy, recall, precision, and F1 score. The result of hotspot detection is defined as follows:  
True positive (TP): the hotspot pattern is identified as a hotspot pattern.  
True negative (TN): the non-hotspot pattern is identified as a non-hotspot pattern.  
Figure 1: Schematic diagram of the CNN-based hotspot-detection method.  
Figure 2: The workflow of the proposed method.  
False positive (FP): the non-hotspot pattern is identified as a hotspot pattern.  
False negative (FN): the hotspot pattern is identified as a non-hotspot pattern.  
The accuracy, recall, precision, and F1 score of the hotspot-detection method are defined as follows:  
\[\text{accuracy}=\frac{\text{TP}+\text{TN}}{\text{TP}+\text{TN}+\text{FP}+\text{ FN}}, \tag{1}\]  
\[\text{recall}=\frac{\text{TP}}{\text{TP}+\text{FN}}, \tag{2}\]  
\[\text{precision}=\frac{\text{TP}}{\text{TP}+\text{FP}}, \tag{3}\]  
\[\text{F1}=2\times\frac{\text{recall}\times\text{precision}}{\text{recall}+ \text{precision}}, \tag{4}\]  
where the accuracy refers to the ratio of the correctly identified patterns to all the patterns, the recall refers to the ratio of patterns correctly identified as hotspot and all the hotspot patterns, and the precision refers to the ratio of real hotspot patterns and patterns identified as hotspot patterns. The F1 score is a factor for comprehensive evaluation of recall and precision. The values of accuracy, recall, precision, and F1 score are all between 0 and 1. The higher accuracy value means the more patterns are correctly identified. The higher recall value means the more hotspot patterns are identified. The higher precision value means the false alarm is lower.