JP2023077058A - Appearance inspection device and appearance inspection method - Google Patents

Appearance inspection device and appearance inspection method Download PDF

Info

Publication number
JP2023077058A
JP2023077058A JP2021190178A JP2021190178A JP2023077058A JP 2023077058 A JP2023077058 A JP 2023077058A JP 2021190178 A JP2021190178 A JP 2021190178A JP 2021190178 A JP2021190178 A JP 2021190178A JP 2023077058 A JP2023077058 A JP 2023077058A
Authority
JP
Japan
Prior art keywords
image
defective
defective product
learning
workpiece
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
JP2021190178A
Other languages
Japanese (ja)
Inventor
京佑 俵
Kyosuke Tawara
新亮 趙
Xinliang Zhao
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Keyence Corp
Original Assignee
Keyence Corp
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 Keyence Corp filed Critical Keyence Corp
Priority to JP2021190178A priority Critical patent/JP2023077058A/en
Publication of JP2023077058A publication Critical patent/JP2023077058A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

To reduce a time required to learn a defective product by naturally creating a defective product image for learning, which has various defective states that may be actually assumed in a workpiece.SOLUTION: A new defective product image is generated by performing an extraction process for extracting a defective point of a defective product image, a pasting process for pasting a defective point, extracted in the extraction process, to a reference image, and a process for making a boundary between the defective point, pasted in the pasting process, and the reference image inconspicuous. An inference model is generated by causing a machine learning network to learn a good product image and defective product image stored in a storage unit in advance and a new defective product image.SELECTED DRAWING: Figure 4

Description

本発明は、ワークの外観を検査する外観検査装置及び外観検査方法に関する。 The present invention relates to an appearance inspection apparatus and an appearance inspection method for inspecting the appearance of a work.

例えば特許文献1には、コンピュータによる機械学習を用いて、ワークが良品であるか不良品であるかの判定を行う処理装置が開示されている。特許文献1の処理装置は、良品データを対象とした教師ありの機械学習を行って良品学習モデルを生成するとともに、不良品データを対象とした教師ありの機械学習を行って不良品学習モデルを生成した後、判定対象となるワークのデータを入力し、良品学習モデル及び不良品学習モデルによってワークが良品であるか不良品であるかの判定が行えるように構成されており、このような装置はワークの外観検査装置とも呼ばれている。 For example, Patent Literature 1 discloses a processing device that uses computer-based machine learning to determine whether a work is good or bad. The processing device of Patent Document 1 performs supervised machine learning on non-defective product data to generate a non-defective product learning model, and performs supervised machine learning on defective product data to generate a defective product learning model. After generation, the data of the work to be judged is input, and it is configured to be able to judge whether the work is a good product or a defective product by the non-defective product learning model and the defective product learning model. is also called a work visual inspection device.

特開2019-204321号公報JP 2019-204321 A

ところで、不良品データを対象とした教師あり学習を行う場合、例えば数十枚、数百枚の不良品画像が必要になる。しかし、ワークの生産現場では不良品が殆ど発生しないのでこれほどの枚数の不良品画像を収集しようとすると、長い時間がかかる。そこで、良品データを対象とした良品学習が解決手段として想定されるが、良品データのみで学習した機械学習ネットワークの場合、不良品の検出能力が不足し、難易度の高い検査では不良品学習に比べて性能が劣るので、不良品学習を行いたい。 By the way, when performing supervised learning on defective product data, for example, tens or hundreds of defective product images are required. However, it takes a long time to collect such a large number of images of defective products because defective products are rarely produced at the work production site. Therefore, learning of non-defective products using non-defective product data is assumed as a solution. I want to learn defective products because the performance is inferior compared to other models.

このことに対して、学習用の不良品画像を外観検査装置の内部で作り出せるようにすれば、比較的短い時間で多数の不良品画像を取得することができる。ところが、外観検査装置の内部で不良品画像を作り出すといっても、例えば、画像のコントラスト変換、単純な回転、縦横比を変化させる単純な変形等に留まり、幅広い不良品画像を作り出すことは困難であった。具体的には、例えばワークの「割れ」の検出を行う推論モデルを生成する場合を想定すると、実際のワークでは「割れ」の形状や位置、大きさが様々に想定されるので、幅広い不良品画像が要求されるのであるが、単にコントラストを変換した画像、回転した画像、縦横比を変化させた画像等では、対応が困難であった。 In contrast to this, if it is possible to create defective product images for learning inside the visual inspection apparatus, a large number of defective product images can be acquired in a relatively short period of time. However, even if it is said that defective product images are created inside the appearance inspection device, for example, it is limited to image contrast conversion, simple rotation, and simple deformation that changes the aspect ratio, etc., and it is difficult to create a wide range of defective product images. Met. Specifically, for example, assuming the case of generating an inference model that detects "cracks" in a workpiece, the shape, position, and size of the "crack" in the actual workpiece are assumed to vary, so a wide range of defective products An image is required, but it is difficult to deal with an image whose contrast is simply converted, a rotated image, an image whose aspect ratio is changed, or the like.

本開示は、かかる点に鑑みたものであり、その目的とするところは、実際にワークに想定される様々な欠陥状態を持つ学習用の不良品画像を自然に作り出せるようにして、不良品学習に要する時間を短縮することにある。 The present disclosure is made in view of this point, and the purpose thereof is to naturally generate defective product images for learning having various defect states that are actually assumed in the work, and to perform defective product learning. to shorten the time required for

上記目的を達成するために、本開示の一態様では、機械学習ネットワークに検査対象のワークを撮影したワーク画像を入力し、入力された前記ワーク画像に基づいてワークの良否判定を行う外観検査装置を前提することができる。外観検査装置は、良品に対応する良品画像と、不良品に対応する不良品画像とを記憶する記憶部と、前記記憶部に予め記憶された前記不良品画像の不良箇所を抽出する抽出処理と、抽出処理で抽出された不良箇所を、ワークを含む参照画像に貼り付ける貼り付け処理と、貼り付け処理で貼り付けられた前記不良箇所と前記参照画像との境界を目立たなくする処理とを実行することにより、新たな不良品画像を生成する画像処理部と、前記記憶部に予め記憶された良品画像及び不良品画像と、前記画像処理部により生成された新たな不良品画像とを機械学習ネットワークに学習させて推論モデルを生成する学習部とを備えている。さらに、外観検査装置は、前記学習部により生成された推論モデルに検査対象のワークを撮影したワーク画像を入力し、入力された前記ワーク画像に基づいてワークの良否判定を行う検査部も備えている。 In order to achieve the above object, in one aspect of the present disclosure, a visual inspection apparatus inputs a workpiece image obtained by photographing a workpiece to be inspected into a machine learning network, and determines the quality of the workpiece based on the input workpiece image. can be assumed. The visual inspection apparatus includes a storage unit for storing a non-defective product image corresponding to a non-defective product and a defective product image corresponding to a defective product; a pasting process of pasting the defective portion extracted by the extracting process onto a reference image including the workpiece; and a process of making the boundary between the defective portion pasted by the pasting process and the reference image inconspicuous. machine learning of the image processing unit that generates a new defective product image, the non-defective product image and the defective product image that are pre-stored in the storage unit, and the new defective product image that is generated by the image processing unit. and a learning unit that trains the network to generate an inference model. Furthermore, the visual inspection apparatus also includes an inspection unit that inputs a workpiece image obtained by photographing a workpiece to be inspected into the inference model generated by the learning unit, and determines whether the workpiece is acceptable based on the input workpiece image. there is

この構成によれば、不良品画像が有する不良箇所が抽出されると、抽出された不良箇所が参照画像に貼り付けられる。不良箇所を貼り付ける参照画像は、良品画像であってもよいし、不良品画像であってもい。これにより、不良箇所を有する不良品画像が新たに生成される。新たに生成された不良品画像では、貼り付けられた不良箇所と参照画像との境界が目立たなくなっているので、自然な不良品画像となる。これを繰り返すことで、実際にワークに想定される様々な欠陥状態を持つ学習用の不良品画像を複数取得できる。 According to this configuration, when the defective portion of the defective product image is extracted, the extracted defective portion is attached to the reference image. The reference image to which the defective portion is pasted may be a non-defective product image or a defective product image. As a result, a new defective product image having a defective portion is generated. In the newly generated defective product image, the boundary between the pasted defective portion and the reference image is not conspicuous, so the defective product image becomes a natural defective product image. By repeating this process, it is possible to acquire a plurality of defective product images for learning having various defect states actually assumed in the workpiece.

新たな不良品画像と、記憶部に予め記憶された良品画像及び不良品画像とを機械学習ネットワークに学習させることで、不良品の検出能力の高い推論モデルが生成される。よって、外観検査性能を高めることができる。 By having a machine learning network learn a new defective product image and non-defective product images and defective product images stored in advance in the storage unit, an inference model with a high ability to detect defective products is generated. Therefore, appearance inspection performance can be improved.

他の態様に係る画像処理部は、前記抽出処理において、前記記憶部に記憶されている不良品画像の特徴量を取得し、周囲の特徴量とは異なる特徴量を有する部位を前記不良箇所として抽出することができる。 The image processing unit according to another aspect acquires the feature amount of the defective product image stored in the storage unit in the extraction process, and treats a part having a feature amount different from the surrounding feature amount as the defective part. can be extracted.

この構成によれば、記憶部に記憶されている不良品画像の不良箇所が自動的に抽出されるので、ユーザの手間を省くことができる。 According to this configuration, since the defective part of the defective product image stored in the storage unit is automatically extracted, it is possible to save the user's trouble.

他の態様に係る画像処理部は、前記抽出処理において、抽出した前記不良箇所の範囲の修正を受け付けることができる。 The image processing unit according to another aspect can receive correction of the range of the extracted defective portion in the extraction process.

すなわち、不良品画像の特徴量に基づいて自動的に抽出された不良箇所の範囲が誤っている場合が想定される。この場合には、ユーザが不良箇所の範囲の修正を行うと、その修正が受け付けられるので、不良箇所の範囲を適切に設定できる。 That is, it is assumed that the range of the defective portion automatically extracted based on the feature amount of the defective product image is incorrect. In this case, when the user corrects the range of the defective portion, the correction is accepted, so the range of the defective portion can be appropriately set.

他の態様に係る画像処理部は、前記抽出処理において、前記記憶部に記憶されている不良品画像の中からユーザによる前記不良箇所の選択操作を受け付け、受け付けた選択操作に基づいて前記不良箇所を抽出することができる。 The image processing unit according to another aspect receives, in the extraction process, a user's selection operation of the defective part from among the defective product images stored in the storage unit, and extracts the defective part based on the received selection operation. can be extracted.

すなわち、不良品画像や不良箇所によっては、特徴量に基づく抽出が困難なケースも想定される。このような場合には、ユーザが不良品画像の中から不良箇所を選択すると、選択した不良箇所を抽出することができるので、不良箇所が誤って抽出され難くなる。 In other words, there may be cases where extraction based on the feature amount is difficult depending on the defective product image or the defective portion. In such a case, if the user selects a defective portion from the defective product image, the selected defective portion can be extracted, so that the defective portion is less likely to be erroneously extracted.

他の態様に係る画像処理部は、前記抽出処理で抽出された不良箇所に画像変換を施した状態で当該不良箇所を前記参照画像に貼り付けることができる。 The image processing unit according to another aspect can paste the defective portion extracted in the extraction process to the reference image in a state in which image conversion is performed on the defective portion.

