Image processing device and image processing method

The image processing device enhances the accuracy of machine learning models for industrial product inspection by automating the retraining process based on non-defective and defective image evaluations, addressing the challenge of insufficient defective image collection and user burden.

JP2024126356APending Publication Date: 2024-09-20KEYENCE CORP
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
JP2023034675
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing machine learning models for industrial product inspection face challenges in achieving high accuracy for defective product classification due to the difficulty in collecting sufficient defective product images, leading to increased user burden and inefficiency in model training.

Method used

An image processing device that evaluates the accuracy of a machine learning model by inputting verification images and automatically determines if retraining is necessary, using both non-defective and defective product images to enhance model precision, and reduces user burden by automating the annotation and retraining process.

Benefits of technology

The solution significantly improves the accuracy of classification processing while minimizing the user's workload by automating the retraining process and reducing the need for manual intervention in model refinement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024126356000001
    Figure 2024126356000001
Patent Text Reader

Abstract

To sufficiently improve accuracy of classification of a machine learning model while reducing a burden on a user.SOLUTION: A processor is configured to: execute determination processing by inputting a plurality of validation images to a machine learning model which has been trained with images belonging to a first class; evaluate whether re-training of the machine learning model is necessary on the basis of results of evaluating the accuracy of determination of the validation images; and input, when it is evaluated that the re-training of the machine learning model is necessary, images belonging to a second class to the machine learning model for re-training, or completes training of the machine learning model when it is evaluated that the re-training of the machine learning model is unnecessary.SELECTED DRAWING: Figure 8
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to an image processing device and an image processing method that include a processor that executes image processing using a machine learning model. [Background technology]

[0002] For example, when performing visual inspection of industrial products, there is known a device configured to execute classification processing to determine whether the product belongs to a good or bad group using a machine learning model (see, for example, Patent Document 1). The processing device of Patent Document 1 generates a good product learning model and a bad product learning model separately, and executes pass / fail judgment based on the result obtained by inputting product data acquired by an imaging unit into the good product learning model and the result obtained by inputting the product data into the bad product learning model. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] JP 2019-204321 A Summary of the Invention [Problem to be solved by the invention]

[0004] Meanwhile, the learning methods for machine learning models can be broadly divided into good product learning (unsupervised learning), in which the machine learning model is trained on only good product images, and defective product learning (supervised learning), in which the machine learning model is trained on not only good product images but also defective product images.

[0005] In comparison with defective product learning, good product learning is relatively easy to collect learning data, but judgment accuracy tends to be low. On the other hand, defective product learning tends to have high judgment accuracy, but it is difficult to collect a sufficient number of defective product images and has a problem of low response to unknown defects.

[0006] In this regard, in Patent Document 1, pass / fail judgment is performed based on the results obtained by inputting product data into a good product learning model and the results obtained by inputting the product data into a defective product learning model. However, this places a heavy burden on the user, as learning is required for both the good product learning model and the defective product learning model.

[0007] The present disclosure has been made in consideration of these points, and its purpose is to sufficiently improve the accuracy of classification processing of machine learning models while reducing the burden on users. [Means for solving the problem]

[0008] In order to achieve the above object, the present embodiment may be based on an image processing device including a processor that inputs an image into a machine learning model and executes a determination process for determining whether the image belongs to a first class or a second class. The processor trains the machine learning model with an image belonging to the first class to generate a machine learning model that determines an image having a feature different from that of the image belonging to the first class as an image belonging to the second class, inputs a plurality of verification images into the machine learning model trained with the image belonging to the first class, and executes a determination process for determining whether the plurality of verification images belong to the first class or the second class. The processor evaluates the accuracy of the determination process for the plurality of verification images, evaluates whether re-learning of the machine learning model is necessary based on the result of evaluating the accuracy of the determination process for the plurality of verification images, and if it is evaluated that re-learning of the machine learning model is necessary, inputs an image belonging to the second class into the machine learning model and re-learns it, and generates the machine learning model so as to determine an image having a feature similar to that of the image belonging to the second class as an image belonging to the second class, and if it is evaluated that re-learning of the machine learning model is unnecessary, completes the learning process of the machine learning model.

[0009] According to this configuration, after the machine learning model is trained by an image belonging to the first class, a plurality of verification images are input to the machine learning model and a judgment process is executed to judge whether the image belongs to the first class or the second class, thereby making it possible to verify the machine learning model. If the accuracy of the judgment process obtained by the verification is insufficient, an image belonging to the second class is input to the machine learning model and re-trained. On the other hand, if the accuracy of the judgment process obtained by the verification is sufficient and re-training of the machine learning model is not necessary, the learning process of the machine learning model is completed. In short, according to this configuration, if the machine learning model can obtain a desired accuracy by learning only images belonging to the first class, the machine learning model trained only with images belonging to the first class is operated, and if the desired accuracy cannot be obtained by learning only images belonging to the first class, the machine learning model trained only with images belonging to the second class is re-trained to obtain the desired accuracy. Since the image processing device executes an evaluation of whether re-training of the machine learning model is necessary and a judgment of whether re-training is performed using images belonging to the second class, the burden on the user is reduced.

[0010] Furthermore, the images belonging to the first class may be good product images obtained by capturing images of good products, and the images belonging to the second class may be defective product images obtained by capturing images of defective products. In this case, the processor can extract the defective product images as images to be re-learned, generate a display screen for receiving designation of defective parts in the defective product images from a user, display the display screen on a display unit, re-learn the defective product images in which the defective parts have been identified via the display screen into the machine learning model, and generate the machine learning model so as to determine an image having characteristics similar to those of the defective parts as an image belonging to the second class.

[0011] According to this configuration, when a machine learning model is retrained on a defective product image in which defective parts have been identified, i.e., annotated defective product images, defective product images with relatively high learning effects are extracted, and a display screen that accepts annotations for the images is automatically generated by the processor, so that the user only needs to annotate the presented defective product images, further reducing the burden on the user.

[0012] The processor can also identify characteristic parts of the defective product image extracted for re-learning the machine learning model that are different from the trained good product image, and display a display screen including an image in which the identified parts are highlighted on the display unit. That is, the accuracy of the judgment process is improved by training the machine learning model to be able to judge as defective parts parts that the machine learning model should have judged as defective parts but did not judge as defective parts. As a method of highlighting, for example, a heat map display can be given, and by supporting annotation with the heat map display, the burden on the user can be further reduced.

[0013] Furthermore, when the processor evaluates that re-learning of the machine learning model is necessary, it can automatically extract defective product images that are relatively likely to result in an incorrect judgment result from among the multiple verification images, and automatically cause the machine learning model to re-learn. Defective product images that are relatively likely to result in an incorrect judgment result are defective product images with a low degree of defect, and efficient learning can be performed by using such defective product images.

[0014] Furthermore, when the processor evaluates that re-learning of the machine learning model is necessary, it can automatically calculate the number of defective product images to be used for re-learning based on the evaluation result of the accuracy of the judgment process, extract the number of defective product images that are relatively likely to result in an incorrect judgment result from the multiple verification images, and automatically re-learn the machine learning model with the number of defective product images. In other words, the image processing device automatically determines the number of images to be added when re-learning according to the accuracy of the judgment result, thereby reducing the workload of the user.

[0015] The processor may also extract the calculated number of defective product images in descending order of the relative likelihood that the judgment result is incorrect, and automatically re-learn the machine learning model. In other words, the number of defective product images to be used for re-learning is not only automatically calculated, but also the criteria for selecting the calculated number of defective product images can be left to the image processing device, thereby reducing the workload of the user.

[0016] Furthermore, when the processor evaluates that re-learning of the machine learning model is necessary, the processor can generate the machine learning model by re-learning defective product images and non-defective product images, so as to determine features similar to the defective product images and features different from the non-defective product images as defective parts. This makes it possible to learn the features of defective parts by learning defective product images, while also improving the accuracy of the boundary when determining whether a product is a non-defective product by learning non-defective product images.

[0017] The processor can also determine the number of good images and defective images to be used for re-learning the machine learning model based on the misclassification rate for good images and the misclassification rate for defective images. This allows the image processing device to automatically determine how many good images and how many defective images should be learned, further reducing the burden on the user.

[0018] The processor can also calculate an evaluation value indicating the degree of defect for each of the plurality of verification images. In this case, if it is evaluated that re-learning of the machine learning model is necessary, the processor can automatically determine whether the machine learning model should learn a pass / fail image or a defective image by comparing the evaluation value of the good image with the evaluation value of the defective image.

[0019] In addition, the processor can automatically decide to terminate the learning process of the machine learning model when it is evaluated that the accuracy of the judgment process of the machine learning model has achieved a specified accuracy, thereby eliminating the need for the user to decide to terminate the learning process.

[0020] The processor can automatically generate a display screen for displaying a numerical value indicating the accuracy of the judgment process of the machine learning model or a graph indicating the accuracy of the judgment process of the machine learning model, and display the display screen on the display unit, thereby making it possible to present the accuracy of the judgment process acquired by the learning process to a user.

[0021] The display screen may also include the number of good product images and the number of defective product images that have been trained by the machine learning model, as well as the number of incorrectly determined images among the plurality of verification images. Effect of the Invention

