TW202226154A - Method for detecting defects of product, computer device and storage medium - Google Patents

Method for detecting defects of product, computer device and storage medium Download PDF

Info

Publication number
TW202226154A
TW202226154A TW109146745A TW109146745A TW202226154A TW 202226154 A TW202226154 A TW 202226154A TW 109146745 A TW109146745 A TW 109146745A TW 109146745 A TW109146745 A TW 109146745A TW 202226154 A TW202226154 A TW 202226154A
Authority
TW
Taiwan
Prior art keywords
test
image
blocks
product
reconstructed
Prior art date
Application number
TW109146745A
Other languages
Chinese (zh)
Other versions
TWI748828B (en
Inventor
郭錦斌
王薇鈞
Original Assignee
鴻海精密工業股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 鴻海精密工業股份有限公司 filed Critical 鴻海精密工業股份有限公司
Priority to TW109146745A priority Critical patent/TWI748828B/en
Application granted granted Critical
Publication of TWI748828B publication Critical patent/TWI748828B/en
Publication of TW202226154A publication Critical patent/TW202226154A/en

Links

Images

Landscapes

  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The present application provides a method of detecting defects of a product. The method includes obtaining a reconstructed image based on a test image of a product; obtaining N test blocks by cutting the test image and obtaining N reconstructed blocks by cutting the reconstructed image; and determining whether the product has defects according to a mean square error between each test block and corresponding reconstructed block. The present application also provides a computer device and a storage medium for realizing the method of detecting defects of the product. The present application can effectively detect defects of the product.

Description

產品瑕疵檢測方法、電腦裝置及儲存介質Product defect detection method, computer device and storage medium

本發明涉及一種產品品質管控技術領域,尤其涉及一種產品瑕疵檢測方法、電腦裝置及儲存介質。The invention relates to the technical field of product quality control, in particular to a product defect detection method, a computer device and a storage medium.

習知技術中,可以基於產品的影像實現對產品是否存在瑕疵進行檢測。然而,由於有些產品僅部分位置存在微小瑕疵,導致較難識別出該類瑕疵,因此,瑕疵識別準確率不高。In the prior art, it is possible to detect whether a product has defects based on an image of the product. However, since some products only have small defects in some positions, it is difficult to identify such defects, so the accuracy of defect identification is not high.

鑒於以上內容,有必要提供一種產品瑕疵檢測方法、電腦裝置及儲存介質,可在實現產品品質檢測的同時有效提升產品的檢測精度。In view of the above, it is necessary to provide a product defect detection method, a computer device and a storage medium, which can effectively improve the detection accuracy of products while realizing product quality detection.

所述產品瑕疵檢測方法,包括: 獲取產品的測試影像;將所述測試影像輸入至自動編碼器獲得重構影像;將所述測試影像切割為N個測試區塊,以及將所述重構影像切割為N個重構區塊;根據所述N個測試區塊分別在所述測試影像中的位置,以及所述N個重構區塊分別在所述重構影像中的位置,將所述N個測試區塊中的任意一個測試區塊與所述N個重構區塊中的其中一個重構區塊建立關聯,其中,該其中一個重構區塊在所述重構影像中的位置與所述任意一個測試區塊在所述測試影像的中位置對應;計算所述N個測試區塊中的每個測試區塊與對應的重構區塊之間的均方誤差,並將計算得到的均方誤差與該每個測試區塊建立關聯;及基於所述N個測試區塊中的每個測試區塊所對應的均方誤差確定所述產品是否存在瑕疵。The product defect detection method includes: acquiring a test image of a product; inputting the test image to an automatic encoder to obtain a reconstructed image; cutting the test image into N test blocks, and converting the reconstructed image Divide into N reconstructed blocks; according to the respective positions of the N test blocks in the test image and the respective positions of the N reconstructed blocks in the reconstructed image, the Any one of the N test blocks is associated with one of the N reconstructed blocks, wherein the position of the one of the reconstructed blocks in the reconstructed image Corresponding to the position of any one of the test blocks in the test image; calculate the mean square error between each test block in the N test blocks and the corresponding reconstructed block, and calculate The obtained mean square error is associated with each test block; and based on the mean square error corresponding to each of the N test blocks, it is determined whether the product has defects.

優選地,所述基於所述N個測試區塊中的每個測試區塊所對應的均方誤差確定所述產品是否存在瑕疵包括:確定所述N個測試區塊中的每個測試區塊所對應的均方誤差是否大於預設值;當所述N個測試區塊中的任意一個測試區塊所對應的均方誤差大於所述預設值時,確定該任意一個測試區塊為瑕疵區塊; 當所述N個測試區塊中包括至少一個瑕疵區塊時,確定所述產品存在瑕疵;及當所述N個測試區塊不包括瑕疵區塊時,確定所述產品不存在瑕疵。Preferably, the determining whether the product has defects based on the mean square error corresponding to each of the N test blocks includes: determining each of the N test blocks Whether the corresponding mean square error is greater than a preset value; when the mean square error corresponding to any one of the N test blocks is greater than the preset value, it is determined that any one of the test blocks is defective block; when the N test blocks include at least one defective block, it is determined that the product has defects; and when the N test blocks do not include defective blocks, it is determined that the product does not have defects .

優選地,該方法還包括:在將所述測試影像輸入至所述自動編碼器之前,利用多張樣本影像訓練所述自動編碼器,其中,所述多張樣本影像中的每張樣本影像為所述產品不存在瑕疵時所拍攝的影像。Preferably, the method further comprises: before inputting the test image to the auto-encoder, training the auto-encoder with a plurality of sample images, wherein each sample image in the plurality of sample images is Image taken when the product is free of defects.

優選地,該方法還包括:根據所述瑕疵區塊在所述測試影像中的位置,在該測試影像上標示所述瑕疵區塊,由此獲得作了標示後的所述測試影像;及在顯示幕上顯示作了標示後的所述測試影像。Preferably, the method further comprises: marking the defective block on the test image according to the position of the defective block in the test image, thereby obtaining the marked test image; and The marked test image is displayed on the display screen.

優選地,該方法還包括:回應使用者在所述測試影像的指定操作,顯示與所述瑕疵區塊對應的所述重構區塊。Preferably, the method further includes: displaying the reconstructed block corresponding to the defective block in response to a user's designated operation on the test image.

優選地,該方法按照預設的切割規則將所述測試影像切割為所述N個測試區塊,以及按照該預設的切割規則將所述重構影像切割為所述N個重構區塊,其中,所述N個測試區塊中的每個測試區塊的大小相等,所述N個重構區塊中的每個重構區塊的大小相等。Preferably, the method cuts the test image into the N test blocks according to a preset cutting rule, and cuts the reconstructed image into the N reconstruction blocks according to the preset cutting rule , wherein each of the N test blocks has the same size, and each of the N reconstructed blocks has the same size.

優選地,所述預設的切割規則是指:沿目標影像的第一中線對所述目標影像進行切割,其中,該第一中線為所述目標影像的頂邊緣與底邊緣所對應的中線;及/或沿所述目標影像的第二中線對所述目標影像進行切割,其中,該第二中線為所述目標影像的左邊緣與右邊緣所對應的中線;所述目標影像為所述測試影像或所述重構影像。Preferably, the preset cutting rule refers to: cutting the target image along a first center line of the target image, wherein the first center line is the line corresponding to the top edge and the bottom edge of the target image center line; and/or cutting the target image along the second center line of the target image, wherein the second center line is the center line corresponding to the left edge and the right edge of the target image; the The target image is the test image or the reconstructed image.

優選地,所述N為正整數,N大於或等於2。Preferably, the N is a positive integer, and N is greater than or equal to 2.

所述電腦可讀儲存介質儲存有至少一個指令,所述至少一個指令被處理器執行時實現所述的產品瑕疵檢測方法。The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by the processor, implements the product defect detection method.

所述電腦裝置包括儲存器和至少一個處理器,所述儲存器中儲存有至少一個指令,所述至少一個指令被所述至少一個處理器執行時實現所述的產品瑕疵檢測方法。The computer device includes a memory and at least one processor, the memory stores at least one instruction, and when the at least one instruction is executed by the at least one processor, implements the product defect detection method.

相較於習知技術,所述產品瑕疵檢測方法、電腦裝置及儲存介質,可在實現產品品質檢測的同時有效提升產品的檢測精度。Compared with the prior art, the product defect detection method, the computer device and the storage medium can effectively improve the detection accuracy of the product while realizing the product quality detection.

為了能夠更清楚地理解本發明的上述目的、特徵和優點,下面結合附圖和具體實施例對本發明進行詳細描述。需要說明的是,在不衝突的情況下,本發明的實施例及實施例中的特徵可以相互組合。In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments may be combined with each other under the condition of no conflict.

在下面的描述中闡述了很多具體細節以便於充分理解本發明,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。In the following description, many specific details are set forth in order to facilitate a full understanding of the present invention, and the described embodiments are only some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

除非另有定義,本文所使用的所有的技術和科學術語與屬於本發明的技術領域的技術人員通常理解的含義相同。本文中在本發明的說明書中所使用的術語只是為了描述具體的實施例的目的,不是旨在於限制本發明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.

參閱圖1所示,為本發明較佳實施例提供的電腦裝置的架構圖。Referring to FIG. 1 , it is a structural diagram of a computer device according to a preferred embodiment of the present invention.

本實施例中,電腦裝置3包括互相之間電氣連接的儲存器31、至少一個處理器32、顯示幕33。In this embodiment, the computer device 3 includes a storage 31 , at least one processor 32 , and a display screen 33 that are electrically connected to each other.

本領域技術人員應該瞭解,圖1示出的電腦裝置3的結構並不構成本發明實施例的限定,所述電腦裝置3還可以包括比圖1更多或更少的其他硬體或者軟體,或者不同的部件佈置。Those skilled in the art should understand that the structure of the computer device 3 shown in FIG. 1 does not constitute a limitation of the embodiment of the present invention, and the computer device 3 may also include more or less other hardware or software than that in FIG. 1 , Or a different component arrangement.

需要說明的是,所述電腦裝置3僅為舉例,其他現有的或今後可能出現的電腦裝置如可適應於本發明,也應包含在本發明的保護範圍以內,並以引用方式包含於此。It should be noted that the computer device 3 is only an example, and other existing or future computer devices that can be adapted to the present invention should also be included in the protection scope of the present invention, and are incorporated herein by reference.

在一些實施例中,所述儲存器31可以用於儲存電腦程式的程式碼和各種資料。例如,所述儲存器31可以用於儲存安裝在所述電腦裝置3中的產品瑕疵檢測系統30,並在電腦裝置3的運行過程中實現高速、自動地完成程式或資料的存取。所述儲存器31可以是包括唯讀儲存器(Read-Only Memory,ROM)、可程式設計唯讀儲存器(Programmable Read-Only Memory,PROM)、可抹除可程式設計唯讀儲存器(Erasable Programmable Read-Only Memory,EPROM)、一次可程式設計唯讀儲存器(One-time Programmable Read-Only Memory,OTPROM)、電子抹除式可複寫唯讀儲存器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、唯讀光碟(Compact Disc Read-Only Memory,CD-ROM)或其他光碟儲存器、磁碟儲存器、磁帶儲存器、或者任何其他能夠用於攜帶或儲存資料的非易失性的電腦可讀的儲存介質。In some embodiments, the storage 31 may be used to store program codes and various data of computer programs. For example, the storage 31 can be used to store the product defect detection system 30 installed in the computer device 3 , and realize high-speed and automatic access to programs or data during the operation of the computer device 3 . The storage 31 may include a Read-Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (Erasable). Programmable Read-Only Memory, EPROM), One-time Programmable Read-Only Memory (OTPROM), Electronically-Erasable Programmable Read-Only Memory (Electrically-Erasable Programmable Read-Only Memory, EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other optical disk storage, magnetic disk storage, magnetic tape storage, or any other non-volatile computer capable of carrying or storing data readable storage medium.

在一些實施例中,所述至少一個處理器32可以由積體電路組成。例如,可以由單個封裝的積體電路所組成,也可以是由多個相同功能或不同功能封裝的積體電路所組成,包括一個或者多個中央處理器(Central Processing unit,CPU)、微處理器、數位訊號處理器、圖形處理器及各種控制晶片的組合等。所述至少一個處理器32是所述電腦裝置3的控制核心(Control Unit),利用各種介面和線路連接整個電腦裝置3的各個部件,透過執行儲存在所述儲存器31內的程式或者模組或者指令,以及調用儲存在所述儲存器31內的資料,以執行電腦裝置3的各種功能和處理資料,例如,對產品瑕疵進行檢測的功能(具體細節參後面對圖3的介紹)。In some embodiments, the at least one processor 32 may be comprised of an integrated circuit. For example, it can be composed of a single packaged integrated circuit, or it can be composed of a plurality of integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing Unit, CPU), microprocessor A combination of processors, digital signal processors, graphics processors, and various control chips. The at least one processor 32 is the control core (Control Unit) of the computer device 3 , and uses various interfaces and lines to connect various components of the entire computer device 3 , and executes programs or modules stored in the storage 31 . Or instructions, and call the data stored in the storage 31 to execute various functions of the computer device 3 and process data, for example, the function of detecting product defects (for details, please refer to the introduction to FIG. 3 later).