この構成によれば、不良品画像全体のコントラストを変えたり、回転させたりするのではなく、不良箇所のみに対して画像変換を施すので、生成する新たな不良品画像のバリエーションを大幅に増やすことができる。 According to this configuration, instead of changing the contrast of the entire defective product image or rotating it, image conversion is applied only to the defective portion, so that the variation of new defective product images to be generated can be greatly increased. can be done.

他の態様に係る画像処理部は、前記参照画像に含まれるワーク部分を、前記不良箇所の貼り付け対象領域として特定し、特定した前記貼り付け対象領域に前記不良箇所を貼り付けることができるので、学習に適した不良品画像を生成できる。また、前記不良箇所の貼り付け処理後、前記不良箇所の前記貼り付け対象領域からはみ出た部分をトリミングするトリミング処理を実行することができる。 The image processing unit according to another aspect can specify a workpiece portion included in the reference image as a pasting target area for the defective portion, and paste the defective portion to the specified pasting target region. , can generate defective images suitable for learning. Further, after pasting the defective portion, a trimming process for trimming a portion of the defective portion protruding from the pasting target area can be executed.

この構成によれば、ワーク部分の外に不良箇所が位置するといった不自然な不良品画像が生成されなくなるので、学習の精度を高めることができる。 According to this configuration, since an unnatural defective product image in which the defective part is located outside the work portion is not generated, the accuracy of learning can be improved.

他の態様に係る画像処理部が生成した新たな不良品画像を表示部に表示させる表示制御部を更に備えているので、不良箇所の貼り付け及びぼかし処理によってどのような不良品画像が生成されているかをユーザが見て確認できる。その結果、違和感のある画像であれば、学習に用いない等、ユーザが学習に使用するか否かを決定できる。 Since the display control unit is further provided for displaying the new defective product image generated by the image processing unit according to another aspect on the display unit, what kind of defective product image is generated by pasting and blurring the defective portion. The user can see and confirm whether the As a result, the user can decide whether or not to use the image for learning, such as not using it for learning, if the image gives a sense of discomfort.

他の態様に係る画像処理部は、当該画像処理部が生成した新たな不良品画像に、不良品のワークを撮影した不良品画像と区別するための識別情報を付与することができる。
この構成によれば、画像処理部が生成した不良品画像と、不良品のワークを撮影した不良品画像とを区別できるので、例えば、不良品のワークを撮影した不良品画像が多く蓄積された段階で、画像処理部が生成した不良品画像を学習対象から除外できる。また、画像処理部が生成した不良品画像を学習する際、不良品のワークを撮影した不良品画像に比べて学習の重みを軽くすることもできる。
The image processing unit according to another aspect can add, to the new defective product image generated by the image processing unit, identification information for distinguishing the defective product image from the defective product image obtained by photographing the defective workpiece.
According to this configuration, it is possible to distinguish between the defective product image generated by the image processing unit and the defective product image obtained by photographing the defective workpiece. In this stage, the defective product image generated by the image processing unit can be excluded from the learning target. Also, when learning the defective product image generated by the image processing unit, the learning weight can be made lighter than the defective product image obtained by photographing the defective workpiece.

以上説明したように、不良品画像から抽出された不良箇所を参照画像に貼り付けた後、不良箇所と参照画像との境界を目立たなくすることにより、実際にワークに想定される様々な欠陥状態を持つ新たな不良品画像を自然に作り出すことができる。そして、新たな不良品画像と、記憶部に予め記憶された良品画像及び不良品画像とを機械学習ネットワークに学習させることで、不良品の検出能力の高い推論モデルを短時間で生成できる。 As described above, after pasting the defective part extracted from the defective product image on the reference image, by making the boundary between the defective part and the reference image inconspicuous, various defect states actually assumed in the workpiece can be detected. It is possible to naturally create a new defective product image with By having the machine learning network learn the new defective product image and the non-defective product image and the defective product image stored in advance in the storage unit, an inference model with high defective product detection capability can be generated in a short time.

本発明の実施形態に係る外観検査装置の構成を示す模式図である。It is a mimetic diagram showing the composition of the appearance inspection device concerning the embodiment of the present invention. 前記外観検査装置のハードウエア構成を示すブロック図である。It is a block diagram which shows the hardware constitutions of the said visual inspection apparatus. 学習処理の手順の一例を示すフローチャートである。6 is a flow chart showing an example of a procedure of learning processing; 不良品画像の内部生成処理の手順の一例を示すフローチャートである。FIG. 11 is a flowchart showing an example of a procedure of internal generation processing of a defective product image; FIG. FIG.5Aは実際の不良品を撮影した不良品画像を示し、FIG.5Bは不良品画像から不良箇所を抽出した画像を示す。FIG. 5A shows a defective product image of an actual defective product, and FIG. 5B shows an image obtained by extracting a defective portion from the defective product image. FIG.6Aは参照画像を示し、FIG.6Bは貼り付け対象領域を特定した画像を示す。FIG. 6A shows a reference image, FIG. 6B shows an image specifying a pasting target area. FIG.7Aはドーナツ状の不良品画像の例を示し、FIG.7B、7Cは不良箇所を貼り付けた様子を示す図である。FIG. 7A shows an example of a doughnut-shaped defective product image, FIG. 7B and 7C are diagrams showing how the defective portions are pasted. FIG.8Aは長い形状の不良品画像の例を示し、FIG.8B、8Cは不良箇所を貼り付けた様子を示す図である。FIG. 8A shows an example of a long-shaped defective product image, FIG. 8B and 8C are diagrams showing how the defective portions are pasted. FIG.9Aは複雑な形状の不良品画像の例を示し、FIG.9B、9Cは不良箇所を貼り付けた様子を示す図である。FIG. 9A shows an example of a defective product image with a complicated shape, FIG. 9B and 9C are diagrams showing how the defective portion is pasted. FIG.10Aは不良箇所を貼り付け対象領域内に貼り付けた様子を示し、FIG.10Bは不良箇所を貼り付け対象領域からはみ出した状態で貼り付けた様子を示す。FIG. 10A shows how the defective part is pasted within the pasting target area, and FIG. 10B shows a state in which the defective portion is pasted out of the region to be pasted. 外観検査装置の運用時の手順の一例を示すフローチャートである。4 is a flow chart showing an example of a procedure during operation of the visual inspection apparatus;

以下、本発明の実施形態を図面に基づいて詳細に説明する。尚、以下の好ましい実施形態の説明は、本質的に例示に過ぎず、本発明、その適用物或いはその用途を制限することを意図するものではない。 BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, embodiments of the present invention will be described in detail based on the drawings. It should be noted that the following description of preferred embodiments is essentially merely illustrative, and is not intended to limit the invention, its applications, or its uses.

図1は、本発明の実施形態に係る外観検査装置1の構成を示す模式図である。外観検査装置1は、例えば各種部品や製品等のような検査対象であるワークを撮像して取得されたワーク画像の良否判定を行うための装置であり、工場等の生産現場等で使用することができる。具体的には、外観検査装置1の内部には機械学習ネットワークが構築されている。生成された機械学習ネットワークに、検査対象のワークを撮像したワーク画像を入力し、当該ワーク画像の良否判定を機械学習ネットワークによって行うことができるようになっている。 FIG. 1 is a schematic diagram showing the configuration of an appearance inspection apparatus 1 according to an embodiment of the present invention. The visual inspection apparatus 1 is a device for determining the quality of a work image obtained by imaging a work to be inspected, such as various parts or products, and is used at a production site such as a factory. can be done. Specifically, a machine learning network is built inside the visual inspection apparatus 1 . A work image obtained by imaging a work to be inspected is input to the generated machine learning network, and the machine learning network can judge whether the work image is good or bad.

ワークは、それ全体が検査対象であってもよいし、ワークの一部のみが検査対象であってもよい。また、1つのワークに複数の検査対象が含まれていてもよい。また、ワーク画像には、複数のワークが含まれていてもよい。 The entire workpiece may be inspected, or only part of the workpiece may be inspected. Also, one workpiece may include a plurality of inspection targets. Also, the workpiece image may include a plurality of workpieces.

外観検査装置1は、装置本体となる制御ユニット2と、撮像ユニット3と、表示装置(表示部)4と、パーソナルコンピュータ5とを備えている。パーソナルコンピュータ5は、必須なものではなく、省略することもできる。表示装置4の代わりにパーソナルコンピュータ5を使用して各種情報や画像を表示させることもできるし、パーソナルコンピュータ5の機能を制御ユニット2に組み込むことや、表示装置4に組み込むことができる。 A visual inspection apparatus 1 includes a control unit 2 serving as an apparatus main body, an imaging unit 3 , a display device (display section) 4 , and a personal computer 5 . The personal computer 5 is not essential and can be omitted. The personal computer 5 can be used instead of the display device 4 to display various information and images, and the functions of the personal computer 5 can be incorporated into the control unit 2 or into the display device 4 .

図1では、外観検査装置1の構成例の一例として、制御ユニット2、撮像ユニット3、表示装置4及びパーソナルコンピュータ5を記載しているが、これらのうち、任意の複数を組み合わせて一体化することもできる。例えば、制御ユニット2と撮像ユニット3を一体化することや、制御ユニット2と表示装置4を一体化することもできる。また、制御ユニット2を複数のユニットに分割して一部を撮像ユニット3や表示装置4に組み込むことや、撮像ユニット3を複数のユニットに分割して一部を他のユニットに組み込むこともできる。 In FIG. 1, the control unit 2, the imaging unit 3, the display device 4, and the personal computer 5 are described as an example of the configuration of the appearance inspection apparatus 1, but any plurality of these may be combined and integrated. can also For example, the control unit 2 and the imaging unit 3 can be integrated, or the control unit 2 and the display device 4 can be integrated. Also, the control unit 2 can be divided into a plurality of units and some of them can be incorporated into the imaging unit 3 and the display device 4, or the imaging unit 3 can be divided into a plurality of units and some of them can be incorporated into other units. .

(撮像ユニット3の構成)
図2に示すように、撮像ユニット3は、カメラモジュール(撮像部)14と、照明モジュール(照明部)15とを備えており、ワーク画像の取得を実行するユニットである。カメラモジュール14は、撮像光学系を駆動するAF用モータ141と、撮像基板142とを備えている。AF用モータ141は、撮像光学系のレンズを駆動することにより、自動でピント調整を実行する部分であり、従来から周知のコントラストオートフォーカス等の手法によってピント調整を行うことができる。撮像基板142は、撮像光学系から入射した光を受光する受光素子としてCMOSセンサ143を備えている。CMOSセンサ143は、カラー画像を取得することができるように構成された撮像センサである。CMOSセンサ143の代わりに、例えばCCDセンサ等の受光素子を用いることもできる。
(Configuration of imaging unit 3)
As shown in FIG. 2, the imaging unit 3 includes a camera module (imaging section) 14 and an illumination module (illumination section) 15, and is a unit that acquires a workpiece image. The camera module 14 includes an AF motor 141 that drives an imaging optical system, and an imaging board 142 . The AF motor 141 is a part that automatically performs focus adjustment by driving the lens of the imaging optical system, and can perform focus adjustment by conventionally known methods such as contrast autofocus. The imaging substrate 142 includes a CMOS sensor 143 as a light receiving element that receives light incident from the imaging optical system. The CMOS sensor 143 is an imaging sensor configured to acquire a color image. Instead of the CMOS sensor 143, for example, a light receiving element such as a CCD sensor can also be used.

