Appearance inspection device and appearance inspection method
Patent Information
- Application Number
- JP2021190178
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-11-24
AI Technical Summary
Existing appearance inspection systems face challenges in generating a wide range of defective product images efficiently due to the scarcity of defective products and limitations in image manipulation, leading to inferior learning performance for defect detection.
A visual inspection apparatus that generates natural-looking defective product images by pasting extracted defective portions onto reference images, applying image processing to make boundaries inconspicuous, and varying image conversions, enabling machine learning to create an inference model with high defect detection capability.
The system effectively generates a variety of defective product images for learning, improving defect detection performance by creating a high-capability inference model in a short time, reducing user effort, and ensuring accurate image generation.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an appearance inspection apparatus and an appearance inspection method for inspecting the appearance of a workpiece.
Background Art
[0002] For example, Patent Document 1 discloses a processing device that uses machine learning by a computer to determine whether a workpiece is a good product or a defective product. The processing device of Patent Document 1 performs supervised machine learning on good product data to generate a good product learning model, and performs supervised machine learning on defective product data to generate a defective product learning model. Then, the data of the workpiece to be determined is input, and it is configured to be able to determine whether the workpiece is a good product or a defective product by the good product learning model and the defective product learning model. Such a device is also called a workpiece appearance inspection device.
Prior Art Documents
Patent Documents
[0003]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0004] By the way, when performing supervised learning on defective product data, for example, dozens or hundreds of defective product images are required. However, since almost no defective products occur at the production site of the workpiece, it takes a long time to collect such a number of defective product images. Therefore, good product learning for good product data is assumed as a solution. However, in the case of a machine learning network that learns only from good product data, the detection ability of defective products is insufficient, and in inspections with high difficulty, the performance is inferior to defective product learning. Therefore, it is desired to perform defective product learning.
[0005] To address this, if defective product images for training could be generated within the visual inspection device, a large number of defective product images could be acquired in a relatively short time. However, even when generating defective product images within the visual inspection device, the methods are limited to simple transformations such as contrast conversion, simple rotation, and simple deformations that change the aspect ratio, making it difficult to generate a wide range of defective product images. Specifically, for example, when generating an inference model to detect "cracks" in a workpiece, a wide range of defective product images is required because the shape, location, and size of the "cracks" can vary considerably in actual workpieces. However, simply converting the contrast, rotating the image, or changing the aspect ratio of the image is insufficient to meet this requirement.
[0006] This disclosure is made in view of the above points, and its purpose is to shorten the time required for defective product training by enabling the natural generation of training images of defective products that have various defect conditions that can actually be expected in the workpiece. [Means for solving the problem]
[0007] To achieve the above objective, one aspect of this disclosure may be based on a visual inspection device that inputs a work image of a work to be inspected into a machine learning network and performs a quality determination of the work based on the input work image. The visual inspection device includes a storage unit that stores good product images corresponding to good products and defective product images corresponding to defective products; an image processing unit that generates a new defective product image by performing an extraction process that extracts defective parts from the defective product image pre-stored in the storage unit, an paste process that pastes the defective parts extracted in the extraction process onto a reference image including the work; and a process that makes the boundary between the defective parts pasted in the paste process and the reference image less noticeable; and a learning unit that generates an inference model by training a machine learning network with the good product image and defective product image pre-stored in the storage unit and the new defective product image generated by the image processing unit. Furthermore, the visual inspection device also includes an inspection unit that inputs a work image of a work to be inspected into the inference model generated by the learning unit and performs a quality determination of the work based on the input work image.
[0008] In this configuration, when a defect is extracted from a defective product image, the extracted defect is pasted onto a reference image. The reference image onto which the defect is pasted can be a good product image or a defective product image. This generates a new defective product image with the defect. In the newly generated defective product image, the boundary between the pasted defect and the reference image is less noticeable, resulting in a more natural-looking defective product image. By repeating this process, multiple training images of defective products with various defect states that are actually expected in a workpiece can be obtained.
[0009] By training a machine learning network with new images of defective products and images of good and defective products pre-stored in the memory unit, an inference model with high defect detection capabilities is generated. Therefore, the visual inspection performance can be improved.
[0010] In the image processing device according to another embodiment, in the extraction process, the device can acquire the feature quantities of the defective product image stored in the storage unit and extract the area having a feature quantity different from the surrounding feature quantities as the defective area.
[0011] With this configuration, the defective parts of the defective product images stored in the memory unit are automatically extracted, saving the user time and effort.
[0012] In other embodiments, the image processing unit can accept requests to correct the range of the extracted defective area during the extraction process.
[0013] In other words, it is possible that the range of defects automatically extracted based on the features of the defective product image may be incorrect. In this case, if the user corrects the range of defects, the correction will be accepted, allowing the range of defects to be set appropriately.
[0014] In the image processing unit according to another embodiment, in the extraction process, the unit can receive a user's selection operation for the defective area from among the defective product images stored in the storage unit, and extract the defective area based on the received selection operation.
[0015] In other words, depending on the image of the defective product or the location of the defect, it may be difficult to extract the defect based on features. In such cases, if the user selects the defective area from the image of the defective product, the selected area can be extracted, making it less likely for defects to be mistakenly extracted.
[0016] In other embodiments, the image processing unit can paste the defective areas extracted in the extraction process onto the reference image after applying an image transformation to them.
[0017] This configuration allows for a significant increase in the variety of new defective product images that can be generated, because the image transformation is applied only to the defective areas, rather than changing the contrast or rotating the entire image of the defective product.
[0018] In another embodiment, the image processing unit can identify the workpiece portion included in the reference image as the area to be pasted with the defective portion, and paste the defective portion onto the identified area to be pasted, thereby generating a defective product image suitable for learning. Furthermore, after the defective portion pasting process, a trimming process can be performed to trim the portion of the defective portion that extends beyond the area to be pasted.
[0019] This configuration prevents the generation of unnatural defective product images where defects are located outside the workpiece area, thereby improving the accuracy of the learning process.
[0020] The system further includes a display control unit that displays new defective product images generated by image processing units of other embodiments on the display unit, allowing the user to see and confirm what kind of defective product images are generated by pasting and blurring the defective areas. As a result, the user can decide whether or not to use an image for training, such as not using an image that looks unnatural.
[0021] In other embodiments, the image processing unit can add identification information to the new defective product image generated by the image processing unit to distinguish it from a defective product image of a defective workpiece. This configuration allows for the distinction between defective product images generated by the image processing unit and defective product images taken of defective workpieces. For example, once a large number of defective product images taken of defective workpieces have been accumulated, the defective product images generated by the image processing unit can be excluded from the training. Furthermore, when training with defective product images generated by the image processing unit, the training weight can be reduced compared to that of defective product images taken of defective workpieces. [Effects of the Invention]
[0022] As described above, after pasting the defective part extracted from the defective product image onto the reference image and making the boundary between the defective part and the reference image inconspicuous, a new defective product image with various defective states actually assumed in the workpiece can be naturally created. Then, by having the new defective product image, the non-defective product image and the defective product image previously stored in the storage unit learned by the machine learning network, an inference model with high defective product detection ability can be generated in a short time.
Brief Description of Drawings
[0023] [Figure 1] It is a schematic diagram showing the configuration of an appearance inspection device according to an embodiment of the present invention. [Figure 2] It is a block diagram showing the hardware configuration of the appearance inspection device. [Figure 3] It is a flowchart showing an example of the procedure of learning processing. [Figure 4] It is a flowchart showing an example of the procedure of internal generation processing of a defective product image. [Figure 5] FIG.5A shows a defective product image obtained by photographing an actual defective product, and FIG.5B shows an image obtained by extracting a defective part from the defective product image. [Figure 6] FIG.6A shows a reference image, and FIG.6B shows an image in which a pasting target area is specified. [Figure 7] FIG.7A shows an example of a donut-shaped defective product image, and FIGS.7B and 7C are diagrams showing how a defective part is pasted. [Figure 8] FIG.8A shows an example of a long-shaped defective product image, and FIGS.8B and 8C are diagrams showing how a defective part is pasted. [Figure 9] FIG.9A shows an example of a defective product image with a complex shape, and FIGS.9B and 9C are diagrams showing how a defective part is pasted. [Figure 10] FIG.10A shows how a defective part is pasted within a pasting target area, and FIG.1OB shows how a defective part is pasted in a state where it protrudes from the pasting target area. [Figure 11]This flowchart shows an example of the procedure for operating a visual inspection device. [Modes for carrying out the invention]
[0024] Embodiments of the present invention will be described in detail below with reference to the drawings. The following description of preferred embodiments is essentially illustrative and is not intended to limit the present invention, its applications, or its uses.
[0025] Figure 1 is a schematic diagram showing the configuration of a visual inspection device 1 according to an embodiment of the present invention. The visual inspection device 1 is a device for determining the quality of workpiece images acquired by imaging a workpiece that is the object of inspection, such as various parts or products, and can be used in production sites such as factories. Specifically, a machine learning network is constructed inside the visual inspection device 1. Workpiece images of the object of inspection are input to the generated machine learning network, and the machine learning network is able to determine the quality of the workpiece images.
[0026] A workpiece may be inspected as a whole, or only a part of it may be inspected. Furthermore, a single workpiece may contain multiple items to be inspected. Also, a workpiece image may contain multiple workpieces.
[0027] The visual inspection device 1 comprises a control unit 2, which serves as the main body of the device; an imaging unit 3; a display device (display unit) 4; and a personal computer 5. The personal computer 5 is not mandatory and can be omitted. Various information and images can be displayed using the personal computer 5 instead of the display device 4, or the functions of the personal computer 5 can be incorporated into the control unit 2 or the display device 4.
[0028] Figure 1 shows an example of the configuration of the visual inspection device 1, consisting of a control unit 2, an imaging unit 3, a display device 4, and a personal computer 5. However, any multiple of these components can be combined and integrated. For example, the control unit 2 and the imaging unit 3 can be integrated, or the control unit 2 and the display device 4 can be integrated. Furthermore, the control unit 2 can be divided into multiple units and some parts incorporated into the imaging unit 3 or the display device 4, or the imaging unit 3 can be divided into multiple units and some parts incorporated into other units.
[0029] (Configuration of imaging unit 3) As shown in Figure 2, the imaging unit 3 comprises a camera module (imaging unit) 14 and an illumination module (illumination unit) 15, and is a unit that performs the acquisition of workpiece images. The camera module 14 comprises an AF motor 141 that drives the imaging optical system and an imaging substrate 142. The AF motor 141 is the part that automatically adjusts the focus by driving the lens of the imaging optical system, and can perform focus adjustment using conventional methods such as contrast autofocus. The imaging substrate 142 is equipped with a CMOS sensor 143 as a light-receiving element that receives light incident from the imaging optical system. The CMOS sensor 143 is an imaging sensor configured to acquire color images. Instead of the CMOS sensor 143, a light-receiving element such as a CCD sensor can also be used.
[0030] The lighting module 15 includes an LED (light-emitting diode) 151 as a light-emitting element that illuminates the imaging area including the workpiece, and an LED driver 152 that controls the LED 151. The timing of light emission, the duration of light emission, and the amount of light emitted by the LED 151 can be arbitrarily controlled by the LED driver 152. The LED 151 may be provided integrally with the imaging unit 3, or it may be provided as a separate external lighting unit.
[0031] (Configuration of display device 4) The display device 4 has a display panel made of, for example, a liquid crystal panel or an organic EL panel. Work images and user interface images output from the control unit 2 are displayed on the display device 4. In addition, if the personal computer 5 has a display panel, the display panel of the personal computer 5 can be used as a substitute for the display device 4.
[0032] (operation equipment) Examples of operating devices for a user to operate the visual inspection device 1 include the keyboard 51 and mouse 52 of a personal computer 5, but are not limited to these; any device configured to accept various operations by the user is acceptable. For example, a pointing device such as the touch panel 41 of a display device 4 is also included as an operating device.
[0033] User operations on the keyboard 51 and mouse 52 can be detected by the control unit 2. The touch panel 41 is a conventional touch-type control panel equipped with, for example, a pressure sensor, and user touch operations can be detected by the control unit 2. The same applies when other pointing devices are used.
[0034] (Configuration of Control Unit 2) The control unit 2 comprises a main board 13, a connector board 16, a communication board 17, and a power supply board 18. The main board 13 is equipped with a processor 13a. The processor 13a controls the operation of each connected board and module. For example, the processor 13a outputs a lighting control signal to the LED driver 152 of the lighting module 15 to control the on / off state of the LED 151. The LED driver 152 switches the on / off state of the LED 151 and adjusts the on / off time, as well as the light intensity of the LED 151, in response to the lighting control signal from the processor 13a.
[0035] Furthermore, the processor 13a outputs an imaging control signal to the imaging substrate 142 of the camera module 14 to control the CMOS sensor 143. The CMOS sensor 143 starts imaging in response to the imaging control signal from the processor 13a and adjusts the exposure time to an arbitrary time to perform imaging. In other words, the imaging unit 3 images the area within the field of view of the CMOS sensor 143 in response to the imaging control signal output from the processor 13a. If there is a workpiece within the field of view, the workpiece will be imaged, but if there are objects other than workpieces within the field of view, those can also be imaged. For example, the visual inspection device 1 can use the imaging unit 3 to capture images of good products corresponding to good products and images of defective products corresponding to defective products as training images for a machine learning network. The training images do not have to be images captured by the imaging unit 3; they may be images captured by other cameras, etc.
[0036] On the other hand, when the visual inspection device is in operation, the imaging unit 3 can capture images of the workpiece. Furthermore, the CMOS sensor 143 is configured to output live images, i.e., the currently captured images, in real time at a short frame rate.
[0037] Once imaging by the CMOS sensor 143 is complete, the image signal output from the imaging unit 3 is input to the processor 13a on the main board 13 for processing and stored in the memory 13b of the main board 13. Details of the specific processing performed by the processor 13a on the main board 13 will be described later. The main board 13 may also be equipped with processing devices such as FPGAs and DSPs. Alternatively, the processor 13a may be an integrated processor with FPGAs and DSPs.
[0038] The main board 13 is equipped with a display control unit 13c. The display control unit 13c generates the display screen, controls the display device 4, and displays the display screen on the display device 4. The specific operation of the display control unit 13c will be described later.
[0039] The connector board 16 is the part that receives power from the outside via a power connector (not shown) provided on the power interface 161. The power supply board 18 is the part that distributes the power received by the connector board 16 to each board and module, and specifically distributes power to the lighting module 15, camera module 14, main board 13, and communication board 17. The power supply board 18 is equipped with an AF motor driver 181. The AF motor driver 181 supplies drive power to the AF motor 141 of the camera module 14, thereby realizing autofocus. The AF motor driver 181 adjusts the power supplied to the AF motor 141 according to the AF control signal from the processor 13a of the main board 13.
[0040] The communication board 17 is the part that performs communication between the main board 13 and the display device 4 and the personal computer 5, and communication between the main board 13 and external control equipment (not shown). Examples of external control equipment include programmable logic controllers. Communication may be wired or wireless, and either communication method can be implemented using conventionally known communication modules.
[0041] The control unit 2 is provided with a storage device (storage unit) 19, which may consist of, for example, a solid-state drive or a hard disk drive. The storage device 19 stores program files 80 and configuration files (software) that enable the hardware to execute the various controls and processes described later. The program files 80 and configuration files can be stored on a storage medium 90, such as an optical disc, and the program files 80 and configuration files stored on this storage medium 90 can be installed on the control unit 2. The program files 80 may also be downloaded from an external server using a communication line. In addition, the storage device 19 can store, for example, the image data described above, and parameters for constructing an inference model obtained after the learning process described later.
[0042] In Figure 2, the storage device 19 is shown as being integrated with the control unit 2, but the storage device 19 may be a separate unit from the control unit 2. An example of such a storage device 19 is a network-attached storage (NAS). The NSA and the control unit 2 are connected by a communication line such as a wired LAN or wireless LAN.
[0043] In other words, the visual inspection device 1 trains a machine learning network using training images, thereby adjusting the parameters of the machine learning network and generating an inference model. By inputting a work image of the work to be inspected into the inference model, the device can determine whether the work is good or bad based on the input work image. By using this visual inspection device 1, a visual inspection method that determines whether a work is good or bad based on a work image can be performed.
[0044] (Processor configuration) As shown in Figure 2, the processor 13a is provided with an image processing unit 13d, a learning unit 13e, and an inspection unit 13f. The image processing unit 13d, the learning unit 13e, and the inspection unit 13f may be hardware components or components that are executed by software. Furthermore, the image processing unit 13d, the learning unit 13e, and the inspection unit 13f do not necessarily have to be provided on the main board 13; some or all of them may be provided on boards other than the main board 13.
[0045] Details of each part will be described later, but the general outline is as follows. The image processing unit 13d is the part that internally generates defective product images, which will be described later. The learning unit 13e is the part that inputs training data into a machine learning network to train it and generates an inference model for determining whether an input image is good or bad. The learning unit 13e may be composed of a separate learning computer, for example, from the control unit 2. The learning computer is configured to perform machine learning at high speed. By connecting the learning computer and the control unit 2 so that they can communicate with each other, the parameters for constructing the inference model generated by the learning computer can be sent to and stored in the storage device 19. This allows the control unit 2 to build the inference model. The inspection unit 13f is the part that inputs the workpiece image into the inference model and determines whether the workpiece is good or bad.
[0046] (Learning process) Next, we will specifically explain the training process of the machine learning network. There are two types of training: defective product training, which uses images of defective products, and good product training, which uses images of good products. In a workpiece production site, good products make up the vast majority, so it is easy to collect a large number of good product images for good product training. However, a machine learning network trained only on good product images will have insufficient ability to detect defective products, and will perform worse than defective product training in inspections with high difficulty, so there is a demand to perform defective product training. However, since the number of defective products generated in a workpiece production site is extremely small, it is difficult to collect defective product images for training in a short time. In this embodiment, the visual inspection device 1 is configured to naturally generate a large number of defective product images with a wide variety of variations. This will be explained in detail below.
[0047] The flowchart in Figure 3 shows an example of the learning process. In step SA1 after the start, the learning unit 13e prepares an untrained machine learning network. An untrained machine learning network is, for example, one in which the initial values of the parameters are randomly determined. In step SA2, good product images and defective product images to be used for training the machine learning network are stored in the storage device 19. This step SA2 is the storage step. The storage step may be performed by the user before step SA1. The good product images and defective product images for training may be images that the user has previously photographed and stored, images acquired by newly imaging workpieces for training, or images acquired by the imaging unit 3 during the operation of the visual inspection device 1. In addition, good product images and defective product images stored in storage devices other than storage device 19 (not shown) can also be used as good product images and defective product images for training.
[0048] Annotation is performed on images of defective products. That is, the user performs the following actions in advance: clearly indicating that the image is defective, specifying the defective parts of the image, etc. The information added by the annotation is stored in the storage device 19 in association with the corresponding defective image.
[0049] Next, the process proceeds to step SA3. In step SA3, it is determined whether or not internal processing of defective product images is necessary. Internal processing of defective product images, as will be explained in detail later, is the process of creating a new defective product image within the visual inspection device 1 using an existing defective product image. The user can make the determination in step SA3. For example, if only one or a few defective product images have been collected, the number of defective product images for defective product learning is insufficient, so the user will determine that internal processing of defective product images is necessary. On the other hand, if dozens or hundreds of defective product images have been collected for defective product learning, the number of defective product images for defective product learning is sufficient, so the user will determine that internal processing of defective product images is unnecessary. The user can input whether or not internal processing of defective product images is necessary using an operating device such as a mouse 52. For example, the display control unit 13c generates a user interface screen that allows the user to select whether or not internal processing of defective product images is necessary and displays it on the display device 4, so that the user can easily input whether or not internal processing of defective product images is necessary. Since user input is received by the learning unit 13e, the visual inspection device 1 can be treated as if the learning unit 13e has determined step SA3.
[0050] If step SA3 determines that YES is required and internal processing of defective product images is necessary, the process proceeds to step SA4. Conversely, if step SA3 determines that NO is required and internal processing of defective product images is not necessary, the process proceeds to step SA5.
[0051] In step SA4, an internal process for generating defective images is executed to increase the number of defective images for training. An example of the procedure for the internal generation process is shown in the flowchart in Figure 4. The flowchart in Figure 4 starts when step SA3 of the flowchart in Figure 3 is determined to be YES. In step SB1 after the start of the flowchart in Figure 4, the learning unit 13e reads the good product images and defective product images stored in the storage device 19, and the display control unit 13c displays the good product images and defective product images read by the learning unit 13e on the display device 4. Any number of images can be displayed on the display device 4, but it is possible to display all defective product images. In this case, the defective product images can be displayed in a list format. This makes it possible to present various defective areas to the user.
[0052] In step SB2, the learning unit 13e receives the user's selection of a defective product image. For example, in the previous step SB1, the display control unit 13c generates a user interface screen that can display defective product images in a list format and displays it on the display device 4. Selection buttons and the like are incorporated into the user interface screen so that the user can select the desired defective product image by operating the mouse 52 or the like. When the learning unit 13e detects the user's selection operation, it temporarily stores the defective product image corresponding to the selection operation as selected.
[0053] In step SB3, the learning unit 13e accepts the user's selection of a reference image. The reference image is the source image used during internal generation; in most cases, a good product image is suitable, but a defective product image may also be used. For example, a selection button or the like can be incorporated into the user interface screen displayed in step SB1, allowing the user to select the desired image using the mouse 52 or the like. When the learning unit 13e detects the user's selection operation, it temporarily stores the image corresponding to the selection operation as selected. The order of steps SB2 and SB3 may be reversed.
[0054] In step SB4, the image processing unit 13d reads the defective product image selected in step SB2 and performs an extraction process to extract the defective areas from the image. The extraction of defective areas may be performed using a rule-based algorithm or manually by the user. In the extraction of defective areas, the image processing unit 13d obtains feature quantities from the defective product image and executes an algorithm that extracts areas with feature quantities different from the surrounding feature quantities as defective areas.
[0055] The following describes a specific example of the defect extraction process based on Figure 5. Figure 5A shows the defective product image 200 selected in step SB2. The defective product image 200 was obtained by imaging the workpiece W having a defect W1. Figure 5B shows the extracted image 201 obtained by extracting the defect W1 from the defective product image 200 using a rule-based algorithm. Examples of algorithms for extracting only the defect W1 include, for example, a color extraction algorithm and the GrabCut algorithm, but are not limited to these, and other algorithms can also be used.
[0056] In the case of the color extraction algorithm, when the user specifies a color corresponding to the defective area W1 on the defective product image 200, the area with that color is automatically extracted as the defective area W1. In the case of the GrabCut algorithm, when the user draws a box around the defective area W1 and its surroundings on the defective product image 200, that area is specified, and the defective area W1 is automatically extracted within the specified area. In other words, in the extraction process, the image processing unit 13d accepts the user's selection operation for the defective area W1 from the defective product image 200 and extracts the defective area W1 based on the accepted selection operation.
[0057] Subsequently, in step SB5, the image processing unit 13d accepts corrections to the range of the defective area W1 extracted in step SB4. If the area extracted by the color extraction algorithm is significantly wider or narrower than the defective area W1, the user can re-specify the color or make corrections such as changing the threshold. When the image processing unit 13d accepts these corrections, the defective area W1 is re-extracted. In the case of the GrabCut algorithm, the user can specify the foreground and background in detail by performing stroke corrections or click corrections, and the defective area W1 is re-extracted each time.
[0058] Furthermore, when a user manually extracts a defective area W1 on the defective product image 200, examples include using the mouse 52 to draw a box around the defective area W1 or filling in the defective area W1. For example, a freehand tool can be used to create a frame around the defective area W1, and the defective area W1 can be extracted using this frame. In this case, the image processing unit 13d extracts the area as the boxed or filled area, considering it to be the defective area W1.
[0059] Alternatively, the defective area W1 can be extracted using the AI Assisted specification. When using the AI Assisted specification, the outline of the defective area W1 is roughly specified and extracted, and then the interior of the extracted area is specified using a fill tool or similar. This allows for the automatic extraction of the defective area W1. After the defective area W1 is automatically extracted, it is also possible to make minor adjustments.
[0060] When the user confirms that the defective area W1 has been extracted as intended and proceeds to the next step, the process moves to step SB6. In step SB6, the image processing unit 13d determines whether or not to apply the image conversion process described later to the defective area W1 extracted in steps SB4 and SB5. For example, the image processing unit 13d generates a user interface screen for selecting whether or not to apply the image conversion process, and the display control unit 13c displays the generated user interface screen on the display device 4. The user selects whether or not to apply the image conversion process on the user interface screen using the mouse 52 or the like. If the image processing unit 13d detects that "apply" has been selected, it proceeds to step SB7, while if it detects that "do not apply" has been selected, it proceeds to step SB8.
[0061] In step SB7, the image processing unit 13d performs image transformation processing on the defective area W1 extracted in steps SB4 and SB5. Examples of image transformation processing include aspect ratio change processing to change the aspect ratio of the defective area W1, rotation processing to rotate the defective area W1, movement processing to move the defective area W1 in the horizontal (X direction) or vertical (Y direction), contrast transformation processing to change the contrast of the defective area W1, and color transformation processing to change the color of the defective area W1. However, it is not limited to these, and other image transformation processing may be applied. In addition, any multiple image transformation processing may be applied to the defective area W1 in any order. After going through step SB7, the defective area W1 in the transformed state can be pasted onto the reference image.
[0062] The user can be allowed to select which image transformation process to apply. For example, the image processing unit 13d generates a user interface screen for selecting an image transformation process, and the display control unit 13c displays the generated user interface screen on the display device 4. When the user selects the desired image transformation process on the user interface screen using a mouse 52 or the like, the image processing unit 13d detects this and applies the detected image transformation process to the defective area W1. Alternatively, the visual inspection device 1 may automatically set which image transformation process to apply. Steps SB6 and SB7 may be omitted.
[0063] After step SB7, or after being determined to be NO in step SB6, the process proceeds to step SB8. In step SB8, the area to be pasted with the extracted defective area W1 is identified from the reference image. For example, suppose a reference image 202 as shown in FIG. 6A of Figure 6 is selected. This reference image 202 is a good product image that includes a good product workpiece W. FIG. 6B of Figure 6 is the area identification image 204 after the area to be pasted with 203 has been identified. The area to be pasted with 203 is identified by extracting the workpiece W portion included in the reference image 202 shown in FIG. 6A. The method for extracting the workpiece W portion can be a method that has been conventionally used in the field of image processing technology. In FIG. 6B, a binarized mask image is used to distinguish the area to be pasted with 203 from other areas, with the white area being the area to be pasted with 203 and the black area being the other areas.
[0064] Subsequently, the process proceeds to step SB9, where it is determined whether or not to apply the rules described later when pasting the defective area W1 onto the pasting target area 203. For example, the image processing unit 13d generates a user interface screen for selecting whether or not to apply the rules, and the display control unit 13c displays the generated user interface screen on the display device 4. The user selects whether or not to apply the rules on the user interface screen using a mouse 52 or the like. If the image processing unit 13d detects that "apply" has been selected, it proceeds to step SB10, while if it detects that "do not apply" has been selected, it proceeds to step SB11.
[0065] In step SB10, a pasting process is executed in which a rule is applied when pasting the defective area W1 to the pasting target area 203. A rule could be, for example, pasting the defective area W1 to the pasting target area 203. For example, suppose a defective product image 200 as shown in FIG. 7A of Figure 7 is selected, and a donut-shaped workpiece W is the object of inspection. In this case, it is known that the defective area W1 exists somewhere in the circumferential direction of the workpiece W. Therefore, as shown in FIG. 7B and 7C of Figure 7, the defective area W1 is moved in the direction corresponding to the circumferential direction of the workpiece W and pasted on the image 204 after the pasting target area 203 has been identified. In other words, a circumferential constraint (an example of a predetermined constraint condition) is applied to the pasting position of the defective area W1.
[0066] Furthermore, suppose a defective product image 200, such as that shown in FIG. 8A of Figure 8, is selected, and a linear workpiece W is the object of inspection. In this case, it is known that the defective area W1 is located somewhere along the longitudinal direction of the workpiece W. Therefore, as shown in FIG. 8B and 8C of Figure 8, the defective area W1 is moved in a direction corresponding to the longitudinal direction of the workpiece W and attached on the image 204 after the area to be attached 203 has been identified. In other words, a constraint (an example of a predetermined constraint condition) is applied to the attachment position of the defective area W1 in the longitudinal direction.
[0067] Furthermore, suppose a defective product image 200, such as that shown in FIG.9A of Figure 9, is selected, and the object of inspection is a complexly shaped annular workpiece W. In this case, the defective area W1 is somewhere on the workpiece W, but it is difficult to pinpoint it simply as in the cases shown in Figures 7 and 8. Therefore, for example, the edges of the outer circumference and inner circumference of the workpiece W are detected to identify the workpiece W, the normal direction of the detected edges is determined, and the defective area W1 is moved in the normal direction and attached.
[0068] For example, as shown in FIG. 10A of Figure 10, the defective area W1 may be randomly pasted onto the part of the workpiece W that corresponds to the pasting area 203. If the defective area W1 is pasted randomly, as shown in FIG. 10B of Figure 10, some of the defective area W1 may extend beyond the part of the workpiece W that corresponds to the pasting area 203, but the protruding part can be trimmed using the trimming process described later.
[0069] In step SB11, which proceeds after it is determined in step SB9 that the rule should not be applied, the user places the defective area W1 onto the target area 203. For example, the user can select the placement location of the defective area W1 by operating the mouse 52, etc., and then confirm the placement, thereby placing the defective area W1 at the desired location. In step SB11, the defective area W1 may also be placed randomly onto the target area 203.
[0070] After the defective area is pasted, step SB12 performs a trimming process to cut off the portion of the defective area W1 that extends beyond the pasting target area 203 (shown in FIG. 10B of Figure 10). Specifically, the image processing unit 13d acquires information indicating the size, shape, and position of the pasting target area 203, as well as information indicating the size, shape, and position of the pasted defective area W1. Based on the acquired information, it determines whether the entire defective area W1 is located inside the pasting target area 203. If the entire defective area W1 is located inside the pasting target area 203, it is determined that trimming is unnecessary. On the other hand, if a part of the defective area W1 is located outside the pasting target area 203, that outside portion is considered an overhang, and that portion is trimmed. As a result, the internally generated defective product image reflects the actual defective state of the workpiece, improving learning efficiency.
[0071] In step SB13, the image processing unit 13d performs a process to make the boundary between the defective area W1 pasted in the pasting process of steps SB10 and SB11 and the reference image 202 less noticeable. That is, since the image from which the defective area W1 was extracted and the reference image 202 are different images, simply pasting the defective area W1 onto the reference image 202 may result in a noticeable boundary between the defective area W1 and the reference image 202. Also, since the position where the defective area W1 was extracted and the position where the defective area W1 was pasted are different, this may also cause the boundary between the defective area W1 and the reference image 202 to be noticeable. If the boundary is noticeable, it is undesirable for an image used for training. Therefore, the blurring process in step SB13 is performed. For example, blurring can be used as a process to make the boundary less noticeable.
[0072] Examples of blurring processes include GAN (Generative Adversarial Network), Deep Image Harmonization, or other rule-based processes; any blurring process is acceptable. Blurring is also known as the Harmonize process in deep learning. By performing the blurring process, the edges of the defective area W1 blend seamlessly with the reference image 202. In this way, the image processing unit 13d internally generates a new image of the defective product. This internal generation process is the image processing step. The internally generated image of the defective product can be stored, for example, in the storage device 19.
[0073] Steps SB10 to SB13 are executed multiple times. In this case, the placement of the defective area W1 is made different for each image. This allows for the internal generation of multiple defective product images in which the placement of the defective area W1 differs from one another. Alternatively, the image conversion may be configured to paste different defective areas W1 onto the reference image. This also allows for the internal generation of multiple defective product images with different defective areas W1.
[0074] In step SB14, the display control unit 13c acquires the internally generated defective product images and displays them on the display device 4. Specifically, the display control unit 13c generates a user interface screen for displaying the internally generated defective product images. The user interface screen has a display area that can display one or more internally generated defective product images in a list. This allows the user to view and confirm the internally generated defective product images. As a result, defective product images that are deemed unsuitable for training can be set not to be used for training. This setting can be configured for each defective product image on the user interface screen. The information "not to be used for training" is also stored in the storage device 19.
[0075] In step SB15, the image processing unit 13d adds identification information to the newly generated defective product image to distinguish it from the defective product image taken of the defective workpiece. An identification flag is added to the internally generated defective product image, and the defective product image is stored in the storage device 19 along with the added information.
[0076] As described above, step SA4 of the flowchart in Figure 3 is completed. In step SA6, settings are made to exclude internally generated defective images from being used for training, and weights are assigned if they are used for training.
[0077] For example, the learning unit 13e generates a user interface screen for selecting whether or not to use internally generated defective product images for training, and the display control unit 13c displays the generated user interface screen on the display device 4. The user selects whether or not to use the images on the user interface screen by operating a mouse 52 or the like. This selection information is stored in memory 13b, for example.
[0078] Furthermore, this user interface screen allows users to set the weighting when using internally generated images of defective products for training. Internally generated images of defective products differ from images of defective products that have actually been captured, so they may not be suitable for training. In such cases, it may be better to make the training weight for defective product images to which identification information has been added in step SB15 shown in Figure 4 lighter than the training weight for defective product images taken of defective workpieces. The weighting can be freely set by the user, and the training weight for internally generated images of defective products may be set to be the same as the training weight for defective product images taken of defective workpieces.
[0079] In step SA7, the learning unit 13e inputs images of good and defective products, pre-stored in the memory device 19, along with images of defective products internally generated by the image processing unit 13d, into the machine learning network. Then, the process proceeds to step SA8, where the input images are used to train the machine learning network and generate an inference model. Steps SA7 and SA8 are learning steps.
[0080] At this point, learning is performed based on the information set in step SA6. For example, if the setting is configured to use internally generated images of defective products for learning, then, as described above, the internally generated images of defective products will also be used to train the machine learning network. However, if the setting is configured not to use internally generated images of defective products for learning, then the internally generated images of defective products will be excluded from the learning target and will not be used to train the machine learning network. For example, once a large number of images of defective workpieces have been accumulated, the internally generated images of defective products can be excluded from the learning target.
[0081] Furthermore, the weights set in step SA6 are also reflected in the training of the machine learning network, allowing the training weights using internally generated images of defective products to be lighter than the training weights using images of defective products taken from actual defective workpieces.
[0082] Furthermore, if step SA3 determines NO and no defective product images are generated internally, the process proceeds to step SA5. In step SA5, the good product images and defective product images pre-stored in the memory device 19 are input to the machine learning network. After that, the process proceeds to step SA8, where the input images are used to train the machine learning network and generate an inference model.
[0083] Step SA9 stores the parameters used to construct the trained inference model in memory device 19.
[0084] The training method for the machine learning network described above is not particularly limited, but for example, the following method can be used. That is, the machine learning network can be trained by minimizing the loss function. There are various definitions of loss, but Mean Square Error (MSE) can be given as an example.
[0085]
number
[0086] Here, T is the target anomaly score map, 0 is the output image (anomaly score map), n is the number of pixels where image T is 0, and x and y are the pixel positions. Loss functions such as Binary Cross Entropy can also be used. The above is merely an example.
[0087] (During operation of visual inspection device 1) Next, the operation of the visual inspection device 1 will be explained based on the flowchart shown in Figure 11. In step SC1 after startup, the processor 13a reads parameters stored in the memory device 19 and prepares a trained machine learning network. This is the inference model generated by the learning unit 13e. In step SC2, the workpiece to be inspected is imaged by the imaging unit 3 to acquire a workpiece image. Then, the process proceeds to step SC3, where the workpiece image acquired in step SC2 is input into the inference model.
[0088] Next, in step SC4, the inference model performs inference processing on the work image input in step SC3. Then, in step SC5, the inference model outputs a map image as a result of the inference processing.
[0089] Subsequently, in step SC6, the quality of the workpiece is determined based on the map image output in step SC5. Steps SC2 to SC6 can be executed each time the workpiece changes. The processes shown in this flowchart correspond to the inspection steps executed by the inspection unit 13f.
[0090] (Effects of the embodiment) As described above, this embodiment allows for the extraction of defective areas from images of defective products obtained by photographing the defective workpiece. The extracted defective areas are pasted onto a reference image, thereby generating a new image of the defective product containing the defective areas. Multiple images of the defective product with different pasting positions, and multiple images of the defective product with different image transformations applied to the defective areas, can be automatically and quickly generated internally. In the newly generated images of the defective product, blurring is performed so that the boundary between the pasted defective areas and the reference image is not noticeable, resulting in a natural-looking image of the defective product.
[0091] By training a machine learning network with new images of defective products and images of good and defective products pre-stored in the storage device 19, an inference model with high defect detection capability is generated. Therefore, the visual inspection performance can be improved. These are merely illustrative in all respects and should not be interpreted restrictively. Furthermore, any modifications or changes that fall within the equivalent scope of the claims are all within the scope of the present invention. [Industrial applicability]
[0092] As described above, the present invention can be used when inspecting the appearance of a workpiece. [Explanation of Symbols]
[0093] 1. Visual inspection device 4 Display device (display section) 13a processor 13b Memory 13c Display Control Unit 13d Image Processing Unit 13e Learning Department 13F Inspection Department
Claims
1. An appearance inspection device that inputs a work image of a work to be inspected into a machine learning network and judges the quality of the work based on the input work image, A storage unit that stores a non-defective product image corresponding to a non-defective product and a defective product image corresponding to a defective product; an image processing unit that generates a new defective product image by executing an extraction process that extracts a defective part of the defective product image stored in advance in the storage unit, a pasting process that pastes the defective part extracted by the extraction process onto a reference image including a workpiece, and a process that makes the boundary between the defective part pasted by the pasting process and the reference image inconspicuous; a learning unit that generates an inference model by training a machine learning network on the non-defective product images and defective product images pre-stored in the storage unit and the new defective product images generated by the image processing unit; An appearance inspection device comprising: an inspection unit that inputs a workpiece image of the workpiece to be inspected into the inference model generated by the learning unit, and determines whether the workpiece is good or bad based on the input workpiece image.
2. 2. The visual inspection apparatus according to claim 1, The image processing unit of the visual inspection device acquires features of the defective product image stored in the memory unit in the extraction process, and extracts a portion having features different from the features of the surrounding area as the defective portion.
3. 3. The visual inspection apparatus according to claim 2, The image processing unit is an appearance inspection device that accepts correction of the range of the extracted defective portion in the extraction process.
4. 4. The visual inspection apparatus according to claim 1, The image processing unit is an appearance inspection device that, in the extraction process, accepts a user's selection operation of the defective part from among the defective product images stored in the memory unit, and extracts the defective part based on the accepted selection operation.
5. 5. The visual inspection apparatus according to claim 1, The image processing unit is an appearance inspection device that applies image conversion to the defective portion extracted by the extraction processing and pastes the defective portion onto the reference image.
6. 6. The visual inspection apparatus according to claim 1, The image processing unit identifies a work portion included in the reference image as a target area for pasting the defective part, pastes the defective part into the identified target area for pasting, and after the pasting process of the defective part, performs a trimming process to trim off the portion of the defective part that protrudes from the target area for pasting.
7. 7. The visual inspection apparatus according to claim 1, The visual inspection apparatus further comprises a display control unit that displays the new defective product image generated by the image processing unit on a display unit.
8. 8. The visual inspection apparatus according to claim 1, The image processing unit is an appearance inspection device that assigns identification information to the new defective product image generated by the image processing unit to distinguish it from defective product images captured by photographing defective workpieces.
9. 9. The visual inspection apparatus according to claim 8, The learning unit is an appearance inspection device configured to be capable of learning about defective products by excluding the defective product images to which the identification information has been added from learning objects.
10. 10. The visual inspection apparatus according to claim 8, The learning unit is configured to reduce the weight of learning from the defective product images to which the identification information has been assigned compared to the weight of learning from defective product images photographed of defective workpieces.
11. 6. The visual inspection apparatus according to claim 1, The image processing unit is an appearance inspection device that marks defective areas on a work portion included in the reference image in accordance with predetermined constraints.
12. A visual inspection method for inputting a workpiece image of an inspection target workpiece into a machine learning network and determining whether the workpiece is good or bad based on the input workpiece image, a storage step of storing a non-defective product image corresponding to a non-defective product and a defective product image corresponding to a defective product; an image processing step of generating a new defective product image by executing an extraction process of extracting a defective part of the defective product image previously stored in the storage step, an attachment process of attaching the defective part extracted in the extraction process to a reference image including a workpiece, and a blurring process of making the boundary between the defective part attached in the attachment process and the reference image less noticeable; a learning step of generating an inference model by training a machine learning network on the non-defective product images and the defective product images pre-stored in the storage step and the new defective product images generated in the image processing step; An appearance inspection method comprising: an inspection step of inputting a work image of the work to be inspected into the inference model generated in the learning step, and determining whether the work is good or bad based on the input work image.
13. An appearance inspection device that inputs a work image of a work to be inspected into a machine learning network and judges the quality of the work based on the input work image, A storage unit that stores a non-defective product image corresponding to a non-defective product and a defective product image corresponding to a defective product; an image processing unit that executes an extraction process for extracting a defective portion of the defective image stored in advance in the storage unit, and an attachment process for attaching the defective portion extracted in the extraction process to the reference image including a workpiece in accordance with a predetermined constraint condition corresponding to the reference image, thereby generating a new defective image; a learning unit that generates an inference model by training a machine learning network on the non-defective product images and defective product images pre-stored in the storage unit and the new defective product images generated by the image processing unit; An appearance inspection device comprising: an inspection unit that inputs a workpiece image of the workpiece to be inspected into the inference model generated by the learning unit, and determines whether the workpiece is good or bad based on the input workpiece image.