在本實施例中,產品瑕疵檢測系統30可以包括一個或多個模組,所述一個或多個模組儲存在所述儲存器31中,並由至少一個或多個處理器(本實施例為處理器32)執行,以實現對產品瑕疵進行檢測的功能(具體細節參後面對圖3的介紹)。In this embodiment, the product defect detection system 30 may include one or more modules, and the one or more modules are stored in the storage 31 and processed by at least one or more processors (this embodiment It is executed by the processor 32) to realize the function of detecting product defects (for details, please refer to the introduction to FIG. 3 later).

在本實施例中,所述產品瑕疵檢測系統30根據其所執行的功能,可以被劃分為多個模組。參閱圖2所示,所述多個模組包括獲取模組301、執行模組302。本發明所稱的模組是指一種能夠被至少一個處理器(例如處理器32)所執行並且能夠完成固定功能的一系列電腦可讀的指令段,其儲存在儲存器(例如電腦裝置3的儲存器31)中。在本實施例中,關於各模組的功能將在後續結合圖3詳述。In this embodiment, the product defect detection system 30 can be divided into a plurality of modules according to the functions it performs. Referring to FIG. 2 , the multiple modules include an acquisition module 301 and an execution module 302 . The module referred to in the present invention refers to a series of computer-readable instruction segments that can be executed by at least one processor (such as the processor 32 ) and can perform fixed functions, which are stored in a storage device (such as the computer device 3 ). storage 31). In this embodiment, the functions of each module will be described in detail with reference to FIG. 3 later.

