# Keypoint-Based Automated Component Placement Inspection for Printed Circuit Boards
## 2 Proposed Algorithm
### Component Placement Inspection for Multiple Classes  
As shown in Figure 4, the NN model for component placement inspection for multiple classes can be viewed as an extension of its counterpart for a single class. Let \(N\) be the number of component classes for the inspection. Consequently, there are \(N\) heat maps for the detection of components, where the \(c\)-th heat map (\(Y\)) is adopted for the detection of components in the \(c\)-th class. Likewise, there are \(N\) pairs of images for the estimation of component sizes, where the \(c\)-th pair \(\{S_{W},S_{H}\}\) is used for the estimation of component sizes.  
From Figure 4, we can see that there are three network models for multiple classes. The first approach, as shown in Figure 4a, is a direct employment of the model for a single class for multiple classes; that is, all the classes share the same frontend network and backend network. When the number of component classes (\(N\)) increases, the model size and computation latency for inference can be maintained. However, the shared frontend network and/or backend network may not be matched to a particular class. Therefore, the detection accuracy for the class may be degraded. Furthermore, the reusability of the model may be an important issue. Because all the classes in the model are jointly trained, the incorporation of new classes may result in the retraining of all the classes. Large overhead may then be required for the inspection of new PCBs, where the accommodation of new classes for component inspection is necessary.  
The second model allows all the classes to share the same frontend network for feature extraction. Furthermore, each class has its own dedicated output branches in the backend network, as shown in Figure 4b. Because of the sharing of the frontend network, the overall model size and computational complexities can still be low for a large number of classes (\(N\)). In addition, because there is a dedicated backend network for each class in the second model, it may outperform the first model for component inspection. Nevertheless, when the incorporation of new classes is desired, it may still be necessary to retrain all the existing classes because the shared frontend network needs to be fine-tuned for the new class, as well as the existing classes.  
The third model can be viewed as an extension of the second model. We separate \(N\) classes of components into \(P\) groups in the third model. The classes belonging to the same group share the same frontend network for feature extraction. Therefore, there are \(P\) frontend networks in the third model, as shown in Figure 4c. One simple approach for carrying out grouping is based on the shapes of the components. For example, components with similar shapes can be grouped together. The shape information for each group  
Figure 4: Three network models for multiclass component placement inspection.  
can then be fully exploited to produce accurate heat maps for component placement prediction. Because there is a dedicated frontend network for each group for feature extraction, the third model may have superior performance over the first and second models for component inspection. Moreover, the networks in the third model could be reused; that is, the accommodation of a new component class may require the training of only the NNs in the group to which the new class belongs. The networks in the other groups can be effectively reused.