PCB defect images suffer from tiny defects, subtle morphological differences and complex background wiring, making traditional single-feature classification unstable. This paper proposes a dual-branch image classification method combining a Transformer and CNN, which jointly models local anomalies and global semantic relationships. The model uses a convolutional branch and a Transformer branch to extract local defect features and global wiring dependencies, respectively. A cross-layer semantic interaction mechanism is adopted for multi-level information fusion, and a discriminative feature enhancement module is applied to highlight key defect regions and suppress background interference. Experiments show that the model improves overall accuracy by over 2%, with an F1-score of 0.930 and defect identification coverage of 0.927. It performs stably across different defect types and background complexities without obvious bias, providing new insights for hybrid deep model design in industrial defect image classification.
Qin et al. (Thu,) studied this question.