本實施例中,以軟體功能模組的形式實現的集成的單元,可以儲存在一個非易失性可讀取儲存介質中。上述軟體功能模組包括一個或多個電腦可讀指令,所述電腦裝置3或一個處理器(processor)透過執行所述一個或多個電腦可讀指令實現本發明各個實施例的方法的部分,例如圖3所示的對產品瑕疵進行檢測的方法。In this embodiment, the integrated unit implemented in the form of a software function module can be stored in a non-volatile readable storage medium. The above-mentioned software function module includes one or more computer-readable instructions, and the computer device 3 or a processor (processor) implements part of the method of each embodiment of the present invention by executing the one or more computer-readable instructions, For example, the method for detecting product defects is shown in FIG. 3 .

在進一步的實施例中,結合圖2,所述至少一個處理器32可執行所述電腦裝置3中所安裝的各類應用程式(如所述的產品瑕疵檢測系統30)、程式碼等。In a further embodiment, referring to FIG. 2 , the at least one processor 32 can execute various application programs (eg, the product defect detection system 30 ), program codes, etc. installed in the computer device 3 .

在進一步的實施例中,所述儲存器31中儲存有電腦程式的程式碼,且所述至少一個處理器32可調用所述儲存器31中儲存的程式碼以執行相關的功能。例如,圖2中所述產品瑕疵檢測系統30的各個模組是儲存在所述儲存器31中的程式碼,並由所述至少一個處理器32所執行,從而實現所述各個模組的功能以達到對產品瑕疵進行檢測的目的(詳見下文中對圖3的描述)。In a further embodiment, the storage 31 stores the code of a computer program, and the at least one processor 32 can call the code stored in the storage 31 to execute related functions. For example, each module of the product defect detection system 30 in FIG. 2 is a program code stored in the storage 31 and executed by the at least one processor 32, thereby realizing the functions of the various modules In order to achieve the purpose of detecting product defects (see the description of Figure 3 below for details).

在本發明的一個實施例中,所述儲存器31儲存一個或多個電腦可讀指令,所述一個或多個電腦可讀指令被所述至少一個處理器32所執行以實現對產品瑕疵進行檢測的目的。具體地,所述至少一個處理器32對上述電腦可讀指令的具體實現方法詳見下文中對圖3的描述。In one embodiment of the present invention, the storage 31 stores one or more computer-readable instructions, and the one or more computer-readable instructions are executed by the at least one processor 32 to implement the detection of product defects. purpose of detection. Specifically, for the specific implementation method of the above computer-readable instructions by the at least one processor 32, please refer to the description of FIG. 3 below.

