摘要: | 自動光學檢測(AOI)是一個相當成熟且被廣泛使用在產品檢測上的技術,例如印刷電路板與平面顯示器。大多數的AOI機台是使用傳統影像處理來進行演算法的設計,這會造成AOI在一些產業上,仍然無法取代人工目檢的現象。以玻璃產品為例,實際使用AOI機台檢測會發現,粉塵與棉絮等非瑕疵造成系統大量的誤判。本研究乃針對玻璃產品的檢測系統進行探討,導入人工智慧技術於AOI來克服此困難,以期能在大小為 85 mm × 53 mm × 2 mm的玻璃試片上,檢測出刮傷與崩邊瑕疵。 在取像系統上,本研究針對產品與瑕疵的特性,進行取像方式的優化。透過使用隧道燈搭配暗場的取像效果,確保取像系統能夠清楚地捕捉瑕疵特徵。在提升影像品質上,則使用治具與吸光黑布,並成功降低影像中的雜訊。 在影像處理系統中,首先挑選5個YOLOv4相關的物件偵測模型進行訓練與比較,分別是YOLOv4、YOLOv4-tiny、YOLOv4-CSP、YOLOv4-P5與YOLOv4-P6。在自製資料集上,是以一套自定義的標註流程進行瑕疵標註,以確保標註的品質。本研究使用5-fold交叉驗證的方式來挑選最適合的使用模型。驗證結果顯示,YOLOv4有最高的準確度並且在推論影像大小僅為672 × 672像素的情況下也能維持良好的模型表現,因此將YOLOv4作為本研究的應用模型。在模型優化方面,使用兩種方式進行YOLOv4的優化,分別是微調與錨框的優化。後者成功提升YOLOv4的準確度,得到此最佳模型並以測試集進行測試後,分別得到精確率98.4%、召回率91.7%與mAP值94.52%。此錨框優化模型能夠良好地排除非瑕疵的干擾,並且能夠檢測僅0.05 mm寬度的刮傷與0.1 mm的崩邊瑕疵,更能夠偵測出僅以3個灰階值呈現的不明顯刮傷。另外,也透過使用此錨框優化模型與5-fold交叉驗證中選用的YOLOv4模型進行實際獨立全尺寸玻璃檢測,展示了兩者模型都能夠正確地檢測出在人工目檢中未被找到的瑕疵。比較以上兩者模型,錨框優化模型能夠準確地進行瑕疵檢測並且有效排除非瑕疵干擾,而原始選用的YOLOv4模型則是能夠有效地在最短時間內完成檢測。;Automated optical inspection (AOI) is widely used in various industries, such as printed circuit board and flat panel display. In a traditional AOI system, digital image processing is applied to design an algorithm for the inspection. However, because of the limitation of AOI, manual visual inspection is still irreplaceable in certain cases, e.g. in glass manufacturing. Pollutions like dust particles and batting could reduce the performance of AOI system for glass. To overcome that, this study introduced an artificial intelligent technique into the AOI system for glass inspection. The inspection targets included two types of glass defects, namely scratch and chip. The goal was to find such defects on the glass specimens with dimensions of 85 mm × 53 mm × 2 mm. In this study, the image acquisition system was optimized to capture the features of defects with the most suitable light source. For a better image quality, a jig and a black cloth were used to reduce the noise on the image. Such an image acquisition system could provide a high-quality image with defects, so that the image processing algorithm could analyze the information of defects on the specimens and detect defects. In the image processing algorithm, 5 YOLOv4 variants were considered for the inspection application, namely YOLOv4, YOLOv4-tiny, YOLOv4-CSP, YOLOv4-P5, and YOLOv4-P6. The custom datasets were built to train these models. In order to have an objective annotation, it followed a procedure to label the custom datasets. After that, 5-fold cross validation was applied to compare each model’s performance. According to the validation results, YOLOv4 was selected for the application in this study as it had the highest accuracy and the ability of maintaining a great accuracy when the input image was resized to only 672 × 672 pixels. Then, two approaches were used to optimize the YOLOv4 model, namely fine-tuning and anchor box optimization. The latter method successfully improved the accuracy of YOLOv4. The most accurate model was the YOLOv4 optimized by anchor box and trained with the input size of 960 × 960 pixels. It had a precision of 98.4%, a recall of 91.7%, and mAP of 94.52% in the test dataset. Moreover, it could effectively exclude non-defect objects. With these results, the developed inspection system could detect defects as small as a scratch of 0.05-mm width and a chip of 0.1 mm. Furthermore, it could also detect an unclear scratch with only three-gray-level difference. Finally, the originally selected YOLOv4 model and its modification by anchor box optimization were applied to inspect two independent specimens of full-size images. The inspection results showed that both models successfully found defects that were not inspected by manual visual inspection. In comparison of the two models, the YOLOv4 model optimized by anchor box was more effective to detect defect and exclude non-defect objects, while the originally selected model of YOLOv4 was more efficient to inspect an entire specimen with a shorter time. |