照明モジュール15は、ワークを含む撮像領域を照明する発光体としてのLED(発光ダイオード)151と、LED151を制御するLEDドライバ152とを備えている。LED151による発光タイミング、発光時間、発光量は、LEDドライバ152によって任意に制御することができる。LED151は、撮像ユニット3に一体に設けてもよいし、撮像ユニット3とは別体として外部照明ユニットとして設けてもよい。 The illumination module 15 includes LEDs (light emitting diodes) 151 as light emitters that illuminate an imaging area including a workpiece, and an LED driver 152 that controls the LEDs 151 . The light emission timing, light emission time, and light emission amount of the LED 151 can be arbitrarily controlled by the LED driver 152 . The LED 151 may be provided integrally with the imaging unit 3, or may be provided separately from the imaging unit 3 as an external lighting unit.

(表示装置4の構成)
表示装置4は、例えば液晶パネルや有機ELパネル等からなる表示パネルを有している。制御ユニット2から出力されたワーク画像やユーザーインターフェース画像等は表示装置4に表示される。また、パーソナルコンピュータ5が表示パネルを有している場合、パーソナルコンピュータ5の表示パネルを表示装置4の代わりとして利用することができる。
(Configuration of display device 4)
The display device 4 has a display panel such as a liquid crystal panel or an organic EL panel. A work image, a user interface image, and the like output from the control unit 2 are displayed on the display device 4 . Moreover, when the personal computer 5 has a display panel, the display panel of the personal computer 5 can be used as a substitute for the display device 4 .

(操作機器)
外観検査装置1をユーザが操作するための操作機器としては、例えば、パーソナルコンピュータ5が有するキーボード51やマウス52等を挙げることができるが、これらに限られるものではなく、ユーザによる各種操作を受付可能に構成された機器であればよい。例えば、表示装置4が有するタッチパネル41のようなポインティングデバイスも操作機器に含まれる。
(operating device)
The operation device for the user to operate the visual inspection apparatus 1 includes, for example, the keyboard 51 and the mouse 52 of the personal computer 5, but is not limited to these, and accepts various operations by the user. Any device can be used as long as it is configured to be able to For example, a pointing device such as the touch panel 41 of the display device 4 is also included in the operating device.

キーボード51やマウス52のユーザによる操作は制御ユニット2で検出可能になっている。また、タッチパネル41は、例えば感圧センサを搭載した従来から周知のタッチ式操作パネルであり、ユーザのタッチ操作は制御ユニット2で検出可能になっている。他のポインティングデバイスを用いた場合も同様である。 The user's operation of the keyboard 51 and mouse 52 can be detected by the control unit 2 . Further, the touch panel 41 is a conventionally well-known touch-type operation panel equipped with, for example, a pressure-sensitive sensor, and the user's touch operation can be detected by the control unit 2 . The same is true when using other pointing devices.

(制御ユニット2の構成)
制御ユニット2は、メイン基板13と、コネクタ基板16と、通信基板17と、電源基板18とを備えている。メイン基板13には、プロセッサ13aが設けられている。プロセッサ13aは、接続されている各基板及びモジュールの動作を制御する。例えば、プロセッサ13aは、照明モジュール15のLEDドライバ152に対してLED151の点灯/消灯を制御する照明制御信号を出力する。LEDドライバ152は、プロセッサ13aからの照明制御信号に応じて、LED151の点灯/消灯の切替及び点灯時間の調整を行うとともに、LED151の光量等を調整する。
(Configuration of control unit 2)
The control unit 2 includes a main board 13 , a connector board 16 , a communication board 17 and a power supply board 18 . The main substrate 13 is provided with a processor 13a. The processor 13a controls the operation of each connected board and module. For example, the processor 13 a outputs a lighting control signal for controlling lighting/lighting out of the LED 151 to the LED driver 152 of the lighting module 15 . The LED driver 152 adjusts the light amount of the LED 151 and the like while switching between lighting and extinguishing of the LED 151 and adjusting the lighting time according to the lighting control signal from the processor 13a.

また、プロセッサ13aは、カメラモジュール14の撮像基板142に、CMOSセンサ143を制御する撮像制御信号を出力する。CMOSセンサ143は、プロセッサ13aからの撮像制御信号に応じて、撮像を開始するとともに、露光時間を任意の時間に調整して撮像を行う。すなわち、撮像ユニット3は、プロセッサ13aから出力される撮像制御信号に応じてCMOSセンサ143の視野範囲内を撮像し、視野範囲内にワークがあれば、ワークを撮像することになるが、ワーク以外の物が視野範囲内にあれば、それも撮像することができる。例えば、外観検査装置1は、機械学習ネットワークの学習用の画像として、撮像ユニット3により、良品に対応する良品画像と不良品に対応する不良品画像とを撮像することができる。学習用の画像は、撮像ユニット3で撮像された画像でなくてもよく、他のカメラ等で撮像された画像であってもよい。 The processor 13a also outputs an imaging control signal for controlling the CMOS sensor 143 to the imaging board 142 of the camera module 14 . The CMOS sensor 143 starts imaging in response to an imaging control signal from the processor 13a, adjusts the exposure time to an arbitrary time, and performs imaging. That is, the image pickup unit 3 picks up an image within the visual field range of the CMOS sensor 143 according to the image pickup control signal output from the processor 13a. If an object is within the field of view, it can also be imaged. For example, the visual inspection apparatus 1 can capture a non-defective product image corresponding to a non-defective product and a defective product image corresponding to a defective product using the imaging unit 3 as images for learning a machine learning network. The learning image may not be an image captured by the imaging unit 3, but may be an image captured by another camera or the like.

一方、外観検査装置の運用時には、撮像ユニット3により、ワークを撮像することができる。また、CMOSセンサ143は、ライブ画像、即ち現在の撮像された画像を短いフレームレートで随時出力することができるように構成されている。 On the other hand, during operation of the visual inspection apparatus, the image of the work can be imaged by the imaging unit 3 . In addition, the CMOS sensor 143 is configured so as to be able to output a live image, that is, a currently captured image at a short frame rate at any time.

CMOSセンサ143による撮像が終わると、撮像ユニット3から出力された画像信号は、メイン基板13のプロセッサ13aに入力されて処理されるとともに、メイン基板13のメモリ13bに記憶されるようになっている。メイン基板13のプロセッサ13aによる具体的な処理内容の詳細については後述する。尚、メイン基板13には、FPGAやDSP等の処理装置が設けられていてもよい。FPGAやDSP等の処理装置が統合されたプロセッサ13aであってもよい。 When the CMOS sensor 143 finishes imaging, the image signal output from the imaging unit 3 is input to the processor 13a of the main board 13 and processed, and is also stored in the memory 13b of the main board 13. . Details of specific processing contents by the processor 13a of the main substrate 13 will be described later. Note that the main board 13 may be provided with a processing device such as FPGA or DSP. A processor 13a integrated with a processing device such as FPGA or DSP may be used.

メイン基板13には、表示制御部13cが設けられている。表示制御部13cは、表示画面を生成するとともに、表示装置4を制御し、表示画面を表示装置4に表示させる部分である。表示制御部13cの具体的な動作については後述する。 The main substrate 13 is provided with a display control section 13c. The display control unit 13c is a part that generates a display screen, controls the display device 4, and causes the display device 4 to display the display screen. A specific operation of the display control unit 13c will be described later.

コネクタ基板16は、電源インターフェース161に設けてある電源コネクタ(図示せず)を介して外部から電力の供給を受ける部分である。電源基板18は、コネクタ基板16で受けた電力を各基板及びモジュール等に分配する部分であり、具体的には、照明モジュール15、カメラモジュール14、メイン基板13、及び通信基板17に電力を分配する。電源基板18は、AF用モータドライバ181を備えている。AF用モータドライバ181は、カメラモジュール14のAF用モータ141に駆動電力を供給し、オートフォーカスを実現している。AF用モータドライバ181は、メイン基板13のプロセッサ13aからのAF制御信号に応じて、AF用モータ141に供給する電力を調整する。 The connector board 16 is a part that receives power supply from the outside via a power connector (not shown) provided on the power interface 161 . The power supply board 18 is a part that distributes the power received by the connector board 16 to each board and modules. do. The power supply board 18 has an AF motor driver 181 . The AF motor driver 181 supplies drive power to the AF motor 141 of the camera module 14 to achieve autofocus. The AF motor driver 181 adjusts the power supplied to the AF motor 141 according to the AF control signal from the processor 13a of the main substrate 13. FIG.

通信基板17は、メイン基板13と表示装置4及びパーソナルコンピュータ5との通信、メイン基板13と外部制御機器(図示せず)との通信等を実行する部分である。外部制御機器は、例えばプログラマブルロジックコントローラ等を挙げることができる。通信は、有線であってもよいし、無線であってもよく、いずれの通信形態も、従来から周知の通信モジュールによって実現することができる。 The communication board 17 is a part that executes communication between the main board 13 and the display device 4 and the personal computer 5, communication between the main board 13 and an external control device (not shown), and the like. The external control device can be, for example, a programmable logic controller or the like. Communication may be wired or wireless, and either form of communication can be realized by conventionally known communication modules.

制御ユニット2には、例えばソリッドステートドライブ、ハードディスクドライブ等からなる記憶装置(記憶部)19が設けられている。記憶装置19には、後述する各制御及び処理を上記ハードウエアによって実行可能にするためのプログラムファイル80や設定ファイル等(ソフトウエア)が記憶されている。プログラムファイル80や設定ファイルは、例えば光ディスク等の記憶媒体90に格納しておき、この記憶媒体90に格納されたプログラムファイル80や設定ファイルを制御ユニット2にインストールすることができる。プログラムファイル80は、外部サーバから通信回線を利用してダウンロードされるものであってもよい。また、記憶装置19には、例えば、上記画像データ等を記憶させておくこともできるし、後述する学習処理後に得られた推論モデルを構築するためのパラメータ等も記憶させておくことができる。 The control unit 2 is provided with a storage device (storage section) 19 such as a solid state drive, a hard disk drive, or the like. The storage device 19 stores program files 80, setting files, and the like (software) for enabling the hardware to execute various controls and processes, which will be described later. The program files 80 and setting files can be stored in a storage medium 90 such as an optical disk, for example, and the program files 80 and setting files stored in this storage medium 90 can be installed in the control unit 2 . The program file 80 may be downloaded from an external server using a communication line. In addition, the storage device 19 can store, for example, the image data and the like, and can also store parameters and the like for constructing an inference model obtained after the learning process described later.

図2では、記憶装置19が制御ユニット2と一体化されたものとして表現しているが、記憶装置19は制御ユニット2とは別体のものであってもよい。そのような記憶装置19の例としては、ネットワーク対応ストレージ(NAS:Network Attached Storage)等を挙げることができる。NSAと制御ユニット2とは有線LANや無線LAN等の通信回線によって接続される。 In FIG. 2 , the storage device 19 is shown as being integrated with the control unit 2 , but the storage device 19 may be separate from the control unit 2 . As an example of such a storage device 19, a network compatible storage (NAS: Network Attached Storage) or the like can be cited. The NSA and the control unit 2 are connected by a communication line such as wired LAN or wireless LAN.

すなわち、外観検査装置1では、学習用の画像を使用して機械学習ネットワークを学習させることで、機械学習ネットワークのパラメータが調整されて推論モデルが生成される。推論モデルに検査対象のワークを撮影したワーク画像を入力し、入力されたワーク画像に基づいてワークの良否判定を行うことができる。この外観検査装置1を使用することで、ワーク画像に基づいてワークの良否判定を行う外観検査方法を実行できる。 That is, in the visual inspection apparatus 1, by learning a machine learning network using images for learning, the parameters of the machine learning network are adjusted and an inference model is generated. A work image obtained by photographing a work to be inspected can be input to the inference model, and the quality of the work can be determined based on the input work image. By using this visual inspection apparatus 1, it is possible to perform a visual inspection method for determining the quality of a workpiece based on the image of the workpiece.