圖3是本發明較佳實施例提供的產品瑕疵檢測方法的流程圖。FIG. 3 is a flowchart of a method for detecting product defects provided by a preferred embodiment of the present invention.

在本實施例中,所述產品瑕疵檢測方法可以應用於電腦裝置3中,對於需要進行產品瑕疵檢測的電腦裝置3,可以直接在該電腦裝置3上集成本發明的方法所提供的用於產品瑕疵檢測的功能,或者以軟體開發套件(Software Development Kit,SDK)的形式運行在所述電腦裝置3上。In this embodiment, the product defect detection method can be applied to the computer device 3. For the computer device 3 that needs to perform product defect detection, the computer device 3 provided by the method of the present invention can be directly integrated into the computer device 3. The function of defect detection may run on the computer device 3 in the form of a software development kit (Software Development Kit, SDK).

如圖3所示,所述產品瑕疵檢測方法具體包括以下步驟,根據不同的需求,該流程圖中步驟的順序可以改變,某些步驟可以省略。As shown in FIG. 3 , the product defect detection method specifically includes the following steps. According to different requirements, the sequence of the steps in the flowchart can be changed, and some steps can be omitted.

步驟S1、獲取模組301獲取待檢測的產品的影像(為清楚簡單說明本發明,以下將待檢測的產品的影像的稱為“測試影像”)。Step S1 , the acquisition module 301 acquires an image of the product to be tested (for the sake of clarity and simplicity to explain the present invention, the image of the product to be tested is referred to as a "test image" hereinafter).

所述待檢測的產品也即是需要進行瑕疵檢測的產品。例如,可以為手機殼、手機保護套,或者任何其他適合的產品。The product to be inspected is also the product that needs to be inspected for defects. For example, it could be a phone case, a phone case, or any other suitable product.

在一個實施例中,所述獲取模組301可以利用攝像頭(圖中未示出)對所述待檢測的產品進行拍攝,獲得該待檢測的產品的測試影像。當然,該待檢測的產品的測試影像也可以預先儲存在儲存器31中,所述獲取模組301可以直接從該儲存器31中獲取所述產品的測試影像。In one embodiment, the acquisition module 301 may use a camera (not shown in the figure) to photograph the product to be inspected to obtain a test image of the product to be inspected. Of course, the test image of the product to be detected can also be stored in the storage 31 in advance, and the acquisition module 301 can directly acquire the test image of the product from the storage 31 .

例如,參閱圖4A所示,獲取到產品的測試影像4。這裡以所述測試影像4包括瑕疵40為例說明。For example, referring to FIG. 4A , a test image 4 of the product is obtained. Here, the test image 4 includes the defect 40 as an example for illustration.

步驟S2、執行模組302 將所述測試影像輸入至自動編碼器(Autoencoder,AE)獲得重構影像。Step S2, the execution module 302 inputs the test image into an autoencoder (Autoencoder, AE) to obtain a reconstructed image.

需要說明的是,所述自動編碼器是一種利用反向傳播演算法使得輸出值等於輸入值的神經網路。通常一個自編碼器包括編碼器(Encoder)和解碼器(Decoder)。其中,編碼器可以將輸入壓縮為潛在空間表徵,解碼器將潛在空間表徵重構為輸出。It should be noted that the auto-encoder is a neural network that uses a back-propagation algorithm to make the output value equal to the input value. Usually an autoencoder consists of an encoder (Encoder) and a decoder (Decoder). Among them, the encoder can compress the input into a latent space representation, and the decoder reconstructs the latent space representation into the output.

本實施例中,執行模組302在將所述測試影像輸入至所述自動編碼器之前,利用多張樣本影像訓練所述自動編碼器,其中,所述多張樣本影像中的每張樣本影像為所述產品不存在瑕疵時所拍攝的影像。In this embodiment, the execution module 302 uses a plurality of sample images to train the auto-encoder before inputting the test image to the auto-encoder, wherein each sample image in the plurality of sample images An image taken when the product in question was free of defects.

例如,參閱圖4B所示,將所述測試影像4輸入至所述自動編碼器獲取到重構影像5。For example, referring to FIG. 4B , the test image 4 is input to the auto-encoder to obtain a reconstructed image 5 .

步驟S3、執行模組302將所述測試影像切割為N個影像區塊,以及將所述重構影像切割為N個影像區塊。Step S3, the execution module 302 cuts the test image into N image blocks, and cuts the reconstructed image into N image blocks.

在一個實施例中,所述N為正整數,N大於或等於2。In one embodiment, the N is a positive integer, and N is greater than or equal to 2.

為便於清楚簡單說明本發明,這裡將所述測試影像對應的每個影像區塊稱為“測試區塊”,以及將所述重構影像對應的每個影像區塊稱為“重構區塊”。In order to clearly and simply describe the present invention, each image block corresponding to the test image is referred to as a "test block", and each image block corresponding to the reconstructed image is referred to as a "reconstruction block". ".

本實施例中,所述執行模組302按照預設的切割規則將所述測試影像切割為所述N個測試區塊,以及按照該預設的切割規則將所述重構影像切割為所述N個重構區塊,其中,所述N個測試區塊中的每個測試區塊的大小相等,所述N個重構區塊中的每個重構區塊的大小相等。In this embodiment, the execution module 302 cuts the test image into the N test blocks according to a preset cutting rule, and cuts the reconstructed image into the N test blocks according to the preset cutting rule N reconstruction blocks, wherein each of the N test blocks is equal in size, and each of the N reconstruction blocks is equal in size.