[0022] As described above, it is possible to evaluate whether or not retraining of the machine learning model trained with images belonging to the first class is necessary, and if retraining is necessary, it is possible to retrain the machine learning model with images belonging to the second class. This makes it possible to sufficiently improve the accuracy of the classification process of the machine learning model while reducing the burden on the user. [Brief description of the drawings]

[0023] [Figure 1] 1 is a schematic diagram illustrating a configuration of an image processing device according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a block diagram showing a hardware configuration of the image processing device. [Diagram 3] FIG. 13 is a diagram illustrating an example of processing a work image using a machine learning model. [Figure 4] 13 is a flowchart showing a first example of step 1 of the automatic learning process. [Diagram 5] FIG. 13 is a diagram showing an example of a user interface screen for displaying an image. [Figure 6] FIG. 13 is a diagram showing an example of a user interface screen for displaying a learning result after a first learning session has been completed. [Figure 7] FIG. 7 is a diagram equivalent to FIG. 6 and showing the state after the second learning has been completed. [Figure 8] FIG. 7 is a diagram equivalent to FIG. 6 and showing the state after the third learning has been completed. [Figure 9] 13 is a flowchart showing a first example of step 2 of the automatic learning process. [Figure 10] 13 is a flowchart showing a second example of step 1 of the automatic learning process. [Figure 11] 13 is a flowchart showing a second example of step 2 of the automatic learning process. [Figure 12] 13 is a flowchart showing an example of defective product learning. [Figure 13] FIG. 13 is a diagram showing an example of an annotation screen. [Figure 14] FIG. 13 is a diagram showing an example of a learning progress display screen. [Figure 15] FIG. 13 is a diagram showing an example of a learning result display area in the case of three-class classification. [Figure 16] 13 is a flowchart showing an example of automatic learning in the case of three-class classification. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0024] Hereinafter, the embodiments of the present invention will be described in detail with reference to the drawings. Note that the following description of the preferred embodiments is merely illustrative in nature and is not intended to limit the present invention, its applications, or its uses.

[0025] 1 is a schematic diagram showing the configuration of an image processing device 1 according to an embodiment of the present invention. The image processing device 1 is a device for determining the quality of a work image acquired by imaging a workpiece to be inspected, such as various parts or products, and can be used in production sites such as factories. Specifically, a machine learning model is constructed inside the image processing device 1, and this machine learning model is generated by learning a plurality of learning images.

[0026] 2, the image processing device 1 includes a control unit 2 which is the main body of the device, 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 the display device 4.

[0027] 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 image processing device 1, but any two or more of these can be combined and integrated. 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. In addition, the control unit 2 can be divided into a plurality of units and some of them can be incorporated into the imaging unit 3 or 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 the other units. By using the image processing device 1, all the steps of the image processing method according to the present invention can be executed.