(プロセッサの構成)
図2に示すように、プロセッサ13aには、画像処理部13d、学習部13e及び検査部13fが設けられている。画像処理部13d、学習部13e及び検査部13fは、ハードウエアで構成された部分であってもよいし、ソフトウエアを実行することによって構成される部分であってもよい。また、画像処理部13d、学習部13e及び検査部13fは、必ずしもメイン基板13に設けられていなくてもよく、これらの一部または全部がメイン基板13以外の基板に設けられていてもよい。
(Processor configuration)
As shown in FIG. 2, the processor 13a is provided with an image processing section 13d, a learning section 13e, and an inspection section 13f. The image processing unit 13d, the learning unit 13e, and the inspection unit 13f may be parts configured by hardware, or may be parts configured by executing software. Also, the image processing unit 13d, the learning unit 13e, and the inspection unit 13f may not necessarily be provided on the main substrate 13, and some or all of them may be provided on a substrate other than the main substrate 13.

各部の詳細については後述するが、概略は以下のとおりである。画像処理部13dは後述する不良品画像を内部生成する部分である。また、学習部13eは、機械学習ネットワークに学習用データを入力して学習させ、入力画像の良否判定を行うための推論モデルを生成する部分である。学習部13eは、例えば制御ユニット2とは別の学習用計算機で構成されていてもよい。学習用計算機は、機械学習を高速で行うことが可能に構成されている。学習用計算機と制御ユニット2とを通信可能に接続しておくことで、学習用計算機で生成された推論モデルを構築するパラメータを記憶装置19に送信して記憶させることができる。これにより、制御ユニット2に推論モデルを構築できる。検査部13fは、ワーク画像を推論モデルに入力してワークの良否判定を行う部分である。 The details of each part will be described later, but the outline is as follows. The image processing unit 13d is a part that internally generates a defective product image, which will be described later. Also, the learning unit 13e is a part that inputs learning data to a machine learning network, causes the machine learning network to learn, and generates an inference model for determining whether an input image is good or bad. The learning unit 13e may be composed of a learning computer separate from the control unit 2, for example. The learning computer is configured to be able to perform machine learning at high speed. By communicably connecting the learning computer and the control unit 2, the parameters for constructing the inference model generated by the learning computer can be transmitted to the storage device 19 and stored. Thereby, an inference model can be constructed in the control unit 2 . The inspection unit 13f is a part that inputs the work image to the inference model and judges the quality of the work.

(学習処理)
次に、機械学習ネットワークの学習処理について具体的に説明する。学習の種類として、不良品画像を学習させる不良品学習と、良品画像を学習させる良品学習とがある。ワークの生産現場では良品が殆どを占めているので、良品学習用の良品画像を多くする収集するのは容易であるが、良品画像のみで学習した機械学習ネットワークの場合、不良品の検出能力が不足し、難易度の高い検査では不良品学習に比べて性能が劣るので、不良品学習を行いたいという要求がある。ところが、ワークの生産現場では不良品の発生数は極めて少ないので、学習用の不良品画像を短時間で収集するのは困難である。本実施形態では、外観検査装置1の内部でバリエーションの豊富な不良品画像を自然に、しかも多数作り出すことができるように構成されている。以下、詳述する。
(learning process)
Next, the learning process of the machine learning network will be specifically described. As types of learning, there are defective product learning in which defective product images are learned, and non-defective product learning in which non-defective product images are learned. At the work production site, most of the products are non-defective products, so it is easy to collect many non-defective product images for learning non-defective products. Insufficient and difficult inspections are inferior in performance to defective product learning, so there is a demand for defective product learning. However, since the number of defective products produced is extremely small at work production sites, it is difficult to collect defective product images for learning in a short period of time. In the present embodiment, the appearance inspection apparatus 1 is configured so that a large number of defective product images with a wide variety of variations can be generated naturally. Details will be described below.

図3のフローチャートは、学習処理の手順の一例を示している。スタート後のステップSA1では、学習部13eが、未学習の機械学習ネットワークを用意する。未学習の機械学習ネットワークは、例えば、パラメータの初期値が無作為に決定されたものである。ステップSA2では、機械学習ネットワークの学習に用いる学習用の良品画像と不良品画像とを記憶装置19に記憶させる。このステップSA2が記憶ステップである。記憶ステップは、ステップSA1よりも前にユーザにより実行されてもよい。また、学習用の良品画像と不良品画像は、ユーザが事前にワークを撮影して蓄積していた画像であってもよいし、学習のために新たにワークを撮像して取得した画像であってもよいし、外観検査装置1の運用中に撮像ユニット3で取得された画像であってもよい。また、記憶装置19以外の記憶装置(図示せず)に記憶されている良品画像及び不良品画像を、学習用の良品画像及び不良品画像として使用することもできる。 The flowchart in FIG. 3 shows an example of the procedure of the learning process. At step SA1 after the start, the learning unit 13e prepares an unlearned machine learning network. An unlearned machine learning network is, for example, one in which the initial values of parameters are randomly determined. At step SA2, the storage device 19 stores the non-defective product image and the defective product image for learning to be used for learning of the machine learning network. This step SA2 is a storage step. The storing step may be performed by the user prior to step SA1. Also, the non-defective product image and the defective product image for learning may be images previously photographed and accumulated by the user, or may be images acquired by newly photographing the work for learning. Alternatively, it may be an image acquired by the imaging unit 3 during operation of the visual inspection apparatus 1 . Also, non-defective product images and defective product images stored in a storage device (not shown) other than the storage device 19 can be used as non-defective product images and defective product images for learning.

不良品画像には、アノテーションを実行しておく。すなわち、不良品画像に、不良品画像であることを明示する処理、不良品画像の不良箇所を指定する処理等をユーザが事前に行っておく。アノテーションによって付与された情報は、該当する不良品画像と関連付けられた状態で記憶装置19に記憶されている。 Annotate the defective product image. That is, the user performs in advance a process of clearly indicating that the defective product image is a defective product image, a process of designating a defective portion of the defective product image, and the like. The information attached by the annotation is stored in the storage device 19 in association with the corresponding defective product image.

その後、ステップSA3に進む。ステップSA3では、不良品画像の内部生成処理が必要であるか否かを判定する。不良品画像の内部生成処理とは、詳細は後述するが、既存の不良品画像を使用して別の不良品画像を外観検査装置1の内部で作り出す処理のことである。ステップSA3の判定はユーザが行うことができる。例えば、不良品画像が1枚、または数枚程度しか収集できなかった場合には、不良品学習のための不良品画像の数が十分ではないので、ユーザは、不良品画像の内部生成処理が必要であると判定する。一方、不良品学習のための不良品画像の数が数十枚、数百枚程度収集されているのであれば、不良品学習のための不良品画像の数が十分であるので、ユーザは、不良品画像の内部生成処理が不要であると判定する。ユーザは、不良品画像の内部生成処理の要否をマウス52等の操作機器を使用して入力できる。例えば、表示制御部13cが、不良品画像の内部生成処理の要否選択が可能なユーザーインターフェース画面を生成して表示装置4に表示させることで、ユーザは不良品画像の内部生成処理の要否を容易に入力できる。ユーザによる入力は、学習部13eで受け付けられるので、外観検査装置1の内部では学習部13eがステップSA3を判定しているとして扱うことができる。 After that, the process proceeds to step SA3. At step SA3, it is determined whether or not the internal generation process of the defective product image is required. The internal defective product image generation process, which will be described later in detail, is a process of using an existing defective product image to create another defective product image inside the visual inspection apparatus 1 . The determination in step SA3 can be made by the user. For example, if only one or several defective product images can be collected, the number of defective product images for defective product learning is not sufficient. determine that it is necessary. On the other hand, if several tens or hundreds of defective product images have been collected for defective product learning, the number of defective product images is sufficient for defective product learning. It is determined that internal generation processing of the defective product image is unnecessary. The user can input the necessity of the internal generation process of the defective product image using the operation device such as the mouse 52 or the like. For example, the display control unit 13c generates a user interface screen on which the user can select whether or not to internally generate defective product images, and causes the display device 4 to display the screen, thereby allowing the user to select whether or not to internally generate defective product images. can be easily entered. Since the input by the user is accepted by the learning unit 13e, it can be treated as if the learning unit 13e determines step SA3 inside the visual inspection apparatus 1. FIG.

ステップSA3でYESと判定されて不良品画像の内部生成処理が必要な場合には、ステップSA4に進む一方、ステップSA3でNOと判定されて不良品画像の内部生成処理が不要な場合には、ステップSA5に進む。 If the result of step SA3 is YES and the internal generation process of the defective product image is necessary, the process proceeds to step SA4. Proceed to step SA5.

ステップSA4では、学習用の不良品画像の数を増やすべく、不良品画像の内部生成処理を実行する。内部生成処理の手順の一例は、図4に示すフローチャートに示している。図4に示すフローチャートは、図3に示すフローチャートのステップSA3でYESと判定されるとスタートする。図4のフローチャートのスタート後のステップSB1では、学習部13eが記憶装置19に記憶されている良品画像及び不良品画像を読み出し、学習部13eが読み出した良品画像及び不良品画像を表示制御部13cが表示装置4に表示させる。表示装置4に表示させる画像の数は何枚であってもよいが、不良品画像については全てを表示させることが可能である。この場合、不良品画像を一覧形式で表示させることができる。これにより、様々な不良箇所をユーザに提示することができる。 At step SA4, internal generation processing of defective product images is executed in order to increase the number of defective product images for learning. An example of the procedure of internal generation processing is shown in the flowchart shown in FIG. The flowchart shown in FIG. 4 starts when YES is determined in step SA3 of the flowchart shown in FIG. In step SB1 after the start of the flow chart of FIG. 4, the learning unit 13e reads the non-defective product image and the defective product image stored in the storage device 19, and displays the non-defective product image and the defective product image read by the learning unit 13e on the display control unit 13c. is displayed on the display device 4. Any number of images may be displayed on the display device 4, but all defective product images can be displayed. In this case, defective product images can be displayed in a list format. This makes it possible to present various defective points to the user.

ステップSB2では、ユーザによる不良品画像の選択を学習部13eが受け付ける。例えば、前のステップSB1において、表示制御部13cが、不良品画像を一覧形式で表示可能なユーザーインターフェース画面を生成し、表示装置4に表示させる。そのユーザーインターフェース画面に選択ボタン等を組み込み、ユーザによるマウス52等の操作により、所望の不良品画像を選択可能にしておく。学習部13eはユーザの選択操作を検出すると、選択操作に対応する不良品画像が選択されたものとして一時的に記憶する。 At step SB2, the learning unit 13e receives the user's selection of a defective product image. For example, in the previous step SB1, the display control unit 13c generates a user interface screen that can display defective product images in a list format, and causes the display device 4 to display it. A selection button or the like is incorporated in the user interface screen so that the user can select a desired defective product image by operating the mouse 52 or the like. When the learning unit 13e detects the user's selection operation, the learning unit 13e temporarily stores the defective product image corresponding to the selection operation as being selected.