在一個實施例中,所述預設的切割規則是指:沿目標影像的第一中線對所述目標影像進行切割,其中,該第一中線為所述目標影像的頂邊緣與底邊緣所對應的中線;及/或沿所述目標影像的第二中線對所述目標影像進行切割,其中,該第二中線為所述目標影像的左邊緣與右邊緣所對應的中線。所述目標影像也即是指所述測試影像或所述重構影像。In one embodiment, the preset cutting rule refers to: cutting the target image along a first center line of the target image, wherein the first center line is a top edge and a bottom edge of the target image The corresponding center line; and/or cutting the target image along the second center line of the target image, wherein the second center line is the center line corresponding to the left edge and the right edge of the target image . The target image also refers to the test image or the reconstructed image.

本實施例以所述執行模組302沿所述目標影像(即所述測試影像或所述重構影像)的第一中線對所述目標影像進行切割;及沿所述目標影像的第二中線對所述目標影像進行切割為例。In this embodiment, the execution module 302 is used to cut the target image along the first center line of the target image (ie, the test image or the reconstructed image); and along the second center line of the target image For example, the center line cuts the target image.

例如,參閱圖4C所示,所述執行模組302沿測試影像4的第一中線對測試影像4進行切割;及沿所述測試影像4的第二中線對所述測試影像4進行切割,將所述測試影像4分割為四個測試區塊41、42、43、44。參閱圖4D所示,所述執行模組302沿重構影像5的第一中線對重構影像5進行切割;及沿所述重構影像5的第二中線對所述重構影像5進行切割,將所述重構影像5分割為四個重構區塊51、52、53、54。For example, as shown in FIG. 4C , the execution module 302 cuts the test image 4 along the first center line of the test image 4 ; and cuts the test image 4 along the second center line of the test image 4 , the test image 4 is divided into four test blocks 41 , 42 , 43 and 44 . Referring to FIG. 4D , the execution module 302 cuts the reconstructed image 5 along the first center line of the reconstructed image 5 ; and cuts the reconstructed image 5 along the second center line of the reconstructed image 5 Cutting is performed to divide the reconstructed image 5 into four reconstructed blocks 51 , 52 , 53 , and 54 .

在其他實施例中,所述執行模組302也可以按照其他切割規則來切割所述目標影像。In other embodiments, the execution module 302 may also cut the target image according to other cutting rules.

例如,所述執行模組302也可以沿所述目標影像的橫向將所述目標影像切割為多個(例如三個)大小相等的影像區塊。For example, the execution module 302 may also cut the target image into multiple (eg, three) image blocks of equal size along the lateral direction of the target image.

步驟S4、執行模組302根據所述N個測試區塊分別在所述測試影像中的位置,以及所述N個重構區塊分別在所述重構影像中的位置,將所述N個測試區塊中的任意一個測試區塊與所述N個重構區塊中的其中一個重構區塊建立關聯,其中,該其中一個重構區塊在所述重構影像中的位置與所述任意一個測試區塊在所述測試影像的中位置對應。Step S4, the execution module 302, according to the respective positions of the N test blocks in the test image and the respective positions of the N reconstructed blocks in the reconstructed image, converts the N Any one of the test blocks is associated with one of the N reconstructed blocks, wherein the position of the one of the reconstructed blocks in the reconstructed image is the same as that of all the reconstructed blocks. Any one of the test blocks corresponds to the middle position of the test image.

舉例而言,所述執行模組302根據所述四個測試區塊41、42、43、44分別在所述測試影像4中的位置,以及所述四個重構區塊51、52、53、54分別在所述重構影像5中的位置,將對應相同位置的測試區塊41與重構區塊51建立關聯,將對應相同位置的測試區塊42與重構區塊52建立關聯,將對應相同位置的測試區塊43與重構區塊53建立關聯,以及將對應相同位置的測試區塊44與重構區塊54建立關聯。For example, the execution module 302 is based on the positions of the four test blocks 41 , 42 , 43 , and 44 in the test image 4 , and the four reconstruction blocks 51 , 52 , and 53 respectively , 54 are respectively at the positions in the reconstructed image 5, the test block 41 corresponding to the same position is associated with the reconstruction block 51, and the test block 42 corresponding to the same position is associated with the reconstruction block 52, The test block 43 corresponding to the same position is associated with the reconstruction block 53 , and the test block 44 corresponding to the same position is associated with the reconstruction block 54 .

步驟S5、執行模組302計算所述N個測試區塊中的每個測試區塊與對應的重構區塊之間的均方誤差(mean-square error, MSE),並將計算得到的均方誤差與該每個測試區塊建立關聯。Step S5, the execution module 302 calculates the mean-square error (mean-square error, MSE) between each test block in the N test blocks and the corresponding reconstruction block, and calculates the calculated mean square error (MSE). A squared error is associated with each test block.

舉例而言,執行模組302計算得到測試區塊41與重構區塊51之間的均方誤差為MSE1,計算得到測試區塊42與重構區塊52之間的均方誤差為MSE2,則將MSE1與測試區塊41建立關聯,將MSE2與測試區塊42建立關聯。For example, the execution module 302 calculates the mean square error between the test block 41 and the reconstruction block 51 as MSE1, and calculates the mean square error between the test block 42 and the reconstruction block 52 as MSE2, Then MSE1 is associated with the test block 41 , and MSE2 is associated with the test block 42 .

步驟S6、執行模組302基於所述N個測試區塊中的每個測試區塊所對應的均方誤差確定所述產品是否存在瑕疵。Step S6, the execution module 302 determines whether the product has defects based on the mean square error corresponding to each of the N test blocks.

