## 2 Methods
### Model Modification and Model Training
#### 2.3.2 Model Training  
The proposed method takes cross entropy as the loss function. For an input layout pattern, the output result of the model is the probability distribution of each category. The labels of the training data are known, so the actual probability distribution for each layout pattern is fixed. The goal of model training is to reduce the gap between the probability distribution of model output and the actual probability distribution. Relative entropy is  
Figure 5: The diagram of VGG13 network architecture.  
Figure 6: The diagram of VGG13 network architecture for hotspot detection.  
a measure of the distance between two random distributions. The definition of relative entropy is shown in Equation (6), where n is the total number of data categories, p is the actual probability of the sample, and q is the model output probability of the sample. Since the labels of the training data are known and the actual probability distribution p is fixed, the first half of Equation (6) is constant. The definition of cross entropy is shown as Equation (7); relative entropy can be expressed as the sum of cross entropy and a constant. The gap between the probability distribution of model output and the actual probability distribution is narrowed by using cross entropy as the loss function. Hotspot detection is a binary classification problem; the cross entropy loss function of a single layout pattern is shown as Equation (8). For all data in a batch, the cross entropy loss is shown as Equation (9), where m is the number of samples in the batch. In the model-training phase, the cross entropy loss is reduced by adopting the batch gradient descent method.  
\[\mathrm{D}(\mathrm{p}\parallel\mathrm{q})=\sum_{\mathrm{i}=1}^{\mathrm{n}} \mathrm{p}_{\mathrm{i}}\mathrm{log}\bigg{(}\frac{\mathrm{p}_{\mathrm{i}}}{ \mathrm{q}_{\mathrm{i}}}\bigg{)}=\sum_{\mathrm{i}=1}^{\mathrm{n}}\mathrm{p}_ {\mathrm{i}}\mathrm{log}(\mathrm{p}_{\mathrm{i}})-\sum_{\mathrm{i}=1}^{ \mathrm{n}}\mathrm{p}_{\mathrm{i}}\mathrm{log}(\mathrm{q}_{\mathrm{i}}), \tag{6}\]  
\[\mathrm{cross\ entropy}=-\sum_{\mathrm{i}=1}^{\mathrm{n}}\mathrm{p}_{\mathrm{i}} \mathrm{log}(\mathrm{q}_{\mathrm{i}}), \tag{7}\]  
\[\mathrm{Loss}_{\mathrm{binary}}=-\big{[}\mathrm{p}_{\mathrm{1}}\mathrm{log}( \mathrm{q}_{\mathrm{1}})+(1-\mathrm{p}_{\mathrm{1}})\mathrm{log}(1-\mathrm{q} _{\mathrm{1}})\big{]}, \tag{8}\]  
\[\mathrm{Loss}_{\mathrm{batch}}=-\frac{1}{\mathrm{m}}\sum_{\mathrm{i}=1}^{ \mathrm{m}}\Big{[}\mathrm{p}_{\mathrm{i}}^{\mathrm{i}}\mathrm{log}\Big{(} \mathrm{q}_{\mathrm{i}}^{\mathrm{i}}\Big{)}+\Big{(}1-\mathrm{p}_{\mathrm{i}}^ {\mathrm{i}}\Big{)}\mathrm{log}\Big{(}1-\mathrm{q}_{\mathrm{i}}^{\mathrm{i}} \Big{)}\Big{]}, \tag{9}\]  
The proposed method takes the transfer learning strategy to apply the convolution kernels of the pre-trained VGG13 network to the hotspot detection. In the model-training phase, the convolutional layers of the pre-trained VGG13 network can be completely frozen or partially released. When the convolutional layers are partially released, the released convolution kernels will be updated. Due to the redesign of the fully connected layers, the weights of the fully connected layers need to be trained. For the proposed method, only partial layers of the VGG13 network need to be trained; the number of parameters required for training is reduced. When all the convolutional layers are frozen, the comparison between the number of parameters of the fully connected layers and the entire VGG13 network is shown in Figure 7.  
Figure 7: The number of parameters.