摘要: | 印刷電路板 (printed circuit board, PCB) 被稱為電子系統產品之母,是因為它可以嵌入各種電子組件,控制軟體和硬體之間的交流,是大多數電子產品必要的元件之一,近兩年興起遠距辦公和教學,智慧型產品需求上升,面對逐年增長的電子產品上游零件需求,如何提升產品良率是廠商重視的議題之一。傳統印刷電路板製程中的瑕疵檢測是透過專業人工,隨著深度學習領域的發展,廠商開始在產線中加入自動光學檢測 (automated optical inspection, AOI) 和自動視覺檢測 (automated visual inspection, AVI) 的技術,降低生產成本並提升產品良率,但是自動檢測儀器會因為拍攝影像的色差或角度等因素,導致印刷電路板瑕疵的誤判,需要人工加以篩選,如果以影像分類網路來辨識自動檢測儀偵測到的瑕疵影像是否為真的瑕疵,可以更進一步降低瑕疵漏撿率。 近幾年來,許多結合卷積神經網路與 Transformer 的網路架構被應用於分類任務,希望能夠同時保有卷積擷取特徵的能力與自我注意力 (self-attention) 學習特徵之間關聯性的能力,我們用這種類型網路架構輸出的特徵圖作為特徵金字塔網路 (feature pyramid network, FPN) 的輸入,相較於傳統卷積神經網路,讓特徵金字塔網路有更好的特徵圖作高低階特徵融合與分類預測。 在本研究中,採用 CoAtNet-0 作為骨幹網路,這是一種結合Transformer和卷積神經網路的架構,主要修改內容包含:i. 卷積區塊加入注意力模組;ii. 加入特徵金字塔網路,通過特徵融合,讓高階特徵幫助低階特徵更穩定,模型在預測時有更豐富的空間資訊,加強網路辨識較小或是不明顯瑕疵特徵的能力;此外,我們還研究了不同注意力模組在骨幹網路的效能,不同的高低階特徵融合方法對網路效能的影響,以及測試修改損失函數類別權重值大小,改善樣本數量不平均的問題。 在實驗中,我們共收集了105,093張印刷電路板的影像資料,其中正常類別有61,671張,瑕疵類別有43,422張。正常類別分為訓練樣本55,016張,驗證樣本6,655張;瑕疵類別分為訓練樣本38,659張,驗證樣本4,763張。實驗結果顯示,原始 CoAtNet-0 的驗證集精確率為 99.264%,召回率為 99.055%,準確率 (accuracy) 為 99.299%;經過本研究修改網路架構與調整訓練參數,最終取得驗證集精確率為 99.140%,召回率為 99.265%,準確率為99.334% 的成果。;The printed circuit board (PCB) is known as the mother of electronic system products. PCB can be embedded various electronic components and is one of the necessary components of most electronic products. In the past two years, work from home and distance learning has become more and more popular, leading demand for smart products rise up. The demand for PCB is very high and still growing, how to improve product yield is one of the issues that manufacturers pay attention to. Defect detection in the traditional PCB manufacturing process relies on manual inspection. With the development of deep learning, manufacturers have switched to automatic optical inspection (AOI) and automatic visual inspection (AVI) for defect detection, reducing production costs and improving product yield. But automatic inspection instruments will cause misjudgment of PCB defects due to factors such as image chromatic aberration or angle, which needs additional manual screening. In recent years, many network architectures combining convolutional neural networks (CNN) and Transformers have been applied to classification tasks. This type of architecture can retain the advantages of both CNN and Transformer. We use the feature map output by this type of network architecture as the input of the feature pyramid network (FPN), which makes FPN have better feature maps than only CNN. In our experiment, we use CoAtNet-0 as the backbone network, which architecture is based on Transformer and CNN. The modifications include: i. Adding attention module at depthwise convolution block; ii. Adding feature pyramid network (FPN), by multiple resolutions, the model can learn more feature information to improve performance. In addition, we compare the performance of adding different attention modules into CoAtNet-0, the impact of different feature fusion methods on FPN performance, and modified different class weight of loss funciton to solve the problem of unbalance class data size. In the experiment, we collected 105,093 images of PCBs, including 61,671 in the normal category and 43,422 in the defect category. Normal images are divided into 55,016 training samples and 6,655 verification samples; defective images are divided into 38,659 training samples and 4,763 verification samples. The experimental results show that the precision of the validation set of the original CoAtNet-0 is 99.264%, the recall is 99.055%, the accuracy is 99.299%. After modifying the network architecture and adjusting the training parameters in this study, the final precision of the validation set reached 99.140%, the recall reached 99.268%, the accuracy reached 99.334%. |