本實施例中,所述基於所述N個測試區塊中的每個測試區塊所對應的均方誤差確定所述產品是否存在瑕疵包括(a1)-(a4):In this embodiment, determining whether the product has defects based on the mean square error corresponding to each of the N test blocks includes (a1)-(a4):

(a1)確定所述N個測試區塊中的每個測試區塊所對應的均方誤差是否大於預設值。例如,預設值可以為0.001。(a1) Determine whether the mean square error corresponding to each of the N test blocks is greater than a preset value. For example, the preset value may be 0.001.

(a2)當所述N個測試區塊中的任意一個測試區塊所對應的均方誤差大於所述預設值時,確定該任意一個測試區塊為瑕疵區塊。(a2) When the mean square error corresponding to any one of the N test blocks is greater than the preset value, determine that any one of the test blocks is a defective block.

舉例而言,假設測試區塊42對應的均方誤差MSE2為0.1,即大於所述預設值,則所述執行模組302確定該測試區塊42為瑕疵區塊。For example, assuming that the mean square error MSE2 corresponding to the test block 42 is 0.1, that is, greater than the predetermined value, the execution module 302 determines that the test block 42 is a defective block.

(a3)當所述N個測試區塊中包括至少一個瑕疵區塊時,確定所述產品存在瑕疵。(a3) When at least one defective block is included in the N test blocks, it is determined that the product is defective.

(a4)當所述N個測試區塊不包括瑕疵區塊時,確定所述產品不存在瑕疵。(a4) When the N test blocks do not include defective blocks, it is determined that the product does not have defects.

在一個實施例中,當確定所述產品存在瑕疵時,所述執行模組302還可以根據所述瑕疵區塊在所述測試影像中的位置,在該測試影像上標示所述瑕疵區塊,由此獲得作了標示後的所述測試影像;及在顯示幕上顯示作了標示後的所述測試影像。In one embodiment, when it is determined that the product is defective, the execution module 302 may further mark the defective block on the test image according to the position of the defective block in the test image, Thereby, the marked test image is obtained; and the marked test image is displayed on the display screen.

在一個實施例中,所述執行模組302還可以回應使用者在所述測試影像的指定操作,顯示與所述瑕疵區塊對應的所述重構區塊。由此便利使用者比對查看產品的瑕疵。In one embodiment, the execution module 302 may further display the reconstructed block corresponding to the defective block in response to the user's designated operation on the test image. Therefore, it is convenient for the user to compare and check the defects of the product.

在一個實施例中,所述在該測試影像上標示所述瑕疵區塊包括:利用預設的顏色例如紅色填充所述瑕疵區塊在所述測試影像上所占的區域;或者生成一個箭頭圖示,將該箭頭圖示指向所述瑕疵區塊在所述測試影像上的位置。In one embodiment, the marking of the defective block on the test image includes: filling an area occupied by the defective block on the test image with a preset color such as red; or generating an arrow diagram shown, the arrow icon points to the position of the defective block on the test image.

在一個實施例中,使用者在所述測試影像的指定操作可以是指在所述測試影像的任意位置的輸入操作,或者是在所標示的瑕疵區塊所在位置的輸入操作。該輸入操作可以是指長按/按兩下操作。In one embodiment, the user's designated operation on the test image may refer to an input operation at any position of the test image, or an input operation at the position of the marked defective block. The input operation may refer to a long-press/double-press operation.

在本發明所提供的幾個實施例中,應該理解到,所揭露的裝置和方法,可以透過其它的方式實現。例如,以上所描述的裝置實施例僅僅是示意性的,例如,所述模組的劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and other division methods may be used in actual implementation.

所述作為分離部件說明的模組可以是或者也可以不是物理上分開的,作為模組顯示的部件可以是或者也可以不是物理單元,即可以位於一個地方,或者也可以分佈到多個網路單元上。可以根據實際的需要選擇其中的部分或者全部模組來實現本實施例方案的目的。The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they can be located in one place or distributed to multiple networks. on the unit. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本發明各個實施例中的各功能模組可以集成在一個處理單元中,也可以是各個單元單獨物理存在,也可以兩個或兩個以上單元集成在一個單元中。上述集成的單元既可以採用硬體的形式實現,也可以採用硬體加軟體功能模組的形式實現。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.

對於本領域技術人員而言,顯然本發明不限於上述示範性實施例的細節,而且在不背離本發明的精神或基本特徵的情況下,能夠以其他的具體形式實現本發明。因此,無論從哪一點來看,均應將實施例看作是示範性的,而且是非限制性的,本發明的範圍由所附請求項而不是上述說明限定,因此旨在將落在請求項的等同要件的含義和範圍內的所有變化涵括在本發明內。不應將請求項中的任何附圖標記視為限制所涉及的請求項。此外,顯然“包括”一詞不排除其他單元或,單數不排除複數。裝置請求項中陳述的多個單元或裝置也可以由一個單元或裝置透過軟體或者硬體來實現。第一,第二等詞語用來表示名稱,而並不表示任何特定的順序。It will be apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, but that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the present invention is defined by the appended claims rather than the foregoing description, and is therefore intended to fall within the scope of the claims. All changes within the meaning and range of the equivalents of , are included in the present invention. Any reference sign in a claim should not be construed as limiting the claim to which it relates. Furthermore, it is clear that the word "comprising" does not exclude other units or, and the singular does not exclude the plural. Multiple units or means stated in the device claim may also be implemented by one unit or means through software or hardware. The terms first, second, etc. are used to denote names and do not denote any particular order.

最後所應說明的是,以上實施例僅用以說明本發明的技術方案而非限制,儘管參照以上較佳實施例對本發明進行了詳細說明,本領域的普通技術人員應當理解,可以對本發明的技術方案進行修改或等同替換,而不脫離本發明技術方案的精神和範圍。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above preferred embodiments, those of ordinary skill in the art should The technical solutions can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.