また、ステップSB3では、ユーザによる参照画像の選択を学習部13eが受け付ける。参照画像とは、内部生成の際に利用する元となる画像であり、多くの場合は良品画像が適しているが、不良品画像を利用してもよい。例えば、ステップSB1で表示されているユーザーインターフェース画面に選択ボタン等を組み込み、ユーザによるマウス52等の操作により、所望の画像を選択可能にしておく。学習部13eはユーザの選択操作を検出すると、選択操作に対応する画像が選択されたものとして一時的に記憶する。ステップSB2とステップSB3の順番は入れ替わってもよい。 Also, at step SB3, the learning unit 13e receives the selection of the reference image by the user. A reference image is an original image that is used for internal generation. In many cases, a non-defective product image is suitable, but a defective product image may be used. For example, a selection button or the like is incorporated into the user interface screen displayed in step SB1 so that the user can select a desired image by operating the mouse 52 or the like. When the learning unit 13e detects the user's selection operation, the learning unit 13e temporarily stores the selected image corresponding to the selection operation. The order of step SB2 and step SB3 may be interchanged.

ステップSB4では、画像処理部13dが、ステップSB2で選択された不良品画像を読み込み、当該不良画像の不良箇所を抽出する抽出処理を実行する。不良箇所の抽出は、ルールベースのアルゴリズムを利用して行ってもよいし、ユーザが手動で行ってもよい。画像処理部13dは、不良箇所の抽出処理において、不良品画像の特徴量を取得し、周囲の特徴量とは異なる特徴量を有する部位を不良箇所として抽出するアルゴリズムを実行する。 At step SB4, the image processing unit 13d reads the defective product image selected at step SB2, and executes extraction processing for extracting a defective portion of the defective image. The extraction of the defective portion may be performed using a rule-based algorithm, or may be performed manually by the user. The image processing unit 13d acquires the feature amount of the defective product image and executes an algorithm for extracting a portion having a feature amount different from the surrounding feature amount as the defective area in the defective area extraction process.

以下、図5に基づいて不良箇所の抽出処理の具体例を説明する。図5のFIG.5Aに、ステップSB2で選択された不良品画像200を示している。不良品画像200は、不良箇所W1を有するワークWを撮像することによって取得されたものである。図5のFIG.5Bは、不良品画像200に対してルールベースのアルゴリズムを利用して不良箇所W1を抽出した抽出画像201である。不良箇所W1のみを抽出するアルゴリズムの例としては、例えば色抽出アルゴリズム、GrabCutアルゴリズム等を挙げることができるが、これらに限られるものではなく、他のアルゴリズムも利用可能である。 A specific example of the process of extracting a defective portion will be described below with reference to FIG. FIG. 5A shows the defective product image 200 selected at step SB2. The defective product image 200 is acquired by imaging the workpiece W having the defective portion W1. FIG. 5B is an extracted image 201 obtained by extracting a defective portion W1 from the defective product image 200 using a rule-based algorithm. Examples of algorithms for extracting only the defective portion W1 include, for example, a color extraction algorithm and a GrabCut algorithm, but are not limited to these, and other algorithms can also be used.

色抽出アルゴリズムの場合、ユーザが不良品画像200上で不良箇所W1に対応する色を指定すると、その色を持った領域を不良箇所W1として自動抽出する。また、GrabCutアルゴリズムの場合、ユーザが不良品画像200上で不良箇所W1及びと当該不良箇所W1の周囲とを囲むと、その領域が指定され、指定された領域内で当該不良箇所W1を自動抽出する。つまり、画像処理部13dは、抽出処理において、不良品画像200の中からユーザによる不良箇所W1の選択操作を受け付け、受け付けた選択操作に基づいて不良箇所W1を抽出する。 In the case of the color extraction algorithm, when the user designates a color corresponding to the defect location W1 on the defective product image 200, the area having that color is automatically extracted as the defect location W1. In the case of the GrabCut algorithm, when the user encloses the defective part W1 and the periphery of the defective part W1 on the defective product image 200, the area is specified, and the defective part W1 is automatically extracted from the specified area. do. That is, in the extraction process, the image processing unit 13d receives a selection operation of the defective part W1 from the defective product image 200 by the user, and extracts the defective part W1 based on the received selection operation.

その後、ステップSB5では、画像処理部13dが、ステップSB4抽出した不良箇所W1の範囲の修正を受け付ける。色抽出アルゴリズムで色抽出した領域が不良箇所W1よりも大幅に広い領域である場合や狭い領域である場合には、ユーザが色指定をし直したり、閾値変更等の修正を行う。この修正を画像処理部13dが受け付けると、不良箇所W1が抽出し直される。GrabCutアルゴリズムの場合、ストローク修正を行うか、クリック修正を行うことにより、前景背景をユーザが細かく指定していき、その都度、不良箇所W1が抽出し直される。 After that, at step SB5, the image processing unit 13d accepts correction of the range of the defective portion W1 extracted at step SB4. If the area extracted by the color extraction algorithm is much wider or narrower than the defective spot W1, the user re-specifies the color or makes corrections such as changing the threshold value. When the image processing unit 13d accepts this correction, the defect location W1 is extracted again. In the case of the GrabCut algorithm, the user finely designates the foreground and background by correcting strokes or correcting clicks, and each time, the defective portion W1 is re-extracted.

また、ユーザが不良品画像200上で不良箇所W1を手動で抽出する場合、例えばマウス52によって不良箇所W1を囲む操作、不良箇所W1を塗りつぶす操作等を挙げることができる。例えば、フリーハンドツール等を使用して不良箇所W1を囲む枠を生成し、この枠によって不良箇所W1を抽出できる。この場合、画像処理部13dは、囲まれた領域または塗りつぶされた領域が不良箇所W1であるとして抽出する。 Further, when the user manually extracts the defective portion W1 on the defective product image 200, for example, an operation of encircling the defective portion W1 with the mouse 52, an operation of filling in the defective portion W1, and the like can be given. For example, a freehand tool or the like is used to generate a frame surrounding the defective portion W1, and the defective portion W1 can be extracted using this frame. In this case, the image processing unit 13d extracts the enclosed area or the filled area as the defective portion W1.

また、AI Assisted指定によって不良箇所W1を抽出してもよい。AI Assisted指定の場合、不良箇所W1の輪郭を大まかに指定して抽出した後、その抽出箇所の内部をFillツール等で指定する。これにより、不良箇所W1を自動抽出することができる。不良箇所W1を自動抽出した後、微修正することも可能である。 Alternatively, the defective portion W1 may be extracted by specifying AI Assisted. In the case of AI Assisted designation, after roughly designating and extracting the contour of the defective portion W1, the interior of the extracted portion is designated by a Fill tool or the like. Thereby, the defective point W1 can be automatically extracted. After automatically extracting the defective portion W1, it is also possible to make a fine correction.

不良箇所W1が狙い通りに抽出されたことをユーザが確認して次に進む操作を行うと、ステップSB6に進む。ステップSB6では、画像処理部13dがステップSB4及びSB5で抽出された不良箇所W1に後述する画像変換処理を施すか否かを判定する。例えば、画像変換処理の適用/非適用を選択するためのユーザーインターフェース画面を画像処理部13dが生成し、生成されたユーザーインターフェース画面を表示制御部13cが表示装置4に表示させる。ユーザは、マウス52等の操作により、ユーザーインターフェース画面上で画像変換処理の適用/非適用を選択する。画像処理部13dは、「適用」が選択されたことを検出すると、ステップSB7に進む一方、「非適用」が選択されたことを検出すると、ステップSB8に進む。 When the user confirms that the defective portion W1 has been extracted as intended and performs an operation to proceed to the next step, the process proceeds to step SB6. At step SB6, the image processing unit 13d determines whether or not to perform image conversion processing, which will be described later, on the defective portion W1 extracted at steps SB4 and SB5. For example, the image processing unit 13d generates a user interface screen for selecting application/non-application of image conversion processing, and the display control unit 13c causes the display device 4 to display the generated user interface screen. The user selects application/non-application of image conversion processing on the user interface screen by operating the mouse 52 or the like. When the image processing unit 13d detects that "apply" has been selected, the process proceeds to step SB7. When detecting that "non-apply" has been selected, the image processing unit 13d proceeds to step SB8.

ステップSB7では、画像処理部13dが、ステップSB4及びSB5で抽出された不良箇所W1に画像変換処理を施す。画像変換処理としては、例えば不良箇所W1の縦横比(アスペクト比)を変更するアスペクト比変更処理、不良箇所W1を回転させる回転処理、不良箇所W1を横方向(X方向)や縦方向(Y方向)に移動させる移動処理、不良箇所W1のコントラストを変換するコントラスト変換処理、不良箇所W1の色の変更する色変更処理等を挙げることができるが、これらに限られるものではなく、他の画像変換処理を適用してもよい。また、不良箇所W1に対し、任意の複数の画像変換処理を任意の順番で施してもよい。ステップSB7を経ることで、画像変換を施した状態の不良箇所W1を参照画像に貼り付けることができる。 At step SB7, the image processing unit 13d performs image conversion processing on the defective portion W1 extracted at steps SB4 and SB5. The image conversion processing includes, for example, aspect ratio change processing for changing the aspect ratio of the defect location W1, rotation processing for rotating the defect location W1, and rotation of the defect location W1 in the horizontal direction (X direction) and vertical direction (Y direction). ), contrast conversion processing for converting the contrast of the defect location W1, color change processing for changing the color of the defect location W1, and the like, but are not limited to these, and other image transformations. Treatment may be applied. Also, any plurality of image conversion processes may be performed in any order on the defective portion W1. By going through step SB7, it is possible to paste the defective portion W1 in the state of image conversion to the reference image.

どの画像変換処理を施すかについては、ユーザによる選択を可能にすることもできる。例えば、画像変換処理を選択するためのユーザーインターフェース画面を画像処理部13dが生成し、生成されたユーザーインターフェース画面を表示制御部13cが表示装置4に表示させる。ユーザは、マウス52等の操作により、ユーザーインターフェース画面上で所望の画像変換処理を選択すると、画像処理部13dはそのことを検出し、検出した画像変換処理を不良箇所W1に施す。また、どの画像変換処理を施すかについては、外観検査装置1が自動的に設定してもよい。尚、ステップSB6及びSB7を省略してもよい。 It is also possible to allow the user to select which image conversion process is to be performed. For example, the image processing unit 13d generates a user interface screen for selecting image conversion processing, and the display control unit 13c causes the display device 4 to display the generated user interface screen. When the user selects a desired image conversion process on the user interface screen by operating the mouse 52 or the like, the image processing section 13d detects this and applies the detected image conversion process to the defective portion W1. Also, which image conversion process is to be performed may be automatically set by the visual inspection apparatus 1 . Incidentally, steps SB6 and SB7 may be omitted.

