Judgement system, image generation device, image generation method, and image generation program
The determination system enhances the efficiency and accuracy of quality judgment by using known quality images to train a machine learning model, collecting misjudged defective images, and generating learning images for retraining, addressing the inefficiencies of existing systems.
Patent Information
- Application Number
- JP2021042764
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-03-16
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-03-16
AI Technical Summary
Existing judgment systems using machine learning models require significant time and human effort to collect images of defective products, and are unable to detect defects that were not anticipated during the initial image collection, necessitating retraining of the model which is inefficient.
A determination system that uses a machine learning model trained on known quality images to detect objects of unknown quality, collects images of incorrectly judged defective products, generates learning images from these images, and retrains the model using these images as teacher data to improve detection accuracy.
This approach reduces human effort in image collection and enables efficient retraining of the model to detect new defects, improving the accuracy and efficiency of quality determination.
Smart Images

Figure 0007557402000003 
Figure 0007557402000008 
Figure 0007557402000009
Abstract
Description
[Technical field]
[0001] The present invention relates to a judgment system or the like that judges pass / fail using a judgment model constructed by machine learning. [Background technology]
[0002] Conventionally, there are known judgment systems that judge the quality of objects using judgment models constructed by machine learning. In such judgment systems, in order to guarantee and improve the judgment accuracy of the judgment model, a large number of images of objects to be judged as defective (hereinafter referred to as defective product images) are required, but there is a problem that collecting a large number of defective product images is time-consuming and requires high human resources.
[0003] As a technique for solving the above problems, a technique for generating defective product images by image synthesis is known. For example, the following Patent Document 1 describes a technique for generating multiple scratch / defect images by using images showing representative silhouette shapes of various scratches and defects. [Prior art documents] [Patent documents]
[0004] [Patent Document 1] Patent Publication No. 2018-205123 Summary of the Invention [Problem to be solved by the invention]
[0005] The technology of Patent Document 1 requires the collection of images showing the representative silhouette shapes of various scratches and defects in advance, but such work requires time and manpower costs. In addition, when scratches or defects of shapes that were not anticipated at the time of collection occur, they cannot be detected.
[0006] In order to detect such scratches and defects, it is necessary to re-learn the judgment model. When re-learning, it is first necessary to find an image that shows the scratch or defect. Then, after creating a silhouette of the shape, it is necessary to generate multiple images of the scratch or defect, and re-learn using the teacher data generated using these. In this way, the technology of Patent Document 1 makes the learning of the judgment model more efficient, but there is room for further efficiency improvement.
[0007] One aspect of the present invention has been made in consideration of the above-mentioned problems, and its purpose is to provide a judgment system, etc. that can efficiently learn a judgment model used to judge the quality of an object. [Means for solving the problem]
[0008] In order to solve the above problems, a judgment system according to one embodiment of the present invention includes a judgment device that judges the quality of an object of unknown quality from an image of the object, using a judgment model constructed by machine learning using images of an object whose quality is known as teacher data; a data collection device that acquires images when the judgment device erroneously judges an object to be good when it is actually defective; an image generation device that generates a plurality of learning images to be used as teacher data for re-learning the judgment model, based on defective parts appearing in the images acquired by the data collection device; and a learning device that re-learns the judgment model using the plurality of learning images generated by the image generation device as teacher data.
[0009] In order to solve the above problems, an image generating device according to one embodiment of the present invention includes a data acquisition unit that acquires images of a plurality of objects of unknown quality that are mistakenly determined to be good when the object is actually defective and erroneously determined to be good, in a pass / fail judgment using a judgment model constructed by machine learning using images of objects of known quality as training data from among images of the objects of unknown quality, and an image generation unit that generates a plurality of learning images to be used as training data for re-learning the judgment model, based on defective parts appearing in the images acquired by the data acquisition unit.
[0010] In order to solve the above problems, an image generation method according to one embodiment of the present invention is an image generation method executed by an image generation device, and includes the steps of: acquiring images of a plurality of objects of unknown pass / fail quality when an object that is actually defective is erroneously judged as good, using a judgment model constructed by machine learning using images of objects of known pass / fail quality as training data, among images of each of the objects of unknown pass / fail quality; and generating a plurality of learning images to be used as training data for re-learning the judgment model, based on the defective parts shown in the images acquired in the step. Effect of the Invention
[0011] According to one aspect of the present invention, it is possible to efficiently learn a judgment model used to judge the quality of an object. [Brief description of the drawings]
[0012] [Figure 1] FIG. 1 is a diagram illustrating an example of the configuration of a determination system according to a first embodiment of the present invention. [Diagram 2] 10A to 10C are diagrams illustrating an example of generation of learning images in the determination system. [Diagram 3] FIG. 11 is a block diagram showing an example of a configuration of a main part of an image generating device according to a second embodiment of the present invention. [Figure 4] FIG. 2 is a diagram illustrating a process executed by the image generating device. [Diagram 5] 11A to 11C are diagrams illustrating a synthesis position determination process executed by the image generating device. [Figure 6] 4 is a flowchart showing a flow of a synthesis process executed by the image generating device. [Figure 7] FIG. 11 is a block diagram showing an example of a configuration of a main part of an image generating device according to a third embodiment of the present invention. [Figure 8] 4A to 4C are diagrams illustrating a process for generating differential color information executed by the image generating device. [Figure 9] FIG. 2 is a diagram illustrating an overall process executed by the image generating device. [Figure 10]11A to 11C are diagrams illustrating a process for setting a color conversion target area executed by the image generating device. [Figure 11] 4 is a flowchart showing a flow of a learning image generation process executed by the image generation device. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] [Embodiment 1] (System Configuration) 1 is a diagram showing an example of the configuration of a determination system 100 according to an embodiment of the present invention. The determination system 100 is a system that uses an image of a predetermined object to determine whether the object is a good product or a defective product.
[0014] The object may be any object that can be judged as being good or bad based on its appearance. Specific examples of the object include various industrial products (which may be finished products, parts, or intermediate products) and food. A defective object is an object that does not meet the requirements required of the object, and examples of such defective objects include those with scratches, stains, discoloration, etc. on the surface, those with foreign matter attached, and those with a different shape, printing, engraving, etc. from good objects.
[0015] As shown in the figure, the judgment system 100 includes a judgment device 1, a storage device 2, a data collection device 3, an image generation device 4, and a learning device 5.
[0016] The determination device 1 is a device that determines the quality of an object from an image of the object whose quality is unknown, using a determination model 15 constructed by machine learning using images of the object whose quality is known as teacher data. The determination device 1 includes an image acquisition unit 11, a determination unit 12, a determination result output unit 13, and an update unit 14.
[0017] The image acquiring unit 11 acquires an image of an object whose quality is unknown. In the example of Fig. 1, the image acquiring unit 11 acquires an image B of an object A whose quality is unknown. An image a of the object A is captured in the image B.
[0018] The judgment unit 12 uses the judgment model 15 to judge whether an object shown in an image acquired by the image acquisition unit 11 is good or bad, based on the image. In the example of FIG. 1, the judgment unit 12 judges whether the object A is a good or bad item based on the output value obtained by inputting the image B into the judgment model 15. The judgment unit 12 also outputs an index value indicating the likelihood of the judgment result together with the judgment result. Hereinafter, this index value will be referred to as the certainty factor. The certainty factor is a numerical value ranging from 0 to 100%, and the closer to 100%, the more likely the judgment result is.
[0019] The judgment model 15 is a model constructed by machine learning using images of objects whose pass / fail are known as teacher data. Moreover, the judgment model 15 outputs a confidence level together with the judgment result as described above. The machine learning algorithm may be any one capable of generating the judgment model 15 capable of classifying images into two categories: pass / fail. As the machine learning algorithm, for example, a convolutional neural network having high image classification accuracy is suitable, but is not limited to this example. The judgment model 15 may also be capable of determining the type of defect. In this case, machine learning may be performed using images including each type of defect.
[0020] The judgment result output unit 13 outputs the judgment result of the judgment unit 12. This judgment result is recorded in the judgment result storage unit 22 of the storage device 2. In addition, the image used for this judgment is stored in the image storage unit 21 of the storage device 2.
[0021] The update unit 14 updates the judgment model 15. Although details will be described later, the learning device 5 re-learns the judgment model 15, updates various parameters of the judgment model 15, and notifies the judgment device 1 of the updated various parameters. Therefore, the update unit 14 updates the judgment model 15 according to the notification from the learning device 5. As a result, the result of the re-learning by the learning device 5 is reflected in the judgment of the judgment unit 12 from the next time onwards.
[0022] The storage device 2 is a device for storing various data used in the judgment system 100. The storage device 2 includes an image storage unit 21 for storing images used for the pass / fail judgment, and a judgment result storage unit 22 for storing the result of the pass / fail judgment.
[0023] The data collection device 3 acquires images that require visual re-determination from among the images used by the determination device 1 for pass / fail determination. Then, the data collection device 3 acquires images of objects that are actually defective and have been erroneously determined as pass by the determination device 1 from among the acquired images. The data collection device 3 includes a candidate extraction unit 31, a visual determination unit 32, and a data transmission unit 33.
[0024] The candidate extraction unit 31 refers to the judgment results stored in the judgment result storage unit 22 and extracts those that require visual re-judgment. Specifically, the candidate extraction unit 31 extracts judgment results whose certainty is less than a predetermined threshold. For example, the candidate extraction unit 31 may extract judgment results whose certainty is less than 80%.
[0025] Furthermore, the candidate extraction unit 31 may extract a judgment result with a relatively low degree of certainty. For example, the candidate extraction unit 31 may extract a judgment result with a degree of certainty in a lower predetermined percentage from among all judgment results, or may extract a judgment result with a degree of certainty in a lower predetermined percentage from among judgment results with degrees of certainty in a predetermined range.
[0026] The visual judgment unit 32 performs visual judgment of an image corresponding to the judgment result extracted by the candidate extraction unit 31. Specifically, the visual judgment unit 32 acquires an image corresponding to the judgment result extracted by the candidate extraction unit 31 from the image storage unit 21, and displays it on a display device (which may be provided in the data collection device 3 or may be connected to the data collection device 3). The visual inspector visually checks the quality of the displayed image and inputs the check result to the data collection device 3. The input contents are the quality of the object. If the result is not quality, defective area information indicating the position and range of the defective part is also input. If the type of defect is to be learned, the type of defect is also input. The visual judgment unit 32 then records these input contents as the results of the visual judgment.
[0027] The data transmission unit 33 identifies an image in which a defective object has been erroneously determined to be a good product based on the visual determination result, and transmits the identified image to the image generating device 4. Since this image is a defective product image in which a defective object is shown and which has been erroneously determined, hereinafter this image will be referred to as a misjudged defective product image.
[0028] Specifically, the data transmission unit 33 first identifies, from among the judgment results stored in the judgment result storage unit 22, a judgment result in which the judgment result by the judgment device 1 is a pass / fail product and the visual judgment result is a defective product. Next, the data transmission unit 33 acquires, from among the images stored in the image storage unit 21, an image corresponding to the identified judgment result as an incorrectly judged defective product image. Then, the data transmission unit 33 transmits the incorrectly judged defective product image together with the judgment results (the judgment results of the judgment device 1 and the visual judgment) to the image generation device 4. For example, a large-capacity file transfer service or the like may be used to transmit these data.
[0029] The image generating device 4 generates a plurality of learning images to be used as teacher data for re-learning the judgment model 15, based on defective parts shown in the misjudged defective product images acquired by the data collecting device 3. The image generating device 4 includes a data acquiring unit 41 and an image generating unit .
[0030] The data acquiring unit 41 acquires images of a plurality of objects of unknown pass / fail quality that are erroneously determined as pass when an object that is actually defective is erroneously determined as pass in pass / fail quality determination using the determination model 15, that is, erroneously determined defective product images. As described above, the erroneously determined defective product images are transmitted from the data transmitting unit 33.
[0031] The image generating unit 42 generates a plurality of learning images to be used as teacher data for re-learning the determination model 15, based on the defective parts shown in the misjudged defective product images acquired by the data acquiring unit 41.
[0032] The learning device 5 re-learns the determination model 15 using the multiple learning images generated by the image generating device 4 as training data. The learning device 5 includes a learning image acquiring unit 51, a training data generating unit 52, a learning unit 53, and an update notifying unit 54.
[0033] The learning image acquisition unit 51 acquires a plurality of learning images generated by the image generation device 4 (more specifically, the image generation unit 42). The teacher data generation unit 52 associates the learning images acquired by the learning image acquisition unit 51 with correct answer data indicating the position and range of the defective part in the learning image, and generates teacher data for re-learning the determination model 15. The correct answer data may include information indicating the type of defect.
[0034] As described above, the learning image used to generate the teacher data is generated by the image generating unit 42. Therefore, the image generating unit 42 can output information indicating the position and range of the defective part in the generated learning image. The teacher data generating unit 52 may generate the teacher data using such information as the correct answer data. In this case, the user of the learning device 5 only needs to visually check whether the correct answer data is appropriate.
[0035] The teacher data generating unit 52 can also generate teacher data from defective product images. In this case, the teacher data generating unit 52 may predict the position and range of the defective part by, for example, template matching. The teacher data generating unit 52 may then display the prediction result on an arbitrary display device, and allow the user of the learning device 5 to visually check whether the position and range are appropriate. In this case, if the displayed position and range are not appropriate, the user of the learning device 5 may manually correct them.
[0036] The learning unit 53 re-learns the determination model 15 using the teacher data generated by the teacher data generating unit 52. The update notifying unit 54 notifies the determination device 1 of various parameters (e.g., weight parameters of a neural network model, etc.) of the determination model 15 updated by the re-learning by the learning unit 53. The various parameters may be transmitted, for example, by using a large-capacity file transfer service. Thereafter, the update unit 14 of the determination device 1 updates the determination model 15 as described above.
[0037] As described above, the judgment system 100 includes a judgment device 1 that judges the quality of an object of unknown quality from an image of the object, using a judgment model 15 constructed by machine learning using images of objects whose quality is known as teacher data; a data collection device 3 that acquires misjudged defective product images (images of objects when the judgment device 1 erroneously judges an object to be good when it is actually defective); an image generation device 4 that generates a plurality of learning images to be used as teacher data for re-learning the judgment model 15 based on defective parts appearing in the misjudged defective product images acquired by the data collection device 3; and a learning device 5 that re-learns the judgment model 15 using the multiple learning images generated by the image generation device 4 as teacher data.
[0038] According to the above configuration, the data collection device 3 collects the images of the defective products misjudged by the judgment device 1, so that the personnel cost of selecting and collecting images for the teacher data can be reduced. Also, according to the above configuration, a plurality of learning images are generated from the collected images of the defective products misjudged and used as the teacher data, so that a sufficient learning effect can be expected even if the number of collected images of the defective products misjudged is not sufficient. For example, even if a new type of defect that was not anticipated when the judgment model 15 was constructed occurs, it becomes possible to judge the object of the new type of defect as defective after re-learning. Thus, according to the above configuration, the learning of the judgment model 15 used for the pass / fail judgment of the object can be made more efficient.
[0039] (Generating learning images) The generation of learning images in the judgment system 100 will be described with reference to Fig. 2. Fig. 2 is a diagram showing an example of the generation of learning images. Learning images can be generated using erroneously judged defective product images and images correctly judged as good products in a pass / fail judgment using the judgment model 15 or images judged as good products in a visual judgment (hereinafter referred to as good product images).
[0040] Image C shown in Fig. 2 is an image of object A1, which is a defective product. The image a1 of the object shown in image C includes discolored part a11, and since the discolored part a11 is included, object A1 is a defective product. Object A1 has been subjected to automatic judgment by judgment device 1 and visual judgment by data collection device 3, and these judgment results are shown in Fig. 2 as judgment result RC.
[0041] The judgment result RC includes the object ID, the automatic judgment result by the judgment device 1, and the visual judgment result by the data collection device 3. The object ID is identification information assigned to the object in the judgment system 100 to uniquely identify the object. The automatic judgment result in the judgment result RC is a non-defective product (72%). "72%" is the confidence level.
[0042] As described above, the candidate extraction unit 31 extracts images whose certainty is less than a predetermined threshold from among the images stored in the image storage unit 21 of the storage device 2. For example, when the candidate extraction unit 31 extracts images whose certainty is less than 80%, image C whose certainty is 72% is extracted.
[0043] It should be noted that repeated relearning improves the judgment accuracy, and the optimal threshold value changes accordingly. Therefore, the candidate extraction unit 31 may automatically update the threshold value. For example, the candidate extraction unit 31 may set the threshold value so that the ratio of the judgment results of the judgment device 1 whose certainty is equal to or greater than the threshold value to those whose certainty is less than the threshold value is constant.
[0044] The image C extracted by the candidate extraction unit 31 is subjected to visual judgment by the visual judgment unit 32. Since the image C contains a discolored part a11, it is judged as a defective product by visual judgment, and the judgment result is recorded as the judgment result RC. The judgment result RC records that the product is defective as a result of the visual judgment, and also records defective area information indicating the position and range of the defective part. x and y are coordinates indicating the position of the defective part, and w and h indicate the width and height of the defective part, respectively. Note that when the judgment unit 12 judges pass / fail without considering the position and range of the defective part (when the position and range of the defective part are not included in the correct answer data in the teacher data used to build the judgment model 15), it is not necessary to record the defective area information.
[0045] Meanwhile, D1 to Dn shown in Fig. 2 are images taken of objects A2-1 to A2-n, which are non-defective products (n is a natural number). Object A2-1 is a non-defective product, and D1 is a non-defective product image. Therefore, the image a2-1 of the object captured in the non-defective product image D1 does not have any defects such as discoloration, scratches, or dirt. Object A2-1 has been subjected to a pass / fail judgment by the judgment device 1, and the judgment results are shown in Fig. 2 as judgment result RD.
[0046] The judgment result RD includes the object ID of the object A2-1 and the automatic judgment result by the judgment device 1. The automatic judgment result in the judgment result RD is a non-defective product (95%), which means that the judgment result is reliable. Such a judgment result is not extracted by the candidate extraction unit 31, and therefore, a visual judgment is not performed by the data collection device 3. For this reason, the judgment result RD does not include a visual judgment result. The same applies to the objects A2-2 to A2-n.
[0047] The data transmission unit 33 identifies the image C as an erroneously determined defective product image based on the determination result RC, and transmits the image C together with the determination result RC to the image generation device 4. Then, the data acquisition unit 41 of the image generation device 4 acquires the transmitted image C and determination result RC.
[0048] Next, the image generating unit 42 cuts out the defective parts indicated in the judgment result RC from the image C to generate a defective partial image C1. The image generating unit 42 also generates a mask image C2 of the defective partial image C1. The mask image C2 is an image used when combining the defective partial image C1 with a non-defective image, and is used to mask the background area of the defective parts in the defective partial image C1.
[0049] The mask image C2 can be generated, for example, in the following procedure. First, the image generating unit 42 displays the defective part image C1 (which may be the defective part image C) on an arbitrary display device. Here, the operator of the image generating device 4 designates the defective part in the displayed image with an arbitrary pointing device such as a mouse. Then, the image generating unit 42 acquires the pixel of the designated defective part and the color information of the pixel. The color information may be any information that can distinguish the boundary between the defective part and the normal part, and may be, for example, RGB values (R: red, G: green, B: blue) or HSV values (H: hue, S: saturation, V: brightness).
[0050] Next, the image generating unit 42 identifies a continuous region including the pixel at the specified position and made up of pixels whose color information difference with respect to the pixel falls within a predetermined range. Specifically, the image generating unit 42 determines whether the color information difference between the pixel at the specified position and its adjacent pixel falls within a predetermined range, and if it is within the range, performs the same determination on the adjacent pixel. By repeating this determination until the color information difference falls outside the predetermined range, the continuous region can be identified.
[0051] Finally, the image generating unit 42 sets the pixels in the continuous region in the defective part image C1 to white (for example, if there are 256 gradations, each of the RGB values is 255) and sets the background to black (pixel value=0). This completes the mask image C2. Note that the image generating unit 42 may smooth the mask image C2 so that the boundary between the background and the defective part becomes smooth when combined.
[0052] Although FIG. 2 shows only image C as the misjudged defective product image, when there are misjudged defective product images other than image C, defective product portion images and mask images are also generated for those misjudged defective product images.
[0053] The image generating unit 42 then performs conversion processing on the defective product partial image C1 and mask image C2 generated as described above to generate images for synthesis, and synthesizes the generated images for synthesis with each of the non-defective product images D1 to Dn to generate learning images E1 to En. As the conversion processing, various types of conversion such as rotation conversion, shape conversion, and color conversion can be applied. The images for synthesis shown in FIG. 2 are a defective product partial image C1' and a mask image C2' that are obtained by rotating and converting the defective product partial image C1 and the mask image C2.
[0054] In order to increase the variation of the learning images E1 to En, it is preferable to vary the synthesis position for each of the non-defective images D1 to Dn when synthesizing. The transparency of the mask image C2 may be changed for each of the non-defective images D1 to Dn. In addition, when there are multiple defective partial images, the defective partial images to be synthesized for each of the non-defective images D1 to Dn may be selected randomly. Details of the synthesis process using the mask images will be described in the second embodiment.
[0055] 2, the image of the object in the learning image E1 is a2-1, the same as in the non-defective product image D1, but this image a2-1 includes a defective part a31 that is a composite of the defective part in the defective product part image C1 that has been rotated. Therefore, the learning image E1 can be used as training data for learning the defective part a31.
[0056] (Another example of how to generate training data) The fact that the confidence level is less than a predetermined threshold indicates that the reliability of the judgment result is low. From the viewpoint of improving the accuracy of the judgment model 15, it is preferable to re-learn images whose confidence level is less than a predetermined threshold as training data so that highly reliable judgment can be made for such images as well.
[0057] Therefore, the data transmission unit 33 of the data collection device 3 may acquire images for which the certainty level is less than a predetermined threshold level among images for which the judgment result of the judgment device 1 is correct, in addition to images for which the judgment result of the judgment device 1 is incorrect. Note that the above-mentioned images for which the certainty level is less than the predetermined threshold level include images for which the judgment result of being a defective product was correct but the certainty level was less than the predetermined threshold level, and images for which the judgment result of being a non-defective product was correct but the certainty level was less than the predetermined threshold level.
[0058] According to the above configuration, images that are preferable to be used as such training data are collected, and re-learning is performed using training data generated based on these images, thereby improving the judgment accuracy of the judgment model.
[0059] Specifically, for an image for which the result of the determination that the image is defective is correct but the degree of certainty is less than a predetermined threshold, the data transmitting unit 33 can transmit the image to the image generating device 4 to generate an image for learning. Furthermore, the data transmitting unit 33 may transmit such an image as a defective product image to the learning device 5 to be used as teacher data for the defective product image.
[0060] In addition, for images in which the determination that the image was a good product was correct but the degree of certainty was less than a predetermined threshold, the data transmission unit 33 may transmit the image to the learning device 5 as a good product image and use it as training data for good product images.
[0061] In addition to or instead of the images whose certainty level is below the predetermined threshold, the data transmission unit 33 may acquire images for which the judgment result of the judgment device 1 was correct, and whose certainty level was relatively low among the certainty levels output by the judgment device 1 for each of the multiple objects.
[0062] [Embodiment 2] A second embodiment of the present invention will be described with reference to Fig. 3 to Fig. 6. Note that the determination system according to this embodiment has a similar configuration to the determination system 100 of the first embodiment, but differs in that it includes an image generating device 6 instead of the image generating device 4. For this reason, the image generating device 6 will be described below, and descriptions of the other components of the determination system will not be repeated.
[0063] (Configuration of image generating device 6) 3 is a block diagram showing an example of a configuration of the main parts of the image generating device 6 according to this embodiment. As shown in the figure, the image generating device 6 includes a control unit 60 that controls each part of the image generating device 6, and a storage unit 61 that stores various data used by the image generating device 6. The image generating device 6 also includes a communication unit 62 that allows the image generating device 6 to communicate with other devices, an input unit 63 that accepts input of data to the image generating device 6, and an output unit 64 that allows the image generating device 6 to output data.
[0064] The control unit 60 also includes a data acquisition unit 601, an object detection unit 602, a region extraction unit 603, a synthesis image generation unit 604, a synthesis position determination unit 605, and an image generation unit 606. The storage unit 61 also stores a learning image 611.
[0065] The data acquisition unit 601, like the data acquisition unit 41 provided in the image generating device 4 of embodiment 1, acquires images of multiple objects of unknown quality, each of which is photographed, where an object that is actually defective has been erroneously judged to be good in a quality judgment using the judgment model 15, i.e., a misjudged defective product image.
[0066] The object detection unit 602 detects an object from the misjudged defective product image acquired by the data acquisition unit 601, and cuts out the part to generate a partial image. The method of detecting the object is not particularly limited, and the object may be detected by template matching, or may be detected using a detection model that has been machine-learned to detect the object. For example, the object may be detected by using YOLO (you look only once) or the like. The object detection unit 602 is not an essential component, but by providing the object detection unit 602, the probability that a background area other than the object becomes a candidate for the synthesis position in determining the synthesis position described later can be reduced, thereby enabling efficient generation of a synthesis image.
[0067] The area extraction unit 603 extracts an area of a predetermined color range in which a part where a defect may occur is captured from a good-quality image in which a good-quality object is captured. Hereinafter, this area is referred to as a defect candidate area. The color range of the defect candidate area is determined in advance. For example, the area extraction unit 603 may display the good-quality image on an arbitrary display device and have an operator of the image generating device 6 specify a part where a defect may occur. The area extraction unit 603 may then extract color information of the specified part and extract the defect candidate area based on the color information.
[0068] The image-to-be-combined generating unit 604 extracts a defective portion from the misjudged defective product image acquired by the data acquiring unit 601, and generates an image to be combined with a defective candidate region. The image-to-be-combined generating unit 604 of this embodiment generates a defective part image by extracting the defective portion from the defective product image, and also generates a mask image. The image-to-be-combined generating unit 604 then performs conversion processing on the generated defective part image and mask image to generate an image to be combined.
[0069] The compositing position determination unit 605 determines the compositing position of the image to be combined generated by the image to be combined generation unit 604. Although details will be described later, the compositing position determination unit 605 determines the compositing position by repeating a series of processes, (1) setting a candidate position for combining the image to be combined within the defective candidate area, (2) determining whether the entire image to be combined combined at the candidate position fits within the area, and (3) changing the candidate position if it does not fit, until it is determined that the entire image to be combined fits within the area.
[0070] Similar to the image generating unit 42 included in the image generating device 4 of the first embodiment, the image generating unit 606 generates a plurality of learning images to be used as teacher data for re-learning the determination model 15, based on the defective parts appearing in the images acquired by the data acquiring unit 601. More specifically, the image generating unit 606 generates a learning image 611 by synthesizing the image for synthesis generated by the image for synthesis generating unit 604 at the synthesis position determined by the synthesis position determining unit 605 in the defect candidate region extracted by the region extracting unit 603.
[0071] The learning images 611 are images used as teacher data for re-learning the determination model 15. As described above, the learning images 611 are generated by the image generating unit 606.
[0072] As described above, the image generating device 6 includes a data acquiring unit 601 that acquires images of misidentified defective products, and an image generating unit 606 that generates a plurality of learning images 611 to be used as training data for re-learning the judgment model 15, based on defective parts appearing in the images of misidentified defective products acquired by the data acquiring unit 601.
[0073] According to the above configuration, an image of a defective product that has been erroneously determined is acquired. Such an image that has been erroneously determined by the determination model 15 is an image that is useful as training data. According to the above configuration, a plurality of learning images 611 that are used as training data for re-learning the determination model 15 are generated based on defective parts that appear in the collected images of defective products that have been erroneously determined, so that sufficient learning is possible even if the number of collected images of defective products that have been erroneously determined is insufficient. Therefore, according to the image generating device 6, it is possible to efficiently learn the determination model 15 that is used to determine the quality of an object.
[0074] As described above, the image generating device 6 includes an area extraction unit 603 which extracts a defect candidate area of a predetermined color range in which a part where a defect may occur is shown from the good product image in which the good product object is shown, and an image-to-be-combined generating unit 604 which cuts out a defective part from the misjudged defective image acquired by the data acquisition unit 601 and generates an image to be combined with the defect candidate area, and the image generating unit 606 combines the image to be combined with the defect candidate area to generate an image for learning.
[0075] According to the above configuration, a defect candidate area of a predetermined color range in which a part where a defect may occur is extracted, and a learning image is generated by synthesizing the synthesis image with the defect candidate area. Therefore, an unnatural learning image in which a defective part is synthesized in an area where a defect may not occur is not generated, and a proper learning image can be generated.
[0076] (Processing flow: Overall) The flow of the process (image generating method) executed by the image generating device 6 will be described with reference to Fig. 4. Fig. 4 is a diagram for explaining the process executed by the image generating device 6. Fig. 4 shows a flowchart showing the flow of the process executed by the image generating device 6, as well as examples of a non-defective object F, a non-defective image G obtained by photographing the object F, a non-defective partial image G1 obtained by cutting out a portion of the non-defective image G in which the object F appears, and a binarized image G2 generated from the non-defective partial image G1.
[0077] Object F is a flat object like object A shown in Fig. 1, but differs from object A in that a recess F2 is formed in the center of the top surface, and the top surface apex F1 is bisected by the recess F2. An image of object F taken from directly above is G. Image G of the non-defective object contains image f1 of object F, which includes image f11 of the top surface apex F1 and image f12 of the recess F2.
[0078] In S11, the data acquiring unit 601 acquires erroneously determined defective product images, which are images of a case where an object that is actually defective is erroneously determined to be a good product in a pass / fail judgment using the judgment model 15. As described in the first embodiment, the data collecting device 3 collects such erroneously determined defective product images and transmits them to the image generating device 4, so the data acquiring unit 601 only needs to acquire the erroneously determined defective product images transmitted by the data collecting device 3.
[0079] In S12, the composite image generating unit 604 generates a partial image by cutting out the defective part from the misjudged defective product image acquired in S11, that is, a defective product partial image, and also generates a mask image corresponding to the defective product partial image. The method of generating the defective product partial image and the mask image is as described in the first embodiment.
[0080] The processes of S13 to S17 are performed for each of the plurality of non-defective images that are the basis for the learning images, and are terminated when learning images have been generated from all of the non-defective images.
[0081] In S13, the data acquisition unit 601 acquires a non-defective product image. Specifically, first, the data acquisition unit 601 extracts a judgment result that is a non-defective product and has a certainty level equal to or higher than a threshold value from among the judgment results stored in the judgment result storage unit 22 (see FIG. 1) of the storage device 2. Then, the data acquisition unit 601 acquires an image corresponding to the extracted judgment result from the image storage unit 21 (see FIG. 1). This image is a non-defective product image.
[0082] In S14, the object detection unit 602 detects an object from the good product image acquired in S12, and cuts out a part of the detected object to generate a good product partial image. For example, if the good product image G was acquired in S13, the object detection unit 602 cuts out a part including the image f1 of the object F from the good product image G to generate a good product partial image G1.
[0083] In S15, the region extraction unit 603 extracts a defect candidate region of a predetermined color range in which a portion where a defect may occur is captured from the non-defective portion image generated in S14. For example, when a reference color for a portion where a defect may occur is set, the region extraction unit 603 may calculate a color difference between each pixel of the non-defective portion image and the reference color, and extract a continuous region in which the calculated color difference is equal to or less than a threshold value as a defect candidate region. After extracting the defect candidate region, the region extraction unit 603 may generate a binarized image so that the defect candidate region can be distinguished from other regions.
[0084] Regarding the process of S15, for example, suppose that in the object F, a certain defect may occur in the top part F1 of the upper surface, but the defect does not occur in the recessed part F2. In this case, the region extraction unit 603 extracts a region of a certain color range set based on the color of the top part F1 of the upper surface, and sets it as a defect candidate region. Then, the region extraction unit 603 binarizes the defect candidate region into white and the other regions into black, thereby generating a binarized image G2. Of the image regions of the binarized image G2, f21 is the defect candidate region, and f22 is the other region.
[0085] In S16, the composite image generating unit 604 generates a composite image from the defective product partial image and the mask image generated in S12. For example, if a plurality of misjudged defective product images are obtained in S11 and a defective product partial image and a mask image are generated from each misjudged defective product image in S12, the composite image generating unit 604 selects the defective product partial image and the mask image to be used from them. This selection may be performed according to a predetermined rule or randomly.
[0086] Then, the composite image generating unit 604 generates a composite image from the defective part image and the mask image. Specifically, the composite image generating unit 604 performs a conversion process on the defective part image and the mask image to generate a composite image. The content of the conversion process is not particularly limited, and for example, the defective part image and the mask image may be subjected to a rotation conversion, and the rotation angle in this case may be set according to a predetermined rule or may be set randomly. The defective part image may be transformed by any transformation method such as affine transformation. In this case, the mask image is also updated to match the defective part image after transformation. Note that each of the above-mentioned conversion processes may be applied alone or in combination. The composite image generating unit 604 may use the defective part image and the mask image as they are as the composite image.
[0087] In S17, the composition position determination unit 605 determines a composition position within the defect candidate region extracted in S15, and the image generation unit 606 composites the image for composition at the determined composition position to generate a learning image 611. As described above, the processes of S13 to S17 are performed on each of the multiple non-defective product images that are the source of the learning image, so that even if only one misjudged defective product image is obtained in S11, multiple learning images 611 having the same defect as the misjudged defective product image are generated.
[0088] As described above, the image generating method executed by the image generating device 6 includes a step (S11) of acquiring a misidentified defective product image, and a step (S17) of generating learning images 611 to be used as teacher data for re-learning the judgment model 15 based on defective parts appearing in the misidentified defective product image acquired in the above step. According to this image generating method, multiple learning images 611 can be generated from one misidentified defective product image, so that sufficient re-learning of the judgment model 15 is possible even if the number of misidentified defective product images collected by the data collecting device 3 is not sufficient. Therefore, according to this image generating method, the learning of the judgment model 15 can be made more efficient.
[0089] (Process flow: synthesis position determination) The flow of the learning image generation process performed in S17 in Fig. 4 will be described with reference to Fig. 5. Fig. 5 is a diagram for explaining the synthesis position determination process. Fig. 5 also shows a flowchart showing the flow of the synthesis position determination process, together with an example of synthesis in a binarized image G2.
[0090] The processes of S171 to S175 in Fig. 5 are repeated until the combination is successful in S175. Note that the process of Fig. 5 may also be ended when the combination is not successful in S175 and the number of combination failures reaches a predetermined upper limit.
[0091] In S171, the synthesis position determination unit 605 sets a candidate position in the binarized image G2. The candidate position may be determined randomly, for example, by using a random number. Then, in S172, the synthesis position determination unit 605 judges whether or not the candidate position determined in S171 is within the defect candidate area extracted in S15 of FIG. 4. If it is determined that the candidate position is within the defect candidate area (YES in S172), the process proceeds to S173. On the other hand, if it is determined that the candidate position is outside the defect candidate area (NO in S172), the process returns to S171. In this case, the synthesis position determination unit 605 resets the candidate position in S171.
[0092] In S173, the composition position determination unit 605 searches for any part outside the defective candidate region around the candidate position set in S171. For example, the composition position determination unit 605 may first perform a search in the left direction from the candidate position. This search is performed until the outer edge of the defective candidate region is reached or the search distance reaches the width of the mask image. Here, if the outer edge is reached before the search distance in the left direction reaches the width of the mask image, the composition position determination unit 605 performs a search in the right direction from the candidate position. Then, if the sum of the search distance in the left direction from the candidate position and the search distance in the right direction does not reach the width of the mask image, the search is terminated. On the other hand, if the sum of the search distance in the left direction from the candidate position and the search distance in the right direction reaches the width of the mask image, the composition position determination unit 605 searches the center of the search range in the left and right directions in the up and down directions. The search in the up and down direction is terminated when the search distance in the up and down direction reaches the height of the mask image or reaches the outer edge of the defective candidate region before reaching the height.
[0093] In S174, the composition position determination unit 605 determines whether or not to determine the candidate position set in S171 as the composition position based on the search result in S173. Specifically, if (1) the horizontal search distance reaches the width of the mask image and (2) the vertical search distance reaches the height of the mask image, the composition position determination unit 605 determines the candidate position as the composition position (YES in S174). In other words, in S174, it is determined whether or not the entire image to be composed fits within the defective candidate area. Once the composition position in the binarized image is determined, the composition position in the non-defective image that is the basis of the binarized image is also determined, and the area in the non-defective image where the image to be composed is composed (hereinafter referred to as the composition area) is also determined from this composition position and the width and height of the mask image.
[0094] On the other hand, if either of the above conditions (1) or (2) is not satisfied, the synthesis position determination unit 605 does not determine a synthesis position (NO in S174), and returns to S171 to set a new candidate position.
[0095] In S175, the image generating unit 606 generates a learning image by compositing the image to be composited generated by the image to be composited generating unit 604 at the composite position determined as described above by the composite position determining unit 605. Note that, although details will be described later, there are cases where the composition fails in S175, in which case the process returns to S171 and a new candidate position is set.
[0096] Regarding the processes of S171 to S174, for example, in the binarized image G2 in Fig. 5, it is assumed that the candidate position is set to the lower left corner of the upper one of two defective candidate regions sandwiching another region f22. In this case, in a search in the left direction, the left end of the defective candidate region is reached before reaching the width of the mask image indicated by the horizontal two-way arrow in the same figure. Therefore, a search is performed in the right direction from the candidate position, and as a result, the total search distance in the left and right directions reaches the width of the mask image.
[0097] Therefore, following the above-mentioned horizontal search, a vertical search is performed. The vertical search is performed from the center of the horizontal search range. In the example of FIG. 5, the bottom end of the defect candidate area is reached before the vertical search distance reaches the height of the mask image indicated by the vertical double arrow in the figure. Therefore, the result of S174 is NO, and the candidate position is reset.
[0098] Here, as shown in Fig. 5, assume that a candidate position is set in the lower left corner of two defective candidate regions sandwiching another region f22. In this case, the search distance in the leftward search reaches the width of the mask image, and the search distance in the up-down search reaches the height of the mask image, so this candidate position is determined as the synthesis position. As a result, for example, a learning image H as shown in Fig. 5 is generated. The learning image H is obtained by synthesizing the synthesis image at the synthesis position determined as described above, and includes a defective part h.
[0099] As described above, the compositing position determination unit 605 sets a candidate position for compositing the compositing image within the defective candidate area (S171), determines whether the entire compositing image to be composited at the candidate position will fit within the area (S174), and if it does not fit, changes the candidate position (S171 after NO in S174). By repeating this series of processes until it is determined that the entire compositing image fits within the area (until YES is determined in S174), the compositing position determination unit 605 determines the compositing position of the compositing image.
[0100] According to the above configuration, a synthesis position where the entirety of the synthesis image fits in can be automatically determined, and a learning image can be generated in which the synthesis image is synthesized at the synthesis position. This makes it possible to generate a proper learning image without generating an unnatural learning image in which a part of the learning image protrudes from the region.
[0101] In the above process, the center of the horizontal search range is searched in the vertical direction. Therefore, depending on the shape of the defective candidate area, when the mask image is placed at the synthesis position determined as described above, a part of it may be outside the defective candidate area. In this case, synthesis fails in S175 (branch of NO in S1751 in FIG. 6 described later), and the candidate position is set again in S171. Of course, in S173, the entire horizontal search range may be searched in the vertical direction, which can avoid the above-mentioned synthesis failure.
[0102] (Processing flow: Composition processing) The flow of the synthesis process performed in S175 of Fig. 5 will be described with reference to Fig. 6. Fig. 6 is a flowchart showing the flow of the synthesis process. The processes of S1751 to S1752 are performed for each pixel in the synthesis area in the non-defective image that is the source of the learning image, and when the processes for all pixels have been completed, the synthesis process shown in Fig. 6 ends.
[0103] In S1751, the image generating unit 606 selects one pixel in the synthesis area that has not been selected so far, and judges whether or not the pixel is a pixel in the defect candidate area. If the selected pixel is a pixel in the defect candidate area (YES in S1751), the process proceeds to S1752. On the other hand, if the selected pixel is not a pixel in the defect candidate area (NO in S1751), the synthesis process ends. In this case, synthesis fails, and the process is started over from the setting of the candidate position in S171 of FIG. 5.
[0104] In S1752, the image generation unit 606 performs synthesis on the pixel selected in S1751. For example, the image generation unit 606 may calculate the R, G, and B values in the learning image by the following formula. Note that the R, G, and B values are all in the range of 0 to 255.
[0105] (R value of training image) = {Sr × (255-M) / 255} + Nr × M / 255 (G value of training image) = {Sg × (255-M) / 255} + Ng × M / 255 (B value of training image) = {Sb × (255-M) / 255} + Nb × M / 255 In the above formula, Sr, Sg, and Sb are the R, G, and B values of the good image that is the source of the learning image, Nr, Ng, and Nb are the R, G, and B values of the composite image (defective part image), and M is the R, G, and B values of the mask image. When compositing using the above formula, the area of the good image that corresponds to the white part of the mask image (R, G, and B values are all 255) has the same R, G, and B values as the defective part image. On the other hand, the pixel value of the area of the good image that corresponds to the black part of the mask image (R, G, and B values are all 0) does not change. In other words, the compositing using the above formula is a compositing in which the white part of the mask image has a transparency of 100% and the black part has a transparency of 0%. The transparency of the mask image can be set appropriately, and learning images with different appearances can also be generated by changing the transparency of the mask image. In addition, the boundary part of the composite image can be smoothed by smoothing the mask image (the transparency of the boundary part is other than 0% and 100%).
[0106] [Embodiment 3] A third embodiment of the present invention will be described with reference to Figs. 7 to 11. The determination system according to this embodiment differs from the determination system 100 of the first embodiment in that it includes an image generating device 7 instead of the image generating device 4. The image generating device 7 differs from the image generating device 6 of the second embodiment in the method of generating learning images. Components similar to those included in the image generating device 6 are denoted by the same reference numerals, and descriptions thereof will be omitted.
[0107] (Configuration of image generating device 7) 7 is a block diagram showing an example of a configuration of a main part of an image generating device 7 according to this embodiment. As shown in the figure, the image generating device 7 includes a control unit 70 that controls each part of the image generating device 7, and a storage unit 71 that stores various data used by the image generating device 7. The control unit 70 includes a data acquisition unit 601, an object detection unit 602, a region extraction unit 603, a color information generation unit 704, a target region setting unit 705, and an image generating unit 706. In addition, the storage unit 71 stores a reference shape 711 and a learning image 712.
[0108] The color information generating unit 704 generates color information indicating the color difference between a defective part shown in the incorrectly determined defective product image and a normal part where the defect may occur but does not occur, from the incorrectly determined defective product image acquired by the data acquiring unit 601. Hereinafter, this color information is referred to as differential color information.
[0109] The target region setting unit 705 sets a part or all of the defect candidate regions extracted by the region extraction unit 603 in the non-defective image acquired by the data acquisition unit 601 as color conversion target regions, which are regions to be subjected to color change. The method of setting the color conversion target regions will be described later.
[0110] Similar to the image generating units 42 and 606, the image generating unit 706 generates a plurality of learning images to be used as teacher data for re-learning the determination model 15, based on defective parts appearing in the misjudged defective product images acquired by the data acquiring unit 601. More specifically, the image generating unit 706 generates learning images 712 by changing the color in the color conversion target area set by the target area setting unit 705, based on the differential color information generated by the color information generating unit 704.
[0111] The reference shape 711 is a shape that serves as a reference when the target area setting unit 705 determines the shape of the color conversion target area. Only one reference shape 711 may be stored, or multiple reference shapes 711 may be stored. The reference shape 711 can be any shape, and for example, the reference shape 711 can be a circle, an ellipse, a rectangle, a polygon, a modified shape thereof, a combination thereof, or the like.
[0112] The learning images 712 are images used as teacher data for re-learning the determination model 15, and are generated by the image generating unit 706. A method for generating the learning images 712 will be described later.
[0113] As described above, the image generating device 7 comprises a color information generating unit 704 which generates, from the misjudged defective product image acquired by the data acquiring unit 601, differential color information indicating the color difference between a defective part appearing in the misjudged defective product image and a normal part where the defect may occur but does not occur, and a region extracting unit 603 which extracts a defect candidate region from a good product image in which a good object is shown, and the image generating unit 706 generates a learning image 712 by changing the color of some or all of the defect candidate regions extracted by the region extracting unit 603 based on the differential color information.
[0114] According to the above configuration, an area in a predetermined color range in which a part where a defect may occur is extracted, and the color of part or all of the area is changed based on differential color information indicating the color difference between the defective part and the normal part to generate the learning image 712. Therefore, it is possible to generate a valid learning image 712 in which defects similar to the defective parts in the misjudged defective product image acquired by the data acquisition unit 601 are reproduced by color differences.
[0115] (Processing flow: Color information generation) The color information generation process (the first half of the image generation method) will be described with reference to Fig. 8. Fig. 8 is a diagram for explaining the differential color information generation process. Fig. 8 also shows a flowchart showing the flow of the differential color information generation process, as well as an example of selection of defective parts and normal parts in a defective product image K.
[0116] In S21, the data acquisition unit 601 acquires an image that has been erroneously determined as a good product by the judgment device 1, that is, a defective product image. Here, for example, it is assumed that a defective product image K shown in FIG. 8 has been acquired. The defective product image K is an image obtained by photographing an object that has a similar shape to the object F shown in FIG. 4 and is a defective product. The defective product image K includes an image k1 of the top of the upper surface of the object and an image k2 of a recess of the object. Furthermore, the defective product image K includes a defective portion k3.
[0117] In S22, the color information generating unit 704 displays the defective product image K acquired in S21 on an arbitrary display device. For example, when the output unit 64 is a display device, the color information generating unit 704 may cause the output unit to display and output the defective product image K. This allows the operator of the image generating device 7 to recognize the defective product image K and the defective part k3 depicted therein.
[0118] In S23, the color information generating unit 704 accepts the selection of the defective part k3 in the defective product image K displayed in S22. The selection of the defective part k3 may be performed, for example, by designating the defective part k3 in the displayed defective product image K by an input operation via the input unit 63. For example, the defective part k3 may be selected with a cursor k4 as shown in FIG.
[0119] In S24, the color information generating unit 704 acquires color information of the defective part k3 selected in S23. In the following, the color information of the defective part k3 is referred to as defective part color information. The defective part color information may be the RGB value of the defective part k3, or may be a converted RGB value. For example, the color information generating unit 704 may convert the RGB value of the defective part k3 into an HSV value to obtain the defective part color information.
[0120] In S25, the color information generating unit 704 accepts the selection of a normal part (a part where a defect may occur but does not occur) in the defective product image K displayed in S22. The selection of the normal part may be performed in the same manner as the selection of the defective part k3.
[0121] In S26, the color information generating unit 704 acquires color information of the normal part selected in S25. Note that, hereinafter, the color information of the normal part is referred to as normal part color information. The normal part color information may be the same information as the defective part color information, and may be an RGB value or may be a converted RGB value. For example, if the defective part color information indicates the HSV value of the defective part k3, the normal part color information also indicates the HSV value of the normal part. Note that the processes of S25 and S26 may be performed before the processes of S23 and S24.
[0122] In S27, the color information generating unit 704 generates differential color information indicating the color difference between the defective part and the normal part. Specifically, the color information generating unit 704 may set the difference between the defective part color information acquired in S24 and the normal part color information acquired in S26 as the differential color information. When the differential color information is expressed in the form of (Th, Ts, Tv), Th, Ts, and Tv are respectively expressed by the following formulas. Th=Oh-Nh Ts=Os-Ns Tv=Ov-Nv Note that Th, Ts, and Tv are the H (hue), S (saturation), and V (lightness) values in the differential color information, respectively. Oh, Os, and Ov are the H, S, and V values in the normal part information, respectively, and Nh, Ns, and Nv are the H, S, and V values in the defective part color information, respectively.
[0123] For example, assume that the normal part color information is (H:53, S:28, V:68) and the defective part color information is (H:43, S:56, V:63). In this case, the difference color information is (H:10, S:-28, V:5). In this example, in the defective part, H (hue) is a smaller value (reddish color) than the normal part, and S (saturation) is a larger value (darker color) than the normal part. The process of FIG. 8 ends with the generation of the difference color information.
[0124] Note that the way in which the color difference from normal parts appears varies depending on the type of defect. For this reason, it is preferable that the color information generating unit 704 generates difference color information that makes it easy to distinguish the color difference from normal parts according to the type of defect to be detected.
[0125] (Processing flow: Overall) The flow of the process (the latter half of the image generating method) executed by the image generating device 7 will be described with reference to Fig. 9. Fig. 9 is a diagram for explaining the process executed by the image generating device 7. Fig. 9 also shows a flowchart showing the flow of the process executed by the image generating device 7, as well as examples of a good-quality partial image M obtained by cutting out a portion in which an object is captured from a good-quality image, a binarized image M1 generated from the good-quality partial image M, and a learning image N generated from the good-quality partial image M.
[0126] The processes of S31 to S35 are performed for each of the multiple non-defective images that are the source of the learning images, and are terminated when learning images have been generated from all of the non-defective images. Note that S31 to S33 are similar to S13 to S15 in FIG. 4, respectively, and therefore will not be described repeatedly here.
[0127] In S34, the target area setting unit 705 sets a color conversion target area to be a target for color change. For example, in the binarized image M1 shown in Fig. 9, a color conversion target area m13 indicated by a dashed frame is set. This color conversion target area m13 straddles both the area where a defect may occur, i.e., the defect candidate area m11 extracted in S33, and another area m12. In this way, it is sufficient that at least a part of the color conversion target area m13 is included in the defect candidate area m11, and it is not necessary that the entire color conversion target area m13 is included in the defect candidate area m11.
[0128] In S35, the image generation unit 706 generates a learning image 712 by changing the color of some or all of the defect candidate regions extracted in S33 based on the difference color information generated by the color information generation unit 704 in S27 of Figure 8.
[0129] For example, as shown in Fig. 9, when a color conversion target region m13 is set in a binary image M1, a learning image N is generated in which the color of each pixel in the color conversion target region m13 is changed. The learning image N includes an image n1 of the top of the upper surface of the object and an image n2 of a recess of the object, and the image n1 includes a defective portion n3 caused by the discoloration process in S35.
[0130] (Process flow: Setting the color conversion target area) The flow of the process of setting the color conversion target area performed in S34 of Fig. 9 will be described with reference to Fig. 10. Fig. 10 is a diagram for explaining the process of setting the color conversion target area. Fig. 10 also shows an example of setting the color conversion target area in the binarized image P, together with a flowchart showing the flow of the process of setting the color conversion target area.
[0131] In S341, the target region setting unit 705 sets a reference position. The reference position may be set within the defective candidate region extracted in S33 of Fig. 9. The method of setting the reference position is arbitrary, and for example, the target region setting unit 705 may set the reference position using a random number. In the binarized image P shown in Fig. 10, of two upper and lower defective candidate regions p1 and another region p2 sandwiched between them, the reference position p3 is set in the lower defective candidate region p1.
[0132] In S342, the target area setting unit 705 selects one to be used for setting the color conversion target area from among the reference shapes 711 stored in the storage unit 71. Here, the reference shape 711 corresponding to the learning image to be generated may be selected, and the selection method is not particularly limited. For example, when generating a learning image including a defective part of an arbitrary shape, the target area setting unit 705 may be configured to randomly select one to be used from the reference shapes 711 stored in the storage unit 71. Also, when generating a learning image including a defective part of a predetermined shape, the target area setting unit 705 may be configured to select one of the reference shapes 711 stored in the storage unit 71 that has the predetermined shape or one that is close to the predetermined shape.
[0133] In S343, the target area setting unit 705 performs shape conversion of the reference shape 711 selected in S342. The shape after conversion becomes the shape of the color conversion target area. Since the position of the color conversion target area is set in S341, the shape of the color conversion target area is determined by the processing of S343, and the position and shape of the color conversion target area are confirmed. Note that if there is only one reference shape 711, the processing of S342 is not necessary. Also, if shape conversion of the reference shape 711 is not necessary, the processing of S343 is not necessary.
[0134] 10 shows a rectangular reference shape Q1 with rounded corners and a circular reference shape Q2 as examples of the reference shape 711. If such a reference shape 711 is selectable, it is assumed that the reference shape Q1 is selected in S342. In this case, shape conversion of the reference shape Q1 is performed in S343.
[0135] The method of shape transformation is not particularly limited. For example, the positions of the vertices of the reference shape Q1 may be shifted according to a predetermined rule or randomly. For example, the reference shape Q1 may be subjected to a rotation transformation, and the rotation angle in this case may be set according to a predetermined rule or may be set randomly. The reference shape Q1 may be transformed by any transformation method such as affine transformation. Note that each of the above-mentioned methods may be applied alone or in combination.
[0136] The transformed reference shape Q11 shown in Fig. 10 is obtained by randomly changing the positions of the four vertices of the reference shape Q1, rotating it by a randomly selected rotation angle, and further deforming it by affine transformation. When the area of this transformed reference shape Q11 is placed at the reference position p3, a color conversion target area p4 as shown in Fig. 10 is determined. In this way, according to the image generation method of this embodiment, it is possible to generate a learning image including a defective part of any shape. Therefore, the image generation method of this embodiment is effective for defects with an indefinite shape or range (for example, discoloration, stains, etc.).
[0137] (Processing flow: Image generation for learning) The flow of the learning image generation process performed in S35 of Fig. 9 will be described with reference to Fig. 11. Fig. 11 is a flowchart showing the flow of the learning image generation process. The processes of S351 to S354 are performed for each pixel in the color conversion target area in the non-defective image that is the source of the learning image, and when the processes are completed for all pixels, the learning image generation process shown in Fig. 11 ends. Note that the learning image generation process shown in Fig. 11 is a process when the difference color information is represented by HSV values. When the difference color information is represented by RGB values, the processes of S352 and S354 are not necessary.
[0138] In S351, the image generating unit 706 selects one pixel that has not been selected so far from among the pixels in the color conversion target area, and determines whether or not the pixel is a pixel in the defective candidate area. If the selected pixel is a pixel in the defective candidate area (YES in S351), the image generating unit 706 proceeds to S352. On the other hand, if the selected pixel is not a pixel in the defective candidate area (NO in S351), the image generating unit 706 starts over from the process of selecting a pixel that has not been selected so far.
[0139] In S352, the image generation unit 706 converts the RGB values of the pixel selected in S351 into HSV values. Then, in S353, the image generation unit 706 converts the HSV values obtained by the conversion in S352 based on the differential color information generated in S27 of Fig. 8. Then, in S354, the image generation unit 706 converts the HSV values obtained by the conversion in S353 back into RGB values.
[0140] The conversion in S353 may be performed, for example, according to the following formula: Dh=Sh-Th+Rh Ds = Ss - Ts + Rs Dv=Sv-Tv+Rv Dh, Ds, and Dv are H (hue), S (saturation), and V (brightness) values of the pixel after conversion, respectively. Sh, Ss, and Sv are H, S, and V values of the non-defective image before conversion, and Th, Ts, and Tv are H, S, and V values of the differential color information. Rh, Rs, and Rv are values determined using random numbers, and are added to the learning image to give it a change. For example, the image generating unit 706 may determine the values of Rh, Rs, and Rv using random numbers before the start of the loop in FIG. 11. The values of Rh, Rs, and Rv are set to values such that the learning image to be generated is not too different from the defective image that is the source of the learning image. For example, the values of Rh, Rs, and Rv may be set using random numbers within the range of -5 to +5. This range may be changeable by setting. Of course, the pixel values of the learning image may be calculated without adding Rh, Rs, and Rv.
[0141] (Another example of a method for generating learning images 712) The learning image 712 can also be generated without using the reference shape 711. In this case, the target region setting unit 705 may set a continuous region made up of pixels in a predetermined color range within the defect candidate region as the color conversion target region.
[0142] Specifically, the target region setting unit 705 may first select a pixel in the defective candidate region in a binarized image obtained by binarizing a non-defective image. Hereinafter, this pixel will be referred to as a first pixel. For example, when generating a learning image 712 using the binarized image P in the example of FIG. 10, the image generating unit 706 selects the first pixel in the defective candidate region p1. The first pixel may be selected randomly. At this time, the color information generating unit 704 may generate differential color information from color information of the defective part acquired in advance and color information of the first pixel.
[0143] Next, the target area setting unit 705 judges whether the difference in color information between the first pixel and the second pixel adjacent to the first pixel is within a predetermined range, and if it is within the range, performs the same judgment on the third pixel adjacent to the first pixel. This judgment is repeated until the difference in color information falls outside the predetermined range, thereby setting the color conversion target area. Note that the upper limits of the width and height of the color conversion target area to be set may be determined in advance.
[0144] After the color conversion target region is set, the image generation unit 706 changes the color of each pixel in the color conversion target region to generate the learning image 712. For example, the image generation unit 706 may first change the color of the first pixel using color information of the defective part acquired in advance and differential color information generated from the color information of the first pixel. Then, the image generation unit 706 may change the color of each pixel in the surrounding color conversion target region by using a differential value (relative value) between the color information of the defective part and the color information of the first pixel as a reference.
[0145] It is preferable to smooth the boundary between the part whose color is to be changed and the part whose color is not to be changed, thereby generating a natural learning image 712 in which the boundary between the part whose color is to be changed and the part whose color is not to be changed is smoothly connected.
[0146] [Modifications] (System configuration) The execution entity of each process described in each of the above embodiments is arbitrary and is not limited to the above examples. In other words, as long as it is possible to execute each process described in each of the above embodiments, the device constituting the determination system can be appropriately changed.
[0147] For example, in the determination system 100 in Fig. 1, the determination device 1, the storage device 2, and the data collection device 3 are each separate devices, but these may be configured as a single determination device. Similarly, the image generation device 4 and the learning device 5 may be configured as a single learning device. In this case, the determination devices may be placed in each of multiple production factories of the object, and the learning device may be placed in a management facility for those production factories. This makes it possible to maintain or improve the determination accuracy of objects in multiple production factories by using a single management facility.
[0148] In addition, in each of the above-described embodiments, an example has been described in which a single judgment model is used to judge a plurality of types of defects. However, a judgment model may be constructed for each type of defect, and each type of defect may be detected by the judgment model for detecting that defect.
[0149] In each of the above-described embodiments, the timing of re-learning is arbitrary. For example, the confidence level output by the judgment model may be automatically monitored, and when the confidence level decreases, the operator of the judgment system 100 may be notified of the decrease to prompt the operator to re-learn. In addition, for example, the operator of the judgment system 100 may cause the system to perform re-learning when an object is added or changed, or when a new type of defect is found.
[0150] (About the composite images) In the above-mentioned embodiments, the defective part image and the mask image are used as the image to be synthesized as they are, or after being subjected to conversion processing, but it is not essential to use a mask image. For example, the defective part shown in the defective part image may be trimmed to be used as the image to be synthesized. Of course, in this case, the defective part may also be subjected to conversion processing.
[0151] [Software implementation example] The functions of the judgment device 1, the data collection device 3, the learning device 5, and the image generation devices 4, 6, and 7 (hereinafter referred to as the "devices") can be realized by a program (image generation program) for causing a computer to function as the devices, and for causing a computer to function as each control block of the devices (in particular, each part shown in Figure 1, each part included in the control unit 60 in Figure 3, and each part included in the control unit 70 in Figure 7).
[0152] In this case, the device includes a computer having at least one control device (e.g., a processor) and at least one storage device (e.g., a memory) as hardware for executing the program. The control device and storage device execute the program to realize each function described in each of the above embodiments.
[0153] The program may be non-transitory and may be recorded in one or more computer-readable recording media. The recording media may or may not be included in the device. In the latter case, the program may be provided to the device via any wired or wireless transmission medium.
[0154] In addition, some or all of the functions of each of the control blocks can be realized by a logic circuit. For example, an integrated circuit in which a logic circuit that functions as each of the control blocks is formed is also included in the scope of the present invention. In addition, the functions of each of the control blocks can be realized by, for example, a quantum computer.
[0155] The present invention is not limited to the above-described embodiments, and various modifications are possible within the scope of the claims. Embodiments obtained by appropriately combining the technical means disclosed in different embodiments are also included in the technical scope of the present invention. [Explanation of symbols]
[0156] 100 Judgment System 1 Judgment device 15 Decision Model 3 Data collection equipment 4. Image Generation Device 41 Data Acquisition Section 42 Image Generation Unit 5 Learning Device 6 Image generation device 601 Data Acquisition Section 603 Area extraction part 604 Image synthesis unit 605 Composite position determination unit 606 Image Generation Unit 611 Learning Images 7 Image Generation Device 704 Color information generation section 706 Image Generation Unit 712 Learning Images
Claims
1. a data acquisition unit that acquires images of a plurality of objects of unknown quality that are erroneously determined to be good when a defective object is erroneously determined to be good in a quality determination using a determination model constructed by machine learning using images of objects of known quality as training data among images of each of the objects of unknown quality; an image generation unit that generates a plurality of learning images to be used as teacher data for re-learning the determination model based on defective parts shown in the images acquired by the data acquisition unit; an area extraction unit that extracts an area of a predetermined color range in which a part where the defect may occur is captured from a non-defective product image in which the non-defective product object is captured; a synthesis image generating unit that cuts out the defective portion from the image acquired by the data acquiring unit and generates a synthesis image to be synthesized with the region; a synthesis position determination unit that determines a synthesis position of the image to be synthesized by repeating a series of processes, including (1) setting a candidate position for synthesizing the image to be synthesized within the area, (2) determining whether the entire image to be synthesized synthesized at the candidate position fits within the area, and (3) changing the candidate position if the image does not fit within the area, until it is determined that the entire image to be synthesized fits within the area; The image generating unit generates the learning image by compositing the image to be combined at the combination position determined by the combination position determination unit.
2. a data acquisition unit that acquires images of a plurality of objects of unknown quality that are erroneously determined to be good when a defective object is erroneously determined to be good in a quality determination using a determination model constructed by machine learning using images of objects of known quality as training data among images of each of the objects of unknown quality; an image generation unit that generates a plurality of learning images to be used as teacher data for re-learning the determination model based on defective parts shown in the images acquired by the data acquisition unit; a color information generating unit that generates, from the image, color information indicating a color difference between a defective part shown in the image and a normal part in which the defect may occur but does not occur; a region extraction unit that extracts a region of a predetermined color range in which a portion where the defect may occur is captured from a non-defective product image in which the non-defective product object is captured, The image generating unit generates the learning image by changing the color of part or all of the area extracted by the area extracting unit based on the color information.
3. A determination device that determines whether an object is good or bad from an image of the object whose quality is unknown, using a determination model constructed by machine learning using images of the object whose quality is known as training data; a data collection device for acquiring the image when the judgment device erroneously judges an object to be a non-defective object when the object is actually a defective object; an image generating device according to claim 1 or 2, which generates a plurality of learning images to be used as teacher data for re-learning the determination model based on defective parts appearing in the images acquired by the data collecting device; a learning device that re-learns the judgment model using the plurality of learning images generated by the image generation device as teacher data.
4. the determination device outputs an index value indicating a likelihood of the result together with the result of the pass / fail determination; The judgment system described in claim 3, wherein, in addition to the images for which the judgment device has made an incorrect judgment, the data collection device acquires at least one of the images for which the judgment result of the judgment device was correct, (1) the images for which the likelihood indicated by the index value was less than a predetermined threshold, and (2) the images for which the likelihood indicated by the index value was relatively low among the index values output by the judgment device for each of a plurality of objects.
5. An image generating method executed by an image generating device, comprising: a data acquisition step of acquiring images of a plurality of objects of unknown quality that are erroneously determined to be good or bad in a quality determination using a determination model constructed by machine learning using images of objects of known quality as training data, when an object that is actually defective is erroneously determined to be good or bad; an image generating step of generating a plurality of learning images to be used as teacher data for re-learning the determination model based on defective parts shown in the images acquired in the data acquiring step; A region extraction step of extracting a region of a predetermined color range in which the part where the defect may occur is shown from a non-defective product image in which the non-defective object is shown; a step of extracting the defective portion from the image acquired in the data acquisition step and generating an image to be combined with the defective portion; a synthesis position determination step of determining a synthesis position of the image to be synthesized by repeating a series of processes of (1) setting a candidate position for synthesizing the image to be synthesized within the area, (2) determining whether the image to be synthesized synthesized at the candidate position fits entirely within the area, and (3) changing the candidate position if the image does not fit, until it is determined that the image to be synthesized fits entirely within the area; In the image generating step, the image for synthesis is synthesized at the synthesis position determined in the synthesis position determination step to generate the learning image.
6. An image generating method executed by an image generating device, comprising: a data acquisition step of acquiring images of a plurality of objects of unknown quality that are erroneously determined to be good or bad in a quality determination using a determination model constructed by machine learning using images of objects of known quality as training data, when an object that is actually defective is erroneously determined to be good or bad; an image generating step of generating a plurality of learning images to be used as teacher data for re-learning the determination model based on defective parts shown in the images acquired in the data acquiring step; generating color information indicating a color difference between a defective portion shown in the image and a normal portion in which the defect may occur but does not occur from the image; A region extraction step of extracting a region of a predetermined color range in which the part where the defect may occur is shown from a non-defective product image in which the non-defective product object is shown, In the image generating step, the learning image is generated by changing a color in a part or all of the area extracted in the area extracting step based on the color information.
7. An image generation program for causing a computer to function as the image generating device described in claim 1, the image generation program causing a computer to function as the data acquisition unit, the image generation unit, the area extraction unit, the image generation unit for synthesis, and the synthesis position determination unit.
8. An image generation program for causing a computer to function as the image generating device described in claim 2, comprising the data acquisition unit, the image generation unit, the color information generation unit, and the area extraction unit.
Citation Information
Patent Citations
Image generation device and image generation method of generating an inspection-purpose image for making performance adjustment of image inspection system
JP2018205123A
Data generation device, data generation method, and data generation program
JP2019109563A
Image recognition learning device, image recognition learning method, image recognition learning program and terminal device
JP2021002270A
Identification system, model presentation method, and model presentation program
WO2020049636A1