3:電腦裝置 31:儲存器 32:處理器 33:顯示幕 30:產品瑕疵檢測系統 301:獲取模組 302:執行模組 4:測試影像 5:重構影像 40:瑕疵 41、42、43、44:測試區塊 51、52、53、54:重構區塊 3: Computer device 31: Storage 32: Processor 33: Display screen 30: Product defect detection system 301: Get Mods 302: Execute the module 4: Test image 5: Reconstruct the image 40: Flaws 41, 42, 43, 44: Test blocks 51, 52, 53, 54: Refactoring blocks

圖1是本發明較佳實施例的電腦裝置的架構圖。FIG. 1 is a structural diagram of a computer device according to a preferred embodiment of the present invention.

圖2是本發明較佳實施例的產品瑕疵檢測系統的功能模組圖。FIG. 2 is a functional module diagram of a product defect detection system according to a preferred embodiment of the present invention.

圖3是本發明較佳實施例的產品瑕疵檢測方法的流程圖。FIG. 3 is a flow chart of a method for detecting product defects according to a preferred embodiment of the present invention.

圖4A示意了產品的一張測試影像。Figure 4A illustrates a test image of the product.

圖4B示意了一張重構影像。Figure 4B illustrates a reconstructed image.

圖4C舉例說明將圖4A所示的測試影像分割多個區塊。FIG. 4C illustrates dividing the test image shown in FIG. 4A into a plurality of blocks.

圖4D舉例說明將圖4B所示的重構影像分割多個區塊。FIG. 4D illustrates dividing the reconstructed image shown in FIG. 4B into multiple blocks.

none

Claims (10)

一種產品瑕疵檢測方法,其特徵在於,該方法包括: 獲取產品的測試影像; 將所述測試影像輸入至自動編碼器獲得重構影像; 將所述測試影像切割為N個測試區塊,以及將所述重構影像切割為N個重構區塊; 根據所述N個測試區塊分別在所述測試影像中的位置,以及所述N個重構區塊分別在所述重構影像中的位置,將所述N個測試區塊中的任意一個測試區塊與所述N個重構區塊中的其中一個重構區塊建立關聯,其中,該其中一個重構區塊在所述重構影像中的位置與所述任意一個測試區塊在所述測試影像的中位置對應; 計算所述N個測試區塊中的每個測試區塊與對應的重構區塊之間的均方誤差,並將計算得到的均方誤差與該每個測試區塊建立關聯;及 基於所述N個測試區塊中的每個測試區塊所對應的均方誤差確定所述產品是否存在瑕疵。 A product defect detection method, characterized in that the method comprises: Obtain test images of the product; inputting the test image to an autoencoder to obtain a reconstructed image; cutting the test image into N test blocks, and cutting the reconstructed image into N reconstruction blocks; According to the respective positions of the N test blocks in the test image and the respective positions of the N reconstructed blocks in the reconstructed image, any one of the N test blocks is The test block is associated with one of the N reconstructed blocks, wherein the position of the one of the reconstructed blocks in the reconstructed image is the same as that of the any one of the test blocks. The middle position of the test image corresponds to; calculating the mean square error between each test block in the N test blocks and the corresponding reconstructed block, and associating the calculated mean square error with each test block; and Whether the product is defective is determined based on the mean square error corresponding to each of the N test blocks. 如請求項1所述的產品瑕疵檢測方法,其特徵在於,所述基於所述N個測試區塊中的每個測試區塊所對應的均方誤差確定所述產品是否存在瑕疵包括: 確定所述N個測試區塊中的每個測試區塊所對應的均方誤差是否大於預設值; 當所述N個測試區塊中的任意一個測試區塊所對應的均方誤差大於所述預設值時,確定該任意一個測試區塊為瑕疵區塊; 當所述N個測試區塊中包括至少一個瑕疵區塊時,確定所述產品存在瑕疵;及 當所述N個測試區塊不包括瑕疵區塊時,確定所述產品不存在瑕疵。 The product defect detection method according to claim 1, wherein the determining whether the product has defects based on the mean square error corresponding to each of the N test blocks includes: Determine whether the mean square error corresponding to each test block in the N test blocks is greater than a preset value; When the mean square error corresponding to any one of the N test blocks is greater than the preset value, determining that the any one of the test blocks is a defective block; When the N test blocks include at least one defective block, determining that the product is defective; and When the N test blocks do not include defective blocks, it is determined that the product does not have defects. 如請求項1所述的產品瑕疵檢測方法,其特徵在於,該方法還包括: 在將所述測試影像輸入至所述自動編碼器之前,利用多張樣本影像訓練所述自動編碼器,其中,所述多張樣本影像中的每張樣本影像為所述產品不存在瑕疵時所拍攝的影像。 The product defect detection method according to claim 1, characterized in that the method further comprises: Before the test image is input to the auto-encoder, the auto-encoder is trained with a plurality of sample images, wherein each sample image in the plurality of sample images is obtained when the product has no defects recorded image. 如請求項1所述的產品瑕疵檢測方法,其特徵在於,該方法還包括: 根據所述瑕疵區塊在所述測試影像中的位置,在該測試影像上標示所述瑕疵區塊,由此獲得作了標示後的所述測試影像;及 在顯示幕上顯示作了標示後的所述測試影像。 The product defect detection method according to claim 1, characterized in that the method further comprises: marking the defective block on the test image according to the position of the defective block in the test image, thereby obtaining the marked test image; and The marked test image is displayed on the display screen. 如請求項4所述的產品瑕疵檢測方法,其特徵在於,該方法還包括: 回應使用者在所述測試影像的指定操作,顯示與所述瑕疵區塊對應的所述重構區塊。 The product defect detection method according to claim 4, characterized in that the method further comprises: In response to a user's designated operation on the test image, the reconstructed block corresponding to the defective block is displayed. 如請求項1所述的產品瑕疵檢測方法,其特徵在於,該方法按照預設的切割規則將所述測試影像切割為所述N個測試區塊,以及按照該預設的切割規則將所述重構影像切割為所述N個重構區塊,其中,所述N個測試區塊中的每個測試區塊的大小相等,所述N個重構區塊中的每個重構區塊的大小相等。The product defect detection method according to claim 1, wherein the method cuts the test image into the N test blocks according to a preset cutting rule, and cuts the test image into the N test blocks according to the preset cutting rule. The reconstructed image is divided into the N reconstruction blocks, wherein the size of each test block in the N test blocks is equal, and each reconstruction block in the N reconstruction blocks are equal in size. 如請求項6所述的產品瑕疵檢測方法,其特徵在於,所述預設的切割規則是指:沿目標影像的第一中線對所述目標影像進行切割,其中,該第一中線為所述目標影像的頂邊緣與底邊緣所對應的中線;及/或沿所述目標影像的第二中線對所述目標影像進行切割,其中,該第二中線為所述目標影像的左邊緣與右邊緣所對應的中線;所述目標影像為所述測試影像或所述重構影像。The product defect detection method according to claim 6, wherein the preset cutting rule refers to: cutting the target image along a first center line of the target image, wherein the first center line is the center line corresponding to the top edge and the bottom edge of the target image; and/or cutting the target image along a second center line of the target image, wherein the second center line is the center line of the target image The center line corresponding to the left edge and the right edge; the target image is the test image or the reconstructed image. 如請求項6所述的產品瑕疵檢測方法,其特徵在於,所述N為正整數,N大於或等於2。The product defect detection method according to claim 6, wherein the N is a positive integer, and N is greater than or equal to 2. 一種電腦可讀儲存介質,其特徵在於,所述電腦可讀儲存介質儲存有至少一個指令,所述至少一個指令被處理器執行時實現如請求項1至8中任意一項所述的產品瑕疵檢測方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, realizes the product defect according to any one of claim items 1 to 8 Detection method. 一種電腦裝置,其特徵在於,該電腦裝置包括儲存器和至少一個處理器,所述儲存器中儲存有至少一個指令,所述至少一個指令被所述至少一個處理器執行時實現如請求項1至8中任意一項所述的產品瑕疵檢測方法。A computer device, characterized in that the computer device comprises a storage and at least one processor, wherein the storage stores at least one instruction, and the at least one instruction is executed by the at least one processor to achieve as claimed in item 1 The product defect detection method described in any one of to 8.
TW109146745A 2020-12-29 2020-12-29 Method for detecting defects of product, computer device and storage medium TWI748828B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW109146745A TWI748828B (en) 2020-12-29 2020-12-29 Method for detecting defects of product, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW109146745A TWI748828B (en) 2020-12-29 2020-12-29 Method for detecting defects of product, computer device and storage medium