ステップSB7の後、またはステップSB6でNOと判定された後にステップSB8に進む。ステップSB8では、抽出された不良箇所W1を貼り付けるための貼り付け対象領域を参照画像の中から特定する。例えば、図6のFIG.6Aに示すような参照画像202が選択されたとする。この参照画像202は良品のワークWを含む良品画像である。図6のFIG.6Bは、貼り付け対象領域203を特定した後の領域特定画像204である。貼り付け対象領域203は、FIG.6Aに示す参照画像202に含まれるワークW部分を抽出することによって特定されている。ワークW部分を抽出する手法は、従来から画像処理の技術分野で用いられている手法を適用可能である。FIG.6Bでは、貼り付け対象領域203をその他の領域と区別するために、2値化マスク画像とし、白部分が貼り付け対象領域203、黒部分がその他の領域としている。 After step SB7 or after step SB6 returns NO, the process proceeds to step SB8. At Step SB8, a pasting target area for pasting the extracted defective portion W1 is specified from the reference image. For example, FIG. Suppose a reference image 202 as shown in 6A is selected. This reference image 202 is a non-defective product image including a non-defective work W. FIG. FIG. 6B is an area identification image 204 after the pasting target area 203 has been identified. The pasting target area 203 is shown in FIG. It is specified by extracting the workpiece W portion included in the reference image 202 shown in 6A. As a method for extracting the workpiece W portion, a method conventionally used in the technical field of image processing can be applied. FIG. In 6B, in order to distinguish the pasting target area 203 from other areas, a binarized mask image is used, the white part is the pasting target area 203, and the black part is the other area.

その後、ステップSB9に進み、不良箇所W1を貼り付け対象領域203に貼り付けるときに後述するルールを適用するか否かを判定する。例えば、ルールの適用/非適用を選択するためのユーザーインターフェース画面を画像処理部13dが生成し、生成されたユーザーインターフェース画面を表示制御部13cが表示装置4に表示させる。ユーザは、マウス52等の操作により、ユーザーインターフェース画面上でルールの適用/非適用を選択する。画像処理部13dは、「適用」が選択されたことを検出すると、ステップSB10に進む一方、「非適用」が選択されたことを検出すると、ステップSB11に進む。 After that, the process proceeds to step SB9, and it is determined whether or not a rule to be described later is applied when the defective portion W1 is pasted on the pasting target area 203 or not. For example, the image processing unit 13d generates a user interface screen for selecting application/non-application of the rule, and the display control unit 13c causes the display device 4 to display the generated user interface screen. The user selects application/non-application of the rule on the user interface screen by operating the mouse 52 or the like. When the image processing unit 13d detects that "apply" has been selected, the process proceeds to step SB10. When detecting that "non-apply" has been selected, the image processing unit 13d proceeds to step SB11.

ステップSB10では、不良箇所W1を貼り付け対象領域203に貼り付けるときにルールを適用して貼り付ける貼り付け処理を実行する。ルールとは、例えば貼り付け対象領域203に不良箇所W1を貼り付けるといったルールを挙げることができ、例えば図7のFIG.7Aに示すような不良品画像200が選択され、ドーナツ状のワークWが検査対象であったとする。この場合、不良箇所W1は、ワークWの周方向のどこかに存在することは既知である。従って、図7のFIG.7B及び7Cに示すように、貼り付け対象領域203を特定した後の画像204上で、不良箇所W1をワークWの周方向に対応する方向移動させて貼り付ける。つまり、不良箇所W1の貼り付け位置について周方向の拘束(所定の拘束条件の例)を加える。 In step SB10, a pasting process is executed in which the defective part W1 is pasted to the pasting target area 203 by applying the rule. The rule can be, for example, a rule of pasting the defective part W1 in the pasting target area 203. For example, FIG. Assume that a defective product image 200 as shown in 7A is selected and a doughnut-shaped work W is to be inspected. In this case, it is known that the defective portion W1 exists somewhere in the workpiece W in the circumferential direction. Therefore, FIG. As shown in 7B and 7C, on the image 204 after the pasting target area 203 is specified, the defective portion W1 is moved in the direction corresponding to the circumferential direction of the workpiece W and pasted. That is, a circumferential constraint (an example of a predetermined constraint condition) is applied to the sticking position of the defective portion W1.

また、例えば図8のFIG.8Aに示すような不良品画像200が選択され、直線状のワークWが検査対象であったとする。この場合、不良箇所W1は、ワークWの長手方向のどこかに存在することは既知である。従って、図8のFIG.8B及び8Cに示すように、貼り付け対象領域203を特定した後の画像204上で、不良箇所W1をワークWの長手方向に対応する方向移動させて貼り付ける。つまり、不良箇所W1の貼り付け位置について長手方向の拘束(所定の拘束条件の例)を加える。 Also, for example, FIG. Assume that a defective product image 200 as shown in 8A is selected and a linear workpiece W is to be inspected. In this case, it is known that the defective portion W1 exists somewhere in the longitudinal direction of the workpiece W. As shown in FIG. Therefore, FIG. As shown in 8B and 8C, on the image 204 after the pasting target area 203 is specified, the defective portion W1 is moved in the direction corresponding to the longitudinal direction of the workpiece W and pasted. That is, a longitudinal constraint (an example of a predetermined constraint condition) is applied to the sticking position of the defective portion W1.

また、例えば図9のFIG.9Aに示すような不良品画像200が選択され、複雑な形状の環状ワークWが検査対象であったとする。この場合、不良箇所W1は、ワークWのどこかであるが、図7や図8に示す場合のように単純に特定するのは難しい。よって、例えば、ワークWの外周部のエッジと内周部のエッジとを検出してワークWを特定し、検出したエッジの法線方向を求めて不良箇所W1を法線方向に移動させて貼り付ける。 Also, for example, FIG. Assume that a defective product image 200 as shown in 9A is selected and an annular work W having a complicated shape is to be inspected. In this case, the defective spot W1 is somewhere on the workpiece W, but it is difficult to simply identify it as in the cases shown in FIGS. Therefore, for example, the workpiece W is identified by detecting the outer and inner edges of the workpiece W, the normal direction of the detected edges is obtained, and the defect spot W1 is moved in the normal direction and pasted. wear.

例えば図10のFIG.10Aに示すように、不良箇所W1を貼り付け対象領域203であるワークWに対応する部分に対して無作為に貼り付けてもよい。不良箇所W1を無作為に貼り付けると、図10のFIG.10Bに示すように、不良箇所W1の一部が貼り付け対象領域203であるワークWに対応する部分からはみ出ることが考えられるが、はみ出た部分は後述するトリミング処理でトリミングすればよい。 For example, FIG. As shown in 10A, the defective portion W1 may be randomly attached to a portion corresponding to the workpiece W, which is the attachment target area 203 . Randomly pasting the defective portion W1 results in FIG. As shown in 10B, it is conceivable that part of the defective portion W1 protrudes from the portion corresponding to the workpiece W, which is the pasting target area 203, but the protruding portion can be trimmed by the trimming process described later.

上記ステップSB9でルールを適用しないと判定されて進んだステップSB11では、ユーザが不良箇所W1を貼り付け対象領域203に貼り付ける。例えば、ユーザがマウス52等を操作して不良箇所W1の貼り付け位置を選択した後、貼り付け確定操作を行うことで、ユーザが所望する位置に不良箇所W1を貼り付けることができる。ステップSB11において、不良箇所W1を貼り付け対象領域203に対して無作為に貼り付けてもよい。 In step SB11, to which the rule has been determined not to be applied in step SB9, the user pastes the defective portion W1 onto the paste target area 203. FIG. For example, after the user operates the mouse 52 or the like to select the pasting position of the defective portion W1, the user can paste the defective portion W1 at a desired position by performing a paste confirming operation. In step SB11, the defective portion W1 may be randomly attached to the attachment target area 203. FIG.

不良箇所の貼り付け処理後、ステップSB12では、不良箇所W1の貼り付け対象領域203からはみ出た部分(図10のFIG.10Bに示す)をトリミングするトリミング処理を実行する。具体的には、画像処理部13dは、貼り付け対象領域203の大きさ、形状及び位置を示す情報を取得するとともに、貼り付けられた不良箇所W1の大きさ、形状及び位置を示す情報を取得する。取得した情報に基づいて、不良箇所W1の全体が貼り付け対象領域203の内方に位置するか否かを判定する。不良箇所W1の全体が貼り付け対象領域203の内方に位置する場合にはトリミング処理が不要と判定する。一方、不良箇所W1の一部が貼り付け対象領域203の外方に位置する場合には、その外方に位置する部分がはみ出た部分であるとし、当該部分をトリミングする。これにより、内部生成した不良品画像が実際のワークの不良状態を反映したものになるので、学習効率が向上する。 After the pasting process of the defective portion, in step SB12, a trimming process of trimming the part (shown in FIG. 10B of FIG. 10) protruding from the pasting target region 203 of the defective portion W1 is executed. Specifically, the image processing unit 13d acquires information indicating the size, shape, and position of the pasting target area 203, and acquires information indicating the size, shape, and position of the pasted defective portion W1. do. Based on the acquired information, it is determined whether or not the entire defective portion W1 is positioned inside the pasting target region 203 . If the entire defective portion W1 is positioned inside the pasting target region 203, it is determined that the trimming process is unnecessary. On the other hand, if a portion of the defective portion W1 is located outside the pasting target area 203, the portion located outside is regarded as a protruding portion, and is trimmed. As a result, the internally generated defective product image reflects the actual defective state of the workpiece, thereby improving the learning efficiency.

ステップSB13では、ステップSB10及びSB11の貼り付け処理で貼り付けられた不良箇所W1と参照画像202との境界を目立たなくする処理を画像処理部13dが実行する。すなわち、不良箇所W1を抽出した画像と、参照画像202とは異なる画像なので、不良箇所W1を参照画像202に貼り付けただけでは、不良箇所W1と参照画像202との境界が目立ってしまう場合がある。また、不良箇所W1が抽出された位置と、不良箇所W1を貼り付ける位置とは異なっているので、このことによっても不良箇所W1と参照画像202との境界が目立ってしまう場合がある。境界が目立ってしまうと、学習用の画像としては好ましくない。よって、ステップSB13のぼかし処理を実行する。目立たなくする処理としては、例えばぼかし処理等がある。 At step SB13, the image processing unit 13d executes a process of making the boundary between the defective portion W1 and the reference image 202 pasted in the pasting processes of steps SB10 and SB11 inconspicuous. That is, since the image from which the defective portion W1 is extracted is different from the reference image 202, the boundary between the defective portion W1 and the reference image 202 may be conspicuous simply by pasting the defective portion W1 onto the reference image 202. be. In addition, since the position where the defective portion W1 is extracted is different from the position where the defective portion W1 is pasted, the boundary between the defective portion W1 and the reference image 202 may be conspicuous. If the boundary is conspicuous, it is not preferable as an image for learning. Therefore, the blurring process of step SB13 is executed. For example, blurring processing or the like is used as the processing for making the image inconspicuous.

ぼかし処理としては、例えばGAN(敵対的生成ネットワーク)、Deep Image Harmonization、あるいはその他のルールベース処理等を挙げることができ、どのようなぼかし処理であってもよい。ぼかし処理は、いわゆるディープラーニングのHarmonize処理ともいう。ぼかし処理を実行することで、不良箇所W1の縁の部分が参照画像202にきれいになじむ。以上のようにして、画像処理部13dが新たな不良品画像を内部生成する。この内部生成処理が画像処理ステップである。内部生成された不良品画像は、例えば記憶装置19に記憶させておくことができる。 Blur processing may include, for example, GAN (Generative Adversarial Network), Deep Image Harmonization, or other rule-based processing, and any blur processing may be used. Blur processing is also called Harmonize processing of so-called deep learning. By executing the blurring process, the edge portion of the defective portion W1 blends nicely with the reference image 202 . As described above, the image processing unit 13d internally generates a new defective product image. This internal generation processing is the image processing step. The internally generated defective product image can be stored in the storage device 19, for example.