[0028] (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 performs acquisition of a workpiece image. The camera module 14 includes an AF motor 14a that drives the imaging optical system, and an imaging board 14b. The AF motor 14a is a part that performs automatic focus adjustment by driving the lens of the imaging optical system, and can perform focus adjustment by a method such as contrast autofocus that has been well known in the past. The imaging board 14b includes a CMOS sensor 14c as a light receiving element that receives light incident from the imaging optical system. The CMOS sensor 14c is an imaging sensor configured to be able to acquire a color image. Instead of the CMOS sensor 14c, a light receiving element such as a CCD sensor can be used.

[0029] The lighting module 15 includes an LED (light-emitting diode) 15a as a light-emitting body that illuminates an imaging area including a workpiece, and an LED driver 15b that controls the LED 15a. The timing, duration, and amount of light emitted by the LED 15a can be arbitrarily controlled by the LED driver 15b. The LED 15a may be provided integrally with the imaging unit 3, or may be provided separately from the imaging unit 3 as an external lighting unit.

[0030] (Configuration of display device 4) The display device 4 has a display panel formed of, for example, a liquid crystal panel or an organic EL panel, and is controlled by a processor 13c of the control unit 2 described later. A work image, a user interface image, and the like output from the control unit 2 are displayed on the display device 4. In addition, if the personal computer 5 has a display panel, the display panel of the personal computer 5 can be used in place of the display device 4.

[0031] (operation equipment) Examples of operation devices for a user to operate the image processing device 1 include, but are not limited to, the keyboard 51 and mouse 52 of the personal computer 5, and may be any device configured to be able to accept various operations by the user. For example, a pointing device such as the touch panel 41 of the display device 4 is also included in the operation devices.

[0032] User operations on the keyboard 51 and mouse 52 can be detected by the control unit 2. The touch panel 41 is a conventionally known touch-type operation panel equipped with, for example, a pressure sensor, and user touch operations can be detected by the control unit 2. The same applies when other pointing devices are used.

[0033] (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 board 13 is provided with a display control unit 13a, an input unit 13b, and a processor 13c. The display control unit 13a and the input unit 13b can be configured, for example, by a processing device mounted on the main board 13. The display control unit 13a, the input unit 13b, and the processor 13c may be configured by one processing device, or the display control unit 13a, the input unit 13b, and the processor 13c may be configured by separate processing devices.

[0034] The display control unit 13a, the input unit 13b, and the processor 13c control the operation of each connected board and module. For example, the processor 13c outputs a lighting control signal that controls turning on / off the LED 15a to the LED driver 15b of the lighting module 15. The LED driver 15b switches the LED 15a on / off and adjusts the lighting time according to the lighting control signal from the processor 13c, and adjusts the light amount of the LED 15a.

[0035] Moreover, the processor 13c outputs an imaging control signal to control the CMOS sensor 14c to the imaging board 14b of the camera module 14. The CMOS sensor 14c starts imaging in response to the imaging control signal from the processor 13c, and adjusts the exposure time to an arbitrary time to perform imaging. That is, the imaging unit 3 images the field of view of the CMOS sensor 14c in response to the imaging control signal output from the processor 13c, and if a workpiece is present within the field of view, the workpiece is imaged. However, if an object other than the workpiece is present within the field of view, the object can also be imaged. For example, the image processing device 1 can capture a good product image corresponding to a good product and a defective product image corresponding to a defective product by the imaging unit 3 as learning images for a machine learning model. The learning images do not have to be images captured by the imaging unit 3, and may be images captured by other cameras or the like.

[0036] On the other hand, when the image processing device 1 is in operation, the workpiece can be imaged by the imaging unit 3. The CMOS sensor 14c is configured to be able to output a live image, that is, a currently captured image, at any time at a short frame rate.

[0037] When the CMOS sensor 14c finishes capturing an image, the image signal output from the imaging unit 3 is input to the processor 13c of the main board 13 for processing, and is stored in the memory 13d of the main board 13. Specific details of the processing by the processor 13c of the main board 13 will be described later. The main board 13 may be provided with a processing device such as an FPGA or a DSP. Alternatively, the processor 13c may be an integrated device such as an FPGA or a DSP.

[0038] The connector board 16 is a part that receives power 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 module, and specifically distributes power to the lighting module 15, the camera module 14, the main board 13, and the communication board 17. The power supply board 18 includes an AF motor driver 181. The AF motor driver 181 supplies driving power to the AF motor 14a of the camera module 14 to realize autofocus. The AF motor driver 181 adjusts the power supplied to the AF motor 14a in response to an AF control signal from the processor 13c of the main board 13.

[0039] 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, and communication between the main board 13 and an external control device (not shown). An example of the external control device is a programmable logic controller. The communication may be wired or wireless, and either form of communication can be realized by a conventionally known communication module.

[0040] The control unit 2 is provided with a storage device (storage unit) 19 consisting of, for example, a solid state drive, a hard disk drive, or the like. The storage device 19 stores a program file 80, a setting file, and the like (software) for enabling the hardware to execute each control and process described below. The program file 80 and the setting file can be stored in a storage medium 90 such as an optical disk, and the program file 80 and the setting file stored in the 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 also store, for example, the image data and parameters for constructing a machine learning model of the image processing device 1.

[0041] (When image processing device 1 is in operation) When the image processing device 1 is operated, the processor 13c reads the parameters stored in the storage device 19, and constructs a trained machine learning model. As shown in FIG. 3, the machine learning model includes a neural network, an autoencoder, an SVM (support vector machine), and the like. The processor 13c inputs a workpiece image obtained by capturing an image of a workpiece to be inspected to the neural network constructed as described above. This is a pre-stage process. When the workpiece image is input to the neural network, the neural network performs feature extraction, and the extracted feature amount is input to an autoencoder and / or a support vector machine that executes a post-stage process. The neural network that performs feature extraction in the pre-stage process may be a convolutional neural network that has been trained in advance, or may be a convolutional neural network that is configured to be able to additionally learn using automatic learning, which will be described later. In addition, in the machine learning model shown in FIG. 3, a configuration may be adopted in which a plurality of feature amounts (feature maps) with different scales are extracted from a plurality of layers of the convolutional neural network, and the plurality of feature amounts are each input to an autoencoder and / or a support vector machine.

[0042] The autoencoder generates and outputs an anomaly map (heat map) based on the input feature amount. The processor 13c executes a determination process to determine whether the workpiece image belongs to the first class or the second class based on the anomaly map output from the autoencoder. For example, the first class can be a good product class, and an image belonging to the first class can be a good product image obtained by capturing an image of a good product, and the second class can be a defective product class, and an image belonging to the second class can be a defective product image obtained by capturing an image of a defective product.

[0043] On the other hand, the support vector machine executes a classification process for classifying the workpiece image into a plurality of classes based on the input feature amount. The plurality of classes includes the first class and the second class, and this enables the processor 13c to classify the workpiece image into a non-defective class and a defective class. The plurality of classes may include a third class, a fourth class, etc., and the number of classes is not particularly limited.

[0044] The machine learning model according to this embodiment is not limited to an autoencoder or an SVM, and other machine learning models may be used.

[0045] The processor 13c of the image processing device 1 executes the above judgment process and classification process, thereby making it possible to determine whether the workpiece is a good or defective product. The image processing device 1 having such functions can also be called an appearance inspection device or the like, since it can inspect the appearance of the workpiece. The workpiece to be inspected by the image processing device 1 may be the entire workpiece, or only a part of the workpiece. Furthermore, one workpiece may include multiple inspection objects. Furthermore, a workpiece image may include multiple workpieces.

[0046] (Automatic learning) In order to train a machine learning model, multiple learning images are input to the machine learning model. Although a user can prepare learning images, it is difficult for the user to accurately determine which images should be input to the machine learning model for training, and this often results in trial and error. In addition, it is difficult to determine the appropriate number of learning images used to generate a machine learning model that classifies good and defective products, because too many learning images are undesirable in terms of long learning time and overlearning, while too few images result in reduced generalization performance. Furthermore, it is desirable not only to classify good and defective products, but also to have a large difference between the evaluation value when judging a product as good and the evaluation value when judging a product as defective. In short, when selecting learning images, various requirements must be met, and so far, experts with abundant know-how have selected learning images based on that know-how, or, in the absence of know-how, a large number of images have been used for training to improve performance, despite the risk of overlearning. For this reason, it has been difficult for an inexperienced person to generate a machine learning model with high classification and judgment accuracy. In addition, in the past, the person who generates the machine learning model selected the learning image, so there was a problem that the accuracy of the generated machine learning model differed depending on the person who selected the learning image. For this reason, it was difficult for an inexperienced person to generate a machine learning model with high accuracy of classification processing and judgment processing. In addition, in the past, the person who generates the machine learning model selected the learning image, so there was a problem that the accuracy of the generated machine learning model differed depending on the person who selected the learning image. The image processing device 1 of the present embodiment can perform an automatic learning process that enables even an inexperienced person to automatically generate a machine learning model with high accuracy of classification processing and judgment processing, similar to an expert, while reducing the burden. An example of the automatic learning process will be described below.

[0047] The automatic learning process can be roughly divided into two steps, and is composed of step 1 and step 2. In step 1, a machine learning model is generated that classifies a good product and a defective product, or judges whether the product belongs to a good product class or a defective product class, by only good product learning. In this specification, the classification of an input image into a good product class or a defective product class can also be called a pass / fail judgment. In step 2, when a good product and a defective product can be classified or judged in step 1, the difference between an evaluation value when judging the product as a good product and an evaluation value when judging the product as a defective product is enlarged by defective product learning. In addition, in step 2, when a good product and a defective product cannot be classified or judged in step 1, a machine learning model is generated that classifies or judges a good product and a defective product by defective product learning, and the difference between an evaluation value when judging the product as a good product and an evaluation value when judging the product as a defective product is enlarged. In addition, in the case of supervised learning, step 1 is omitted and only step 2 is executed.

[0048] (First example of step 1) FIG. 4 is a flowchart showing an example of step 1 of the automatic learning process. Before starting the automatic learning process, a user prepares a plurality of learning images. The learning images include good product images that have been identified as good products and defective product images that have been identified as defective products. Since the first class is a good product class and the second class is a defective product class, the good product images can be called first class images to which a label indicating the first class has been added, and the defective product images can be called second class images to which a label indicating the second class has been added.

[0049] A plurality of images of both good and defective products are prepared. Although only good images may be used as learning images, both good and defective images are required as verification images for verifying the accuracy of the machine learning model, so the user needs to prepare both images. In addition, in order to evaluate the generalization performance of the machine learning model generated by the automatic learning process, a plurality of evaluation images different from the learning images and the verification images may be prepared. The evaluation images are images for testing whether the machine learning model generated using the learning images and the verification images can correctly perform classification processing on the evaluation images, which are unknown images. If the machine learning model erroneously classifies the evaluation images, the user can determine that the reliability of the machine learning model is low.

[0050] A good product label is assigned to the good product image, and a bad product label is assigned to the bad product image. The user assigns the good product label and the bad product label to each image. The user saves the learning images, the verification images, and the evaluation images in a specified folder. The verification images may or may not include the learning images.

[0051] In step SA1, a non-defective image is registered as a learning image for training the machine learning model. The number of learning images to be registered may be one or more. In step SA1, the processor 13c generates an image display user interface screen 100 shown in FIG. 5 and displays it on the display device 4. The image display user interface screen 100 is provided with an image addition button 101, a learning image display area 102 in which learning images are displayed in thumbnail format, and a verification image display area 103 in which verification images are displayed in thumbnail format. When the user operates the mouse 52 to press the image addition button 101, the processor 13c generates a folder selection window (not shown) and displays it on the display device 4. When the user selects the above-mentioned predetermined folder in the folder selection window, all learning images in the folder are read as learning images and displayed in the learning image display area 102. If the read learning images include a non-defective image belonging to a non-defective class and a defective image belonging to a defective class, only the non-defective image is selected as an image to be used for learning in step SA1. This selection operation can be performed, for example, by the user operating the mouse 52, and the selected learning image is registered as an image to be input to the machine learning model. When registering multiple learning images, it is preferable to select images with low similarity to each other. The learning image may be registered by the user as described above, or may be automatically registered by the processor 13c. For example, the processor 13c may automatically select and register the image displayed first in the file, or may automatically select and register based on the update date. Note that a defective product image can also be registered as a learning image in step SA1. In this case, the process proceeds to automatic learning in step 2 described later.

[0052] After the learning images are registered, the process proceeds to step SA2. An automatic learning button 113 for starting automatic learning is provided on the image display user interface screen 100, and when the user operates the mouse 52 to press the automatic learning button 113, the processor 13c starts automatic learning. Specifically, the processor 13c inputs the learning images registered in step SA1 into a machine learning model to execute learning. This is a learning step in which the machine learning model learns the learning images. By performing the learning step using the non-defective images, a machine learning model is generated that determines an image having characteristics different from that of a non-defective image belonging to a non-defective class as a defective image belonging to a defective class.

[0053] After the learning step, the processor 13c inputs a plurality of verification images to the machine learning model trained in the learning step, and executes a classification process to classify the plurality of verification images into a good product class and a defective product class. At this time, the processor 13c also inputs a plurality of verification images to the machine learning model trained in the learning step, and executes a determination process to determine whether the plurality of verification images belong to a good product class or a defective product class. This is the verification step. In the verification step, the processor 13c can obtain a degree of separation between the good product class and the defective product class by the classification process of the plurality of verification images.

[0054] In the verification step, the processor 13c generates a user interface screen 150 for displaying a learning result as shown in FIG. 6 and displays it on the display device 4. The user interface screen 150 for displaying a learning result is provided with a first learning result display area 151 for displaying the learning result of the machine learning model obtained in the first verification step, and a verification in progress display area 152 for displaying the fact that verification is in progress together with the elapsed time from the start of learning. The user interface screen 150 for displaying a learning stop button 153 is also provided, and when the user operates the learning stop button 153, the processor 13c forcibly ends the learning of the machine learning model even if it is in the middle. Furthermore, the user interface screen 150 for displaying a learning result of the machine learning model obtained in the second verification step and a region 154B for displaying the learning result of the machine learning model obtained in the third verification step are shown.

[0055] The first learning result display area 151 is provided with an image number display area 151a that displays the number of learning images used in the first learning and the number of verification images used in the verification step, a Pareto chart display area 151b, and an inference result display area 151c.

[0056] The Pareto chart display area 151b displays a Pareto chart generated by the processor 13c. The Pareto chart is a separation graph showing the degree of separation between a good class and a defective class, and is also a graph showing the accuracy of the judgment process of the machine learning model. The horizontal axis of this graph is the score (first evaluation axis), and the vertical axis is the cumulative number of images. The larger the score, the higher the degree of belonging to the defective class, and conversely, the smaller the score, the higher the degree of belonging to the good class. The score can also be called a first evaluation value indicating the degree of belonging to the good class. That is, in the classification process of classifying a plurality of verification images into a good class and a defective class, the processor 13c calculates a first evaluation value indicating the degree of belonging to the good class for each of the plurality of verification images. In addition, since the score is also an evaluation value indicating the degree of defect as described above, the processor 13c can also calculate an evaluation value indicating the degree of defect for each of the plurality of verification images, and this evaluation value can also be called a second evaluation value indicating the degree of belonging to the defective class.

[0057] In the inference result display area 151c, the inference result by the machine learning model verified in the verification step is displayed in a table format. The table displayed in the inference result display area 151c is also called a confusion matrix, and displays the number of good images and the number of defective images of the verification images, as well as the number of good images and the number of defective images inferred by the machine learning model. The processor 13c calculates an erroneous determination rate indicating the ratio of good images detected as defective images and an oversight rate indicating the ratio of defective images determined as good images, and displays them in the inference result display area 151c. The processor 13c also calculates the difference between the scores of good and defective products, and displays them in the inference result display area 151c. In the examples shown in FIG. 6 to FIG. 8, the verification images for each round also include learning images used for learning the machine learning model.

[0058] Next, the process proceeds to step SA3 in the flow chart shown in FIG. 4. Step SA3 is a step for judging whether or not the good-quality image and the defective-quality image have been separated in the verification step of step SA2 according to a predetermined criterion, and evaluates the accuracy of the classification process of the verification image and the judgment process of the verification image. That is, the score calculated in step SA2 is a numerical value indicating the degree of defect in the verification image, for example, the size of a defect. In step SA3, the processor 13c calculates the difference between the maximum score (degree of defect: high) when the product is judged to be good and the minimum score (degree of defect: low) when the product is judged to be defective, and judges whether or not this difference is equal to or greater than a predetermined numerical value. If the difference is equal to or greater than the predetermined numerical value, it is judged that the good-quality image and the defective-quality image have been separated, whereas if the difference is less than the predetermined numerical value, it is judged that the good-quality image and the defective-quality image have not been separated.

[0059] If it is determined in step SA3 that the good-quality images and the defective-quality images have been separated, the process proceeds to step SA7, where it is determined whether or not the setting is set to execute only step 1. That is, the user can set whether to execute automatic learning in a first mode in which automatic learning ends only at step 1, or in a second mode in which both step 1 and step 2 are executed. This user setting is accepted by the input unit 13b. If the setting is set to execute only step 1, automatic learning ends. On the other hand, if the setting is set to execute both step 1 and step 2, the process proceeds to the flowchart of step 2 shown in FIG. 9.

[0060] If it is determined in step SA3 that the good images and the bad images have not been separated, the process proceeds to step SA4. In step SA4, the processor 13c determines whether or not there is one or more good images remaining in the images for verification. If there is one or more good images remaining in the images for verification, the process proceeds to step SA5. In step SA5, it is determined whether or not there is a good image that has been erroneously detected in the images for verification.

[0061] If there is no erroneously detected good image in the verification image in step SA5, proceed to step SA6. In step SA6, the processor 13c judges whether there is a good image with a higher score than the erroneously determined defective image in the verification image. If there is no good image with a higher score than the erroneously determined defective image in step SA6, proceed to step SA7.

[0062] If there is a non-defective image that has been erroneously detected in the verification images in step SA5, the process proceeds to step SA8. In step SA8, the processor 13c extracts n non-defective images that have been erroneously detected from the verification images in order of the highest score. n is an integer equal to or greater than 1, and therefore the number of non-defective images extracted in step SA8 may be one, or two or more. The number of images extracted in step SA8 may be the number described in a second example below.

[0063] After extracting n quality images in descending order of score in step SA8, the process proceeds to step SA2, where the n quality images extracted in step SA8 are input to the machine learning model for automatic re-learning. At this time, the processor 13c may perform so-called data augmentation, such as rotating the image or changing the brightness of the image. For example, the processor 13c automatically generates an image in which the brightness of the image extracted in step SA8 is changed by 5%, and inputs the image to the machine learning model for learning. If the learning effect is low, the processor 13c also generates an image in which the brightness is changed by 10% stepwise or dynamically, and inputs the image to the machine learning model for learning.

[0064] If there is a good product image with a higher score than the defective product image erroneously determined in step SA6, the process proceeds to step SA9. In step SA9, n good product images with a higher score than the defective product image erroneously determined are extracted in ascending order of score. n is an integer equal to or greater than 1, and therefore the good product images extracted in step SA9 may be one or two or more. In this way, the processor 13c compares the scores, which are the evaluation values ​​of the good product images of the multiple verification images, with the scores, which are the evaluation values ​​of the defective product images, and automatically determines, based on the comparison result, whether to extract a good product image with a relatively high evaluation value or a defective product image with a relatively low evaluation value as an image to be re-learned by the machine learning model.

[0065] Although there is an idea of ​​extracting defective product images with low scores from among the images of defective products that have been erroneously judged to be defective, since the purpose of image inspection is to detect non-defective products, learning of good products is continued as long as possible in order to clarify the range of good products. If defective product learning were to be performed, a large number of defective product images would be required to clarify the boundary between good products and defective products, but since there are few defective products in the first place, there is also the problem that it is difficult to prepare a large number of defective product images.

[0066] After extracting n quality images in ascending order of score in step SA9, the process proceeds to step SA2, where the n quality images extracted in step SA9 are input to a machine learning model for automatic re-learning. At this time, the processor 13c may perform so-called data augmentation, such as rotating the image or changing the brightness of the image.

[0067] In step SA2, a plurality of verification images are input to the re-learned machine learning model, and a classification process is performed to classify the plurality of verification images into the plurality of classes. Then, steps SA3 to SA7, and steps SA8 and SA9 as necessary are performed.

[0068] FIG. 7 shows a user interface screen 150 for displaying a learning result in which a second learning result display area 154 for displaying the learning result of the machine learning model obtained in the second verification step is displayed after the second learning (first re-learning) is completed. The second learning result display area 154 is generated and displayed by the processor 13c, similar to the first learning result display area 151. The second learning result display area 154 includes an image number display area 154a for displaying the number of learning images used in the second learning and the number of verification images used in the verification step, a Pareto chart display area 154b showing the degree of separation obtained in the second verification step, and an inference result display area 154c obtained in the second verification step. As shown in FIG. 7, an area 154B for displaying the learning result of the machine learning model obtained in the third verification step is shown.

[0069] FIG. 8 shows a user interface screen 150 for displaying a learning result in which a third learning result display area 155 for displaying the learning result of the machine learning model obtained in the third verification step is displayed after the third learning (second re-learning) is completed. The third learning result display area 155 is generated and displayed by the processor 13c in the same manner as the first learning result display area 151. The third learning result display area 155 includes an image number display area 155a for displaying the number of learning images used in the third learning and the number of verification images used in the verification step, a Pareto chart display area 155b for displaying the degree of separation obtained in the third verification step, and an inference result display area 155c obtained in the third verification step. Each time the processor 13c repeatedly executes re-learning of the machine learning model, the processor 13c updates the separation graph shown as the Pareto chart to the separation graph obtained by the machine learning model after re-learning. As shown in FIG. 7 and FIG. 8, the processor 13c can generate a user interface screen 150 for displaying a learning result on the display device 4 as a display screen for displaying the latest separation graph obtained by updating so as to be comparable with past separation graphs.

[0070] The training images are duplicated each time. For example, if the number of training images for the second time is four, those four training images are included in the five training images for the third time. In other words, training images are added each time the number of training times increases.

[0071] As shown in FIG. 8, as the number of learning times increases, the difference between the scores of good and defective products increases, and the separation between good and defective images becomes clear. In the machine learning model that has completed the third learning, the separation between good and defective images and the determination of whether the image belongs to a good class or a defective class can be clearly performed, so the automatic learning is terminated at the time of completion of the third learning. In this way, until it is determined that the re-learning of the machine learning model is unnecessary, the processor 13c automatically repeats the following steps: a classification process for classifying multiple validation images using the learned machine learning model; an evaluation of the accuracy of the classification process; an evaluation of whether the re-learning of the machine learning model is necessary; and, when it is determined that the re-learning of the machine learning model is necessary, a process for extracting validation images that are relatively likely to have an incorrect classification result from among the multiple validation images and automatically re-learning the validation images to the machine learning model. As a result, the accuracy of the machine learning model is improved, and the progress is presented to the user as shown in FIG. 8.

[0072] In addition, after obtaining the degree of separation between the good class and the defective class by the verification step of step SA2, by going through steps SA3 to SA6, processor 13c evaluates the accuracy of the classification process of the multiple verification images based on the degree of separation between the good class and the defective class obtained in step SA2, and further evaluates whether or not re-learning of the machine learning model is necessary based on the evaluation result of the accuracy of the classification process of the multiple verification images. If processor 13c evaluates that re-learning of the machine learning model is necessary, it extracts verification images that are relatively likely to have erroneous classification results from the multiple verification images and automatically causes the machine learning model to re-learn them, whereas if it evaluates that re-learning of the machine learning model is unnecessary, it completes the learning process of the machine learning model.

[0073] When the processor 13c evaluates that the machine learning model needs to be retrained, the processor 13c extracts defective images with a relatively high first evaluation value or non-defective images with a relatively low first evaluation value, and automatically causes the machine learning model to retrain the defective images. The processor 13c also extracts non-defective images with a relatively high evaluation value indicating the degree of defect, or non-defective images with a relatively low evaluation value indicating the degree of defect, and automatically causes the machine learning model to retrain the defective images. Then, as shown in FIG. 8, the processor 13c obtains a degree of separation between the distribution of non-defective images and defective images on the horizontal axis (first evaluation value) of the Pareto diagram. The processor 13c automatically repeats a classification process of classifying a plurality of validation images using the trained machine learning model, an evaluation of the accuracy of the classification process, an evaluation of whether or not the machine learning model needs to be retrained, and a process of extracting validation images with a relatively high possibility of being erroneous from the plurality of validation images when it is evaluated that the machine learning model needs to be retrained, and automatically causing the machine learning model to retrain the validation images. The processor 13c executes this repetitive process until the degree of separation between the distribution of non-defective images and defective images on the horizontal axis of the Pareto chart becomes equal to or greater than a predetermined value. The criteria for evaluating that relearning of the machine learning model is unnecessary are not limited to the specifications determined by the degree of separation described above. In other words, assuming a case where the degree of separation does not become equal to or greater than a predetermined value, it may be evaluated that relearning of the machine learning model is unnecessary when the number of times or the time required to repeatedly execute the above process reaches a number or time specified in advance by the user, or a number or time specified in advance on the device side. It may be evaluated whether or not relearning is unnecessary based on a criterion that appropriately combines the above-mentioned degree of separation and the number or time.

[0074] Furthermore, when multiple evaluation images are prepared, the processor 13c may evaluate that relearning of the machine learning model is unnecessary, and after completing the learning process of the machine learning model, input multiple evaluation images different from the multiple learning images and the multiple verification images to the machine learning model, execute a classification process to classify the multiple evaluation images into multiple classes (non-defective class or defective class), and evaluate the accuracy of the classification process. The processor 13c may display the accuracy rate on the display device 4 as the accuracy of the classification process of the multiple evaluation images.

[0075] Furthermore, when the processor 13c calculates a second evaluation value indicating the degree of belonging to the defective class for each of the multiple verification images, when the processor 13c evaluates that re-learning of the machine learning model is necessary, the processor 13c extracts a non-defective image having a relatively high second evaluation value or a defective image having a relatively low second evaluation value, and automatically causes the machine learning model to re-learn the non-defective image or the defective image having a relatively low second evaluation value. The processor 13c then calculates the degree of separation between the distributions of the non-defective images and the defective images on the second evaluation value axis, and automatically repeats the following steps until the processor 13c evaluates that re-learning of the machine learning model is unnecessary based on the degree of separation: a classification process of classifying the multiple verification images using the trained machine learning model; an evaluation of the accuracy of the classification process; an evaluation of whether or not re-learning of the machine learning model is necessary; and a process of extracting a verification image having a relatively high possibility of being erroneously classified from the multiple verification images when it is evaluated that re-learning of the machine learning model is necessary, and automatically causing the machine learning model to re-learn the non-defective image or the defective image.

[0076] (First example of step 2) Next, the process of step 2 will be described with reference to the flowchart shown in FIG. 9. In step SB1, the good class and the defective class are compared in the Pareto diagram, and the image with the gentler gradient is added. For example, the processor 13c calculates the difference in score between the highest-scoring image and the second-highest-scoring image among the images classified in the good class, and calculates the difference in score between the lowest-scoring image and the second-lowest-scoring image among the images classified in the defective class. If the difference between these two scores is the same, the processor 13c calculates the difference in score between the highest-scoring image and the third-highest-scoring image among the images classified in the good class, and calculates the difference in score between the lowest-scoring image and the third-lowest-scoring image among the images classified in the defective class.

[0077] In step SB2, processor 13c determines which of the two scores calculated in step SB1 is larger. If the difference in the scores of the images classified as the non-defective class is larger, the process proceeds to step SB3. If the difference in the scores of the images classified as the defective class is larger, the process proceeds to step SB4.

[0078] In step SB3, the processor 13c adds up to n good images in the verification images in order from the image with the highest score. In step SB4, the processor 13c adds up to n defective images in the verification images in order from the image with the lowest score. After steps SB3 and SB4, the process proceeds to step SB5.

[0079] In step SB5, the processor 13c judges whether the number of sheets added in step SB3 or step SB4 is greater than 0. If the judgment in step SB5 is YES, the process proceeds to step SB6, where the processor 13c executes re-learning in the same manner as in step SA2 of the flowchart shown in FIG. 4, performs verification using verification images, and generates a Pareto diagram. Note that, if the process proceeds to step SB6 via step SB4, the processor 13c inputs an image belonging to a defective class to the machine learning model for re-learning, and generates a machine learning model so as to determine an image having similar characteristics to an image belonging to the defective class as an image belonging to the defective class. Thereafter, the process proceeds to step SB7, where it is judged whether a termination condition is satisfied. The termination condition will be described in a second example of step 2 to be described later.

[0080] (Step 1, second example) FIG. 10 is a flowchart showing a second example of step 1 of the automatic learning process. In step SC1, the processor 13c sets the count number to 0. In step SC2, the processor 13c determines whether additional learning is ON. For example, when the image processing device 1 starts operating and an image of a workpiece is captured, a new workpiece image can be collected. When a new workpiece image is collected, a process of adding a learning image by retaining each label related to the classification of the existing learning image and verification image used for learning the machine learning model in operation and adding a new image acquired after the start of operation to the existing learning image (additional learning process) and a process of initializing each label related to the classification of the existing learning image and verification image used for learning the machine learning model in operation and learning the machine learning model with all images including the new image acquired after the start of operation (all image learning process) can be selected. There are good product labels attached to good product images and defective product labels attached to defective product images. If the accuracy of the machine learning model in operation is high, you can add work images without initializing it. If the accuracy is low, however, initializing it and letting it learn from scratch may result in higher accuracy. It is possible to use either method depending on the situation.

[0081] The image display user interface screen 100 shown in Fig. 5 is provided with a selection area 104 for selecting whether or not to enable additional learning processing. When the user operates the mouse 52 to check the selection area 104, the processor 13c executes the additional learning processing. On the other hand, when the selection area 104 is not checked, the processor 13c executes all-image learning processing. Whether to select additional learning processing or all-image learning processing is determined by the input unit 13b accepting the operation of the mouse 52 by the user, and the processor 13c determines this. In other words, the image processing device 1 is configured to be capable of accepting the user's selection of additional learning processing or all-image learning processing.

[0082] If step SC2 is determined as NO and additional learning processing is not selected, the process proceeds to step SC3. In step SC3, the processor 13c initializes each label related to the classification of the existing learning images and verification images. In step SC4, the processor 13c registers only one good image as a learning image. At this time, the good image located at the top may be selected and registered, or another good image may be registered.

[0083] In steps SC5 and SC6, the processes of steps SA2 and SA3 in the flowchart shown in Fig. 4 are executed, respectively. If it is determined in step SC6 that the non-defective product images and the defective product images can be separated, the accuracy of the determination process is sufficiently high and a predetermined accuracy is obtained, and in this case, this flow is terminated. That is, when it is evaluated that the accuracy of the determination process of the machine learning model has obtained a predetermined accuracy, the processor 13c automatically determines to terminate the learning process of the machine learning model.

[0084] When the processor 13c determines to end the learning process of the machine learning model, the processor 13c automatically generates a Pareto chart graph in the learning result display user interface screen 150 shown in Fig. 6 to Fig. 8 and displays it on the display device 4. When the processor 13c determines to end the learning process of the machine learning model, the processor 13c automatically generates a numerical value indicating the accuracy of the judgment process of the machine learning model, for example, the difference in scores between a good product and a defective product, and displays it on the display device 4. This makes it possible to present to the user the accuracy of the judgment process that has been acquired when the learning process is ended.

[0085] 6 to 8, the learning result display user interface screen 150 includes image number display areas 151a, 154a, and 155a that display the number of good images and the number of defective images trained by the machine learning model, and inference result display areas 151c, 154c, and 155c that display the number of erroneous judgments for a plurality of verification images. This makes it possible to present the number of learning images and the number of erroneous judgments to the user.

[0086] If it is determined in step SC6 that the good-quality images and the defective-quality images have not been separated, the process proceeds to step SC7. In step SC7, the processor 13c registers the good-quality image with the highest score among the verification images as a learning image. Then, the process proceeds to step SC8, where the same process as in step SC5 is executed.

[0087] In step SC9, the processor 13c judges whether the total number of non-defective images is a predetermined number (e.g., 20) or less, or whether the setting is set to execute only step 1. If the total number of non-defective images exceeds the predetermined number, the process proceeds to step SC10, and if the setting is set to execute steps 1 and 2, the process proceeds to step SC10. On the other hand, if the total number of non-defective images is a predetermined number or less, the process proceeds to step SC11, and if the setting is set to execute only step 1, the process proceeds to step SC11.

[0088] In step SC10, the processor 13c judges whether the total number of learning images is equal to or greater than half of the non-defective images. If the total number of learning images is equal to or greater than half of the non-defective images, the process proceeds to step SC12. In step SC12, similar to step SA7 in the flowchart shown in FIG. 4, the process judges whether or not the process is set to execute only step 1. If the process is set to execute only step 1, the automatic learning is terminated. On the other hand, if the process is set to execute both step 1 and step 2, the process proceeds to the flowchart of step 2 shown in FIG. 11.

[0089] If it is determined in step SC10 that the total number of learning images is less than half the number of non-defective images, the process proceeds to step SC11. In step SC11, it is determined whether or not the non-defective images and the defective images have been separated according to a predetermined criterion, similar to step SA3 in the flowchart shown in Fig. 4. If it is determined in step SA3 that the non-defective images and the defective images have been separated, the automatic learning is automatically terminated.

[0090] If it is determined in step SC11 that the good-quality images and the defective-quality images have not been separated, the process proceeds to step SC13. In step SC13, the processor 13c determines whether the count number is smaller than a predetermined value (e.g., 5). If the count number is equal to or greater than the predetermined value, the process proceeds to step SC12, whereas if the count number is smaller than the predetermined value, the process proceeds to step SC14.

[0091] In steps SC14 and SC15, the same judgment is made as in steps SA4 and SA5 in the flowchart shown in Fig. 4. If the judgment in step SC14 is NO, proceed to step SC12. If the judgment in step SC15 is NO, proceed to step SC16. If the judgment in step SC15 is YES and there is a good image among the verification images that has been erroneously detected, proceed to step SC17. In step SC17, the erroneous judgment rate is calculated. The erroneous judgment rate is the erroneous judgment rate for good images of multiple verification images, and can be calculated using the following formula.

[0092] False positive rate = (number of good images judged as defective among the validation and learning images / total number of good images) x 100

[0093] After calculating the misjudgment rate in step SC17, the process proceeds to step SC18. In step SC18, n good images that have been erroneously detected are extracted from the verification images in the order of the scores, similar to step SA8 in the flowchart shown in FIG. 4. The number of images to be extracted may be changed according to the misjudgment rate. For example, the number of images to be extracted in step SC18 can be set to increase as the misjudgment rate increases. The number of images to be extracted in step SC18 can also be determined by a ratio, such as a number equivalent to 5%, 10%, or 15% of all good images. In this way, the processor 13c determines the number of good images to be used for re-learning the machine learning model based on the misjudgment rates of good images for a plurality of verification images.

[0094] In step SC18, n quality images are extracted in descending order of score, and then the process proceeds to step SC8, where the n quality images extracted in step SC18 are input to a machine learning model for automatic re-learning.

[0095] If the determination in step SC16 is YES, the process proceeds to step SC19, where the oversight rate is calculated. The oversight rate is the rate of erroneous determination of defective product images among a plurality of verification images, and can be calculated by the following formula.

[0096] Missing rate = (number of defective images judged as good images among the verification images and learning images / total number of defective images) x 100

[0097] After calculating the oversight rate in step SC19, the process proceeds to step SC20. In step SC20, n images of good images having higher scores than the erroneously determined defective images are extracted in ascending order of scores, similar to step SA9 in the flowchart shown in FIG. 4. The number of images to be extracted may be changed according to the oversight rate. For example, the number of images to be extracted in step SC20 may be set to increase as the oversight rate increases. The number of images to be extracted in step SC20 may also be determined by a ratio, such as a number of images corresponding to 5%, 10%, or 15% of all good images. In this way, the processor 13c determines the number of defective images to be used for re-learning the machine learning model based on the oversight rate, which is the erroneous determination rate for defective images of a plurality of verification images. The number of images to be extracted in step SC20 may be set to be greater than the number of images to be extracted in step SC18.

[0098] After step SC20, the process proceeds to step SC21, where the processor 13c adds 1 to the count number. This count number is used in the judgment of the next step SC13. If re-learning is performed multiple times by going through steps SC16 to SC20 multiple times, the judgment in step SC13 is NO, the process proceeds to step SC12, and the above step 2 is started. In other words, if the processor 13c evaluates that further re-learning of the machine learning model is necessary after repeating re-learning using non-defective images multiple times, the above step 2 is automatically executed. Note that the processor 13c may end the learning at only step 1, or the user may be allowed to move to the above step 2 at any timing.

[0099] After step SC21, the process proceeds to step SC8, where the n defective product images extracted in step SC20 are input to the machine learning model for automatic re-learning.

[0100] In this way, when the processor 13c evaluates in step SC15 that re-learning of the machine learning model is necessary, in steps SC18 and SC20, the processor 13c automatically calculates the number of verification images to be used for re-learning based on the evaluation result of the accuracy of the classification process, and extracts the calculated number of verification images that are relatively likely to be erroneous from among the multiple verification images. After extracting the verification images that are relatively likely to be erroneous, the processor 13c can automatically re-learn the machine learning model with that number of verification images. This reduces the burden on the user.

[0101] (Second example of step 2) FIG. 11 is a flowchart showing a second example of step 2 of the automatic learning process. In steps SD1 and SD2, the same processes as in steps SB1 and SB2 in the flowchart shown in FIG. 9 are executed. If the difference in scores of the images classified into the non-defective class is larger, the process proceeds to step SD3. In step SD3, non-defective images are extracted according to a predetermined criterion. Specifically, the processor 13c first identifies the image with the highest score among the non-defective images in the verification images. Then, the processor 13c calculates a score by subtracting 10% of the score of the identified image. Thereafter, the processor 13c adds non-defective images having scores equal to or higher than the calculated score up to the maximum number that can be added (for example, 5 images).

[0102] In step SD4, the processor 13c determines whether or not the number of non-defective images added in step SD3 is one or more. If the number of non-defective images added in step SD3 is one or more, the process proceeds to step SD5, where the processor 13c executes re-learning in the same manner as in step SB6 of the flowchart shown in Fig. 9, performs verification using verification images, and generates a Pareto chart. On the other hand, if the number of non-defective images added in step SD3 is zero, re-learning cannot be performed, and the process proceeds to step SD6 without passing through step SD5.

[0103] In step SD6, processor 13c determines whether the number of defective images in the verification images is 1 or whether the number of good images in the verification images is 0. If the result of the determination in step SD6 is that the number of defective images in the verification images is 1, learning is automatically terminated, and if the number of good images in the verification images is 0, learning is automatically terminated. On the other hand, if the result of the determination in step SD6 is that the number of defective images in the verification images is other than 1, the process proceeds to step SD7, and if the number of good images in the verification images is 1 or more, the process proceeds to step SD7.

[0104] In step SD7, the process of step SA3 in the flowchart shown in Fig. 4 is executed. If it is determined in step SD7 that the good product images and the defective product images have been separated, learning is automatically terminated. If it is determined in step SD7 that the good product images and the defective product images have not been separated, the process proceeds to step SD8. In step SD8, the processor 13c extracts one image with the lowest score from among the defective product images in the verification images.

[0105] In step SD9, it is determined whether or not the number of defective product images added in step SD8 is one or more. If the number of defective product images added in step SD8 is one or more, the process proceeds to step SD10, where defective product learning, which will be described later, is executed.

[0106] If the number of defective images added in step SD8 is 0, the process proceeds to step SD11, where a judgment similar to that in step SD6 is made. If the result of the judgment in step SD11 is that the number of defective images in the verification images is 1, learning is automatically terminated, and if the number of good images in the verification images is 0, learning is automatically terminated. On the other hand, if the result of the judgment in step SD11 is that the number of defective images in the verification images is a number other than 1, the process proceeds to step SD12, and if the number of good images in the verification images is 1 or more, the process proceeds to step SD12. In step SD12, the same process as in step SD7 is performed.

[0107] If the result of the determination in step SD2 is that the difference in the scores of the images classified into the defective class is greater, the process proceeds to step SD13. In step SD13, defective images are extracted according to a predetermined criterion. Specifically, the processor 13c first identifies the image with the lowest score among the defective images in the verification images. Next, the processor 13c calculates a score by adding 10% of the score of the identified image. Thereafter, the processor 13c extracts defective images having scores equal to or lower than the calculated score up to the maximum number of addable images (e.g., 5 images). However, if there are 5 or fewer defective images in the verification images, not all of them are used for defective learning, and only one is left.

[0108] In step SD14, the processor 13c judges whether or not the number of defective product images extracted in step SD13 is one or more. If the number of defective product images extracted in step SD13 is one or more, the process proceeds to step SD15 and executes defective product learning, which will be described later. On the other hand, if the number of defective product images extracted in step SD13 is zero, the process proceeds to step SD16 without going through step SD15.

[0109] In steps SD16 and SD17, the same determinations as in steps SD6 and SD7 are made, respectively. In the subsequent step SD18, the processor 13c adds one image having the highest score among the non-defective images of the verification images.

[0110] In step SD19, it is determined whether or not the number of non-defective images added in step SD18 is one or more. If the number of non-defective images added in step SD18 is one or more, the process proceeds to step SD20, where the same process as in step SD5 is executed.

[0111] If the number of non-defective images added in step SD18 is 0, the process proceeds to step SD20, where the same process as in step SD5 is executed, and then the process proceeds to steps SD11 and SD12.

[0112] 11, when the processor 13c evaluates that re-learning of the machine learning model is necessary, the processor 13c not only causes the machine learning model to learn defective product images in steps SD10 and SD15, but also causes the machine learning model to re-learn non-defective product images in steps SD5 and SD20. This makes it possible to generate a machine learning model that determines, as defective parts, features similar to the defective product images learned in the machine learning model in steps SD10 and SD15 and features different from the non-defective product images learned in steps SD5 and SD20.

[0113] Furthermore, by following the flowchart shown in FIG. 11, when the processor 13c judges in the judgment process of determining which class the image belongs to that the machine learning model needs to be re-learned, the processor 13c automatically judges whether the machine learning model should learn a good / bad image or a defective image by comparing the evaluation value of the good product image with the evaluation value of the defective product image, and allows the machine learning model to learn the image with the better learning effect.

[0114] (Defective product learning) Fig. 12 is a flowchart showing an example of defective product learning. This flow is executed in steps SD10 and SD15 of the flowchart shown in Fig. 11, and steps SE1 to SE3 are repeated the number of times corresponding to the number of extracted defective product images.

[0115] In step SE1, it is determined whether or not the user has selected area designation for the defective product image in step 2, that is, whether or not the user is to designate a defective portion for the defective product image (whether or not to annotate). If the user has selected area designation, the process proceeds to step SE2, where the input unit 13b accepts the annotation operation by the user.

[0116] Specifically, the processor 13c extracts a defective product image from among the multiple verification images as an image to be retrained by the machine learning model, and then generates an annotation screen 200 shown in Fig. 13 as a display screen for accepting designation of defective parts in the defective product image from a user, and displays the annotation screen 200 on the display device 4. The display of the annotation screen 200 is automatically executed when the process proceeds to step SE2.

[0117] The annotation screen 200 is provided with an input image display area 201 in which an input image input to a machine learning model is displayed, a heat map display area 202 in which a heat map output from the machine learning model is displayed, and an area designation unit 203. The input image displayed in the input image display area 201 corresponds to the heat map displayed in the heat map display area 202, and the scale of the input image and the heat map are the same, and the same area is displayed. As shown in the figure, a user interface that can display the input image and the heat map side by side makes it easier to grasp the corresponding parts of the two. Note that the heat map display area 202 may be omitted, and may be displayed as needed.

[0118] A heat map is an image in which characteristic parts different from a good product image are emphasized more than other parts by differences in color and brightness. That is, the processor 13c can identify characteristic parts of a defective product image extracted from a plurality of verification images for re-learning the machine learning model that are different from the good product image that has already been trained, and then generate an annotation screen 200 including a heat map as an image in which the identified different characteristic parts of the extracted defective product image are emphasized, and display the annotation screen 200 on the display device 4.

[0119] The input image displayed in the input image display area 201 is a defective product image extracted from a plurality of verification images for re-learning the machine learning model. However, it may not be possible to grasp which area the machine learning model is reacting to only with the input image displayed in the input image display area 201. In this example, a heat map that highlights the identified different characteristic parts is also displayed at the same time, so that the user can grasp the area that the machine learning model is reacting to as a defective part and the strength of the reaction by looking at the heat map.

[0120] In the area designation unit 203, it is possible to designate a plurality of areas, for example, "area 0", "area 1", "area 2", "area 3", etc. When designating the mask area as "area 0", it is possible to select the shape of the area to be designated. The shape can be, for example, a rectangle, a circle, a polygon, etc., and the user can select it by operating the mouse 52 or the like. The selected shape is accepted by the input unit 13b, and the processor 13c superimposes and displays a frame 204 of the same shape as the selected shape on the input image and the heat map, respectively.

[0121] The frame 204 is for specifying a defective portion. The position, size, angle, aspect ratio, etc. of the frame 204 can be changed by the user by operating the mouse 52 or the like. The user can specify the area surrounded by the frame 204 as the defective portion by moving the frame 204 so as to surround the defective portion or by changing the size of the frame 204. Both the frame 204 on the input image and the frame 204 on the heat map can be operated, and when the frame 204 on the input image is operated, the operation is reflected in the frame 204 on the heat map, so that the two frames 204 have the same size and are arranged at the same position. When the frame 204 on the heat map is operated, the operation is reflected in the frame 204 on the input image.

[0122] In order to increase the score difference between good and defective products, multiple defective product images may be required. If multiple defective product images are required, they can be displayed in order and annotations can be made for each defective product image in turn. For example, when annotation is performed with the first defective product image displayed and is completed, the second defective product image is automatically displayed and is ready to accept annotations.

[0123] The designation of the defective portion is accepted by the input unit 13b. When the designation of the defective portion is accepted by the input unit 13b, the processor 13c identifies the area surrounded by the frame 204 as the defective portion, and stores it in, for example, the storage device 19. In step SE3, the processor 13c adds the defective product image in which the defective portion has been identified via the annotation screen 200 to the learning images. In step SE4, the machine learning model is retrained to generate a machine learning model so as to determine an image having characteristics similar to the defective portion as an image belonging to a defective class.

[0124] The processor 13c is configured to be able to resume re-learning of the machine learning model in response to a user instruction even after the learning process of the machine learning model is completed. For example, a learning execution button 105 is provided on the user interface screen 150 for displaying learning results shown in Fig. 5. The operation of the learning execution button 105 by the user is a user instruction to resume re-learning of the machine learning model, and this user instruction is accepted by the processor 13c.

[0125] When the processor 13c receives an instruction to retrain the machine learning model, the processor 13c inputs a new verification image, which is different from the existing verification image, into the machine learning model and executes a process of classifying the new verification image into multiple classes. For example, after the image processing device 1 starts operating, multiple work images can be acquired, and these work images can become new verification images. The processor 13c evaluates the accuracy of the classification process based on the degree of separation of multiple classes obtained by the classification process for the new verification image, and when it is evaluated that retraining of the machine learning model is necessary based on the evaluation result of the accuracy of the classification process, it extracts verification images that are likely to be erroneous from the new verification images and automatically retrains them in the machine learning model, while when it is evaluated that retraining of the machine learning model is unnecessary, it completes the learning process of the machine learning model. As a result, even if a new image is acquired after the learning process has been completed, the existing machine learning model can be retrained by a user instruction, so that the accuracy of the machine learning model can be continuously improved.

[0126] (Learning model selection function) The accuracy of the machine learning model changes by repeatedly executing re-learning of the machine learning model. FIG. 6 shows the accuracy of the machine learning model after the first learning, and as the number of learning times increases to the second and third times, the accuracy of the machine learning model improves as shown in FIG. 8. Taking the time when the third learning is completed as a reference, the third learning is the most recent re-learning, and the separation graph obtained in the most recent re-learning is displayed in the Pareto chart display area 155b in FIG. 8. The learning stages before the learning stage in which the most recent separation graph was obtained are the first learning stage and the second learning stage, and the separation graph obtained in the first learning stage and the separation graph obtained in the second learning stage are past separation graphs when the separation graph obtained in the third learning is taken as a reference. That is, the processor 13c generates a learning result display user interface screen 150 shown in FIG. 7 or FIG. 8 as a display screen that displays the most recent separation graph obtained by repeatedly executing re-learning of the machine learning model and the past separation graph obtained in the learning stage before the learning stage in which the most recent separation graph was obtained in a comparative manner, and displays it on the display device 4. Although FIG. 8 shows only the first three learning rounds, the number of learning rounds is not particularly limited, and learning can be repeated until a desired accuracy is obtained.

[0127] 14 shows an example of a learning progress display screen 250 for presenting the progress of the accuracy of a machine learning model. The learning progress display screen 250 can be incorporated into the learning result display user interface screen 150 shown in FIGS. 6 to 8 and displayed together with a Pareto chart or the like. Since the learning progress graph shows the progress of the learning of the machine learning model, the user can predict how many times of learning it will take to obtain a machine learning model with the desired accuracy by looking at the learning progress graph.

[0128] The learning progress display screen 250 is provided with a graph display area 251 in which a learning progress graph is displayed. The horizontal axis of the learning progress graph is the number of learning times, and in this example, the number of learning times is shown up to 15 times. The vertical axis on the left side is the number of images learned, and the vertical axis on the right side is the number of images misjudged by the machine learning model. As shown in the learning progress graph, the accuracy of the machine learning model is significantly improved from the first to fourth learning times, but the degree of improvement in accuracy decreases from the fifth learning time onwards, and the number of misjudgments in the 12th learning time machine learning model is significantly higher than those in the 11th and 13th learning times. In this way, increasing the number of learning times does not necessarily improve the accuracy, and depending on the image used for learning, the accuracy may suddenly decrease. By displaying the learning progress graph, the user can grasp the sudden decrease in accuracy, and can avoid the machine learning model of that time and select a machine learning model with high accuracy in other times to use during operation. This function is called a learning model selection function.

[0129] Specifically, the processor 13c is configured to be able to accept from the user a selection of a past machine learning model corresponding to a past separation graph, in addition to a most recent machine learning model corresponding to a most recent separation graph, as a machine learning model to be used during operation. For example, when a numerical value (number of learning times) on the horizontal axis of the learning progress graph shown in FIG. 14 is designated with the mouse 52 or the like, the selection of the machine learning model corresponding to the separation graph of the designated number of learning times is accepted by the processor 13c. The "machine learning model corresponding to the separation graph of the designated number of learning times" refers to the machine learning model when the separation graph of the designated number of learning times is obtained.

[0130] When the processor 13c receives the selection of the past machine learning model, it identifies all learning images that have been trained by the selected past machine learning model. Which learning images have been trained by the past machine learning model can be stored in the storage device 19 or the like as learning information, and by reading the learning information, the processor 13c can obtain which learning images have been trained by the machine learning model at which time.

[0131] The processor 13c identifies all learning images that have been trained by the selected past machine learning model, and then reproduces the selected past machine learning model by training all the identified learning images in the machine learning model in an initial state before the start of learning. This allows the past machine learning model to be easily reproduced and used for operation when a past machine learning model in an earlier learning stage has higher classification accuracy than the most recent machine learning model that has been repeatedly retrained.

[0132] When reproducing a past machine learning model, there is a method of not inheriting the machine learning model trained so far, and a method of inheriting the machine learning model trained so far, and either method may be used. When not inheriting the machine learning model trained so far, all the identified learning images are trained in the machine learning model in the initial state. For example, when reproducing the third machine learning model shown in FIG. 8, the machine learning model obtained in the second learning is not inherited, and a cumulative five learning images are input to the machine learning model in the initial state and trained.

[0133] On the other hand, when inheriting a previously trained machine learning model, only the images newly added since the previous time are trained on the model obtained in the previous training. For example, if you want to reproduce the third machine learning model shown in Figure 8, only one training image added between the second and third trainings is trained on the machine learning model obtained in the second training. When inheriting a previously trained machine learning model, training is not performed from the initial state, so the total training time until automatic training is completed can be shortened.

[0134] (3-class classification) 15 is a diagram showing an example of a learning result display area when performing three-class classification using a machine learning model. The number of images to which label 1 is assigned, the number of images to which label 2 is assigned, and the number of images to which label 3 is assigned are displayed in the image number display area 151a. The inference result display area 151c has columns for label 1, label 2, and label 3 for actual and predicted results, respectively. This allows the learning results to be presented to the user when performing three-class classification.

[0135] Specifically, the flowchart in FIG. 16 shows the process. In step SF1, the first image (in file name order) of each class is added to the learning images. After repeating the process for the number of classes, in step SF2, the added image is input to the machine learning model to learn and then verified. If the verification result shows that separation is possible, step SF3 is judged as YES and the process ends. If separation is not possible, step SF3 is judged as NO and the process proceeds to step SF4. In step SF4, it is judged whether or not one or more images for verification remain. If one or more images for verification do not remain, the process ends, and if one or more images for verification remain, the process proceeds to step SF5. In step SF5, it is judged for all classes whether or not there is an image that has been misjudged. If there is a class that has been misjudged, only one image with the highest score in that class is added to the learning images. If there are multiple classes that have been misjudged, only one image with the highest score in each class is added to the learning images (step SF6). It is not added to classes that have not been misjudged. Thereafter, the process proceeds to step SF2, where the added image is input to the machine learning model to learn and then verified.

[0136] The above-described embodiment is merely illustrative in all respects and should not be construed as limiting. Furthermore, all modifications and variations within the scope of the claims are within the scope of the present invention. [Industrial Applicability]

[0137] As described above, the image processing device and image processing method according to the present disclosure can be used, for example, when performing visual inspection of industrial products. [Explanation of symbols]

[0138] 1 Image processing device 2. Control unit 3 Imaging unit 4 Display device (display section) 13c processor

Claims

1. An image processing device including a processor that inputs an image into a machine learning model and executes a determination process to determine whether the image belongs to a first class or a second class, The processor, (1) generating a machine learning model that learns images belonging to the first class and determines an image having a different characteristic from an image belonging to the first class as an image belonging to the second class; (2) inputting a plurality of verification images into the machine learning model trained with images belonging to the first class, and executing a determination process for determining whether the plurality of verification images belong to the first class or the second class; (3) evaluating the accuracy of the judgment process of the plurality of verification images; (4) Based on the result of evaluating the accuracy of the judgment process of the multiple verification images, evaluate whether or not re-learning of the machine learning model is necessary. If it is evaluated that re-learning of the machine learning model is necessary, input images belonging to the second class into the machine learning model and re-learn them, thereby generating the machine learning model so as to judge images having similar characteristics to images belonging to the second class as images belonging to the second class. If it is evaluated that re-learning of the machine learning model is not necessary, complete the learning process of the machine learning model. Image processing device.

2. 2. The image processing device according to claim 1, The images belonging to the first class are non-defective product images obtained by capturing images of non-defective products, The images belonging to the second class are defective product images obtained by capturing images of defective products, The processor, extracting the defective product image from the plurality of verification images as an image to be retrained by the machine learning model, generating a display screen for receiving designation of a defective part in the defective product image from a user, and displaying the display screen on a display unit; The defective product image in which the defective portion is identified via the display screen is re-learned by the machine learning model, and the machine learning model is generated so as to determine an image having a feature similar to the defective portion as an image belonging to the second class. Image processing device.

3. 3. The image processing device according to claim 2, The processor, Identifying a feature portion of a defective product image extracted from the plurality of verification images for re-learning the machine learning model that differs from the trained non-defective product image; generating a display screen including an image in which the identified different characteristic portion in the extracted defective product image is emphasized, and displaying the display screen on the display unit; Image processing device.

4. 3. The image processing device according to claim 2, The processor, If it is evaluated that re-learning of the machine learning model is necessary, automatically extracting defective product images that are relatively likely to result in an incorrect judgment result from the plurality of verification images, and automatically re-learning the machine learning model. Image processing device.

5. 3. The image processing device according to claim 2, The processor, If it is determined that the machine learning model needs to be retrained, the number of defective product images to be used for retraining is automatically calculated based on the evaluation result of the accuracy of the judgment process; extracting the number of defective product images that are relatively likely to result in an incorrect judgment from the plurality of verification images, and automatically re-learning the machine learning model with the number of defective product images; Image processing device.

6. 6. The image processing device according to claim 5, The processor, If it is evaluated that re-learning of the machine learning model is necessary, the calculated number of defective product images are extracted from the plurality of verification images in order of relatively high possibility that the judgment result is erroneous, and the machine learning model is automatically re-learned from the defective product images in that number. Image processing device.

7. 3. The image processing device according to claim 2, The processor, If it is evaluated that re-learning of the machine learning model is necessary, the machine learning model is re-learned not only with defective product images but also with good product images, and the machine learning model is generated so as to determine features similar to the defective product images and features different from the good product images as defective parts. Image processing device.

8. 3. The image processing device according to claim 2, The processor, calculating a misjudgment rate for good images and a misjudgment rate for defective images of the plurality of verification images, and determining the number of good images and the number of defective images to be used for re-learning the machine learning model based on the calculated misjudgment rate for good images and the calculated misjudgment rate for defective images; Image processing device.

9. 3. The image processing device according to claim 2, The processor, In the determination process, an evaluation value indicating a degree of defect is calculated for each of the plurality of verification images; If it is determined that re-learning of the machine learning model is necessary, the evaluation value of the non-defective product image is compared with the evaluation value of the defective product image to automatically determine whether the machine learning model should learn a non-defective product image or a defective product image. Image processing device.

10. 3. The image processing device according to claim 2, The processor, When it is evaluated that the accuracy of the judgment process of the machine learning model has attained a predetermined accuracy, a decision is automatically made to terminate the learning process of the machine learning model. Image processing device.

11. 3. The image processing device according to claim 2, The processor, automatically generating a display screen for displaying a numerical value indicating the accuracy of the judgment process of the machine learning model or a graph indicating the accuracy of the judgment process of the machine learning model, and displaying the generated display screen on the display unit; Image processing device.

12. 12. The image processing device according to claim 11, The display screen for displaying a numerical value indicating the accuracy of the judgment process of the machine learning model or a graph indicating the accuracy of the judgment process of the machine learning model includes the number of good product images and the number of defective product images that have been trained by the machine learning model, and the number of incorrectly judged images for the multiple verification images. Image processing device.

13. An image processing method for inputting an image into a machine learning model and executing a determination process for determining whether the image belongs to a first class or a second class, comprising: (1) generating a machine learning model that learns images belonging to the first class and determines an image having a feature different from that of an image belonging to the first class as an image belonging to the second class; (2) inputting a plurality of verification images into the machine learning model trained with images belonging to the first class, and executing a determination process for determining whether the plurality of verification images belong to the first class or the second class; (3) evaluating the accuracy of the determination process of the plurality of verification images; (4) evaluating whether or not re-learning of the machine learning model is necessary based on the result of evaluating the accuracy of the judgment process of the multiple verification images, and if it is evaluated that re-learning of the machine learning model is necessary, inputting images belonging to the second class into the machine learning model and causing them to re-learn, thereby generating the machine learning model so as to judge images having similar characteristics to images belonging to the second class as images belonging to the second class, and if it is evaluated that re-learning of the machine learning model is unnecessary, completing the learning process of the machine learning model; An image processing method comprising:

Citation Information

Patent Citations

  • Machine learning device, inspection device, and machine learning method

    JP2019015654A

  • Image determination device, image inspection device, manufacturing system of electric wire with terminal, and image determination method

    JP2020052044A

  • Learning apparatus, detection apparatus, learning method, and learning program

    JP2021086382A

  • Workpiece inspection indicating number of defect images for training and defect detection system

    JP2021196363A

  • Image processing arrangements

    US20200356813A1