Publications (2)

Publication Number Publication Date
TWI748828B TWI748828B (en) 2021-12-01
TW202226154A true TW202226154A (en) 2022-07-01

Family

ID=80681056

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109146745A TWI748828B (en) 2020-12-29 2020-12-29 Method for detecting defects of product, computer device and storage medium

Country Status (1)

Country Link
TW (1) TWI748828B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI792827B (en) * 2021-12-31 2023-02-11 鴻海精密工業股份有限公司 Method for detecting product appearance defects, computer device and storage medium
TWI807854B (en) * 2022-06-09 2023-07-01 鴻海精密工業股份有限公司 Method for detecting defects, computer device and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI608369B (en) * 2016-11-23 2017-12-11 財團法人工業技術研究院 Classification method, classification module and computer program product
TWI629665B (en) * 2017-11-24 2018-07-11 住華科技股份有限公司 Defect inspection method and defect inspection system
CN110555839A (en) * 2019-09-06 2019-12-10 腾讯云计算(北京)有限责任公司 Defect detection and identification method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
TWI748828B (en) 2021-12-01

Similar Documents

Publication Publication Date Title
US20230214989A1 (en) Defect detection method, electronic device and readable storage medium
TW202226154A (en) Method for detecting defects of product, computer device and storage medium
US20220207714A1 (en) Product defect detection method, computing device, and storage medium
CN110969600A (en) Product defect detection method and device, electronic equipment and storage medium
CN109901996A (en) Method, apparatus, electronic equipment and the readable storage medium storing program for executing of subtest
CN114419029B (en) Training method of surface defect detection model, surface defect detection method and device
TW202225682A (en) Circuit board checking method, electronic device, and storage medium
CN112418590B (en) Printed circuit board component detection method and system
CN107493469A (en) A kind of method and device of the area-of-interest of determination SFR test cards
CN111105392A (en) Display performance testing method and device and storage medium
CN111951210A (en) Data processing method, device and equipment
CN114266737A (en) Defect detection method, device, equipment and storage medium
CN114757868A (en) Product flaw detection method, computer device and storage medium
CN113971650A (en) Product flaw detection method, computer device and storage medium
TWI755240B (en) Computer device and image processing method
TW202225674A (en) Method for detecting defects of product and computer device
CN115222699A (en) Defect detection method, defect detection device and system
TWI770561B (en) Product defect detection method, computer device and storage medium
TWI748184B (en) Defect detecting method, electronic device, and computer readable storage medium
CN110880182B (en) Image segmentation model training method, image segmentation device and electronic equipment
JP2023047003A (en) Machine learning system, learning data collection method and learning data collection program
TWI807854B (en) Method for detecting defects, computer device and storage medium
TWI755212B (en) Method and related equipment for determinting input dimensions of model
TWI769633B (en) Method and device for detecting image defects, computer device and medium
TWI765589B (en) Abnormality detection method, computer device, and storage medium