TWI765442B - Method for defect level determination and computer readable storage medium thereof - Google Patents

Method for defect level determination and computer readable storage medium thereof Download PDF

Info

Publication number
TWI765442B
TWI765442B TW109142282A TW109142282A TWI765442B TW I765442 B TWI765442 B TW I765442B TW 109142282 A TW109142282 A TW 109142282A TW 109142282 A TW109142282 A TW 109142282A TW I765442 B TWI765442 B TW I765442B
Authority
TW
Taiwan
Prior art keywords
defect
target
area
target defect
characteristic parameter
Prior art date
Application number
TW109142282A
Other languages
Chinese (zh)
Other versions
TW202127372A (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 大陸商鄭州富聯智能工坊有限公司
Publication of TW202127372A publication Critical patent/TW202127372A/en
Application granted granted Critical
Publication of TWI765442B publication Critical patent/TWI765442B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/0006Industrial image inspection using a design-rule based approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30164Workpiece; Machine component

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Geometry (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Analysis (AREA)

Abstract

The present invention provides a method for detect level determination comprising: obtaining at least an image of an object to be detected, extracting target defect area from the image, obtaining a first feature parameter from the target defect area, obtaining a weighting value according to the first feature parameter based on a predetermined rule, obtaining a second feature parameter from the target defect area, calculating a defect grade based on the second feature parameter and the weighting value, determining the defect level corresponding to the target defect area based on the defect grade, and outputting the defect level. The present invention also provides a computer readable medium. The present invention can be used to increase the accuracy and efficiency of defect level determination.

Description

瑕疵等級判定的方法及存儲介質 Method and storage medium for determining defect level

本發明涉及圖像識別技術領域,具體涉及一種瑕疵等級判定的方法及存儲介質。 The invention relates to the technical field of image recognition, in particular to a method and a storage medium for determining a defect level.

當前產品製造業朝高精度、高品質方向發展。精密金屬零部件在加工時,容易出現碰傷、壓傷、擦傷等多種瑕疵,且瑕疵尺寸達到微米級。因此產品檢測更顯重要與困難。為了達到外觀品質的要求,自動光學檢測(Automated Optical Inspection,AOI)設備需要正確的對檢測到的瑕疵進行精確的分類及分級。 The current product manufacturing industry is developing in the direction of high precision and high quality. Precision metal parts are prone to various defects such as bumps, crushes, and abrasions during processing, and the size of the defects reaches the micron level. Therefore, product testing is more important and difficult. In order to meet the requirements of appearance quality, automatic optical inspection (Automated Optical Inspection, AOI) equipment needs to accurately classify and grade the detected defects.

對於瑕疵的分級,由於瑕疵的型態具有隨機性以及AOI的局限性,傳統的瑕疵分級方法採用的是機器視覺外觀瑕疵檢測方法。然而,瑕疵的型態非常多變,現有技術中還沒有能夠涵蓋所有瑕疵型態的演算法來對瑕疵進行準確檢測。因此,現有的影像處理技術對於此種型態多變的檢測目標,準確性不高。 For the classification of defects, due to the randomness of the type of defects and the limitation of AOI, the traditional defect classification method adopts the method of machine vision appearance defect detection. However, the types of flaws are very variable, and there is no algorithm in the prior art that can cover all types of flaws to accurately detect flaws. Therefore, the existing image processing technology is not very accurate for such a variety of detection targets.

鑒於以上問題,本發明提出一種瑕疵等級判定的方法和電腦可讀存儲介質,以提高圖像中目標瑕疵區域等級判定的效率與準確率。 In view of the above problems, the present invention proposes a method and a computer-readable storage medium for determining a defect level, so as to improve the efficiency and accuracy of determining the level of a target defect area in an image.

本申請的第一方面提供一種瑕疵等級判定方法,由電子裝置的處理器執行,所述方法包括:獲取待測物體的至少一張圖像; 從所述圖像中提取目標瑕疵區域;獲取所述目標瑕疵區域的第一特徵參數;根據所述第一特徵參數依據預設規則得到加權值;獲取所述目標瑕疵區域的第二特徵參數;根據所述第二特徵參數和所述加權值計算瑕疵規格分數;根據所述瑕疵規格分數判定所述目標瑕疵區域對應的瑕疵等級;以及輸出所述瑕疵等級。 A first aspect of the present application provides a method for determining a defect level, which is executed by a processor of an electronic device, the method comprising: acquiring at least one image of an object to be measured; extracting the target defect area from the image; obtaining the first characteristic parameter of the target defect area; obtaining a weighted value according to the first characteristic parameter according to a preset rule; obtaining the second characteristic parameter of the target defect area; Calculate a defect specification score according to the second characteristic parameter and the weighted value; determine a defect level corresponding to the target defect area according to the defect specification score; and output the defect level.

優選地,所述從所述圖像中提取目標瑕疵區域包括:提取所述圖像中的多個目標瑕疵子區域;處理所述多個目標瑕疵子區域得到所述目標瑕疵區域。 Preferably, the extracting the target defect region from the image comprises: extracting a plurality of target defect sub-regions in the image; and processing the plurality of target defect sub-regions to obtain the target defect region.

優選地,所述處理所述多個目標瑕疵子區域得到所述目標瑕疵區域包括:判斷所述多個目標瑕疵子區域的類型;確定所述多個目標瑕疵子區域的位置;聚合類型相同且位置相鄰的兩個或數個所述目標瑕疵子區域生成所述目標瑕疵區域。 Preferably, the processing of the plurality of target defective sub-regions to obtain the target defective sub-regions comprises: judging the types of the plurality of target defective sub-regions; determining the positions of the plurality of target defective sub-regions; Two or several of the target defect sub-regions located adjacent to each other generate the target defect region.

優選地,所述判斷所述多個目標瑕疵子區域的類型包括:通過卷積神經網路模型判斷所述多個目標瑕疵子區域的類型。 Preferably, the judging the types of the multiple target defect sub-regions includes: judging the types of the multiple target defect sub-regions through a convolutional neural network model.

優選地,所述目標瑕疵區域的第一特徵參數包括如下任意一種或多種:位置、灰度差、長寬比、灰度方差、灰度均值差、對比度、小梯度優勢、大梯度優勢、灰度分佈不均勻性、梯度分佈不均勻性、能量、灰度平均、梯度平均、灰度均方差、梯度均方差、相關性、灰度熵、梯度熵、混合熵、差分矩和逆差分矩。 Preferably, the first characteristic parameters of the target defect area include any one or more of the following: position, grayscale difference, aspect ratio, grayscale variance, grayscale mean difference, contrast, small gradient dominance, large gradient dominance, grayscale Degree distribution inhomogeneity, gradient distribution inhomogeneity, energy, gray mean, gradient mean, gray mean square error, gradient mean square error, correlation, gray entropy, gradient entropy, hybrid entropy, difference moment, and inverse difference moment.

優選地,所述方法還包括: 判斷所述目標瑕疵區域的位置是否在預設位置範圍,且判斷所述目標瑕疵區域的灰度差是否小於預設值。 Preferably, the method further includes: It is judged whether the position of the target defect area is within a preset position range, and it is judged whether the grayscale difference of the target defect area is less than a preset value.

優選地,所述方法還包括:當所述目標瑕疵區域的位置不在預設位置範圍,或所述目標瑕疵區域的灰度差大於或等於所述預設值時,獲取所述目標瑕疵區域的第二特徵參數;將所述第二特徵參數作為瑕疵規格分數;根據所述瑕疵規格分數判定所述目標瑕疵區域對應的瑕疵等級。 Preferably, the method further includes: when the position of the target defect area is not within a preset position range, or the grayscale difference of the target defect area is greater than or equal to the preset value, acquiring the target defect area the second characteristic parameter; using the second characteristic parameter as the defect specification score; and determining the defect level corresponding to the target defect area according to the defect specification score.

優選地,所述第二特徵參數包括所述目標瑕疵區域的尺寸。 Preferably, the second characteristic parameter includes the size of the target defect region.

優選地,所述根據所述第一特徵參數依據預設規則計算加權值包括:判斷所述第一特徵參數是否符合所述預設規則中的多個條件組合;當所述第一特徵參數符合所述預設規則中的任意一個條件組合時,設定所述第一特徵參數在所述條件組合下的權值為1;當所述第一特徵參數不符合所述預設規則中的任意一個條件組合時,設定所述第一特徵參數在所述條件組合下的權值為0;加總計算所述第一特徵參數符合所述預設規則中的多個條件組合的權值,得到加權值。 Preferably, the calculating the weighted value according to the preset rule according to the first feature parameter includes: judging whether the first feature parameter complies with a plurality of condition combinations in the preset rule; when the first feature parameter satisfies When any one of the preset rules is combined, the weight of the first characteristic parameter under the condition combination is set to 1; when the first characteristic parameter does not conform to any one of the preset rules When conditions are combined, set the weight value of the first characteristic parameter under the condition combination to 0; add up and calculate the weights of the first characteristic parameter conforming to multiple condition combinations in the preset rule to obtain a weighted value value.

優選地,根據所述第二特徵參數和所述加權值計算瑕疵規格分數包括:通過第一公式計算所述瑕疵規格分數,所述第一公式為:瑕疵規格分數=第二特徵參數*(1+加權值總數*m),其中,m為一閾值。 Preferably, calculating the defect specification score according to the second characteristic parameter and the weighted value includes: calculating the defect specification score by using a first formula, and the first formula is: defect specification score=second characteristic parameter*(1 +Total weighted value*m), where m is a threshold.

優選地,所述根據所述瑕疵規格分數判定所述目標瑕疵區域對應的瑕疵等級包括:將所述瑕疵規格分數與一個或多個預設的瑕疵等級閾值進行比對,得到比對結果; 根據比對結果判定所述目標瑕疵區域對應的瑕疵等級。 Preferably, the determining the defect level corresponding to the target defect area according to the defect specification score includes: comparing the defect specification score with one or more preset defect level thresholds to obtain a comparison result; The defect level corresponding to the target defect area is determined according to the comparison result.

優選地,所述方法還包括:根據目標瑕疵區域的瑕疵規格分數,確認是否再次對所述圖像進行瑕疵等級判定。 Preferably, the method further includes: according to the defect specification score of the target defect area, confirming whether to perform defect level judgment on the image again.

優選地,所述方法還包括:依據預存的瑕疵等級對應的分數範圍設置預設閾值範圍;比對所述目標瑕疵區域的瑕疵規格分數與所述預設閾值範圍;及當所述瑕疵規格分數位於所述預設閾值範圍中時,再次對所述圖像進行瑕疵等級判定。 Preferably, the method further comprises: setting a preset threshold range according to the score range corresponding to the pre-stored defect level; comparing the defect specification score of the target defect area with the preset threshold range; and when the defect specification score When it is within the preset threshold range, the image is again subjected to flaw level determination.

優選地,通過深度學習演算法再次對所述圖像進行瑕疵等級判定。 Preferably, the image is again subjected to flaw level determination through a deep learning algorithm.

本發明第二方面提供一種電腦可讀存儲介質,其上存儲有電腦程式,所述電腦程式被處理器執行時實現如前所述的瑕疵等級判定的方法。 A second aspect of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the aforementioned method for determining a defect level is implemented.

本發明中瑕疵等級判定的方法及電腦可讀存儲介質,通過提取待識別圖像中的目標瑕疵區域,再根據所述目標瑕疵區域的第一特徵參數和第二特徵參數來計算目標瑕疵區域的規格分數。最後根據規格分數得到瑕疵等級。進一步地,通過設定所述合格的閾值範圍,再根據所述目標瑕疵區域的規格分數決定瑕疵在經過影像處理技術的判定之後,是否再由深度學習技術來輔助判定,不需要所有的瑕疵都經由深度學習技術的判定,大幅縮減檢測的時間,也降低運算主機的計算需求,進而節省硬體的構置成本。 The method and computer-readable storage medium for determining the defect level of the present invention extract the target defect area in the image to be identified, and then calculate the target defect area according to the first characteristic parameter and the second characteristic parameter of the target defect area. Spec Score. Finally, the defect grade is obtained according to the specification score. Further, by setting the qualified threshold range, and then according to the specification score of the target defect area, it is determined whether the defect will be judged by the deep learning technology after the image processing technology is judged. The determination of deep learning technology greatly reduces the detection time, and also reduces the computing requirements of the computing host, thereby saving the construction cost of hardware.

S1~S8:步驟 S1~S8: Steps

2:圖像 2: Image

20:第一刮傷 20: First scratch

21:第一長條 21: The first strip

22:第二長條 22: The second strip

23:第三長條 23: The third strip

24:第四長條 24: Fourth strip

30:第一擦傷 30: First scratch

301:第一區域 301: First area

302:第二區域 302: Second area

303:第三區域 303: The third area

304:第四區域 304: Fourth area

31:第二擦傷 31: Second Scratch

311:第五區域 311: Fifth Region

312:第六區域 312: The sixth area

200:瑕疵等級判定系統 200: Defect level determination system

201:獲取模組 201: Get Mods

202:提取模組 202: Extract the module

203:計算模組 203: Computing Modules

204:瑕疵等級初判模組 204: Defective Level Preliminary Judgment Module

205:輸出模組 205: Output module

206:瑕疵等級複判模組 206: Defect level re-judgment module

10:電子裝置 10: Electronics

11:記憶體 11: Memory

12:處理器 12: Processor

13:電腦程式 13: Computer Programs

圖1是本發明一實施例所提供的瑕疵等級判定方法的流程示意圖。 FIG. 1 is a schematic flowchart of a method for determining a defect level according to an embodiment of the present invention.

圖2是本發明一實施例所提供的圖像2中第一刮傷的示意圖。 FIG. 2 is a schematic diagram of a first scratch in an image 2 provided by an embodiment of the present invention.

圖3是本發明一實施例提供的圖像2中第一擦傷的示意圖。 FIG. 3 is a schematic diagram of a first scratch in image 2 provided by an embodiment of the present invention.

圖4是本發明一實施例所提供的根據目標瑕疵區域的特徵參數加總計算所述特徵參數符合所述預設規則中的多個條件組合的權值的示意圖。 4 is a schematic diagram of calculating the weights of the characteristic parameters conforming to a plurality of condition combinations in the preset rule according to the summation of the characteristic parameters of the target defect area according to an embodiment of the present invention.

圖5是本發明一實施例所提供的瑕疵等級判定系統示意圖。 FIG. 5 is a schematic diagram of a defect level determination system provided by an embodiment of the present invention.

圖6是本發明一實施方式提供的電子裝置架構示意圖。 FIG. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.

為了能夠更清楚地理解本發明的上述目的、特徵和優點,下面結合附圖和具體實施例對本發明進行詳細描述。需要說明的是,在不衝突的情況下,本申請的實施例及實施例中的特徵可以相互組合。 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 application and the features in the embodiments may be combined with each other in the case 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,圖1為本發明一個實施例提供的瑕疵等級判定方法的流程示意圖。根據不同的需求,所述流程圖中步驟的順序可以改變,某些步驟可以省略。為了便於說明,僅示出了與本發明實施例相關的部分。 Please refer to FIG. 1. FIG. 1 is a schematic flowchart of a method for determining a defect level according to an embodiment of the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted. For the convenience of description, only the parts related to the embodiments of the present invention are shown.

如圖1所示,所述瑕疵等級判定方法包括以下步驟。 As shown in FIG. 1 , the defect level determination method includes the following steps.

步驟S1、獲取待測物體的至少一張圖像。 Step S1, acquiring at least one image of the object to be measured.

在一實施方式中,可通過相機拍攝所述待測物體獲得至少一張圖像。所述相機可以為線陣相機,所述待測物體為手機或平板電腦等裝置。在另一實施方式中,可接收伺服器傳送的待測物體的至少一張圖像。在其他實施方式中,可以從本地資料庫中獲取待測物體的至少一張圖像。本實施方式中,圖 像可包括待測物體的完整或局部圖像,圖像可以是任意解析度,也可以經過高採樣或低採樣,依實際需求而定。 In one embodiment, at least one image can be obtained by photographing the object to be measured by a camera. The camera may be a line scan camera, and the object to be measured is a device such as a mobile phone or a tablet computer. In another embodiment, at least one image of the object to be measured transmitted by the server can be received. In other embodiments, at least one image of the object to be measured can be acquired from a local database. In this embodiment, Fig. The image can include a complete or partial image of the object to be measured. The image can be of any resolution, and can also be sampled high or low, depending on actual needs.

步驟S2、從圖像中提取目標瑕疵區域。 Step S2, extracting the target defect area from the image.

在一實施例中,圖像中可能包括多個目標瑕疵區域。將圖像中的每個目標瑕疵區域用矩形框框選,可以得到包括多個目標瑕疵區域的圖像。所述目標瑕疵區域包括多個目標瑕疵子區域。 In one embodiment, multiple target defect regions may be included in the image. Each target defect area in the image is selected with a rectangular frame, and an image including multiple target defect areas can be obtained. The target defect area includes a plurality of target defect sub-areas.

需要說明的是,圖像中的多個目標瑕疵子區域可以為不同類型的瑕疵。例如,擦傷類型、刮傷類型、碰傷類型和污漬類型。圖像中每種類型的瑕疵數量也可以為多個。為了便於處理,可以將圖像先分割為多個目標瑕疵子區域,再將多個目標瑕疵子區域進行分類,並將同類且相鄰的多個目標瑕疵子區域聚合成目標瑕疵區域,之後再通過本申請所述的瑕疵等級判定方法對每種類型的目標瑕疵區域中的每個目標瑕疵區域進行等級判定。 It should be noted that the multiple target defect sub-regions in the image may be different types of defects. For example, scratch type, scratch type, bump type, and stain type. The number of defects of each type in the image can also be multiple. In order to facilitate processing, the image can be first divided into multiple target defect sub-regions, then the multiple target defect sub-regions can be classified, and the same and adjacent multiple target defect sub-regions can be aggregated into target defect sub-regions. Each target defect area in each type of target defect area is graded by the defect grade determination method described in this application.

在一實施例中,從圖像中提取目標瑕疵區域的步驟包括: In one embodiment, the step of extracting the target defect region from the image includes:

(1)對圖像進行濾波; (1) Filter the image;

在一實施例中,可利用影像處理技術對圖像進行濾波,以去除所述圖像中的噪點。濾波的方法可以是,但不限於,中值濾波、均值濾波、高斯濾波、雙邊濾波中的任意一種。通過對圖像進行濾波處理,能夠消除雜訊影響。在一個優選實施例中,採用中值濾波或均值濾波技術對圖像進行濾波處理。 In one embodiment, the image may be filtered using image processing techniques to remove noise in the image. The filtering method may be, but not limited to, any one of median filtering, mean filtering, Gaussian filtering, and bilateral filtering. By filtering the image, the influence of noise can be eliminated. In a preferred embodiment, a median filtering or mean filtering technique is used to filter the image.

(2)提取圖像中的多個目標瑕疵區域子區域; (2) Extracting multiple target defect sub-regions in the image;

在一實施方式中,可利用影像處理技術提取圖像中的多個目標瑕疵子區域,影像處理技術可以是興趣區域(Region of Interest,ROI)演算法、語意分割演算法、二值化等。 In one embodiment, multiple target defect sub-regions in the image can be extracted by using image processing technology, and the image processing technology can be Region of Interest (ROI) algorithm, semantic segmentation algorithm, binarization and the like.

(3)處理多個目標瑕疵子區域得到目標瑕疵區域。 (3) Processing a plurality of target defect sub-regions to obtain a target defect region.

在一實施方式中,可根據圖像中的瑕疵類型和位置分別採用不同的處理方法,得到目標瑕疵區域。具體而言,可先判斷多個目標瑕疵子區域的類型,確定多個目標瑕疵子區域的位置,再聚合類型相同且位置相鄰的兩個或數個目標瑕疵子區域生成目標瑕疵區域。 In one embodiment, different processing methods may be used according to the type and position of the defect in the image to obtain the target defect area. Specifically, the types of multiple target defect sub-regions may be first judged, the positions of the multiple target defect sub-regions may be determined, and two or more target defect sub-regions of the same type and adjacent positions may be aggregated to generate the target defect areas.

在一實施例中,可通過卷積神經網路模型判斷多個目標瑕疵子區域的類型。 In one embodiment, the types of multiple target defect sub-regions can be determined through a convolutional neural network model.

例如,如圖2所示,圖像中的多個目標瑕疵子區域包括第一長條21、第二長條22、第三長條23和第四長條24。確認多個目標瑕疵區域的類型為刮傷類型,並且確認多個目標瑕疵子區域在圖像中的位置。由此可知,圖像中的目標瑕疵區域可能是一個刮傷類型的區域,並且該目標瑕疵區域包括多個連續且緊鄰的小刮傷。即如圖2所示,第一刮傷20包括第一長條21、第二長條22、第三長條23和第四長條24。為了避免將第一長條21、第二長條22、第三長條23和第四長條24誤認為是四個刮傷,需要將第一長條21、第二長條22、第三長條23和第四長條24進行擬合得到目標瑕疵區域,即第一刮傷20。 For example, as shown in FIG. 2 , the plurality of target defect sub-regions in the image include a first strip 21 , a second strip 22 , a third strip 23 and a fourth strip 24 . It is confirmed that the type of the plurality of target defect regions is a scratch type, and the positions of the plurality of target defect sub-regions in the image are confirmed. From this, it can be known that the target defect area in the image may be a scratch type area, and the target defect area includes a plurality of continuous and closely adjacent small scratches. That is, as shown in FIG. 2 , the first scratch 20 includes a first elongated strip 21 , a second elongated strip 22 , a third elongated strip 23 and a fourth elongated strip 24 . In order to avoid mistaking the first long strip 21 , the second long strip 22 , the third long strip 23 and the fourth long strip 24 as four scratches, the first long strip 21 , the second long strip 22 , the third long strip 22 and the third The long strip 23 and the fourth long strip 24 are fitted to obtain the target defect area, that is, the first scratch 20 .

又如,如圖3所示,圖像中的多個目標瑕疵子區域包括第一區域301、第二區域302、第三區域303、第四區域304、第五區域311和第六區域312。確認多個目標瑕疵區域的類型為擦傷類型,並且確認多個目標瑕疵子區域在圖像中的位置。由此可知,圖像中的目標瑕疵區域可能是兩個擦傷類型的區域,並且兩個所述目標瑕疵區域分別包括多個連續且緊鄰的小擦傷。即如圖3所示,第一擦傷30包括第一區域301、第二區域302、第三區域303和第四區域304。第二擦傷31包括第五區域311和第六區域312。為了避免將所述第一區域301、第二區域302、第三區域303、第四區域304、第五區域311和第六區域312誤認為是六個擦傷。需要將第一區域301、第二區域302、第三區域303和第四區域304進行 群聚得到目標瑕疵區域,即第一擦傷30。將第五區域311和第六區域312進行群聚得到目標瑕疵區域,即第二擦傷31。 For another example, as shown in FIG. 3 , the multiple target defect sub-regions in the image include a first region 301 , a second region 302 , a third region 303 , a fourth region 304 , a fifth region 311 and a sixth region 312 . The type of the plurality of target defect regions is confirmed as a scratch type, and the positions of the plurality of target defect sub-regions in the image are confirmed. It can be seen from this that the target defect regions in the image may be two scratch-type regions, and the two target defect regions respectively include a plurality of continuous and closely adjacent small scratches. That is, as shown in FIG. 3 , the first scratch 30 includes a first area 301 , a second area 302 , a third area 303 and a fourth area 304 . The second scratch 31 includes a fifth area 311 and a sixth area 312 . In order to avoid mistaking the first area 301 , the second area 302 , the third area 303 , the fourth area 304 , the fifth area 311 and the sixth area 312 as six scratches. The first area 301, the second area 302, the third area 303 and the fourth area 304 need to be The clustering results in the target defect area, the first scratch 30 . The fifth area 311 and the sixth area 312 are clustered to obtain the target defect area, that is, the second scratch 31 .

優選地,從圖像中提取目標瑕疵區域的步驟還可以包括:濾除目標瑕疵區域中尺寸小於預設尺寸的瑕疵區域。 Preferably, the step of extracting the target defect area from the image may further include: filtering out defect areas whose size is smaller than a preset size in the target defect area.

由於待測物體上可能會存在灰塵,短毛線等平時用戶肉眼看不到的物質。在對待測物體進行拍攝得到圖像時,可能將灰塵/短毛線等誤認為是瑕疵。因此,需要將目標瑕疵區域中的小瑕疵進行剔除。在一實施例中,通過比對目標瑕疵區域的尺寸與預設尺寸,濾除尺寸小於預設尺寸的目標瑕疵區域。例如,比對目標瑕疵區域的面積與預設面積,濾除面積小於預設面積的目標瑕疵區域。 Since there may be dust on the object to be measured, short wool and other substances that are usually invisible to the naked eye of the user. When taking images of the object to be measured, dust/short hairs may be mistaken for defects. Therefore, it is necessary to remove small defects in the target defect area. In one embodiment, by comparing the size of the target defect area with the preset size, the target defect area whose size is smaller than the preset size is filtered out. For example, the area of the target defect area is compared with the preset area, and the target defect area with an area smaller than the preset area is filtered out.

步驟S3、獲取目標瑕疵區域的第一特徵參數。 Step S3, acquiring the first characteristic parameter of the target defect area.

在一實施例中,可利用影像處理技術提取目標瑕疵區域的第一特徵參數。目標瑕疵區域的第一特徵參數包括如下任意一種或多種:位置、灰度差、長寬比、灰度方差、灰度均值差、對比度、小梯度優勢、大梯度優勢、灰度分佈不均勻性、梯度分佈不均勻性、能量、灰度平均、梯度平均、灰度均方差、梯度均方差、相關性、灰度熵、梯度熵、混合熵、差分矩和逆差分矩。 In one embodiment, the image processing technology can be used to extract the first characteristic parameter of the target defect area. The first characteristic parameters of the target defect area include any one or more of the following: position, grayscale difference, aspect ratio, grayscale variance, grayscale mean difference, contrast, small gradient dominance, large gradient dominance, and grayscale distribution inhomogeneity , gradient distribution inhomogeneity, energy, gray mean, gradient mean, gray mean square error, gradient mean square error, correlation, gray entropy, gradient entropy, hybrid entropy, difference moment, and inverse difference moment.

位置為目標瑕疵區域在圖像中的位置。灰度差為目標瑕疵區域與圖像背景之間的灰度差。灰度方差為目標瑕疵區域與圖像背景的之間的灰度方差。灰度均值差為目標瑕疵區域與圖像背景之間的灰度均值差。對比度為目標瑕疵區域與圖像背景之間的對比度。 Position is the position of the target defect area in the image. The grayscale difference is the grayscale difference between the target defect area and the image background. The grayscale variance is the grayscale variance between the target defect area and the image background. The gray mean difference is the mean gray difference between the target defect area and the image background. Contrast is the contrast between the target defect area and the background of the image.

步驟S4、根據第一特徵參數依據預設規則計算加權值。 Step S4, calculating a weighted value according to a preset rule according to the first characteristic parameter.

在一實施例中,可判斷第一特徵參數是否符合所預設規則中的多個條件組合。當第一特徵參數符合預設規則中的任意一個條件組合時,設定第一特徵參數在所述條件組合下的權值為1。當第一特徵參數不符合預設規則中的 任意一個條件組合時,設定第一特徵參數在所述條件組合下的權值為0。加總計算第一特徵參數符合預設規則中的多個條件組合的權值,得到加權值。 In one embodiment, it can be determined whether the first characteristic parameter complies with a plurality of condition combinations in the preset rule. When the first characteristic parameter conforms to any condition combination in the preset rule, the weight of the first characteristic parameter under the condition combination is set to 1. When the first characteristic parameter does not meet the preset rules For any combination of conditions, set the weight of the first feature parameter to 0 under the combination of conditions. A weighted value is obtained by adding up and calculating the weights of the first characteristic parameters that meet the multiple condition combinations in the preset rule.

例如,如圖4所示,預設規則中的多個條件組合包括第一條件組合,第二條件組合...第N條件組合。每一條件組合包括多個特徵參數條件。例如,第一條件組合包括灰度差大於x1,長寬比大於y1和灰度方差大於z1。第二條件組合包括灰度差大於x2,長寬比大於y2和灰度方差大於z2。第N條件組合包括灰度差大於xn,長寬比大於yn和灰度方差大於zn。 For example, as shown in FIG. 4 , the multiple condition combinations in the preset rule include a first condition combination, a second condition combination... an Nth condition combination. Each condition combination includes multiple characteristic parameter conditions. For example, the first combination of conditions includes that the grayscale difference is greater than x1, the aspect ratio is greater than y1, and the grayscale variance is greater than z1. The second combination of conditions includes that the grayscale difference is greater than x2, the aspect ratio is greater than y2, and the grayscale variance is greater than z2. The Nth condition combination includes that the grayscale difference is greater than xn, the aspect ratio is greater than yn, and the grayscale variance is greater than zn.

需要說明的是,所述多個條件組合中的每個條件組合還可以包括其他特徵參數條件。例如,目標瑕疵區域與圖像背景之間的灰度均值差大於w1,目標瑕疵區域與圖像背景之間的對比度大於v1等。 It should be noted that, each condition combination in the multiple condition combinations may also include other characteristic parameter conditions. For example, the gray mean difference between the target defect area and the image background is greater than w1, the contrast between the target defect area and the image background is greater than v1, and so on.

當第一特徵參數符合第一條件組合中的所有條件時,得到權值為1。當第一特徵參數不符合第一條件組合中的任意一個條件時,得到權值為0。例如,當第一特徵參數中的灰度差大於x1,且長寬比大於y1,且灰度方差大於z1,得到權值為1。當第一特徵參數中的灰度差小於等於x1,或者長寬比小於等於y1,或者灰度方差小於等於z1,得到權值為0。依次類推,可以分別得到第一特徵參數符合第二條件的權值,第一特徵參數符合第N條件的權值。再將第一條件的權值,第二條件的權值...第N條件的權值加總計算得到加權值。 When the first characteristic parameter meets all the conditions in the first condition combination, a weight value of 1 is obtained. When the first characteristic parameter does not meet any condition in the first condition combination, the obtained weight is 0. For example, when the grayscale difference in the first feature parameter is greater than x1, the aspect ratio is greater than y1, and the grayscale variance is greater than z1, the weight value is 1. When the grayscale difference in the first feature parameter is less than or equal to x1, or the aspect ratio is less than or equal to y1, or the grayscale variance is less than or equal to z1, the weight value is 0. By analogy, the weights of the first characteristic parameters meeting the second condition and the weights of the first characteristic parameters meeting the Nth condition can be obtained respectively. Then, the weights of the first condition, the weights of the second condition...the weights of the Nth condition are summed to obtain the weighted value.

步驟S5、獲取目標瑕疵區域的第二特徵參數。 Step S5, acquiring the second characteristic parameter of the target defect area.

在一實施方式中,第二特徵參數包括目標瑕疵區域的尺寸。在其他實施方式中,第二特徵參數還可以包括所述目標瑕疵區域的其他特徵,如長寬比、分佈面積、平均灰度值、平均梯度等。 In one embodiment, the second characteristic parameter includes the size of the target defect region. In other embodiments, the second feature parameter may further include other features of the target defect region, such as aspect ratio, distribution area, average gray value, average gradient, and the like.

在一實施方式中,目標瑕疵區域的尺寸可依據瑕疵的類型不同而不同。例如,當目標瑕疵區域的類型為刮傷類型時,目標瑕疵區域的尺寸可以 是瑕疵的長度。當目標瑕疵區域的類型為擦傷類型時,目標瑕疵區域的尺寸可以是瑕疵的面積。 In one embodiment, the size of the target defect area may vary depending on the type of defect. For example, when the type of target defect area is scratch type, the size of the target defect area can be is the length of the flaw. When the type of the target defect area is a scratch type, the size of the target defect area may be the area of the defect.

步驟S6、根據第二特徵參數和加權值計算瑕疵規格分數。 Step S6: Calculate the defect specification score according to the second characteristic parameter and the weighted value.

在一實施例中,根據所述第二特徵參數和加權值計算瑕疵規格分數包括:通過第一公式計算瑕疵規格分數,所述第一公式為:瑕疵規格分數=第二特徵參數*(1+加權值*m)。其中,所述m為一預設閾值。 In one embodiment, calculating the defect specification score according to the second characteristic parameter and the weighted value includes: calculating the defect specification score by using a first formula, where the first formula is: defect specification score=second characteristic parameter*(1+ Weighted value*m). Wherein, the m is a preset threshold.

優選地,所述瑕疵等級判定方法還可以包括:判斷目標瑕疵區域的位置是否在預設位置範圍,且判斷目標瑕疵區域的灰度差是否小於預設值。 Preferably, the defect level determination method may further include: judging whether the position of the target defect area is within a preset position range, and judging whether the grayscale difference of the target defect area is less than a preset value.

在本實施方式中,當目標瑕疵區域的位置不在預設位置範圍,且目標瑕疵區域的灰度差大於或等於預設值時,確認目標瑕疵區域為易識別的瑕疵。在計算目標瑕疵區域的瑕疵規格分數時,直接將第二特徵參數作為瑕疵規格分數。再根據瑕疵規格分數判定目標瑕疵區域對應的瑕疵等級。也就是說,當目標瑕疵區域的位置不在預設位置範圍,且目標瑕疵區域的灰度差大於或等於預設值時,無需考慮第一特徵參數計算瑕疵規格分數。即根據第一特徵參數依據預設規則計算的加權值為零,直接將第二特徵參數作為瑕疵規格分數。再根據瑕疵規格分數判定目標瑕疵區域對應的瑕疵等級。 In this embodiment, when the position of the target defect area is not within the preset position range, and the grayscale difference of the target defect area is greater than or equal to the preset value, it is confirmed that the target defect area is an easily identifiable defect. When calculating the defect specification score of the target defect area, the second feature parameter is directly used as the defect specification score. Then, the defect grade corresponding to the target defect area is determined according to the defect specification score. That is, when the position of the target defect area is not within the preset position range, and the grayscale difference of the target defect area is greater than or equal to the preset value, the defect specification score need not be calculated by considering the first characteristic parameter. That is, the weighted value calculated according to the preset rule according to the first feature parameter is zero, and the second feature parameter is directly used as the defect specification score. Then, the defect grade corresponding to the target defect area is determined according to the defect specification score.

當目標瑕疵區域的位置在預設位置範圍,或者目標瑕疵區域的灰度差小於預設值時,確認目標瑕疵區域為不易識別的瑕疵。為了避免將目標瑕疵區域漏掉,無法準確找出圖像中的嚴重刮傷。在計算目標瑕疵區域的瑕疵規格分數時需要考慮第一特徵參數來計算瑕疵規格分數,即根據第二特徵參數和加權值總數計算瑕疵規格分數。再根據瑕疵規格分數判定目標瑕疵區域對應的瑕疵等級。 When the position of the target defect area is within the preset position range, or the grayscale difference of the target defect area is less than the preset value, it is confirmed that the target defect area is a defect that is not easy to identify. In order to avoid missing targeted defect areas, it is not possible to accurately identify severe scratches in the image. When calculating the defect specification score of the target defect area, the first characteristic parameter needs to be considered to calculate the defect specification score, that is, the defect specification score is calculated according to the second characteristic parameter and the total weighted value. Then, the defect grade corresponding to the target defect area is determined according to the defect specification score.

在一實施例中,可以通過目標瑕疵區域的座標來判斷目標瑕疵區域是否位於預設位置範圍。預設位置範圍可以是指待測物體中存在彎曲位置的 區域範圍,或是其他在拍攝圖像時容易產生圖像失真的區域。例如,當待測物體為手機時,手機外殼具有四個端點,每個端點可以是圓弧形。由於待測物體在拍攝時,四個圓弧形端點處的瑕疵容易出現判錯的情況,所以將四個圓弧形端點作為預設位置範圍。 In one embodiment, whether the target defect area is located in a preset position range can be determined by the coordinates of the target defect area. The preset position range can refer to the bending position in the object to be measured. area, or other areas that are prone to image distortion when taking images. For example, when the object to be measured is a mobile phone, the mobile phone case has four end points, and each end point can be in the shape of a circular arc. Since the defects at the four arc-shaped endpoints are prone to misjudgment when the object to be measured is photographed, the four arc-shaped endpoints are used as the preset position range.

在一實施方式中,可通過判斷目標瑕疵區域的座標(X1,Y1)與預設位置範圍的座標(X2,Y2)是否匹配,來判斷目標瑕疵區域是否位於預設位置範圍中。當目標瑕疵區域的座標(X1,Y1)與預設位置範圍的座標(X2,Y2)相匹配時,確認目標瑕疵區域位於預設位置範圍中。當目標瑕疵區域的座標(X1,Y1)與預設位置範圍的座標(X2,Y2)不匹配時,確認目標瑕疵區域不位於預設位置範圍中。 In one embodiment, it can be determined whether the target defect area is located in the preset position range by judging whether the coordinates (X1, Y1) of the target defect area match the coordinates (X2, Y2) of the preset position range. When the coordinates (X1, Y1) of the target defect area match the coordinates (X2, Y2) of the preset position range, it is confirmed that the target defect area is located in the preset position range. When the coordinates (X1, Y1) of the target defect area do not match the coordinates (X2, Y2) of the preset position range, it is confirmed that the target defect area is not located in the preset position range.

具體地,在所述圖像中以圖像左上角的點為原點建立笛卡爾座標系(XOY),其中笛卡爾座標系的X方向表示圖像的寬度,笛卡爾座標系的Y方向表示圖像的高度。目標瑕疵區域的座標(X1,Y1)對應於所述圖像中的圖元點。特殊區域在圖像中的座標(X2,Y2)是確定的。 Specifically, a Cartesian coordinate system (XOY) is established in the image with the point at the upper left corner of the image as the origin, wherein the X direction of the Cartesian coordinate system represents the width of the image, and the Y direction of the Cartesian coordinate system represents the width of the image. The height of the image. The coordinates (X1, Y1) of the target defect area correspond to the primitive points in the image. The coordinates (X2, Y2) of the special area in the image are determined.

可以理解的是,預設位置範圍的座標為一個座標範圍。在一個實施方式中,目標瑕疵區域的座標(X1,Y1)與預設位置範圍的座標(X2,Y2)相匹配可以是指當“X1”位於區間[X2-M,X2+M],且“Y1”位於區間[Y2-N,Y2+N]時,即可判定為目標瑕疵區域的座標(X1,Y1)與預設位置範圍的座標(X2,Y2)相匹配。“M”和“N”的值可以預先設定。 It can be understood that the coordinates of the preset position range are a range of coordinates. In one embodiment, the matching of the coordinates (X1, Y1) of the target defect area with the coordinates (X2, Y2) of the preset position range may mean that when "X1" is located in the interval [X2-M, X2+M], and When "Y1" is located in the interval [Y2-N, Y2+N], it can be determined that the coordinates (X1, Y1) of the target defect area match the coordinates (X2, Y2) of the preset position range. The values of "M" and "N" can be preset.

在一實施方式中,還可利用影像處理技術獲取目標瑕疵區域的灰度差作為加權的條件。通過判斷目標瑕疵區域的灰度差是否小於預設值,當灰度差小於預設值時,確認目標瑕疵區域為不易識別的瑕疵。例如,當待測物體出現比較嚴重的刮傷時,通過線陣相機拍攝得到的圖像中嚴重的刮傷應顯示為黑色。然而,由於線上陣相機拍攝待測物體的過程中,出現光線反光。導致拍 攝得到的圖像中嚴重刮傷顯示為淺灰色。為了避免出現將淺灰色的瑕疵漏掉,無法準確找出圖像中的嚴重刮傷,定義目標瑕疵區域與圖像背景的灰度差小於所述預設值時,目標瑕疵區域為不易識別的瑕疵。 In one embodiment, an image processing technology can also be used to obtain the grayscale difference of the target defect area as a weighting condition. By judging whether the grayscale difference of the target defect area is smaller than the preset value, when the grayscale difference is smaller than the preset value, it is confirmed that the target defect area is a defect that is not easy to identify. For example, when the object to be tested is severely scratched, the severe scratches in the image captured by the line scan camera should be displayed as black. However, due to the process of shooting the object to be measured by the line scan camera, light reflection occurs. lead to beat Severe scratches are shown in light grey in the captured image. In order to avoid missing the light gray defects and unable to accurately find serious scratches in the image, it is defined that when the grayscale difference between the target defect area and the image background is less than the preset value, the target defect area is not easy to identify. flaw.

步驟S7、根據所述瑕疵規格分數判定目標瑕疵區域對應的瑕疵等級。 Step S7: Determine the defect level corresponding to the target defect area according to the defect specification score.

在一實施方式中,通過將瑕疵規格分數與一個或多個預設的瑕疵等級閾值進行比對,得到比對結果,根據比對結果判定目標瑕疵區域對應的瑕疵等級。所述一個或多個預設的瑕疵等級閾值可以以瑕疵等級表的形式預先存儲在電子裝置中。 In one embodiment, a comparison result is obtained by comparing the defect specification score with one or more preset defect level thresholds, and the defect level corresponding to the target defect area is determined according to the comparison result. The one or more preset defect level thresholds may be pre-stored in the electronic device in the form of a defect level table.

在一實施方式中,瑕疵等級表描述的是瑕疵等級與對應的瑕疵規格分數範圍之間的關係。例如,瑕疵等級包括A等級、B等級、C等級、D等級和E等級。A等級對應的瑕疵規格分數範圍為20~100,B等級對應的瑕疵規格分數範圍為100~300,C等級對應的瑕疵規格分數範圍為300~500,D等級對應的瑕疵規格分數範圍為500~900,E等級對應的瑕疵規格分數範圍為900~1000。 In one embodiment, the defect level table describes the relationship between the defect level and the corresponding range of defect specification scores. For example, defect grades include A grades, B grades, C grades, D grades, and E grades. The range of defect specification scores corresponding to grade A is 20~100, the range of defect specification score corresponding to grade B is 100~300, the range of defect specification score corresponding to grade C is 300~500, and the range of defect specification score corresponding to grade D is 500~ 900, the corresponding defect specification score range of E grade is 900~1000.

根據目標瑕疵區域的瑕疵規格分數與瑕疵規格分數範圍進行比對,確認目標瑕疵區域對應的瑕疵等級。例如,當目標瑕疵區域的瑕疵規格分數為80時,確認目標瑕疵區域的等級為A級。 Compare the defect specification score of the target defect area with the defect specification score range to confirm the defect level corresponding to the target defect area. For example, when the defect specification score of the target defect area is 80, the grade of the target defect area is confirmed to be A grade.

在一實施方式中,對於不同類型的瑕疵預存有不同的瑕疵等級表。例如,當瑕疵類型為刮傷類型時,瑕疵等級表中的瑕疵規格分數為根據刮傷的長度計算得到的分數;當瑕疵類型為擦傷類型時,瑕疵等級表中的瑕疵規格分數為根據擦傷的面積計算得到的分數。 In one embodiment, different defect level tables are pre-stored for different types of defects. For example, when the defect type is scratch type, the defect specification score in the defect grade table is the score calculated according to the length of the scratch; when the defect type is scratch type, the defect specification score in the defect grade table is based on scratches. The fraction of the area calculated.

步驟S8、輸出瑕疵等級。 Step S8, output the defect level.

在一實施方式中,可輸出瑕疵等級到顯示幕或其他使用者介面供使用者參考。也可以將瑕疵等級存儲於儲存器或是傳送到遠端的伺服器。 In one embodiment, the defect level can be output to a display screen or other user interface for user reference. Defect levels can also be stored in memory or sent to a remote server.

優選地,所述瑕疵等級判定方法還包括步驟S9:根據目標瑕疵區域的瑕疵規格分數,確認是否再次對所述圖像進行瑕疵等級判定。可以理解,在其他實施例中,步驟S9也可以省略。 Preferably, the defect level determination method further includes step S9 : confirming whether to perform the defect level determination on the image again according to the defect specification score of the target defect area. It can be understood that, in other embodiments, step S9 may also be omitted.

具體地,根據目標瑕疵區域的瑕疵規格分數,確認是否再次對所述圖像進行瑕疵等級判定的步驟包括: Specifically, according to the defect specification score of the target defect area, the step of confirming whether to perform the defect level judgment on the image again includes:

(1)依據預存的瑕疵等級對應的分數範圍設置預設閾值範圍。例如,設置瑕疵等級對應的分數範圍中的分數300作為合格線。再根據所述合格線設置一個預設閾值範圍(如200~400) (1) Set the preset threshold range according to the score range corresponding to the pre-stored defect level. For example, a score of 300 in the range of scores corresponding to the defect level is set as the pass line. Then set a preset threshold range (such as 200~400) according to the qualified line

所述預設閾值範圍是一個可依需求調整的範圍。 The preset threshold range is a range that can be adjusted according to requirements.

(2)比對目標瑕疵區域的瑕疵規格分數與預設閾值範圍,確認是否再次對所述圖像進行瑕疵等級判定。 (2) Compare the defect specification score of the target defect area with the preset threshold value range, and confirm whether to perform the defect level judgment on the image again.

在一實施例中,比對目標瑕疵區域的瑕疵規格分數與預設閾值範圍,確認目標瑕疵區域的瑕疵等級的正確率。當目標瑕疵區域的瑕疵規格分數大於所述預設閾值範圍的最大值,或小於預設閾值範圍的最小值時,判定目標瑕疵區域的瑕疵等級的正確率高,無需再次對所述圖像進行瑕疵等級判定;當目標瑕疵區域的瑕疵規格分數位於預設閾值範圍時,判定所述目標瑕疵區域的瑕疵等級的正確率低。 In one embodiment, the defect specification score of the target defect area is compared with a preset threshold range, and the correct rate of the defect level of the target defect area is confirmed. When the defect specification score of the target defect area is greater than the maximum value of the preset threshold range, or smaller than the minimum value of the preset threshold value range, the correct rate of determining the defect level of the target defect area is high, and there is no need to re-process the image. Determination of defect level; when the defect specification score of the target defect area is within the preset threshold range, the correct rate of determining the defect level of the target defect area is low.

(3)當目標瑕疵區域的瑕疵規格分數位於預設閾值範圍時,再次對所述圖像進行瑕疵等級判定。 (3) When the defect specification score of the target defect area is within the preset threshold range, perform defect level determination on the image again.

例如,當瑕疵規格分數大於或等於400時,大概率會真實存在瑕疵,所以此瑕疵規格分數的瑕疵等級判斷正確率高,瑕疵判定結果即為原始瑕疵等級。或者當瑕疵規格分數小於等於200時,大概率並非存在瑕疵,所以此瑕疵規格分數的瑕疵等級判斷正確率高,瑕疵判定結果即為原始瑕疵等級。當目標瑕疵區域的瑕疵規格分數大於200且小於400時,此範圍區間內的瑕疵規格分 數的瑕疵等級判斷正確率低,不能確定對應的目標瑕疵區域的瑕疵等級是合格還是不合格,需要再次對圖像進行瑕疵等級判定,即對目標瑕疵區域的瑕疵等級進行複判。 For example, when the defect specification score is greater than or equal to 400, there is a high probability that there is a real defect, so the defect level judgment accuracy of this defect specification score is high, and the defect judgment result is the original defect level. Or when the defect specification score is less than or equal to 200, there is a high probability that there is no defect, so the defect level judgment accuracy of this defect specification score is high, and the defect judgment result is the original defect level. When the defect specification score of the target defect area is greater than 200 and less than 400, the defect specification score within this range The accuracy rate of the judgment of the defect grade of the number of defects is low, and it is impossible to determine whether the defect grade of the corresponding target defect area is qualified or unqualified.

在一實施例中,通過深度學習演算法再次對圖像進行瑕疵等級判定。 In one embodiment, the image is again subjected to defect level determination through a deep learning algorithm.

在一實施例中,可通過設定預設閾值範圍,來決定根據瑕疵規格分數決定影像處理技術的判斷結果是否需要再由深度學習技術來輔助判定,不需要所有的瑕疵都經由深度學習技術的判定,大幅縮減檢測的時間,也降低運算主機的計算需求,進而節省硬體的構置成本。 In one embodiment, a preset threshold range can be set to determine whether the judgment result of the image processing technology based on the defect specification score needs to be further judged by the deep learning technology, and it is not necessary that all the defects be judged by the deep learning technology. , which greatly reduces the detection time, and also reduces the computing requirements of the computing host, thereby saving the construction cost of hardware.

因此,為了進一步提高圖像中的瑕疵等級判定的準確率和效率,在一實施例中,在確定圖像中目標瑕疵區域的初步等級後,本申請的瑕疵等級判定方法還可包括步驟S10:當目標瑕疵區域的瑕疵規格分數位於預設閾值範圍時,再次對圖像進行瑕疵等級判定。可以理解,在其他實施例中,所述步驟S10也可以省略。 Therefore, in order to further improve the accuracy and efficiency of judging the defect level in the image, in one embodiment, after determining the preliminary level of the target defect area in the image, the method for judging the defect level of the present application may further include step S10: When the defect specification score of the target defect area is within the preset threshold range, the image is again subjected to defect level judgment. It can be understood that, in other embodiments, the step S10 may also be omitted.

本申請針對位於特殊區域(例如待測物體彎曲的地方,所拍攝到的瑕疵圖像會失真)以及特殊型態的瑕疵(影像處理技術容易判別錯誤之瑕疵型態)的瑕疵,可以進行基於影像處理技術的判別時加入加權計算,並設定一個預設閾值範圍對計算出來的數值進行判定,以決定是否要進行複判。 In this application, for defects located in special areas (for example, where the object to be tested is curved, the captured image of defects will be distorted) and defects of special types (the types of defects that are easy to be identified by image processing technology), image-based The weighted calculation is added to the judgment of the processing technology, and a preset threshold range is set to judge the calculated value, so as to decide whether to carry out a rejudgment.

瑕疵在經過影像處理技術判定之後,若經計算發現其正確性較低,表示其特徵較不符合檢測演算法之設定,但因影像處理之演算法無法涵蓋到所有的瑕疵型態,所以利用深度學習技術來輔助判定,深度學習技術利用了大量的真實瑕疵資料來學習特定缺陷特徵,因此能夠得出更準確的判定。 After the defect is judged by the image processing technology, if the accuracy is found to be low after calculation, it means that its characteristics are less in line with the setting of the detection algorithm, but because the image processing algorithm cannot cover all types of defects, the depth is used. Learning technology is used to assist judgment. Deep learning technology uses a large amount of real defect data to learn specific defect characteristics, so it can draw more accurate judgments.

圖1至圖4詳細介紹了本發明的瑕疵等級判定的方法,通過所述方法,能夠提高瑕疵等級判定的效率及準確率。下面結合圖5和圖6,對實現所述 瑕疵等級判定方法的軟體系統的功能模組以及硬體裝置架構進行介紹。應所述瞭解,所述實施例僅為說明之用,在專利申請範圍上並不受此結構的限制。 FIG. 1 to FIG. 4 describe in detail the method for determining the defect level of the present invention, through which the efficiency and accuracy of determining the defect level can be improved. Below in conjunction with Fig. 5 and Fig. 6, to realize the described The functional modules of the software system and the hardware device architecture of the defect level determination method are introduced. It should be understood that the embodiments are only used for illustration, and are not limited by this structure in the scope of the patent application.

圖5為本發明一實施方式提供的瑕疵等級判定的系統的結構圖。 FIG. 5 is a structural diagram of a system for determining a defect level according to an embodiment of the present invention.

在一些實施方式中,瑕疵等級判定系統200可以包括多個由程式碼段所組成的功能模組。瑕疵等級判定系統200中的各個程式段的程式碼可以存儲於電腦裝置的記憶體中,並由電腦裝置中的至少一個處理器所執行,以實現瑕疵等級判定的功能。 In some embodiments, the defect level determination system 200 may include a plurality of functional modules composed of program code segments. The program codes of each program segment in the defect level determination system 200 may be stored in the memory of the computer device, and executed by at least one processor in the computer device, so as to realize the function of defect level determination.

參考圖5,本實施方式中,瑕疵等級判定系統200根據其所執行的功能,可以被劃分為多個功能模組,各個功能模組用於執行圖1對應實施方式中的各個步驟,以實現瑕疵等級判定的功能。本實施方式中,瑕疵等級判定系統200包括獲取模組201、提取模組202、計算模組203、瑕疵等級初判模組204、輸出模組205以及瑕疵等級複判模組206。各個功能模組的功能將在下面的實施例中進行詳述。 Referring to FIG. 5 , in this embodiment, the defect level determination system 200 can be divided into a plurality of functional modules according to the functions it performs, and each functional module is used to perform each step in the corresponding embodiment of FIG. 1 to achieve Defect level judgment function. In this embodiment, the flaw level determination system 200 includes an acquisition module 201 , an extraction module 202 , a calculation module 203 , a flaw level preliminary determination module 204 , an output module 205 and a flaw level re-determination module 206 . The functions of each functional module will be described in detail in the following embodiments.

獲取模組201用於獲取待測物體的至少一張圖像。獲取模組201還用於獲取目標瑕疵區域的第一特徵參數和第二特徵參數。第一特徵參數包括如下任意一種或多種:位置、灰度差、長寬比、灰度方差、灰度均值差、對比度、小梯度優勢、大梯度優勢、灰度分佈不均勻性、梯度分佈不均勻性、能量、灰度平均、梯度平均、灰度均方差、梯度均方差、相關性、灰度熵、梯度熵、混合熵、差分矩和逆差分矩。第二特徵參數包括目標瑕疵區域的尺寸、長寬比、分佈面積、平均灰度值、平均梯度等。 The acquisition module 201 is used for acquiring at least one image of the object to be measured. The obtaining module 201 is further configured to obtain the first characteristic parameter and the second characteristic parameter of the target defect area. The first characteristic parameter includes any one or more of the following: position, grayscale difference, aspect ratio, grayscale variance, grayscale mean difference, contrast, small gradient dominance, large gradient dominance, grayscale distribution inhomogeneity, gradient distribution inhomogeneous Uniformity, Energy, Gray Average, Gradient Average, Gray Mean Square Error, Gradient Mean Square Error, Correlation, Gray Entropy, Gradient Entropy, Hybrid Entropy, Difference Moments, and Inverse Difference Moments. The second characteristic parameter includes the size, aspect ratio, distribution area, average gray value, average gradient, and the like of the target defect region.

提取模組202用於從圖像中提取目標瑕疵區域。 The extraction module 202 is used for extracting target defect regions from the image.

具體地,提取模組202用於對圖像進行濾波,提取圖像中的多個目標瑕疵子區域,判斷多個目標瑕疵子區域的類型及確定多個目標瑕疵子區域的 位置,聚合類型相同且位置相鄰的兩個或數個目標瑕疵子區域生成目標瑕疵區域;及濾除目標瑕疵區域中尺寸小於預設尺寸的瑕疵區域。 Specifically, the extraction module 202 is used for filtering the image, extracting multiple target defect sub-regions in the image, judging the types of the multiple target defect sub-regions and determining the types of the multiple target defect sub-regions. position, aggregating two or more target defect sub-regions of the same type and adjacent in position to generate a target defect area; and filtering out defect areas whose size is smaller than a preset size in the target defect area.

計算模組203用於根據第一特徵參數依據預設規則進行加權計算,得到加權值。 The calculation module 203 is configured to perform weighted calculation according to a preset rule according to the first characteristic parameter to obtain a weighted value.

具體地,計算模組203可用於判斷第一特徵參數是否符合預設規則中的多個條件組合。當第一特徵參數符合預設規則中的任意一個條件組合時,設定第一特徵參數在所述條件組合下的權值為1。當第一特徵參數不符合預設規則中的任意一個條件組合時,設定第一特徵參數在條件組合下的權值為0。加總計算第一特徵參數符合所述預設規則中的多個條件組合的權值,得到加權值。 Specifically, the calculation module 203 can be used to determine whether the first characteristic parameter complies with a plurality of condition combinations in the preset rule. When the first characteristic parameter conforms to any condition combination in the preset rule, the weight of the first characteristic parameter under the condition combination is set to 1. When the first characteristic parameter does not meet any condition combination in the preset rule, the weight of the first characteristic parameter under the condition combination is set to 0. A weighted value is obtained by adding up and calculating the weights of the first characteristic parameters that meet the multiple condition combinations in the preset rule.

計算模組203還用於根據第二特徵參數和加權值計算瑕疵規格分數。 The calculation module 203 is further configured to calculate the defect specification score according to the second characteristic parameter and the weighted value.

瑕疵等級初判模組204用於根據瑕疵規格分數判定目標瑕疵區域對應的瑕疵等級。 The defect grade preliminary judgment module 204 is used to judge the defect grade corresponding to the target defect area according to the defect specification score.

具體地,瑕疵等級初判模組204可將瑕疵規格分數與一個或多個預設的瑕疵等級閾值進行比對,得到比對結果,再根據比對結果判定目標瑕疵區域對應的初判瑕疵等級。 Specifically, the defect grade preliminary judgment module 204 can compare the defect specification score with one or more preset defect grade thresholds to obtain a comparison result, and then determine the preliminary judgment defect grade corresponding to the target defect area according to the comparison result .

輸出模組205用於輸出瑕疵等級。 The output module 205 is used for outputting the defect level.

瑕疵等級複判模組206用於根據目標瑕疵區域的瑕疵規格分數,確認是否再次對所述圖像進行瑕疵等級判定。具體地,瑕疵等級複判模組206依據預存的瑕疵等級對應的分數範圍設置預設閾值範圍,再比對瑕疵規格分數與預設閾值範圍。當瑕疵規格分數大於所述預設閾值範圍中的最大值,或小於預設閾值範圍中的最小值時,無需再次對圖像進行瑕疵等級判定;當瑕疵規格分數所述預設閾值範圍中時,再次對圖像進行瑕疵等級判定。 The defect grade re-judgment module 206 is used for confirming whether to perform the defect grade judgment on the image again according to the defect specification score of the target defect area. Specifically, the defect grade re-judgment module 206 sets a preset threshold range according to the score range corresponding to the pre-stored defect grade, and then compares the defect specification score with the preset threshold range. When the defect specification score is greater than the maximum value in the preset threshold range, or smaller than the minimum value in the preset threshold value range, there is no need to perform defect level judgment on the image again; when the defect specification score is within the preset threshold value range , and judge the image flaw level again.

圖6為本發明一實施方式提供的電子裝置的功能模組示意圖。所述電子裝置10包括記憶體11、處理器12以及存儲在所述記憶體11中並可在處理器12上運行的電腦程式13,例如瑕疵等級判定的程式。 FIG. 6 is a schematic diagram of a functional module of an electronic device according to an embodiment of the present invention. The electronic device 10 includes a memory 11 , a processor 12 , and a computer program 13 stored in the memory 11 and executable on the processor 12 , such as a program for determining defect levels.

在一實施方式中,電子裝置10可以是但不限於智慧手機、平板電腦、電腦設備等。 In one embodiment, the electronic device 10 may be, but not limited to, a smart phone, a tablet computer, a computer device, and the like.

處理器12可執行電腦程式13以實現上述方法實施例中瑕疵等級判定的方法的步驟,用於判定圖像2中目標瑕疵區域的瑕疵等級。或者,處理器12可執行電腦程式13以實現上述系統實施例中各模組/單元的功能。 The processor 12 can execute the computer program 13 to implement the steps of the method for determining the defect level in the above method embodiment, for determining the defect level of the target defect area in the image 2 . Alternatively, the processor 12 can execute the computer program 13 to realize the functions of the modules/units in the above-mentioned system embodiments.

示例性的,電腦程式13可以被分割成一個或多個模組/單元,一個或者多個模組/單元被存儲在記憶體11中,並由處理器12執行。所述一個或多個模組/單元可以是能夠完成特定功能的一系列電腦程式指令段,指令段用於描述電腦程式13在電子裝置10中的執行過程。例如,電腦程式13可以被分割成圖6中的模組201-206。 Exemplarily, the computer program 13 may be divided into one or more modules/units, and one or more modules/units are stored in the memory 11 and executed by the processor 12 . The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 13 in the electronic device 10 . For example, computer program 13 may be divided into modules 201-206 in FIG. 6 .

本領域技術人員可以理解,圖6僅僅是電子裝置10的示例,並不構成對電子裝置10的限定,電子裝置10可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如電子裝置10還可以包括輸入輸出設備等。 Those skilled in the art can understand that FIG. 6 is only an example of the electronic device 10, and does not constitute a limitation to the electronic device 10. The electronic device 10 may include more or less components than the one shown, or combine certain components, or Various components such as the electronic device 10 may also include input and output devices and the like.

所稱處理器12可以是中央處理單元(Central Processing Unit,CPU),還可以包括其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現成可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者所述處理器也可以是任何常規的處理器等,處理器12是電子裝置10的控制中心,利用各種介面和線路連接整個電子裝置10的各個部分。 The so-called processor 12 may be a central processing unit (Central Processing Unit, CPU), and may also include other general-purpose processors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC) , Off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The processor 12 is the control center of the electronic device 10 , and uses various interfaces and lines to connect various parts of the entire electronic device 10 .

記憶體11可用於存儲電腦程式13和/或模組/單元,處理器12通過運行或執行存儲在記憶體11內的電腦程式和/或模組/單元,以及調用存儲在記憶體11內的資料,實現電子裝置10的各種功能。記憶體11可以包括外部存儲介質,也可以包括記憶體。此外,記憶體11可以包括高速隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟,智慧存儲卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,快閃記憶體卡(Flash Card)、至少一個磁碟記憶體器件、快閃記憶體器件、或其他易失性固態記憶體器件。 The memory 11 can be used to store computer programs 13 and/or modules/units. The processor 12 executes or executes the computer programs and/or modules/units stored in the memory 11 and calls the data to realize various functions of the electronic device 10 . The memory 11 may include an external storage medium or a memory. In addition, the memory 11 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (Secure Digital, SD) card, flash memory card (Flash Card), at least one disk memory device, flash memory device, or other volatile solid state memory device.

電子裝置10集成的模組/單元如果以軟體功能單元的形式實現並作為獨立的產品銷售或使用時,可以存儲在一個電腦可讀取存儲介質中。基於這樣的理解,本發明實現上述實施例方法中的全部或部分流程,也可以通過電腦程式來指令相關的硬體來完成,所述的電腦程式可存儲於一電腦可讀存儲介質中,所述電腦程式在被處理器執行時,可實現上述各個方法實施例的步驟。最後應說明的是,以上實施例僅用以說明本發明的技術方案而非限制,儘管參照較佳實施例對本發明進行了詳細說明,本領域的普通技術人員應當理解,可以對本發明的技術方案進行修改或等同替換,而不脫離本發明技術方案的精神和範圍。 If the modules/units integrated in the electronic device 10 are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, so When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. 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 preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent substitutions can be made without departing from the spirit and scope of the technical solutions of the present invention.

S1~S8:步驟 S1~S8: Steps

Claims (14)

一種瑕疵等級判定方法,由電子裝置的處理器執行,其改良在於,所述方法包括:獲取待測物體的至少一張圖像;從所述圖像中提取目標瑕疵區域;獲取所述目標瑕疵區域的第一特徵參數;根據所述第一特徵參數依據預設規則得到加權值;獲取所述目標瑕疵區域的第二特徵參數;根據所述第二特徵參數和所述加權值計算瑕疵規格分數;根據所述瑕疵規格分數判定所述目標瑕疵區域對應的瑕疵等級;輸出所述瑕疵等級;以及根據目標瑕疵區域的瑕疵規格分數,確認是否再次對所述圖像進行瑕疵等級判定。 A defect level determination method, executed by a processor of an electronic device, is improved in that the method includes: acquiring at least one image of an object to be measured; extracting a target defect area from the image; acquiring the target defect obtain the weighted value according to the preset rule according to the first characteristic parameter; obtain the second characteristic parameter of the target defect area; calculate the defect specification score according to the second characteristic parameter and the weighted value ; determine the defect level corresponding to the target defect area according to the defect specification score; output the defect level; and confirm whether to perform the defect level determination on the image again according to the defect specification score of the target defect area. 如請求項1所述之瑕疵等級判定方法,其中,所述從所述圖像中提取目標瑕疵區域包括:提取所述圖像中的多個目標瑕疵子區域;處理所述多個目標瑕疵子區域得到所述目標瑕疵區域。 The defect level determination method according to claim 1, wherein the extracting the target defect region from the image comprises: extracting a plurality of target defect sub-regions in the image; processing the plurality of target defect sub-regions area to obtain the target defect area. 如請求項2所述之瑕疵等級判定方法,其中,所述處理所述多個目標瑕疵子區域得到所述目標瑕疵區域包括:判斷所述多個目標瑕疵子區域的類型;確定所述多個目標瑕疵子區域的位置;聚合類型相同且位置相鄰的兩個或數個所述目標瑕疵子區域生成所述目標瑕疵區域。 The defect level determination method according to claim 2, wherein the processing the multiple target defect sub-regions to obtain the target defect sub-regions comprises: judging the types of the multiple target defect sub-regions; determining the multiple target defect sub-regions The position of the target defect sub-region; the target defect region is generated by aggregating two or more target defect sub-regions with the same type and adjacent positions. 如請求項3所述之瑕疵等級判定方法,其中,所述判斷所述多個目標瑕疵子區域的類型包括:通過卷積神經網路模型判斷所述多個目標瑕疵子區域的類型。 The method for determining a defect level according to claim 3, wherein the determining the types of the multiple target defect sub-regions comprises: judging the types of the multiple target defect sub-regions through a convolutional neural network model. 如請求項1所述之瑕疵等級判定方法,其中,所述目標瑕疵區域的第一特徵參數包括如下任意一種或多種:位置、灰度差、長寬比、灰度方差、灰度均值差、對比度、小梯度優勢、大梯度優勢、灰度分佈不均勻性、梯度分佈不均勻性、能量、灰度平均、梯度平均、灰度均方差、梯度均方差、相關性、灰度熵、梯度熵、混合熵、差分矩和逆差分矩。 The defect level determination method according to claim 1, wherein the first characteristic parameters of the target defect area include any one or more of the following: position, grayscale difference, aspect ratio, grayscale variance, grayscale mean difference, Contrast, small gradient dominance, large gradient dominance, gray distribution inhomogeneity, gradient distribution inhomogeneity, energy, gray average, gradient average, gray mean square error, gradient mean square error, correlation, gray entropy, gradient entropy , mixed entropy, difference moments, and inverse difference moments. 如請求項5所述之瑕疵等級判定方法,其中,所述方法還包括:判斷所述目標瑕疵區域的位置是否在預設位置範圍,且判斷所述目標瑕疵區域的灰度差是否小於預設值。 The defect level determination method according to claim 5, wherein the method further comprises: judging whether the position of the target defect area is within a preset position range, and judging whether the grayscale difference of the target defect area is smaller than a preset position value. 如請求項6所述之瑕疵等級判定方法,其中,所述方法還包括:當所述目標瑕疵區域的位置不在預設位置範圍,或所述目標瑕疵區域的灰度差大於或等於所述預設值時,獲取所述目標瑕疵區域的第二特徵參數;將所述第二特徵參數作為瑕疵規格分數;根據所述瑕疵規格分數判定所述目標瑕疵區域對應的瑕疵等級。 The defect level determination method according to claim 6, wherein the method further comprises: when the position of the target defect area is not within a preset position range, or the grayscale difference of the target defect area is greater than or equal to the predetermined position When setting the value, the second characteristic parameter of the target defect area is obtained; the second characteristic parameter is used as the defect specification score; the defect level corresponding to the target defect area is determined according to the defect specification score. 如請求項7所述之瑕疵等級判定方法,其中,所述第二特徵參數包括所述目標瑕疵區域的尺寸。 The method for determining a defect level according to claim 7, wherein the second characteristic parameter includes the size of the target defect area. 如請求項1所述之瑕疵等級判定方法,其中,所述根據所述第一特徵參數依據預設規則計算加權值包括:判斷所述第一特徵參數是否符合所述預設規則中的多個條件組合;當所述第一特徵參數符合所述預設規則中的任意一個條件組合時,設定所述第一特徵參數在所述條件組合下的權值為1;當所述第一特徵參數不符合所述預設規則中的任意一個條件組合時,設定所述第一特徵參數在所述條件組合下的權值為0;加總計算所述第一特徵參數符合所述預設規則中的多個條件組合的權值,得到加權值。 The defect level determination method according to claim 1, wherein calculating the weighted value according to the first characteristic parameter according to a preset rule comprises: judging whether the first characteristic parameter complies with a plurality of the preset rules Condition combination; when the first characteristic parameter meets any condition combination in the preset rules, set the weight of the first characteristic parameter under the condition combination to 1; when the first characteristic parameter When it does not meet any combination of conditions in the preset rules, set the weight of the first characteristic parameter under the combination of conditions to 0; add up and calculate that the first characteristic parameter meets the preset rules. The weight of the combination of multiple conditions to obtain the weighted value. 如請求項1所述之瑕疵等級判定方法,其中,根據所述第二特徵參數和所述加權值計算瑕疵規格分數包括: 通過第一公式計算所述瑕疵規格分數,所述第一公式為:瑕疵規格分數=第二特徵參數*(1+加權值總數*m),其中,m為一閾值。 The method for determining a defect level according to claim 1, wherein calculating the defect specification score according to the second characteristic parameter and the weighted value includes: The defect specification score is calculated by a first formula, where the first formula is: defect specification score=second characteristic parameter*(1+total weighted value*m), where m is a threshold. 如請求項1所述之瑕疵等級判定方法,其中,所述根據所述瑕疵規格分數判定所述目標瑕疵區域對應的瑕疵等級包括:將所述瑕疵規格分數與一個或多個預設的瑕疵等級閾值進行比對,得到比對結果;根據比對結果判定所述目標瑕疵區域對應的瑕疵等級。 The method for determining a defect level according to claim 1, wherein the determining the defect level corresponding to the target defect area according to the defect specification score comprises: comparing the defect specification score with one or more preset defect levels The threshold is compared to obtain a comparison result; the defect level corresponding to the target defect area is determined according to the comparison result. 如請求項1所述之瑕疵等級判定方法,其中,所述方法還包括:依據預存的瑕疵等級對應的分數範圍設置預設閾值範圍;比對所述目標瑕疵區域的瑕疵規格分數與所述預設閾值範圍;及當所述瑕疵規格分數位於所述預設閾值範圍中時,再次對所述圖像進行瑕疵等級判定。 The method for determining a defect level according to claim 1, wherein the method further comprises: setting a preset threshold range according to a score range corresponding to a pre-stored defect level; comparing the defect specification score of the target defect area with the pre-stored defect level setting a threshold range; and when the defect specification score is within the preset threshold range, perform a defect level determination on the image again. 如請求項1所述之瑕疵等級判定方法,其中,所述方法還包括:通過深度學習演算法再次對所述圖像進行瑕疵等級判定。 The method for determining a defect level according to claim 1, wherein the method further comprises: performing a defect level determination on the image again through a deep learning algorithm. 一種電腦可讀存儲介質,其改良在於,其上存儲有電腦程式,所述電腦程式被處理器執行時實現如請求項1至13中任一項所述之瑕疵等級判定的方法。 A computer-readable storage medium is improved in that a computer program is stored thereon, and when the computer program is executed by a processor, the method for determining a defect level according to any one of claims 1 to 13 is implemented.
TW109142282A 2019-12-31 2020-12-01 Method for defect level determination and computer readable storage medium thereof TWI765442B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911415102.9 2019-12-31
CN201911415102.9A CN111223078B (en) 2019-12-31 2019-12-31 Method for determining flaw level and storage medium

Publications (2)

Publication Number Publication Date
TW202127372A TW202127372A (en) 2021-07-16
TWI765442B true TWI765442B (en) 2022-05-21

Family

ID=70830979

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109142282A TWI765442B (en) 2019-12-31 2020-12-01 Method for defect level determination and computer readable storage medium thereof

Country Status (2)

Country Link
CN (1) CN111223078B (en)
TW (1) TWI765442B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112270687A (en) * 2020-10-16 2021-01-26 鲸斛(上海)智能科技有限公司 Cloth flaw identification model training method and cloth flaw detection method
CN112149693A (en) * 2020-10-16 2020-12-29 上海智臻智能网络科技股份有限公司 Training method of contour recognition model and detection method of target object
TWI795921B (en) * 2021-09-24 2023-03-11 鴻海精密工業股份有限公司 Image detection method, computer device, and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW410275B (en) * 2000-01-21 2000-11-01 China Textile Inst Drapery surface defects detection method with digital image processing and neural network groups
TWI416346B (en) * 2010-07-27 2013-11-21 Applied Materials Israel Ltd Defect classification with optimized purity
CN103544499A (en) * 2013-10-12 2014-01-29 江南大学 Method for reducing dimensions of texture features for surface defect detection on basis of machine vision
TWI664586B (en) * 2018-03-22 2019-07-01 National Taiwan Normal University Method for defect inspection of transparent substrate through complex defect diffractionwavefront
TWM596871U (en) * 2019-12-03 2020-06-11 智泰科技股份有限公司 Intelligent optical inspection AI data collection system

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3640136B2 (en) * 1998-01-22 2005-04-20 Jfeスチール株式会社 Surface flaw inspection method and apparatus
JP2000035321A (en) * 1998-07-17 2000-02-02 Nisshin Steel Co Ltd Inspection device for surface of metal zone
CN101419176B (en) * 2007-10-26 2012-03-28 比亚迪股份有限公司 Surface flaw detecting method and device
CN101710448B (en) * 2009-12-29 2011-08-10 浙江工业大学 Road traffic state detecting device based on omnibearing computer vision
CN102236925B (en) * 2011-05-03 2013-08-14 西安印钞有限公司 System and method for offline secondary detection and checking of machine detected data of large-piece checker
CN105741048A (en) * 2016-02-23 2016-07-06 安徽容知日新信息技术有限公司 Alarming method and apparatus for device
CN106650823A (en) * 2016-12-30 2017-05-10 湖南文理学院 Probability extreme learning machine integration-based foam nickel surface defect classification method
CN108074240B (en) * 2017-12-29 2021-09-28 Tcl华星光电技术有限公司 Recognition method, recognition apparatus, computer-readable storage medium, and program product
CN109472206B (en) * 2018-10-11 2023-07-07 平安科技(深圳)有限公司 Risk assessment method, device, equipment and medium based on micro-expressions
CN109507371A (en) * 2018-12-21 2019-03-22 仪征申威冲压有限公司 A kind of quantitative judge and evaluation method of body of a motor car outer covering piece surface quality
CN109692877B (en) * 2018-12-29 2020-11-10 中冶南方工程技术有限公司 Cold-rolled strip steel surface quality management system and method
CN110109834A (en) * 2019-04-30 2019-08-09 贝壳技术有限公司 A kind of test report automatically generating device and method
CN110216319B (en) * 2019-06-14 2021-01-05 北京科技大学 Medium plate optimized shearing control method based on surface quality online evaluation
CN110517247A (en) * 2019-08-27 2019-11-29 北京百度网讯科技有限公司 Obtain the method and device of information

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW410275B (en) * 2000-01-21 2000-11-01 China Textile Inst Drapery surface defects detection method with digital image processing and neural network groups
TWI416346B (en) * 2010-07-27 2013-11-21 Applied Materials Israel Ltd Defect classification with optimized purity
CN103544499A (en) * 2013-10-12 2014-01-29 江南大学 Method for reducing dimensions of texture features for surface defect detection on basis of machine vision
TWI664586B (en) * 2018-03-22 2019-07-01 National Taiwan Normal University Method for defect inspection of transparent substrate through complex defect diffractionwavefront
TWM596871U (en) * 2019-12-03 2020-06-11 智泰科技股份有限公司 Intelligent optical inspection AI data collection system

Also Published As

Publication number Publication date
CN111223078B (en) 2023-09-26
TW202127372A (en) 2021-07-16
CN111223078A (en) 2020-06-02

Similar Documents

Publication Publication Date Title
TWI765442B (en) Method for defect level determination and computer readable storage medium thereof
CN110060237B (en) Fault detection method, device, equipment and system
Zhou et al. Automated visual inspection of glass bottle bottom with saliency detection and template matching
US10740912B2 (en) Detection of humans in images using depth information
CN110930390B (en) Chip pin missing detection method based on semi-supervised deep learning
CN107424160A (en) The system and method that image center line is searched by vision system
KR100868884B1 (en) Flat glass defect information system and classification method
CN110517265A (en) A kind of detection method of surface defects of products, device and storage medium
CN114495098B (en) Diaxing algae cell statistical method and system based on microscope image
CN116703909B (en) Intelligent detection method for production quality of power adapter
CN111582359A (en) Image identification method and device, electronic equipment and medium
CN113222938A (en) Chip defect detection method and system and computer readable storage medium
CN115082477B (en) Semiconductor wafer processing quality detection method based on light reflection removing effect
CN115471476A (en) Method, device, equipment and medium for detecting component defects
CN110807404A (en) Form line detection method, device, terminal and storage medium based on deep learning
CN111695373A (en) Zebra crossing positioning method, system, medium and device
CN115690670A (en) Intelligent identification method and system for wafer defects
TW201512649A (en) Method of chip detects inspecting, system therefor, and computer program product thereof
CN109376782B (en) Support vector machine cataract classification method and device based on eye image features
US9946918B2 (en) Symbol detection for desired image reconstruction
CN116385440B (en) Visual detection method for arc-shaped blade
CN113392455A (en) House type graph scale detection method and device based on deep learning and electronic equipment
CN111507177B (en) Identification method and device for metering turnover cabinet
CN116993654B (en) Camera module defect detection method, device, equipment, storage medium and product
CN112308061B (en) License plate character recognition method and device