ステップSB10~SB13は複数回実行される。このとき、不良箇所W1の貼り付け位置が画像ごとに異なるようにする。これにより、不良箇所W1の貼り付け位置が互いに異なる複数の不良品画像を内部生成できる。また、画像変換が異なる不良箇所W1を参照画像に貼り付けるようにしてもよい。これにより、異なる不良箇所W1を有する複数の不良品画像を内部生成できる。 Steps SB10 to SB13 are executed multiple times. At this time, the pasting position of the defective portion W1 is made different for each image. Thereby, it is possible to internally generate a plurality of defective product images in which the pasting positions of the defective portion W1 are different from each other. Also, the defective portion W1 having a different image conversion may be pasted on the reference image. Thereby, it is possible to internally generate a plurality of defective product images having different defective parts W1.

ステップSB14では、内部生成された不良品画像を表示制御部13cが取得し、表示装置4に表示させる。具体的には、表示制御部13cは、内部生成された不良品画像を表示するためのユーザーインターフェース画面を生成する。ユーザーインターフェース画面には、内部生成された不良品画像を1枚または複数枚一覧表示可能な表示領域が設けられている。これにより、ユーザは内部生成された不良品画像を見て確認することができる。その結果、学習に使用しない方がよいと判断される不良品画像については学習に使用しないように設定できる。この設定は、ユーザーインターフェース画面上で、不良品画像ごとに設定可能になっている。「学習に使用しない」という情報も記憶装置19に記憶される。 At step SB14, the display control unit 13c acquires the internally generated defective product image and causes the display device 4 to display it. Specifically, the display control unit 13c generates a user interface screen for displaying the internally generated defective product image. The user interface screen is provided with a display area in which one or a plurality of internally generated defective product images can be displayed as a list. This allows the user to view and check the internally generated defective product image. As a result, it is possible to set such defective product images that should not be used for learning not to be used for learning. This setting can be set for each defective product image on the user interface screen. The information “not used for learning” is also stored in the storage device 19 .

ステップSB15では、画像処理部13dが生成した新たな不良品画像に、不良品のワークを撮影した不良品画像と区別するための識別情報を付与する。内部生成された不良品画像に識別用のフラグを付与し、その付与情報と共に不良品画像を記憶装置19に記憶しておく。 In step SB15, the new defective product image generated by the image processing unit 13d is provided with identification information for distinguishing it from the defective product image obtained by photographing the defective workpiece. An identification flag is added to the internally generated defective product image, and the defective product image is stored in the storage device 19 together with the added information.

以上のようにして図3のフローチャートのステップSA4が完了する。ステップSA6では、内部生成された不良品画像を学習に使用しないことの設定(除外設定)と、学習に使用する場合の重み付けを行う。 As described above, step SA4 in the flowchart of FIG. 3 is completed. At Step SA6, settings are made so that the internally generated defective product images are not used for learning (exclusion settings), and weighting is performed when they are used for learning.

例えば、内部生成された不良品画像を学習に使用する/使用しないを選択するためのユーザーインターフェース画面を学習部13eが生成し、生成されたユーザーインターフェース画面を表示制御部13cが表示装置4に表示させる。ユーザは、マウス52等の操作により、ユーザーインターフェース画面上で使用する/使用しないを選択する。この選択情報は例えばメモリ13b等に記憶される。 For example, the learning unit 13e generates a user interface screen for selecting whether or not to use the internally generated defective product image for learning, and the display control unit 13c displays the generated user interface screen on the display device 4. Let The user selects use/not use on the user interface screen by operating the mouse 52 or the like. This selection information is stored, for example, in the memory 13b.

また、このユーザーインターフェース画面では、内部生成された不良品画像を学習に使用する場合の重み付けの設定が行えるようになっている。内部生成された不良品画像は、実際に撮像された不良品画像とは異なっているので、学習に適しているとは言い難い場合も考えられる。このような場合には、図4に示すステップSB15で識別情報が付与された不良品画像による学習の重みを、不良品のワークを撮影した不良品画像による学習の重みに比べて軽くした方がよいことがある。重み付けは、ユーザが自由に設定することができ、内部生成された不良品画像による学習の重みと、不良品のワークを撮影した不良品画像による学習の重みとを同じにしてもよい。 Also, on this user interface screen, it is possible to set the weighting when using internally generated defective product images for learning. Since the internally generated defective product image is different from the actually captured defective product image, it may be difficult to say that it is suitable for learning. In such a case, it is better to make the learning weight by the defective product image to which the identification information is given in step SB15 shown in FIG. There is good news. The weighting can be freely set by the user, and the learning weight based on internally generated defective product images and the learning weight based on defective product images obtained by photographing defective workpieces may be made the same.

ステップSA7では、学習部13eが、記憶装置19に予め記憶された良品画像及び不良品画像と、画像処理部13dにより内部生成された不良品画像とを機械学習ネットワークに入力する。その後、ステップSA8に進んで、入力した画像を機械学習ネットワークに学習させて推論モデルを生成する。ステップSA7及びSA8は学習ステップである。 At step SA7, the learning unit 13e inputs the non-defective product image and the defective product image pre-stored in the storage device 19 and the defective product image internally generated by the image processing unit 13d to the machine learning network. Then, in step SA8, the input image is learned by a machine learning network to generate an inference model. Steps SA7 and SA8 are learning steps.

このとき、ステップSA6で設定された情報に基づいて学習を行う。例えば、内部生成された不良品画像を学習に使用するという設定がなされている場合には、上述したように内部生成された不良品画像も機械学習ネットワークに学習させるが、内部生成された不良品画像を学習に使用しないという設定がなされている場合には、内部生成された不良品画像を学習対象から除外して機械学習ネットワークに学習させない。例えば、不良品のワークを撮影した不良品画像が多く蓄積された段階で、内部生成された不良品画像を学習対象から除外できる。 At this time, learning is performed based on the information set in step SA6. For example, if the setting is to use internally generated defective product images for learning, the machine learning network is also trained with internally generated defective product images as described above. When the setting is made so that images are not used for learning, internally generated defective product images are excluded from learning targets and are not learned by the machine learning network. For example, at the stage when a large number of defective product images of defective workpieces have been accumulated, internally generated defective product images can be excluded from learning targets.

また、ステップSA6で設定された重み付けも機械学習ネットワークの学習に反映されるようになっており、内部生成された不良品画像による学習の重みを、不良品のワークを撮影した不良品画像による学習の重みに比べて軽くすることができる。 In addition, the weighting set in step SA6 is also reflected in the learning of the machine learning network. can be made lighter than the weight of

また、ステップSA3でNOと判定されて不良品画像を内部生成していない場合にはステップSA5に進む。ステップSA5では、記憶装置19に予め記憶された良品画像及び不良品画像を機械学習ネットワークに入力する。その後、ステップSA8に進んで、入力した画像を機械学習ネットワークに学習させて推論モデルを生成する。 If NO is determined in step SA3 and the defective product image is not internally generated, the process proceeds to step SA5. At step SA5, the non-defective product image and the defective product image pre-stored in the storage device 19 are input to the machine learning network. Then, in step SA8, the input image is learned by a machine learning network to generate an inference model.

ステップSA9は、学習が完了した推論モデルを構築するパラメータを記憶装置19に記憶する。 A step SA9 stores in the storage device 19 the parameters for constructing the inference model for which learning has been completed.

上記機械学習ネットワークの学習の手法は特に限定されないが、例えば次の方法を利用することができる。すなわち、Loss関数を最小化することで機械学習ネットワークの学習を行うことができる。Lossの定義は様々であるが、Mean Square Error(MSE)を例して挙げることができる。 Although the learning method of the machine learning network is not particularly limited, for example, the following method can be used. That is, the machine learning network can be learned by minimizing the Loss function. Although there are various definitions of Loss, Mean Square Error (MSE) can be cited as an example.

Figure 2023077058000002
Figure 2023077058000002

ここで、Tは目標異常度マップ、0は出力画像(異常度マップ)、nは画像Tが0の画素数、x、yは画素位置である。尚、Binary Cross EntropyなどのLoss関数も使用可能である。以上はあくまでも例示である。 Here, T is the target anomaly degree map, 0 is the output image (abnormality degree map), n is the number of 0 pixels in the image T, and x and y are the pixel positions. A Loss function such as Binary Cross Entropy can also be used. The above is just an example.

(外観検査装置1の運用時)
次に、外観検査装置1の運用時について、図11に示すフローチャートに基づいて説明する。スタート後のステップSC1では、プロセッサ13aが、記憶装置19に記憶されているパラメータ等を読み込んで学習済みの機械学習ネットワークを用意する。これが学習部13eにより生成された推論モデルである。ステップSC2では、検査対象のワークを撮像ユニット3で撮像してワーク画像を取得する。その後、ステップSC3に進み、ステップSC2で取得したワーク画像を推論モデルに入力する。
(During operation of appearance inspection device 1)
Next, operation of the visual inspection apparatus 1 will be described based on the flowchart shown in FIG. At step SC1 after the start, the processor 13a reads the parameters and the like stored in the storage device 19 to prepare a learned machine learning network. This is the inference model generated by the learning unit 13e. In step SC2, the image of the workpiece to be inspected is captured by the imaging unit 3 to acquire the workpiece image. After that, the process proceeds to step SC3, and the workpiece image acquired in step SC2 is input to the inference model.

次いで、ステップSC4では、推論モデルがステップSC3で入力されたワーク画像の推論処理を実行する。その後、ステップSC5では、推論モデルが推論処理の結果としてマップ画像を出力する。 Next, at step SC4, the inference model executes inference processing of the work image input at step SC3. Thereafter, at step SC5, the inference model outputs a map image as a result of inference processing.

しかる後、ステップSC6では、ステップSC5で出力されたマップ画像に基づいてワークの良否判定を行う。ステップSC2~SC6は、ワークが変わる都度、実行することができる。このフローチャートに示す処理は、検査部13fが実行する検査ステップに相当する。 After that, at step SC6, the quality of the workpiece is determined based on the map image output at step SC5. Steps SC2-SC6 can be executed each time the workpiece changes. The processing shown in this flowchart corresponds to the inspection step executed by the inspection unit 13f.

(実施形態の作用効果)
以上説明したように、この実施形態によれば、不良品のワークを撮影して取得された不良品画像から不良箇所を抽出することができる。抽出された不良箇所は参照画像に貼り付けられるので、不良箇所を有する不良品画像が新たに生成される。不良箇所の貼り付け位置を変えた複数の不良品画像や、不良箇所に対する画像変換を変えた複数の不良品画像を自動でかつ短時間で内部生成できる。新たに生成された不良品画像では、貼り付けられた不良箇所と参照画像との境界が目立たないようにぼかし処理を実行しているので、自然な不良品画像となる。
(Action and effect of the embodiment)
As described above, according to this embodiment, it is possible to extract a defective portion from a defective product image obtained by photographing a defective workpiece. Since the extracted defective portion is pasted on the reference image, a new defective product image having the defective portion is generated. A plurality of defective product images with different pasting positions of defective parts and a plurality of defective product images with different image conversions for defective parts can be automatically and internally generated in a short time. In the newly generated defective product image, blurring processing is performed so that the boundary between the pasted defective portion and the reference image is inconspicuous, so the defective product image becomes a natural defective product image.

新たな不良品画像と、記憶装置19に予め記憶された良品画像及び不良品画像とを機械学習ネットワークに学習させることで、不良品の検出能力の高い推論モデルが生成される。よって、外観検査性能を高めることができる。
はあらゆる点で単なる例示に過ぎず、限定的に解釈してはならない。さらに、特許請求の範囲の均等範囲に属する変形や変更は、全て本発明の範囲内のものである。
By having a machine learning network learn a new defective product image and non-defective product images and defective product images stored in advance in the storage device 19, an inference model with a high ability to detect defective products is generated. Therefore, appearance inspection performance can be improved.
is merely an example in all respects and should not be construed in a restrictive manner. Furthermore, all modifications and changes within the equivalent scope of claims are within the scope of the present invention.

