Method for producing labeled image data, inspection method, memory storing program, device for producing labeled image data, and inspection device
By adding extra channels to the image and assigning specific pixel values, segmenting and labeling the image, it solves the problem of label reassignment when the number of image segmentations changes in deep learning, reduces learning costs and improves the accuracy of the recognizer.
Patent Information
- Application Number
- CN201980047310.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-07-20
- Filing Date
- 2019-07-11
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2039-07-11
AI Technical Summary
In machine learning such as deep learning, a large number of images need to be learned to determine the parameters of the recognizer, and if the number of image divisions is changed, the divided images need to be relabeled, which increases the production burden and learning cost.
By adding extra channels to the image, assigning specific pixel values to the defective areas, and segmenting the image into multiple segmented images, assigning good or bad labels, and finally removing the extra channels to generate labeled image data, the production burden is reduced and learning is reduced cost.
It reduces the operational burden, reduces learning costs, and improves the accuracy of the recognizer in the process of image segmentation and labeling. Especially when the number of image segmentations is changed, there is no need to repeatedly specify the defect area, which simplifies the process of recreating labeled image data. process.
Smart Images

Figure CN112424827B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for producing labeled image data, a method for inspecting the same, a memory storing a program, a device for producing labeled image data, and a device for inspecting the same. The labeled image data is given to a recognizer as teaching data when performing supervised learning, etc. Background Art
[0002] For example, Patent Document 1 discloses a learning device that divides image data with correct labels into multiple parts, performs additional learning, and adds an output showing a stable result to an image with supervision. The learning device includes: an image generation unit that generates an unlabeled image based on a first image with correct labels; an image selection unit that selects an unlabeled image to be presented to a user; an output unit that outputs the selected unlabeled image to a display unit; and a correct label setting unit that associates the correct label obtained from the input unit with the selected unlabeled image and sets it as a second image with correct labels. The discriminator generation unit regenerates the discriminator based on the feature vector of the first image with correct labels and the feature vector of the second image with correct labels.
[0003] Furthermore, Patent Document 2 discloses a machine learning device that uses a method of using machine learning for generation of supervised data.
[0004] Prior art literature
[0005] Patent Literature
[0006] Patent Document 1: Japanese Patent Publication No. 2013-125322
[0007] Patent Document 2: Japanese Patent Publication No. 2015-185149 Summary of the invention
[0008] Technical problem to be solved by the invention
[0009] However, in machine learning such as deep learning, a large number of images need to be learned in order to determine the parameters of the recognizer. For example, it is known that when a recognizer is used for inspection, if the image is segmented as described in Patent Document 1, the accuracy is improved, but it is necessary to assign a label to each segmented image. In addition, if the accuracy of the recognizer is not sufficient, if the number of image segments is changed and learning is performed again, a recognizer with a high accuracy can be obtained.
[0010] However, if the number of image segments is changed, there is a technical problem that the segmented images segmented with the changed number of segments need to be labeled again. In addition, the above technical problem is not limited to deep learning, but is basically common in supervised machine learning performed by support vector machines (SVM) and the like described in Patent Document 1.
[0011] The object of the present invention is to provide a method for producing labeled image data, a method for inspecting the same, a program, a device for producing labeled image data, and a device for inspecting the same, which can reduce the burden of producing labeled image data for segmenting images and use them as supervised data for supervised or semi-supervised machine learning and reduce the learning cost.
[0012] Technical solutions adopted to solve technical problems
[0013] Hereinafter, a method for solving the above-mentioned technical problems and its effects will be described.
[0014] A method for producing labeled image data that solves the above-mentioned technical problem, the method producing labeled image data for use as supervisory data, wherein the supervisory data is used to cause a pre-learning identifier to perform supervised or semi-supervised machine learning in order to generate an identifier for inspecting the presence or absence of defects in an inspection object in a captured image, the method for producing labeled image data comprising: a channel adding step, wherein other channels other than one or more channels constituting the image are added to an image in which the inspection object is captured; a pixel value adding step, wherein a second pixel value is added as a pixel value indicating a defect to an area in the other channel corresponding to a defect area in the image, the second pixel value being different from a first pixel value added to other areas without defects; a segmentation step, wherein the image including the other channel is segmented into a plurality of segmented images; a label adding step, wherein, among the plurality of segmented images, a bad label is added to the segmented image including the second pixel value in the other channel in the segmented image, and a good label is added to the segmented image not including the second pixel value in the other channel in the segmented image; and a channel removing step, wherein the other channel is removed from the segmented image to produce the labeled image data.
[0015] According to the above method, even if the captured image is segmented to generate labeled image data used as supervisory data, the generation burden can be reduced and the learning cost can be reduced. For example, when the number of image segmentations is changed to regenerate labeled image data, the operator does not need to re-perform the operation of specifying the defective area of the image each time the number of segmentations is changed, thereby reducing the operation burden and the learning cost.
[0016] In the above-mentioned method for producing the image data, it is more ideal that: there are multiple types of the above-mentioned defects, in the above-mentioned pixel value assigning step, when the above-mentioned second pixel value is assigned to the above-mentioned other channels, the second pixel value with different values according to the type of the above-mentioned defect is assigned, and in the above-mentioned label assigning step, the above-mentioned segmented image including the above-mentioned second pixel value is assigned a bad label with different values according to the values of the above-mentioned two pixel values.
[0017] According to the above method, it is possible to create labeled image data to which different defect labels are given according to the types of defects.
[0018] In the above-mentioned method for producing image data, it is preferable that: in the above-mentioned segmentation step, the above-mentioned image to which the above-mentioned other channel is added is segmented into a plurality of the above-mentioned segmented images in which the above-mentioned segmented images adjacent to each other partially overlap.
[0019] According to the above method, even if a defect involves a plurality of segmented images, the frequency of defect segmentation can be reduced. Therefore, when learning is performed using labeled image data, a high accuracy rate can be easily obtained.
[0020] In the above-mentioned method for producing image data, it is more ideal that the above-mentioned other channel is an alpha channel.
[0021] According to the above method, by using the alpha channel for setting the opacity of the image, it is possible to relatively easily assign the second pixel value indicating the defect to the area corresponding to the defect area without affecting the channel of the captured image.
[0022] In the above-mentioned method for producing image data, it is more ideal that: when the output when the test data is input into the recognizer cannot obtain an accuracy rate above the specified value, the number of divisions in the above-mentioned segmentation step is changed, and the above-mentioned recognizer is generated by using the above-mentioned labeled image data as supervised data for supervised or semi-supervised machine learning.
[0023] According to the above method, when the output of the recognizer generated by supervised or semi-supervised machine learning when the test data is input cannot obtain a correct rate of more than a predetermined value, when the number of divisions in the division step is changed and the labeled image data is re-created, the image has already been assigned another channel and a second pixel value indicating a defect. Therefore, when the number of divisions of the image is changed and the labeled image data is re-created, the operator does not need to operate the input device and specify the defect area in order to specify the area to be assigned the second pixel value to another channel.
[0024] The inspection method for solving the above-mentioned technical problem comprises: an identifier generation step, in which the labeled image data produced by the method for producing labeled image data according to any one of claims 1 to 5 is used as supervised data to perform supervised or semi-supervised machine learning and generate an identifier; and a judgment step, in which the quality of the inspection object is judged based on an output value, and the output value is obtained as follows: an image captured by the inspection object is divided into a number of divisions that is the same as the number of divisions of the segmented image used in generating the identifier to obtain a plurality of segmented images, the segmented images are input to the identifier, and are output from the identifier as recognition results.
[0025] According to the above method, since the burden of creating labeled image data for training a pre-trained recognizer can be reduced, the quality of the inspection object can be inspected at a low learning cost.
[0026] In the above inspection method, it is more ideal that the above machine learning is deep learning.
[0027] According to the above method, the quality of the inspection object can be inspected by deep learning at a low learning cost.
[0028] A program for solving the above technical problem is executed by a computer that produces labeled image data, and in order to generate a recognizer for use in inspecting the presence or absence of defects in an inspection object in a captured image, the labeled image data is used as supervision data for causing a pre-learned recognizer to perform supervised or semi-supervised machine learning, wherein the above program is executed by a computer that produces labeled image data for use as supervision data, wherein the supervision data is used to generate a recognizer for use in inspecting the presence or absence of defects in an inspection object in a captured image, and causes a pre-learned recognizer to perform supervised or semi-supervised machine learning, and the program is characterized in that it comprises: a channel adding step, in which the computer adds other channels other than one or more channels constituting the image to the image of the inspection object. a pixel value assigning step, wherein the computer assigns a second pixel value as a pixel value indicating a defect to an area in the other channel corresponding to the defective area in the image, wherein the second pixel value is different from a first pixel value assigned to other areas without defects; a segmentation step, wherein the computer segments the image including the other channel into a plurality of segmented images; a label assigning step, wherein the computer assigns a bad label to a segmented image including the second pixel value in the other channel of the segmented image, and assigns a good label to a segmented image not including the second pixel value in the other channel of the segmented image, among the plurality of segmented images; and a channel removing step, wherein the computer removes the other channel from the segmented image to produce labeled image data.
[0029] By making the computer execute the above program, the burden of creating labeled image data by dividing the captured image and recreating it by changing the number of divisions if the accuracy of the learned recognizer is low is reduced, thereby reducing the learning cost. For example, when the labeled image data is recreated by changing the number of divisions of the image, the burden of the operator to re-designate the defective area of the image each time the number of divisions is changed can be reduced, thereby reducing the learning cost.
[0030] A device for producing labeled image data that solves the above-mentioned technical problem, which produces labeled image data used as supervisory data, wherein the supervisory data is used to supervise or semi-supervise a pre-learning recognizer in order to generate a recognizer for inspecting whether an inspection object in a captured image has defects, and the device for producing labeled image data is characterized in that it comprises: a channel adding unit that adds other channels other than one or more channels constituting the image to the image captured by the inspection object; a pixel value assigning unit that assigns a second pixel value as a pixel value indicating a defect to an area in the other channel corresponding to a defect area in the image, the second pixel value being different from a first pixel value assigned to other areas without defects; a segmentation unit that segments the image including the other channel into a plurality of segmented images; and a label assigning unit that assigns a bad label to a segmented image in which the other channel in the segmented image includes the second pixel value, and assigns a good label to a segmented image in which the other channel in the segmented image does not include the second pixel value, and after the label is assigned, removes the other channel from the segmented image to produce the labeled image data.
[0031] According to the labeled image data generating device, the burden of generating labeled image data by dividing a captured image and regenerating the labeled image data by changing the number of divisions if the accuracy of the learned recognizer is low can be reduced, thereby reducing the learning cost. For example, when the labeled image data is regenerated by changing the number of divisions of an image, the burden of the operator to re-designate the defective area of the image each time the number of divisions is changed can be reduced, thereby reducing the learning cost.
[0032] An inspection device that solves the above-mentioned technical problem comprises: a device for producing the above-mentioned labeled image data; a recognizer that is generated by using the labeled image data produced by the device for producing the labeled image data as supervised data and performing supervised or semi-supervised machine learning; a segmented image acquisition unit that segments an image of an inspection object with the same number of segmentations as the number of segmentations of the segmented image used in generating the recognizer to acquire a plurality of segmented images; and a determination unit that determines whether the inspection object is good or not based on an output result from the recognizer when the segmented image acquired by the segmented image acquisition unit is input into the recognizer.
[0033] According to the inspection device, the burden of creating labeled image data for learning a recognition device before learning is completed can be reduced, and the quality of the inspection object can be inspected at a low learning cost.
[0034] Effects of the Invention
[0035] According to the present invention, even when an image is segmented and labeled image data is produced as supervised data for supervised or semi-supervised machine learning, the production burden can be reduced and the learning cost can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a schematic side view showing an inspection device having a machine learning function according to the first embodiment.
[0037] Figure 2 This is a schematic plan view showing a portion of the inspection device that captures an image of an inspection target article.
[0038] Figure 3 This is a schematic diagram showing an example of various folders and images in the folders.
[0039] Figure 4 This is a block diagram showing the electrical structure of an inspection device having a machine learning function.
[0040] Figure 5 (a) is a schematic diagram showing the captured image. Figure 5 (b) is a schematic diagram showing the channel structure of the captured image.
[0041] Figure 6 (a) is a schematic diagram showing defects in an image. Figure 6 (b) is a schematic diagram illustrating a method for inputting and specifying a defect area.
[0042] Figure 7 is a schematic diagram showing the structure of an image to which an alpha channel is added.
[0043] Figure 8 This is a schematic diagram for explaining image segmentation.
[0044] Fig. 9 (a) and (b) are schematic diagrams for explaining a method of image segmentation.
[0045] Fig.10 (a) is a schematic diagram for explaining label setting. Fig.10 (b) is a schematic diagram showing the labeled segmented image data as the supervision data. Fig.10 (c) is a schematic diagram illustrating the conversion of arrangement data.
[0046] Fig.11 This is a schematic diagram for explaining supervised learning of a recognizer in a deep learning unit.
[0047] Fig.12 It is a flow chart showing the defect location entry process.
[0048] Fig.13 1 is a flowchart showing a segmented image creation process for creating a labeled segmented image as supervisory data.
[0049] Fig.14 (a) and (b) are schematic diagrams for explaining the process of assigning the second pixel value to the defective area of the alpha channel in the second embodiment.
[0050] Fig.15 1 is a flowchart showing the main part of a segmented image creation process for creating a labeled segmented image as supervisory data. DETAILED DESCRIPTION
[0051] (First Embodiment)
[0052] Hereinafter, an inspection system including an inspection device having a machine learning function will be described with reference to the accompanying drawings. Figure 1 The inspection system 11 shown inspects whether the article 12 has defects using an image of the article 12. The inspection system 11 includes a transport device 20 for transporting the article 12 and an inspection device 30 for inspecting the article 12 transported by the transport device 20.
[0053] like Figure 1As shown, the conveying device 20 includes: a conveyor 21 for conveying articles 12; a sensor 22 for detecting the articles 12 placed on the conveyor 21 and conveyed; and a discharge device 23 for removing the defective articles 12 from the production line where good articles are conveyed when the articles 12 are determined to be defective according to the inspection result of the inspection device 30. The conveyor 21 is, for example, a belt conveyor, and a conveyor belt 25 wound on a plurality of rollers 24 is rotated by the power of an electric motor 26. The conveyor 21 may be any other structure as long as it can convey the articles 12, such as a roller conveyor. A pair of guide members 27 for guiding the articles 12 are arranged on both sides of the width direction intersecting the conveying direction X of the conveyor 21. The discharge device 23 may be a structure that pushes out the articles 12 and removes them, or a structure that blows out the articles 12 and removes them by the force of air, but may be any other structure as long as it can remove the defective articles 12.
[0054] The inspection system 11 includes a controller C that controls the transport device 20 and the inspection device 30 .
[0055] The inspection device 30 includes: a camera 31 that photographs the article 12 transported by the conveyor 21; and a computer 32 that is electrically connected to the camera 31. The inspection device 30 determines whether the article 12 has a defect based on the image of the article 12 photographed by the camera 31. The computer 32 constitutes a part of the controller C. Specifically, the controller C includes: a programmable logic controller 33 (hereinafter also referred to as "PLC33") that controls the conveying device 20 and the camera 31; and the computer 32 that is electrically connected to the PLC33. The computer 32 includes an input device 34 and a display unit 35.
[0056] The PLC 33 controls the conveying device 20 and controls the photographing timing of the camera 31 according to the detection signal of the object 12 detected by the sensor 22. The image data obtained by the camera 31 photographing the object 12 is sent to the computer 32. The computer 32 checks whether the object 12 has defects based on the image data from the camera 31. Figure 1 In the example shown, the computer 32 is a personal computer or the like, but may be a microprocessor or the like built into a controller C in which the computer 32 and the PLC 33 are integrally configured.
[0057] exist Figure 1 , Figure 2 In the embodiment, a square plate-shaped article 12 is exemplified, but the shape, size, and type of the article 12 are not particularly limited.
[0058] like Figure 5As shown in (a), in the image captured by the camera 31, in addition to the object 12g, the conveyor belt 25 around the object 12g and a part of the guide member 27 are also included as part of the image. The inspection device 30 of this embodiment uses the identifier 66 (see Figure 4 ) The article 12 is inspected for defects. When a defect is detected, the inspection device 30 identifies the type of defect.
[0059] In this embodiment, the inspection device 30 performs supervised learning in order to generate the identifier 66 required for inspection. In this example, deep learning is used as machine learning. In deep learning, a large number of images need to be learned in order to obtain a high accuracy of the identifier 66. However, since it takes a lot of time to prepare a large number of images for learning, it is necessary to make it easy to create labeled image data and to make it easy to process in order to reduce the time required to redo the process due to changes in conditions.
[0060] The inspection device 30 generates the labeled segmented image data DIm (see Fig.10 (b)), in the labeled segmented image data Dim, for example, the segmented image data obtained by segmenting the image data of the object 12 captured by the camera 31 is set as a set with a correct label, and the correct label indicates the type of defect in the case of a good product and a defective product. Then, the inspection device 30 performs supervised learning using the labeled segmented image data DIm to generate the identifier 66.
[0061] like Figure 3 As shown in FIG. 1 , the image (original image) data used to create the monitoring data is divided into a folder F1 for good products and folders F2 and F3 for defective products and stored. The folder F1 for good products stores image data Im1 of good products with or without defects. There are multiple ( Figure 3 In the example, there are two types of defective products (folders F2 and F3). For example, the folder F2 stores image data Im2 of defective products containing small defects Ds. In addition, the folder F3 stores image data Im3 of defective products containing large defects D1. In addition, in the case where the image data Im2 and Im3 of defective products are not particularly distinguished for each type of defect, they are also collectively referred to as image data Imd. In addition, the original image used to produce the supervision data is not limited to the image captured by the camera 31 of the inspection device 30, but may also be an image obtained by pre-shooting the object 12 at other locations using a camera different from the inspection device 30. In the above case, the computer 32 inputs the image data from the external memory, or receives the image data from the server via the network.
[0062] Next, refer to Figure 4The electrical structure of the inspection system 11 is described. Figure 4 As shown, the controller C includes a computer 32 and a PLC 33. The conveyor 21, the sensor 22, and the discharge device 23 constituting the transport device 20 are electrically connected to the PLC 33. The PLC 33 includes a camera trigger processing unit 36 and a defective discharge processing unit 37. If a detection signal obtained by the sensor 22 detecting the article 12 is input, the camera trigger processing unit 36 outputs a shooting trigger signal to the computer 32. When the article 12 inspected by the computer 32 is a defective product, a discharge instruction signal is input from the computer 32 to the defective discharge processing unit 37.
[0063] The camera 31 is connected to a computer 32. An input device 34 and a display unit 35 are connected to the computer 32. If a shooting trigger signal is input from the camera trigger processing unit 36 to the computer 32, the computer 32 outputs a shooting instruction signal to the camera 31. If the camera 31 receives the shooting instruction signal, the camera 31 shoots the article 12 detected by the sensor 22 on the conveyor 21 as the center of the shooting area. In addition, the computer 32 performs inspection processing using the image data captured by the camera 31, and if it is determined that the article 12 is a defective defective product, the discharge instruction signal is output to the defective discharge processing unit 37. The defective discharge processing unit 37 drives the discharge device 23 based on the discharge instruction signal input from the computer 32 and removes the defective article 12 from the conveyor 21.
[0064] Next, refer to Figure 4 , the structure of the computer 32 constituting the inspection device 30 is described. Figure 4 As shown, the computer 32 includes a CPU 41, a memory 42, and an auxiliary memory 43. The auxiliary memory 43 is constituted by, for example, a hard disk drive (HDD).
[0065] Various programs Pr and identifier data CD are stored in the memory 42. The program Pr includes Fig.12 The defect location entry procedure shown in the flowchart of Fig.13The program for making a segmented image shown in the flowchart. The so-called identifier data CD includes model data (model data) and parameters constituting the identifier 66. The CPU 41 reads the identifier data CD and functions as the identifier 66. However, in the stage before the identifier 66 is completed, that is, in the stage of not learning or in the learning stage, its recognition result cannot obtain the expected accuracy. Therefore, the learning unit 64 performs supervised learning on the identifier 66 to adjust the parameters constituting the identifier data CD to the most appropriate value. Therefore, the identifier 66 includes: a learned identifier 66 that can obtain the expected accuracy according to the degree of learning; and a pre-learning identifier 66 that is in the stage of not learning or in the learning stage and cannot obtain the expected accuracy. In addition, even if the identifier 66 becomes a learned identifier, the learning cannot be terminated. In order to obtain a higher accuracy, or to adjust when the accuracy drops due to a slight change in the defect shape even if it is the same object 12, additional learning is performed.
[0066] Therefore, at the stage before the recognition device 66 is learned, the recognition device data CD is composed of the model data and the parameters before adjustment. Then, at the stage after the recognition device 66 is learned, the recognition device data CD is composed of the parameters and model data adjusted by the recognition device 66 before learning is completed. The CPU 41 reads the recognition device data CD composed of the parameters and model data adjusted by the supervised learning, and functions as the recognition device 66 after learning. The program Pr includes a program for the supervision data production unit 52 described later to produce the supervision data, which is given by the learning unit 64 in order to make the recognition device 66 before learning is completed to learn.
[0067] The CPU 41 includes a control unit 51, a supervisory data creation unit 52, a deep learning unit 53, and an inspection processing unit 54. The components 51 to 54 are functional units constituted by software constructed by the CPU 41 executing the program Pr. The control unit 51 performs overall control of the components 52 to 54.
[0068] The supervisory data production unit 52 produces supervisory data, which is given when the learning unit 64 causes the discriminator 66 before learning is completed to perform supervised learning. The supervisory data production unit 52 includes a defect position recording unit 61, a segmented image production unit 62 as an example of a segmentation unit, and a label setting unit 63 as an example of a label assignment unit. In addition to producing supervisory data to be given to the discriminator 66 by the learning unit 64 for supervised learning, the supervisory data production unit 52 also produces supervisory data to be given to the discriminator 66 as test data in order for the inference unit 65 described later to verify the result of supervised learning, that is, whether the discriminator 66 obtains the expected accuracy. In addition, in the present embodiment, the supervisory data production unit 52 corresponds to an example of a labeled image data production device.
[0069] The deep learning unit 53 includes a learning unit 64, an inference unit 65, and a discriminator 66. The learning unit 64 uses the supervisory data to make the discriminator 66 before learning complete supervised learning, thereby generating a discriminator 66 that has completed learning. The machine learning in this example is deep learning (deep learning). The learning unit 64 adjusts parameters such as weighting coefficients to the most appropriate values by giving the supervisory data produced by the supervisory data production unit 52 to the discriminator 66 and performing supervised learning.
[0070] The auxiliary memory 43 stores Figure 4 The image data set IG shown in FIG. 1 includes a plurality of image data Im (hereinafter referred to as "image Im") which are original images when the supervisory data generating unit 52 generates supervisory data. Figure 4 In the example shown, the image data set IG includes a learning data set TrD and a test data set TsD. The image data Im belonging to the learning data set TrD is the image data of the original image when the supervisory data generation unit 52 generates the supervisory data for supervised learning. The learning data set TrD includes Figure 3 The OK image Im1 and NG image Imd (Im2, Im3) are shown. Figure 3 As shown, in the folders F1, F2, and F3 named "OK", "NG1", and "NG2", OK image data Im1, NG1 image data Im2, and NG2 image data Im3 are stored respectively. In this way, in this example, NG image data Imd is separately stored in a plurality of folders F2 and F3 named according to the size of the defect or the type of the defect.
[0071] The image data Im belonging to the test data set TsD is the image data of the original image when the supervisory data generating unit 52 generates the supervisory data for the test, and the supervisory data for the test is used by the inference unit 65 to verify the accuracy of the identifier 66. The test data set TsD includes a plurality of image data different from the training data set TrD, but includes the same image data as the training data set TrD. Figure 3 The OK images Im1s and NG images Im2s and Im3s are distinguished by a plurality of folders F1 to F3 named with various names. In addition, in the present embodiment, the names of the folders F1 to F3 are used to correctly label the data when the supervisory data generating unit 52 generates supervisory data from the image Im. Figure 4In the example, the auxiliary memory 43 shows only the image data set IG for one quality of the article 12. When multiple types of articles 12 are inspected, the image data set IG is stored for each type. In the above case, the identifier data CD and the identifier 66 are set for each type. In addition, when there are multiple parts of the same article 12 to be inspected, the image data set IG, the identifier data CD and the identifier 66 are set for each part of the inspection object.
[0072] Next, refer to Figure 4 , the constituent elements of the supervisory data production unit 52 are explained. The defect position entry unit 61 enters the position of the defect into the defective image Imd in the image Im. If the operator inputs the designated defect position area from the input device 34, the defect position entry unit 61 adds other channels to the defective image Imd in addition to the color expression channel that expresses the color of the image Imd. Other channels are auxiliary channels that are added in addition to the color expression channel. The auxiliary channel is, for example, a channel that indicates opacity, and in this example, it is the alpha channel Imα. The defect position entry unit 61 adds the alpha channel Imα in addition to the color expression channel to the defective image Imd. Next, the defect position entry unit 61 enters the defect position area into the alpha channel Imα.
[0073] The divided image generating unit 62 divides the image data Im into a plurality of pieces to generate a plurality of divided image data DI. The operator operates the input device 34 to instruct the divided image generating unit 62 on the number of divisions. The divided image generating unit 62 divides the image data Im into the indicated number of divisions M×N to generate M×N pieces of divided image data DI (hereinafter also referred to as “divided images DI”).
[0074] The label setting unit 63 assigns a label to the segmented image DI. If the segmented image data has an alpha channel, the label setting unit 63 determines whether there is a second pixel value indicating a defect, and if there is a second pixel value, the name of the folder storing the original image (folder name), that is, "NG1" or "NG2", is assigned as a label. Although the segmented image data has an alpha channel, if there is no second pixel value indicating a defect, "OK" is assigned as a label. If the segmented image data does not have an alpha channel, the name of the folder storing the original image (folder name), that is, "OK", is assigned as a label. The label setting unit 63 removes the alpha channel from the segmented image after assigning the label, thereby producing labeled image data DIm (refer to Fig.10 (b)).
[0075] The learning unit 64 of the deep learning unit 53 uses the labeled image data as supervisory data to perform supervised learning on the pre-learning classifier 66. By causing the classifier 66 to learn the supervisory data, the learned classifier 66 is generated.
[0076] The machine learning in this example is deep learning (deep learning). The learning unit 64 causes the classifier 66 to learn the supervised data and determine the parameters.
[0077] The inference unit 65 uses the learned recognizer 66, inputs the image of the inspection object into the recognizer 66, and checks for defects based on the output results obtained by deep learning. In the inspection performed using the above-mentioned deep learning, if there are defects, the type of defects is also determined. In addition, the inference unit 65 is not only used for actual inspection, but also used to verify whether the learning results are appropriate. Then, the inference unit 65 inputs the labeled segmented image data DIm into the learned recognizer 66, and compares its output results with the correct labels to verify the accuracy. The above-mentioned labeled segmented image data Dim is produced by the supervisory data production unit 52 using the image data Im in the test data set TsD as the original image. If the accuracy is higher than the specified value, the learning is terminated. If the accuracy does not reach the specified value, the conditions are changed, such as changing the number of divisions of the image data Im, and re-learning is performed.
[0078] Figure 4 The inspection processing unit 54 shown in the figure inspects the inspection object 12 photographed by the camera 31 using the identifier 66. The inspection processing unit 54 includes an image acquisition unit 67, an image segmentation unit 68 as an example of a segmented image acquisition unit, and a determination unit 69. The image acquisition unit 67 acquires the image of the object 12 photographed by the camera 31. The image segmentation unit 68 divides the image acquired by the image acquisition unit 67 into the same number of divisions as the labeled segmented image data DIm used as supervisory data by the learning unit 64 in supervised learning. The inspection processing unit 54 sends the segmented image segmented by the image segmentation unit 68 to the deep learning unit 53. In the deep learning unit 53, the inference unit 65 inputs the segmented image DI received from the image segmentation unit 68 of the inspection processing unit 54 to the identifier 66 and infers whether it is "OK", "NG1", or "NG2" based on the output result of the identifier 66. The inference result of the inference unit 65 is sent from the deep learning unit 53 to the determination unit 69 of the inspection processing unit 54. In the inspection processing unit 54, the determination unit 69 performs inspection determination based on the inference result from the deep learning unit 53. The determination unit 69 determines whether the article 12 has a defect based on one of the inference results of "OK", "NG1", and "NG2". In this example, if the inference result is "OK", the determination unit 69 determines that it is a good product, and if the inference result is "NG1" or "NG2", the determination unit 69 determines that it is a defective product.
[0079] According to the determination result of the inspection processing unit 54, if the inspection result of the article 12 is a defective article, the computer 32 outputs a discharge instruction signal to the defective discharge processing unit 37. If the discharge instruction signal is input, the defective discharge processing unit 37 drives the discharge device 23 to discharge the defective article 12 on the conveyor 21 from the conveyor 21 to the outside.
[0080] Figure 5 (a) shows an example of image data Im captured by the camera 31. The image data Im is image data Imd (also referred to as "NG image data Imd") of a defective product including a defect Dg. Figure 5 As shown in (a), the image Im captured by the camera 31 includes the object 12g, the conveyor belt 25g, and the guide member 27g. The camera 31 can capture images in color. Figure 5 As shown in (b), the image Im captured by the camera 31 is composed of three channels: a red channel (R channel), a green channel (G channel), and a blue channel (B channel).
[0081] The operator displays the folder list on the display unit 35, opens the defective product folders F2 and F3 by mouse operation, selects the defective product image Imd, and displays the defective product image Imd (also referred to as "Ng image Imd") of the photographed article 12g containing the defect Dg on the display unit 35. For example, Figure 5 The NG image Imd including the defect Dg shown in (a) of FIG. 3 is shown in FIG. 3. The operator uses a pointing device such as a mouse or a stylus pen of the input device 34 to input and designate an area of the defect Dg in the NG image Imd.
[0082] Figure 6 (a) means Figure 5 The defect in the NG image Imd shown in (a) is Figure 6 If the defect Dg is shown in (a), the operator operates a pointing device such as a mouse or an electronic pen constituting the input device 34 to draw a line along the outline of the defect Dg. Figure 6 The defect area DA is surrounded by the enclosing line EL shown by the bold line in (b), or the defect area DA is blurred by the operation of the pointing device, thereby inputting the position coordinates of the designated defect area.
[0083] The defect position input unit 61 includes a channel adding unit 61A and a pixel value assigning unit 61B. If there is an input of the position coordinates of the defect area DA specified from the input device 34, the channel adding unit 61A adds the alpha channel Imα to the NG image data Imd. Then, the pixel value assigning unit 61B assigns a second pixel value P2 as a pixel value representing a defect to an area Dα (hereinafter also referred to as "defect area Dα") corresponding to the defect area DA of the alpha channel, and the second pixel value P2 is different from the first pixel value P1 assigned to the area without defects. The second pixel value P2 is assigned to all pixels belonging to the defect area Dα defined by the position coordinates of the defect area DA specified on the NG image Imd and the same position coordinates on the alpha channel Imα.
[0084] like Figure 7 As shown, the image ImD of the defective product after recording the defect position (also called "NG image ImD") is composed of the R channel ImR, the G channel ImG, the B channel ImB, and the alpha channel Imα that assigns the second pixel value P2 to the defect area Dα. The NG image ImD after recording the defect position is stored in the same folder F2, F3 as the original image, or in other folders F2, F3 with the same name.
[0085] The segmented image production unit 62 segments the image Im in the folders F1 to F3 for learning. The image Im that the segmented image production unit 62 segments is an OK image Im1 in the good product folder F1 and an NG image ImD to which the alpha channel Imα in the defective product folders F2 and F3 is attached. The segmented image production unit 62 displays the segmentation number input column on the display unit 35. The operator operates the input device 34 to input the number of image segments suitable for learning. The number of image segments is specified by the number of vertical segmentations M and the number of horizontal segmentations N of the input image. Among them, M and N are natural numbers, and at least one of them is greater than 2.
[0086] like Figure 8 As shown in FIG. 1 , the segmented image generating unit 62 divides the image data Im into M×N segments. As a result, M×N segmented images DI are generated. Figure 8 As shown, the M×N segmented images DI are divided into K segmented images including at least a part of a defect and (M×N-K) segmented images not including a defect. In addition, there are also images in which the object 12g is not included at all in the segmented images DI. Figure 8 In FIG. 5 , the image Im is divided into 48 pieces of 6×8.
[0087] In this embodiment, it is more desirable that the segmented image generating unit 62 segments the image data Im so that the boundaries between adjacent segmented images are partially overlapped. Fig. 9As shown in (a) of FIG. 1 , for a divided image DIo having other divided images adjacent to it in both the longitudinal and transverse directions, the divided image creating unit 62 extends the overlap amount ΔL on both sides in both the longitudinal and transverse directions.
[0088] In addition, regarding the segmented image DI located along the periphery of the image data Im, there is no adjacent segmented image on the outside in at least one of the longitudinal direction and the lateral direction. Regarding the direction in which there is no adjacent segmented image, the segmented image DIo is extended by twice the length of the repetition amount ΔL on the side where the adjacent segmented image exists. For example, Fig. 9 As shown in (b), the segmented image DIo at the upper left corner of the image data Im has adjacent segmented images only below and to the right. Fig. 9 The divided image DIo in (b) is extended downward and rightward by twice the length of the repetition amount ΔL. In this way, the image Im is divided into a plurality of divided images DI of the same size so that parts of the image Im overlap with those of the adjacent divided images DI.
[0089] If all images Im in the plurality of folders F1 to F3 are completely divided into M×N divided images DI, then the label setting unit 63 assigns a correct label (hereinafter referred to as a “label”) to the divided images DI. That is, the label setting unit 63 creates a data set (set data) that associates the divided images DI with the labels.
[0090] like Fig.10 As shown in (a), the setting of labels is performed by using the segmented image DI to which the alpha channel DIα (hereinafter also referred to as “α channel DIα”) is added for the segmented image DI of the defective product image ImD. For the segmented image DI of the good product, the segmented image creating unit 62 sets the name “OK” of the folder F1 to which the original image belongs as a label. In addition, the segmented image DI of the defective product image ImD is composed of the R channel DIR, the G channel DIG, the B channel DIB and the alpha channel DIα.
[0091] Regarding the segmented image DI whose original image belongs to either of the two defective product folders F2 and F3, Fig.10 As shown in (a), as long as there is a second pixel value P2 indicating a defect in the α channel DIα of the segmented image DI, the name "NG1" or "NG2" of the folder F2 or F3 to which the original image belongs is set as a label. For the segmented image DI without the second pixel value P2, "OK" is set as a label regardless of the name of the folder F2 or F3 to which the original image belongs.
[0092] If the labels are set for all segmented images DI, then Fig.10As shown in (b), the label setting unit 63 extracts the RGB image together with the label from the segmented image DI after label setting. That is, the α channel DIα is removed from the segmented image DI to obtain the segmented image data DIm (hereinafter also referred to as "supervisory data Dim") with the label as the supervisory data. Fig.10 As shown in (c), the learning unit 64 that receives the labeled segmented image DIm converts the segmented image data DIm from which the labels are removed into arrangement data. The arrangement data is data in which the pixel values of all pixels of the segmented image DI are arranged in a predetermined order.
[0093] like Fig.11 As shown, the deep learning unit 53 includes a recognizer 66. When learning, the recognizer 66 is in a state before learning is completed (including before learning or transfer learning). The learning unit 64 gives the recognizer 66 supervised data and performs supervised learning. As a result, if the expected accuracy is obtained, the recognizer 66 is completed. In other words, the learning unit 64 generates a learned recognizer 66 by making the recognizer 66 before learning complete perform supervised learning. In the following, the structure of the recognizer 66 is described without distinguishing before and after learning.
[0094] The recognizer 66 has a neural network model. For example, a convolutional neural network is used. The recognizer 66 has an input layer 81, an intermediate layer 82 (hidden layer), and an output layer 83. The input layer 81 has a plurality of perceptrons. Fig.11 In the example shown, there are a total of n perceptrons x1, ..., xk, ..., xn. For example, if the segmented image DI is image data composed of 2500 pixels of 50×50 pixels, each pixel has three pixel values of R value, G value, and B value, and therefore, the arrangement data is composed of 7500 pixel value data. In this example, the input layer 81 has 7500 perceptrons x1~xn (where n=7500). The intermediate layer 82 is composed of multiple layers composed of multiple perceptrons. The output layer 83 has the same number of perceptrons as the correct labels that output the output results.
[0095] Here, the accuracy (Precision) in the case of segmented images is provided below. If the number of pixels of defects Dg in the overall image Im is set to TP (true positive), and the number of non-defective pixels is set to FP (false positive), the accuracy Prec1 is expressed as Prec1 = TP / (TP+FP). In the case where the image Im is segmented into M×N, and one of the segmented images contains all defects, the accuracy Prec2 is expressed as TP / (TP+(FP / (M×N))). In other words, the accuracy Prec2 is expressed as Prec2≒(M×N)·Prec1. Thus, the labeled segmented image data DIm of the image Im segmented (N×M) is used as supervisory data, so that the accuracy is improved to approximately (M×N) times. Then, supervised learning is performed using the highly accurate segmented image data DIm, so that a highly accurate identifier 66 can be generated.
[0096] Next, the function of the inspection device 30 will be described. Fig.12 , the defect position entry processing performed by the computer 32 executing the program is explained. This processing is performed by the defect position entry unit 61 of the supervisory data production unit 52. For example, the operator starts the application software for producing labeled image data in the computer 32. The operator operates the input device 34 on the application software and specifies the folder storing the original image for producing the labeled image data. In other words, the operator specifies the defective product folders F2 and F3 storing the NG images Imd displayed on the computer 32. In addition, the operator can also open the folder by operating the mouse constituting the input device 34, and select the NG images Imd displayed on the computer 32 one by one.
[0097] First, in step S11 , the computer 32 reads and displays an NG image from a defective product folder. Specifically, the computer 32 reads the first NG image Imd from the designated defective product folders F2 and F3 among the plurality of folders F1 to F3 stored in the auxiliary memory 43 and displays it on the display unit 35 .
[0098] Based on the information displayed on the screen of the display unit 35, the operator uses a pointing device such as a mouse or an electronic pen to draw an encircling line EL along the outline of the defect Dg on the NG image Imd displayed on the display unit 35, thereby specifying the defect area DA.
[0099] In step S12, the computer 32 determines whether the defect area DA has been designated. If the operator operates the selection device to connect the start point and the end point of the enclosing line EL, thereby determining the enclosed area, the defect area DA is determined to be designated. If the defect area DA is designated, the computer 32 visually communicates the designated area to the operator by coloring the designated area with a predetermined color. Figure 6 The designated area indicated by hatching in (b) is blurred.
[0100] In step S13, the computer 32 adds an alpha channel Imα to the NG image Imd. That is, the computer 32 adds other channels other than the three color expression channels of RGB constituting the NG image Imd. In this embodiment, the other channel is the alpha channel Imα as an auxiliary channel that expresses the opacity of the image with pixel values. Figure 7 As shown, the image ImD with alpha channel is composed of four channels, namely, R channel ImR, G channel ImG, B channel ImB and alpha channel Imα. In addition, in the present embodiment, the processing of step S13 is equivalent to an example of a "channel adding step" of adding other channels other than one or more channels constituting the image to the image of the inspection object.
[0101] In step S14, the computer 32 records the defect area DA in the alpha channel Imα. That is, the computer 32 assigns a second pixel value P2 as a pixel value representing a defect to the area Dα corresponding to the defect area DA in the alpha channel Imα, and the second pixel value P2 is different from the first pixel value P1 assigned to the non-defective areas outside the area. Figure 7 In the example shown, the computer 32 records the area Dα corresponding to the defect area DA in the alpha channel Imα, that is, the defect area Dα on the alpha channel Imα. Figure 7 The second pixel value P2 represented by black in the alpha channel is assigned to the area without defects in the alpha channel Imα. Figure 7The first pixel value P1 represented by white in the image. The first pixel value P1 is, for example, the initial value of the alpha channel Imα, and a value of 100% opacity is set, and a value other than the value of 100% opacity is recorded as the second pixel value P2. In addition, as long as the first pixel value and the second pixel value are different values, any pixel value can be set as long as they are different values. For example, if the pixel value of the image is 256 tones, the first pixel value can be "255", the second pixel value can be "0", or vice versa. In this embodiment, the processing of step S14 is equivalent to an example of a "pixel value assignment step" of assigning a second pixel value as a pixel value representing a defect to the area in the other channel corresponding to the defective area in the image, and the second pixel value is different from the first pixel value assigned to other areas without defects.
[0102] In step S15, the image ImD with alpha channel is stored in the memory 43. Therefore, the memory 43 stores the NG image ImD with alpha channel in which the second pixel value P2 is assigned to the area Dα corresponding to the defect area DA in the alpha channel Imα.
[0103] In step S16, the computer 32 determines whether all images have been processed. If not all images have been processed, the process returns to step S11, and the processes of steps S11 to S15 are repeated for the next NG image Imd. In this example, if the processes of steps S11 to S15 are completed for all NG images Imd in the defective product folders F2 and F3, step S16 is a positive determination, and the defect position entry process is terminated. In this way, the NG images ImD with alpha channels of each defect type are stored in the memory 43 in the corresponding folders F2 and F3.
[0104] Next, refer to Fig.13 , the segmentation image production process is explained. Fig.12 After the defect position entry process is completed, the computer 32 executes Fig.13 The split image creation process is performed by the split image creation unit 62 and the label setting unit 63. The operator inputs the desired number of divisions M×N into the division number input field of the setting screen displayed on the display unit 35 by the application software by operating the mouse or the like.
[0105] First, in step S21, the computer 32 reads images from the folders F1 to F3. The computer 32 first reads the first image Im.
[0106] In step S22, the computer 32 divides the image Imd into segments according to the specified number of segments. Figure 8As shown in FIG. 1 , the image Im is divided into the specified M×N divided images DI. Fig. 9 As shown in (a) and (b), the M×N segmented images DI of the same size are divided into adjacent segmented images DI that repeat only by the repetition amount ΔL or 2·ΔL. The computer 32 sets a label for each segmented image DI through the following steps S23 to S27. In addition, in the present embodiment, the processing of step S22 is equivalent to an example of a "segmentation step" of dividing an image containing other channels into a plurality of segmented images.
[0107] In step S23, the computer 32 determines whether the segmented image DI is an image other than the OK image. Here, the OK image refers to the segmented image DI segmented from the OK image stored in the folder F1 with the folder name "OK". In other words, as long as the name of the folder to which the original image of the segmented image DI belongs is "OK", the segmented image DI is an OK image. If the segmented image DI is an image other than the OK image, the computer 32 proceeds to step S24. If the segmented image DI is not an image other than the OK image, that is, it is an OK image, the computer 32 proceeds to step S26.
[0108] In step S26, the computer 32 sets the name of the folder to which the original image belongs to the label of the divided image DI. For example, for the divided image DI determined as an OK image in step S23, the name "OK" of the folder F1 to which the original image belongs is set to its label.
[0109] In step S24, the computer 32 determines whether the segmented image DI is attached with an α channel. In other words, it is determined whether the segmented image DI is segmented from an NG image with an α channel in which the operator has entered the defect position and whether it has an α channel DIα. As long as the segmented image DI is attached with an α channel, the computer 32 proceeds to step S25. If it is not attached with an α channel, the computer 32 proceeds to step S26. The so-called segmented image DI without an α channel is, for example, a segmented image DI in which the original image of the segmented image DI belongs to the defective product folder F2 or F3, but the defect position is not entered. Assume that even if there is an image in which the operator has not designated the defect area DA, for the segmented image DI, the name of the folder to which the original image belongs is set in its label as "NG1" or "NG2".
[0110] In step S25, the computer 32 determines whether there is a defective area DA in the segmented image DI. If there is a pixel with the second pixel value P2 indicating a defect in the alpha channel DIα of the segmented image DI, the computer 32 determines that there is a defective area DA. In addition, if there is no pixel with the second pixel value P2 in the alpha channel DIα of the segmented image DI, the computer 32 determines that there is no defective area DA. If there is a defective area DA in the segmented image DI, the process proceeds to step S26, and if there is no defective area DA in the segmented image DI, the process proceeds to step S27.
[0111] If the defective area DA exists in the divided image DI, in step S26, the computer 32 sets "NG1" or "NG2" as the name of the defective product folder F2 or F3 to which the NG image Imd of the original image belongs, as the label of the divided image DI.
[0112] In step S27, the computer 32 sets the label of the segmented image DI to "OK". That is, even if it is not an OK image (that is, an NG image) and has an α channel, the label of the segmented image DI of the defect-free area DA is set to "OK". In addition, in the present embodiment, the processing of steps S25 (affirmative judgment) and S26 is equivalent to the following processing: among multiple segmented images DI, a bad label is assigned to the segmented image DI whose other channels in the segmented image DI contain the second pixel value P2 indicating the defect. In addition, the processing of steps S25 (negative judgment) and S27 is equivalent to the following processing: a good label is assigned to the segmented image DI whose other channels in the segmented image DI do not contain the second pixel value P2. Therefore, the processing of steps S25 to S27 is equivalent to an example of a "label assignment step".
[0113] In step S28, the computer 32 stores the segmented image DI as an RGB image in the memory 43. At this time, if the segmented image DI has an α channel, the computer 32 removes the α channel DIα from the labeled segmented image DI, and stores the labeled segmented image data DIm composed of the labeled RGB image as supervisory data in the memory 43. In addition, if the segmented image DI does not have an α channel, the computer 32 directly stores it in the memory 43 as the labeled segmented image data DIm composed of the labeled RGB image. In addition, in the present embodiment, the processing of step S28 is equivalent to an example of a "channel removal step" of removing other channels from the segmented image DI.
[0114] In step S29, the computer 32 determines whether all the segmented images DI have been processed. If there is an unprocessed segmented image DI, the process returns to step S23, and steps S23 to S28 are performed for the next segmented image DI, and a label is set for the next segmented image ID. Then, if steps S23 to S28 are performed for all the segmented images DI, and the label setting for all the segmented images DI is completed (affirmative determination in S29), the process proceeds to step S30.
[0115] In step S30, the computer 32 determines whether all images Im have been processed. If there are unprocessed images Im, the computer 32 returns to step S21, and performs the processing of steps S21 to S29 for the next image Im, and sets labels for all segmented images DI obtained by segmenting the next image Im. Then, if the processing of steps S21 to S29 is performed for all images Im, and the segmentation of all images Im and the setting of labels for all segmented images DI are completed (affirmative judgment in S30), the segmented image production process is completed. In this way, all the segmented image data DIm with labels as supervisory data are produced and stored in the memory 43. For example, if there are a total of 100 pieces of image data Im in folders F1 to F3, then when M×N=48, each image Im is divided into 48 pieces, and 4800 pieces of segmented image data DIm with labels are produced as supervisory data.
[0116] Then, the learning unit 64 performs supervised learning using the labeled segmented image DIm as supervised data. Fig.10 As shown in (c) of FIG. 1 , the learning unit 64 converts the RGB image other than the label in the labeled segmented image data DIm into array data consisting of arrays of pixel values. Then, as shown in FIG. Fig.11 As shown in FIG. 1 , the learning unit 64 normalizes the array data and inputs the normalized array data to the input layer 81 of the discriminator 66 before learning. The normalized array data is input to each of the perceptrons x1 to xn of the input layer 81 .
[0117] For example, the normalized arrangement data of RGB images of 4800 pieces of supervisory data DIm are sequentially input to the input layer 81 of the recognizer 66. Based on the normalized arrangement data input to the input layer 81, the recognizer 66 performs learning processing via a neural network including the input layer 81, the intermediate layer 82 of 2 to 150 layers, and the output layer 83. In the learning process, the error back propagation method is performed to determine the most appropriate parameters of the weights W1, W2, etc. The error back propagation method is to make the error between the output value and the correct label back propagate to each layer and adjust the weight of each layer to be close to the correct value.
[0118] By using the labeled supervisory data DIm to segment the image Im to obtain the segmented image DI, a high accuracy rate can be expected for the discriminator 66 obtained after learning. In addition, when the expected accuracy rate is not obtained, the operator changes the number of segmentations and re-creates the supervisory data DIm. In this case, the alpha channel Imα initially added and the second pixel value P2 assigned to the defect area DA remain in the NG image ImD. Therefore, even if the segmented image production unit 62 re-segments the image Im with the number of segmentations re-specified by the operator, the label setting unit 63 can set a suitable label for the segmented image DI according to the presence or absence of the second pixel value P2 of the alpha channel DIα of the re-segmented segmented image DI. Therefore, it is sufficient for the operator to perform the operation of specifying the defect area DA for the image Imd once, and such operation is not required during re-segmentation. Therefore, the burden of producing the supervisory data DIm, which is produced by setting labels for each segmented image DI obtained by segmenting the image Im, can be reduced, thereby reducing the learning cost accordingly. In addition, an example of how many NG images Imd there are out of 100 images Im has been described. However, in reality, in order to obtain the desired accuracy, the number of images Im required for learning the identifier 66 is enormous. Completing the task of specifying the defect area DA in the NG image Imd at one time will greatly reduce the production burden.
[0119] The inspection method includes a classifier generation step, a segmented image acquisition step, and a determination step. In the classifier generation step, the learning unit 64 performs supervised machine learning using the labeled segmented image DIm to which the label is assigned as supervisory data and generates a classifier 66. In the segmented image acquisition step, the image segmentation unit 68 divides the image Im photographed with the article 12 by the same number of divisions as the number of divisions of the segmented image DI when the supervisory data DIm for generation of the classifier 66 is prepared to obtain a plurality of segmented images DI. In the determination step, the determination unit 69 determines whether the article 12 has a defect based on the output value output from the classifier 66 as the recognition result after the segmented image DI is input to the classifier 66. In particular, the determination unit 69 determines whether the article 12 is a good product or a defective product, and the article 12 determined to be a defective product is discharged from the conveyor 21 by the discharge device 23, and the discharge device 23 is driven by the instruction of the computer 32 via the defective discharge processing unit 37. Furthermore, when the article 12 is determined to be a defective product by inspection, the display unit 35 displays a message indicating that the article 12 is a defective product and the type of defect obtained based on the recognition result of the recognition device.
[0120] As described above in detail, according to the above embodiment, the following effects can be obtained.
[0121] (1) The method for producing labeled image data of the present embodiment produces labeled segmented image data DIm used as supervisory data for causing the discriminator 66 before learning to perform supervised machine learning in order to generate a discriminator 66 for inspecting the presence or absence of defects Dg in the inspection object in the captured image Im. The method for producing labeled image data comprises a channel adding step (step S13), a pixel value assigning step (step S14), a segmenting step (step S22), a label assigning step (steps S25 to S27), and a channel removing step (step S28). In the channel adding step (S13), a channel other than the plurality of color expression channels ImR, ImG, and ImB constituting the image Im of the inspection object is added as an alpha channel Imα. In the pixel value assigning step (S14), a second pixel value P2 is assigned as a pixel value indicating a defect to an area Dα in the alpha channel Imα corresponding to the defect area DA in the image Im, and the second pixel value P2 is different from the first pixel value P1 assigned to other areas without defects. In the segmentation step (S22), the image ImD including the alpha channel Imα is segmented into a plurality of segmented images DI. In the label assigning step (S25 to S27), among the plurality of segmented images DI, a bad label (a label of "NG1" or "NG2") is assigned to the segmented image DI in which the alpha channel DIα in the segmented image DI includes the second pixel value P2, and a good label (a label of "OK") is assigned to the segmented image DI in which the alpha channel DIα in the segmented image DI does not include the second pixel value P2. In the channel removing step (S28), the alpha channel DIα is removed from the segmented image DI to produce labeled segmented image data DIm. Thus, even if the captured image Im is segmented to produce the labeled segmented image data DIm as the supervised data, the workload can be reduced and the learning cost can be reduced. For example, when the number of segments of the image Im is changed and the labeled segmented image data DIm is re-produced, the operator does not need to re-designate the defect area DA of the image Im each time the number of segments is changed, thereby reducing the workload and the learning cost. In addition, since the image Im is segmented to produce the labeled segmented image data DIm, the accuracy can be improved compared to the case where it is not segmented. Then, since the highly accurate labeled segmented image data DIm is used for supervised learning, a highly accurate identifier 66 can be generated. Therefore, by using deep learning with the highly accurate identifier 66, it is possible to inspect the object 12 for defects with high accuracy.
[0122] (2) In the segmentation step (S22), the image ImD to which the alpha channel Imα is attached is segmented into a plurality of segmented images DI in which adjacent segmented images DI are partially repeated. Therefore, even if the defect DG involves a plurality of segmented images DI, the frequency with which the defect DG is segmented can be reduced. Therefore, it is easy to obtain a high accuracy when learning using the labeled segmented images DIm.
[0123] (3) As another channel, the alpha channel Imα is used. Therefore, by using the alpha channel Imα for setting the opacity of the image, it is possible to relatively easily assign the second pixel value P2 representing the defect to the area Dα corresponding to the defect area DA without affecting the color expression channel of the image Im captured by the camera 31.
[0124] (4) When the output of the test data input to the identifier 66 cannot obtain a correct rate of more than a specified value, the number of divisions in the segmentation step (S22) is changed. The above-mentioned identifier 66 is generated by supervised machine learning using the labeled segmented image data DIm as the supervisory data. Therefore, when the correct rate of more than a specified value cannot be obtained, the alpha channel Imα and the second pixel value P2 indicating the defect are already assigned to the image. Therefore, when the number of divisions is changed and the labeled segmented image data DIm is regenerated, the operator does not need to perform an operation to specify the area Dα assigned the second pixel value P2 in the alpha channel Imα, which is an operation of operating the input device 34 to specify the defect area DA.
[0125] (5) The inspection method comprises: a classifier generation step, a segmented image acquisition step, and a determination step. In the classifier generation step, the labeled segmented image data DIm to which a label is assigned is used as supervisory data, and supervised machine learning is performed to generate the classifier 66. In the segmented image acquisition step, the image Im photographed with the inspection object is segmented by the same number of divisions as the number of divisions of the segmented image DI when the supervisory data for generating the classifier 66 is generated, and a plurality of segmented images DI are acquired. In the determination step, the quality of the article 12 is determined based on the output value, which is the result of the segmented image DI being input to the classifier 66 and output from the classifier 66 as a recognition result. As a result, since the burden of generating the labeled segmented image data DIm, which is given as supervisory data for the classifier 66 to perform supervised learning before the learning is completed, can be reduced, the quality of the article 12 can be inspected at a low learning cost.
[0126] (6) Machine learning is deep learning. Thus, the quality of the article 12 can be inspected with high accuracy at low learning cost through deep learning.
[0127] (7) The program Pr is executed by the computer 32 to produce the labeled segmented image data Dim used as the supervisory data, which is to generate the identifier 66 for inspecting the presence or absence of defects of the article 12 in the captured image Im so as to perform supervised machine learning on the identifier 66 before learning is completed. The computer 32 sequentially executes the channel adding step (S13), the pixel value assigning step (S14), the segmentation step (S22), the label assigning step (S25 to S27), and the channel removing step (S28) included in the program Pr. In the channel adding step (S13), the computer 32 adds the alpha channel Imα other than the plurality of color expression channels constituting the image Im as another channel to the image Im of the captured inspection object. In the pixel value assigning step (S14), the computer 32 assigns the second pixel value P2 as a pixel value indicating a defect to the area Dα in the alpha channel Imα corresponding to the defect area DA in the image, and the second pixel value P2 is different from the first pixel value P1 assigned to the other area without a defect. In the segmentation step (S22), the computer 32 segments the image ImD including the alpha channel Imα into a plurality of segmented images DI. In the labeling step (S25 to S27), among the plurality of segmented images DI, the computer 32 assigns a bad label (a label of "NG1" or "NG2") to the segmented image DI in which the alpha channel Imα in the segmented image includes the second pixel value P2, and assigns a good label to the segmented image DI in which the alpha channel Imα in the segmented image DI does not include the second pixel value P2. In the channel removal step (S28), the computer 32 removes the alpha channel Imα from the segmented image DI to produce labeled image data DIm.
[0128] By executing the above-mentioned program Pr in the computer 32, even if the captured image Im is segmented to generate the labeled segmented image data DIm used as the supervised data for supervised machine learning, the generation burden can be reduced and the learning cost can be reduced. For example, when the number of segmentations of the image Im is changed and the labeled segmented image data DIm is newly generated, the operator's work burden of re-designating the defect area DA of the image Im every time the number of segmentations is changed can be reduced, and the learning cost can be reduced.
[0129] (8) A supervisory data generating unit 52 as an example of a labeled image data generating device generates labeled segmented image data Dim as supervisory data, wherein the supervisory data is for generating a distinguisher 66 for detecting whether a defect exists in a captured image and for causing a distinguisher 66 before learning to perform supervised machine learning. The supervisory data generating unit 52 includes a channel adding unit 61A, a pixel value assigning unit 61B, a segmented image generating unit 62, and a label setting unit 63. The channel adding unit 61A adds an alpha channel Imα to an image Im capturing the inspection object as a channel other than one or more channels constituting the image Im. The pixel value assigning unit 61B assigns a second pixel value P2 as a pixel value indicating a defect to an area Dα in the alpha channel Imα corresponding to a defect area DA in the image Im, and the second pixel value P2 is different from a first pixel value P1 assigned to other areas without a defect. The segmented image generating unit 62 segments the image Im including the alpha channel Imα into a plurality of segmented images DI. The label setting unit 63 assigns a bad label ("NG1" or "NG2" label) to the segmented image DI in which the alpha channel DIα of the segmented image DI includes the second pixel value P2, and assigns a good label ("OK" label) to the segmented image DI in which the alpha channel DIα of the segmented image DI does not include the second pixel value P2. In addition, after the label is assigned, the alpha channel DIα is removed from the segmented image DI to produce the labeled segmented image data DIm. Therefore, even in the case where the above-mentioned supervisory data production unit 52 divides the captured image Im to produce the labeled segmented image data Dim used as supervisory data in supervised machine learning, as long as the operation of specifying the defect area DA is performed once at the stage of the original image, it is possible to assign appropriate labels to each segmented segmented image DI. For example, when the result of learning is that the identifier 66 cannot obtain the expected accuracy, the number of divisions of the image Im is changed to re-produce the labeled segmented image data DIm. In the above case, since the addition of the alpha channel Imα to the image Im and the assignment of the second pixel value P2 to the area Dα corresponding to the defect area DA have already been completed, the operator only needs to specify the changed number of divisions to start the segmentation process of the image ImD by the computer 32. In other words, the operator does not need to re-perform the operation of specifying the defect area DA of the image Im every time the number of divisions is changed. Therefore, the burden of creating the labeled segmented image data DIm can be reduced, and the learning cost can be reduced.
[0130] (9) The inspection device 30 inspects the presence or absence of defects in the article 12 based on the image Im of the article 12 to be inspected. The inspection device 30 includes a supervisory data generator 52, a recognizer 66, an image segmentation unit 68, and a determination unit 69. The recognizer 66 is generated by performing supervised machine learning using the labeled segmented image data DIm generated by the supervisory data generator 52 as supervisory data. The image segmentation unit 68 segments the image Im of the article 12 to be inspected with the same number of segments as the number of segments of the segmented image DI when generating the labeled segmented image data DIm to be generated by the recognizer 66, and obtains a plurality of segmented images DI. The recognizer 66 receives the segmented image DI obtained by the image segmentation unit 68 as input, and outputs a recognition result. The determination unit 69 determines whether the article 12 is good or not based on the recognition result from the recognizer 66. According to the inspection device 30 described above, the burden of generating the labeled segmented image DIm for the recognizer 66 before learning is completed can be reduced, so that the quality of the article 12 can be inspected at a low learning cost.
[0131] (Second Embodiment)
[0132] Next, the second embodiment will be described with reference to the drawings. The second embodiment differs from the first embodiment in that information on the type of label is also given to the alpha channel. The description of the same structures as the first embodiment will be omitted, and only the different structures will be described.
[0133] like Fig.14 As shown in FIG. 1 , the processing contents of the defect position recording unit 61 are partially different from those of the first embodiment described above. Fig.14 The display contents shown on the left side of (a) and (b) are displayed on the display unit 35. When the NG image belonging to the defective product folder F2 with the folder name "NG1" is displayed, input units 71 and 72 for specifying the type of defective product are displayed on the display unit 35. Fig.14 In the example shown in (a), the input unit 71 specifies the type of "NG1", and the input unit 72 specifies the type of "NG2". After the operator uses a pointing device such as a mouse or an electronic pen to draw an encircling line EL along the outline of the defect Ds to specify the defect area DA, the operator selects the input unit 71 corresponding to the type of the defect Ds using the mouse or the like. In this way, the channel adding unit 61A is Fig.14 The NG image Im2 shown on the right side of (a) is added with an alpha channel Imα. In addition, the pixel value assigning unit 61B assigns a second pixel value P21 corresponding to the type of defect selected by the input unit 71 to the area Dα1 corresponding to the defect area DA in the image Im in the added alpha channel Imα.
[0134] In addition, Fig.14 In the example shown in (b), the operator draws the encircling line EL along the outline of the defect D1 by operating a pointing device such as a mouse or an electronic pen and inputs the designated defect area DA, and then selects the input unit 72 corresponding to the type of the defect D1 by using the mouse or the like. Fig.14 The NG image Im3 shown on the right side of (b) is added with an alpha channel Imα, and a second pixel value P22 is assigned to a region Dα2 in the added alpha channel Imα corresponding to the defect region DA in the image Im. The second pixel value P22 corresponds to the type of defect selected by the input unit 72. Fig.14 In the example shown, the types of defects are classified according to the sizes of the defects, but the defects may be classified according to the types.
[0135] Next, refer to Fig.15 The function of the inspection device 30 of the second embodiment is described below. The processing of the defect position input unit 61 is as follows: Fig.14 As shown, in the alpha channel Imα, for the area Dα1 or Dα2 corresponding to the defect area DA, a second pixel value P21 or P22 corresponding to the type of defect is set. The computer 32 executes Fig.15 The computer 32 performs the divided image creation process shown in FIG.
[0136] exist Fig.15 In the embodiment, steps S23 to S27 are the same as those in the first embodiment, and the process of step S31 is different from that in the first embodiment. Fig.15 Omitted in Fig.13 The processing of steps S21, S22, and S28 to S30 in the first embodiment is the same as that in the first embodiment. The computer 32 displays the first image read from the folders F1 to F3 (S21). The operator inputs the desired number of divisions M×N in advance in the division number input column of the setting screen displayed on the display unit 35. The computer 32 divides the image into M×N divided images (S22).
[0137] exist Fig.15 In step S23 shown in the figure, the computer 32 determines whether the segmented image DI is an image other than the OK image. If the segmented image DI is an image other than the OK image, the computer 32 proceeds to step S24. If the segmented image DI is not an image other than the OK image, that is, an OK image, the computer 32 proceeds to step S26. In step S26, the computer 32 sets the name "OK" of the folder to which the original image belongs in the label of the segmented image DI.
[0138] In step S24, the computer 32 determines whether the segmented image DI is attached with an α channel. If the segmented image DI is attached with an α channel, the computer 32 proceeds to step S25, and if not, the computer 32 proceeds to step S26. For the segmented image DI that is an image other than an OK image and does not have an α channel, the name of the folder to which the original image belongs, "NG1" or "NG2", is set in its label.
[0139] In step S25, the computer 32 determines whether there is a defective area DA in the segmented image DI. If there is a pixel with the second pixel value P2 indicating a defect in the α channel DIα of the segmented image DI, the computer 32 determines that there is a defective area DA. If there is no pixel with the second pixel value P2 indicating a defect, the computer 32 determines that there is no defective area DA. If there is a defective area DA in the segmented image DI, the process proceeds to step S31. If there is no defective area DA in the segmented image DI, the process proceeds to step S27.
[0140] In step S31, the computer 32 sets a label corresponding to the second pixel value P2 of the defective area Dα of the alpha channel DIα. That is, if the second pixel value P2 of the defective area Dα of the alpha channel Imα is the second pixel value P21 indicating the first defect Ds, the computer 32 sets the label "NG1" corresponding to the second pixel value P21. In addition, if the second pixel value P2 of the defective area Dα of the alpha channel Imα is the second pixel value P22 indicating the second defect DI, the computer 32 sets the label "NG2" corresponding to the second pixel value P22.
[0141] In step S27, the computer 32 sets the label of the divided image DI as "OK". That is, even if it is an image other than an OK image (ie, an NG image) and has an α channel, the label of the divided image DI without the defective area DA is set as "OK".
[0142] In the case where the segmented image DI obtained by segmenting the image Im has defects classified into multiple types by labels, an appropriate label corresponding to the type of defect is set for the segmented image DI. Therefore, it can be expected that the learned identifier 66 has a high accuracy. In addition, in the case where the desired accuracy cannot be obtained, even if the operator changes the number of segmentations, since the second pixel values P21 and P22 assigned to the initially added α channel Imα and the defect areas Dα1 and Dα2 remain, even if the image is re-segmented with a different number of segmentations, the labels corresponding to the presence or absence of the second pixel values P21 and P22 of the α channel DIα and the values of the second pixel values P21 and P22 can be automatically set to the segmented image DI after the segmentation. Therefore, the operator only needs to perform the operation of inputting the designated defect area DA for the image Im once, and this operation is not required when re-segmenting. Therefore, when the image Im is segmented and labels are set for each segmented image DI to produce the segmented image data DIm with labels, the production burden can be reduced, thereby reducing the learning cost.
[0143] According to the second embodiment, in addition to the same effects as those of the above-described first embodiment, the following effects can be obtained.
[0144] (10) There are multiple types of defects D. In the pixel value assigning step (S14), when the second pixel value P2 is assigned to the alpha channel Imα, second pixel values P21 and P22 of different values corresponding to the type of defect D are assigned. In the label assigning steps (S25 to S27), different defect labels ("NG1" or "NG2" labels) corresponding to the values of the second pixel values P21 and P22 are assigned to the segmented image DI including the second pixel value P2. Therefore, it is possible to create labeled segmented image data DIm to which different defect labels corresponding to the type of defect D are assigned.
[0145] The embodiment is not limited to the above-mentioned embodiment, and can be changed into the following embodiment.
[0146] The grayscale value of the alpha channel, which is an auxiliary channel as an example of other channels, is not limited to 256 grayscales, and can be 64 grayscales, 32 grayscales, 16 grayscales, 8 grayscales, 4 grayscales, or 2 grayscales. For example, the second pixel value for the type of defect can be set to a value that combines information other than the type of defect.
[0147] By combining the size and type of the defect Dg, even if the defects belong to the same size range, as long as the types of the defects are different, different second pixel values can be set. According to the above structure, in the case of an image containing defects, the type of the defect determined by the combination of the size of the defect and the type of the defect can be identified.
[0148] The image is not limited to a color image such as an RGB image, but may be a grayscale image. That is, the channel of the image captured by the camera 31 may also be a single channel. In the above case, the defect position recording unit 61 adds an alpha channel as another channel to the grayscale image, and sets a second pixel value in the area corresponding to the defect area in the added alpha channel, and the second pixel value is different from the first pixel value assigned to the area without the defect.
[0149] It can also be applied to semi-supervised learning where images with the correct label are mixed with images without the correct label.
[0150] The shape, size and type of the inspection object 12 are not particularly limited. The article 12 may be, for example, a container such as a plastic bottle or a bottle, food, beverage, electronic component, electrical product, daily necessities, parts, components, raw materials such as powder or liquid, etc. The article 12 may be any article as long as it can be inspected for defects from the appearance. The inspection of the article 12 performed by the inspection device 30 is not limited to the appearance inspection of the article 12. For example, the inside of the article 12 may be inspected in a non-destructive manner using an image obtained by irradiating ultrasound or X-rays.
[0151] The inspection object is not limited to the object 12, and may be a photograph of a building, a topographical photograph taken by aerial photography, a photograph of the sky, an astronomical photograph, a microscope photograph, etc. The above-mentioned photograph may be segmented to generate segmented image data with labels.
[0152] The labeled image data creation device may be configured as a device separate from the inspection device 30 .
[0153] Supervised or semi-supervised machine learning is not limited to deep learning. For example, it can also be applied to machine learning in which the intermediate layer is a single-layer neural network or support vector machine (SVM).
[0154] ·A computer 32 equipped with a GPU (Graphics Processing Unit) can also be used. In the above case, it is more ideal that the deep learning unit 53 including the identifier 66 is installed on the GPU. In the above case, the identifier data CD is stored in the GPU memory. In addition, the device can be configured in a manner that separates the learning function of the identifier 66 before learning is completed and the inspection function of inspection. That is, it can be divided into: a labeled image data production device having a learning function of the identifier 66 before learning is completed; and an inspection device that inspects an article using the identifier 66 driven by the labeled image data production device to learn. In the above case, the labeled image data production device has a GPU, and the GPU has a deep learning unit 53. In addition, in order to perform additional learning, it is more ideal that the inspection device has a labeled image data production device. In the above case, since the processing load when performing additional learning is small, it is sufficient to set the inspection device without a GPU and the CPU with a deep learning unit 53.
[0155] Explanation of symbols
[0156] 11 Inspection system; 12 Article as an example of an inspection object; 20 Transport device; 21 Conveyor; 22 Sensor; 23 Discharge device; 30 Inspection device; 31 Camera; 32 Computer; 33 Programmable logic controller; 34 Input unit; 35 Display unit; 36 Camera trigger processing unit; 37 Defective discharge processing unit; 41 CPU; 42 Memory; 43 Auxiliary memory; 51 Control unit; 52 Supervisory data production unit as an example of a labeled image data production device; 53 Deep learning unit; 54 Inspection processing unit; 61 Defect position entry unit; 61A Channel adding unit; 61B Pixel value assigning unit; 62 Segmented image production unit as an example of a segmentation unit; 63 Label setting unit as an example of a label assigning unit; 64 Learning unit; 65 Inference unit; 66 Recognizer; 67 Image acquisition unit; 68 Segmented image acquisition unit an image segmentation unit as an example of a unit; 69 a determination unit; 81 an input layer; 82 an intermediate layer; 83 an output layer; an X transport direction; a C controller; a Pr program; an IG image data set; a TrD learning data set; an Im image data (image); an Imd defective product image (NG image); an Imα alpha channel as an example of other channels; an ImD defective product image (NG image); a D, Ds, Dl defect; a Dg defect; a DA defect area; a Dα, Dα1, Dα2 area (defect area); a P1 first pixel value; a P2 second pixel value; a P21 second pixel value; a P22 second pixel value; a DI segmented image (segmented image data); a DIα alpha channel; a ΔL repetition amount; a TsD test data set; a DIm labeled image data and an example of test data and labeled segmented image data as supervisory data.
Claims
1. A method for producing labeled image data, the method producing labeled image data used as supervisory data, wherein: The supervised data is used to perform supervised or semi-supervised machine learning on the pre-learned recognizer in order to generate a recognizer for inspecting the presence or absence of defects in the inspection object in the captured image. The method for producing labeled image data is characterized by comprising: a channel adding step, wherein other channels other than one or more channels constituting the image are assigned to the image capturing the inspection object; a pixel value assigning step, wherein a second pixel value is assigned as a pixel value representing a defect to an area in the other channel corresponding to the defect area in the image, the second pixel value being different from a first pixel value assigned to other areas without defects; A segmentation step, wherein the image including the other channels is segmented into M×N segmented images, where M is the number of vertical segmentations of the segmented image, and N is the number of horizontal segmentations of the segmented image, and M and N are natural numbers and at least one of them is greater than 2; a labeling step, wherein, among the plurality of segmented images, a bad label is assigned to the segmented image whose other channels in the segmented image contain the second pixel value, and a good label is assigned to the segmented image whose other channels in the segmented image do not contain the second pixel value; and The channel removal step includes removing the other channels from the segmented image to create labeled image data.
2. The method for producing labeled image data according to claim 1, wherein: There are many types of defects. In the pixel value assigning step, when the second pixel value is assigned to the other channel, a second pixel value having a different value depending on the type of the defect is assigned, In the labeling step, a different bad label is assigned to the segmented image including the second pixel value according to the value of the second pixel value.
3. The method for producing labeled image data according to claim 1 or 2, wherein: In the segmentation step, the image to which the other channel is added is segmented into a plurality of segmented images in which adjacent segmented images partially overlap each other.
4. The method for producing labeled image data according to claim 1 or 2, wherein: The other channel is an alpha channel.
5. The method for producing labeled image data according to claim 1 or 2, wherein: When the output when the test data is input to the recognizer cannot obtain an accuracy rate greater than a specified value, the number of divisions in the division step is changed. The recognizer is generated by supervised or semi-supervised machine learning using the labeled image data as supervised data.
6. An inspection method, characterized in that: have: a recognizer generating step, wherein the labeled image data generated by the labeled image data generating method according to claim 1 or 2 is used as supervised data to perform supervised or semi-supervised machine learning, and a recognizer is generated; and A determination step, wherein the quality of the inspection object is determined based on an output value, wherein the output value is obtained as follows: an image captured of the inspection object is segmented with the same number of segmentations as the number of segmentations of the segmented image used in generating the identifier to obtain a plurality of segmented images, the segmented images are input into the identifier, and are output from the identifier as a recognition result.
7. The inspection method according to claim 6, characterized in that: The machine learning is deep learning.
8. A memory storing a program, the program being executed by a computer for producing labeled image data for use as supervisory data, wherein: The supervised data is used to perform supervised or semi-supervised machine learning on the pre-learned recognizer in order to generate a recognizer for inspecting the presence or absence of defects in the inspection object in the captured image. The program is characterized by having: a channel adding step, wherein the computer adds other channels other than the one or more channels constituting the image to the image of the inspection object; a pixel value assigning step, wherein the computer assigns a second pixel value as a pixel value indicating a defect to an area in the other channel corresponding to the defect area in the image, wherein the second pixel value is different from a first pixel value assigned to other areas without defects; A segmentation step, wherein the computer segments the image including the other channels into M×N segmented images, where M is the number of vertical segmentations of the segmented image, and N is the number of horizontal segmentations of the segmented image, and M and N are natural numbers and at least one of them is greater than 2; a labeling step, wherein the computer assigns a bad label to the segmented image whose other channels in the segmented image contain the second pixel value, and assigns a good label to the segmented image whose other channels in the segmented image do not contain the second pixel value, among the plurality of segmented images; and A channel removal step, wherein a computer removes the other channels from the segmented image to create labeled image data.
9. A device for producing labeled image data, which produces labeled image data for use as supervisory data, wherein: The supervision data is used to supervise or semi-supervise a pre-learning recognizer in order to generate a recognizer for detecting whether an inspection object in a captured image has defects. The device for creating labeled image data is characterized by comprising: a channel adding unit for adding other channels other than one or more channels constituting the image to the image of the inspection object; a pixel value assigning unit that assigns a second pixel value as a pixel value indicating a defect to an area in the other channel corresponding to the defect area in the image, the second pixel value being different from a first pixel value assigned to other areas without the defect; a segmentation unit, which segments the image including the other channels into M×N segmented images, where M is the number of vertical segmentations of the segmented images, and N is the number of horizontal segmentations of the segmented images, and M and N are natural numbers and at least one of them is greater than 2; as well as A label assigning unit, which assigns a bad label to the segmented image whose other channels in the segmented image contain the second pixel value, and assigns a good label to the segmented image whose other channels in the segmented image do not contain the second pixel value, among the multiple segmented images, and after assigning the labels, removes the other channels from the segmented image to produce labeled image data.
10. An inspection device, characterized in that: have: The apparatus for producing labeled image data according to claim 9; a recognizer generated by performing supervised or semi-supervised machine learning using the labeled image data produced by the labeled image data producing device as supervised data; a segmented image acquisition unit that acquires a plurality of segmented images by segmenting an image capturing the inspection object with the same number of segmentations as the number of segmentations of the segmented image used for generating the identifier; as well as A determination unit determines whether the inspection object is good or not based on an output result from the recognizer when the segmented image acquired by the segmented image acquisition unit is input to the recognizer.