以上説明したように、本発明は、ワークの外観を検査する場合に利用できる。 INDUSTRIAL APPLICABILITY As described above, the present invention can be used for inspecting the appearance of workpieces.

1 外観検査装置
4 表示装置(表示部)
13a プロセッサ
13b メモリ
13c 表示制御部
13d 画像処理部
13e 学習部
13f 検査部
1 visual inspection device 4 display device (display unit)
13a processor 13b memory 13c display control unit 13d image processing unit 13e learning unit 13f inspection unit

Claims (12)

機械学習ネットワークに検査対象のワークを撮影したワーク画像を入力し、入力された前記ワーク画像に基づいてワークの良否判定を行う外観検査装置であって、
良品に対応する良品画像と、不良品に対応する不良品画像とを記憶する記憶部と、
前記記憶部に予め記憶された前記不良品画像の不良箇所を抽出する抽出処理と、抽出処理で抽出された不良箇所を、ワークを含む参照画像に貼り付ける貼り付け処理と、貼り付け処理で貼り付けられた前記不良箇所と前記参照画像との境界を目立たなくする処理とを実行することにより、新たな不良品画像を生成する画像処理部と、
前記記憶部に予め記憶された良品画像及び不良品画像と、前記画像処理部により生成された新たな不良品画像とを機械学習ネットワークに学習させて推論モデルを生成する学習部と、
前記学習部により生成された推論モデルに検査対象のワークを撮影したワーク画像を入力し、入力された前記ワーク画像に基づいてワークの良否判定を行う検査部と、を備える外観検査装置。
A visual inspection apparatus for inputting a workpiece image obtained by photographing a workpiece to be inspected into a machine learning network and determining the quality of the workpiece based on the input workpiece image,
a storage unit for storing non-defective product images corresponding to non-defective products and defective product images corresponding to defective products;
an extraction process for extracting the defective part of the defective product image pre-stored in the storage unit, a pasting process for pasting the defective part extracted by the extraction process to a reference image including the workpiece, and pasting by the pasting process an image processing unit that generates a new defective product image by executing a process that obscures the boundary between the attached defective portion and the reference image;
a learning unit for generating an inference model by causing a machine learning network to learn non-defective product images and defective product images stored in advance in the storage unit and new defective product images generated by the image processing unit;
and an inspection unit that inputs a work image obtained by photographing a work to be inspected into the inference model generated by the learning unit, and performs quality determination of the work based on the input work image.
請求項1に記載の外観検査装置において、
前記画像処理部は、前記抽出処理において、前記記憶部に記憶されている不良品画像の特徴量を取得し、周囲の特徴量とは異なる特徴量を有する部位を前記不良箇所として抽出する外観検査装置。
In the visual inspection apparatus according to claim 1,
In the extraction process, the image processing unit acquires the feature amount of the defective product image stored in the storage unit, and extracts a part having a feature amount different from the surrounding feature amount as the defective part. Device.
請求項2に記載の外観検査装置において、
前記画像処理部は、前記抽出処理において、抽出した前記不良箇所の範囲の修正を受け付ける外観検査装置。
In the appearance inspection apparatus according to claim 2,
The visual inspection apparatus, wherein the image processing unit receives correction of the range of the extracted defective portion in the extraction process.
請求項1から3のいずれか1つに記載の外観検査装置において、
前記画像処理部は、前記抽出処理において、前記記憶部に記憶されている不良品画像の中からユーザによる前記不良箇所の選択操作を受け付け、受け付けた選択操作に基づいて前記不良箇所を抽出する外観検査装置。
In the visual inspection apparatus according to any one of claims 1 to 3,
In the extracting process, the image processing unit receives a user's selection operation of the defective part from among the defective product images stored in the storage unit, and extracts the defective part based on the received selection operation. inspection equipment.
請求項1から4のいずれか1つに記載の外観検査装置において、
前記画像処理部は、前記抽出処理で抽出された不良箇所に画像変換を施した状態で当該不良箇所を前記参照画像に貼り付ける外観検査装置。
In the visual inspection apparatus according to any one of claims 1 to 4,
The image processing unit is an appearance inspection device that pastes the defective portion extracted in the extraction process on the reference image in a state in which image conversion is performed on the defective portion.
請求項1から5のいずれか1つに記載の外観検査装置において、
前記画像処理部は、前記参照画像に含まれるワーク部分を、前記不良箇所の貼り付け対象領域として特定し、特定した前記貼り付け対象領域に前記不良箇所を貼り付け、前記不良箇所の貼り付け処理後、前記不良箇所の前記貼り付け対象領域からはみ出た部分をトリミングするトリミング処理を実行する外観検査装置。
In the visual inspection apparatus according to any one of claims 1 to 5,
The image processing unit identifies a workpiece portion included in the reference image as a pasting target area of the defective portion, pastes the defective portion onto the identified pasting target region, and pastes the defective portion. After that, the appearance inspection apparatus performs a trimming process for trimming the part of the defective portion protruding from the pasting target area.
請求項1から6のいずれか1つに記載の外観検査装置において、
前記画像処理部が生成した新たな不良品画像を表示部に表示させる表示制御部を更に備えている外観検査装置。
In the visual inspection apparatus according to any one of claims 1 to 6,
The visual inspection apparatus further comprising a display control unit that causes a display unit to display the new defective product image generated by the image processing unit.
請求項1から7のいずれか1つに記載の外観検査装置において、
前記画像処理部は、当該画像処理部が生成した新たな不良品画像に、不良品のワークを撮影した不良品画像と区別するための識別情報を付与する外観検査装置。
In the visual inspection apparatus according to any one of claims 1 to 7,
The image processing unit provides a new defective product image generated by the image processing unit with identification information for distinguishing it from a defective product image obtained by photographing a defective workpiece.
請求項8に記載の外観検査装置において、
前記学習部は、前記識別情報が付与された前記不良品画像を学習対象から除外して不良品学習が可能に構成されている外観検査装置。
In the appearance inspection device according to claim 8,
The visual inspection apparatus, wherein the learning unit is configured to be capable of performing defective product learning by excluding the defective product image to which the identification information is assigned from a learning object.
請求項8または9に記載の外観検査装置において、
前記学習部は、前記識別情報が付与された前記不良品画像による学習の重みを、不良品のワークを撮影した不良品画像による学習の重みに比べて軽くすることが可能に構成されている外観検査装置。
In the appearance inspection device according to claim 8 or 9,
The learning unit is configured such that the learning weight of the defective product image to which the identification information is assigned can be made lighter than the learning weight of the defective product image obtained by photographing the defective workpiece. inspection equipment.
請求項1から5のいずれか1つに記載の外観検査装置において、
前記画像処理部は、所定の拘束条件にしたがって、前記参照画像に含まれるワーク部分に対し、不良箇所を貼り付ける外観検査装置。
In the visual inspection apparatus according to any one of claims 1 to 5,
The image processing unit is a visual inspection device that affixes a defective portion to a work portion included in the reference image according to a predetermined constraint condition.
機械学習ネットワークに検査対象のワークを撮影したワーク画像を入力し、入力された前記ワーク画像に基づいてワークの良否判定を行う外観検査方法であって、
良品に対応する良品画像と、不良品に対応する不良品画像とを記憶する記憶ステップと、
前記記憶ステップで予め記憶された前記不良品画像の不良箇所を抽出する抽出処理と、抽出処理で抽出された不良箇所を、ワークを含む参照画像に貼り付ける貼り付け処理と、貼り付け処理で貼り付けられた前記不良箇所と前記参照画像との境界を目立たなくするぼかし処理とを実行することにより、新たな不良品画像を生成する画像処理ステップと、
前記記憶ステップで予め記憶された良品画像及び不良品画像と、前記画像処理ステップで生成された新たな不良品画像とを機械学習ネットワークに学習させて推論モデルを生成する学習ステップと、
前記学習ステップで生成された推論モデルに検査対象のワークを撮影したワーク画像を入力し、入力された前記ワーク画像に基づいてワークの良否判定を行う検査ステップと、を備える外観検査方法。
A visual inspection method for inputting a workpiece image obtained by photographing a workpiece to be inspected into a machine learning network and determining the quality of the workpiece based on the input workpiece image,
a storage step of storing a non-defective product image corresponding to a non-defective product and a defective product image corresponding to a defective product;
an extraction process for extracting a defective part of the defective product image stored in advance in the storage step; a pasting process for pasting the defective part extracted by the extracting process onto a reference image including a workpiece; an image processing step of generating a new defective product image by executing a blurring process that obscures the boundary between the attached defective portion and the reference image;
a learning step of generating an inference model by causing a machine learning network to learn the non-defective product image and the defective product image stored in advance in the storage step and the new defective product image generated in the image processing step;
and an inspection step of inputting a work image obtained by photographing a work to be inspected into the inference model generated in the learning step, and determining the quality of the work based on the input work image.
JP2021190178A 2021-11-24 2021-11-24 Appearance inspection device and appearance inspection method Pending JP2023077058A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2021190178A JP2023077058A (en) 2021-11-24 2021-11-24 Appearance inspection device and appearance inspection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2021190178A JP2023077058A (en) 2021-11-24 2021-11-24 Appearance inspection device and appearance inspection method

Publications (1)

Publication Number Publication Date
JP2023077058A true JP2023077058A (en) 2023-06-05

Family

ID=86610399

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2021190178A Pending JP2023077058A (en) 2021-11-24 2021-11-24 Appearance inspection device and appearance inspection method

Country Status (1)

Country Link
JP (1) JP2023077058A (en)

Similar Documents

Publication Publication Date Title
JP6681844B2 (en) Remote visual inspection image capture system and method
JP2020187657A (en) Image inspection device
CN110675346A (en) Image acquisition and depth map enhancement method and device suitable for Kinect
JP6102749B2 (en) Information processing apparatus, imaging control method, program, digital microscope system, display control apparatus, display control method, and program
JP2005283577A (en) Inspection system and method for providing feedback
JP2014109479A (en) Image processing apparatus, image processing method, and computer program
JP2023077054A (en) Appearance inspection device and appearance inspection method
JP2010263423A (en) Method and device for processing image
JP2020187656A (en) Image inspection device
JP2020016471A (en) Image inspection device
JP2023077058A (en) Appearance inspection device and appearance inspection method
US8736706B1 (en) Method and system for generating high resolution composite images
JP2007013231A (en) Device, method and program for compensating shading of image
JP2011076224A (en) Device, system, method, and program for information processing
WO2019235223A1 (en) Image processing device, image processing method, and image processing program
JP2013229706A (en) Image acquisition apparatus, image acquisition method, and image acquisition program
JP2010175281A (en) Apparatus for forming image of appearance surface
JP2011109507A (en) Apparatus and program for processing image
JP2023077059A (en) Appearance inspection device and appearance inspection method
JP2019047418A (en) Information processing apparatus, information processing method, computer program
EP2595113B1 (en) Image processing apparatus and image processing method
JP4470659B2 (en) Model registration method for parts inspection and inspection data creation apparatus using this method
JP2023077056A (en) Appearance inspection device and appearance inspection method
JP2006234718A (en) X-ray inspecting apparatus
JP2021140270A (en) Image processing apparatus, control method of image processing apparatus, and program