[go: up one dir, main page]

WO2024154379A1 - モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル - Google Patents

モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル Download PDF

Info

Publication number
WO2024154379A1
WO2024154379A1 PCT/JP2023/032684 JP2023032684W WO2024154379A1 WO 2024154379 A1 WO2024154379 A1 WO 2024154379A1 JP 2023032684 W JP2023032684 W JP 2023032684W WO 2024154379 A1 WO2024154379 A1 WO 2024154379A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
foreign object
inference model
training
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/JP2023/032684
Other languages
English (en)
French (fr)
Inventor
達也 大西
智 土屋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hamamatsu Photonics KK
Original Assignee
Hamamatsu Photonics KK
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hamamatsu Photonics KK filed Critical Hamamatsu Photonics KK
Priority to EP23917591.2A priority Critical patent/EP4625313A1/en
Priority to JP2023573665A priority patent/JP7424572B1/ja
Priority to CN202380091701.8A priority patent/CN120569753A/zh
Priority to KR1020257026571A priority patent/KR20250137617A/ko
Priority to JP2024001044A priority patent/JP2024102002A/ja
Publication of WO2024154379A1 publication Critical patent/WO2024154379A1/ja
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N23/00Investigating or analysing materials by the use of wave or particle radiation, e.g. X-rays or neutrons, not covered by groups G01N3/00 – G01N17/00, G01N21/00 or G01N22/00
    • G01N23/02Investigating or analysing materials by the use of wave or particle radiation, e.g. X-rays or neutrons, not covered by groups G01N3/00 – G01N17/00, G01N21/00 or G01N22/00 by transmitting the radiation through the material
    • G01N23/04Investigating or analysing materials by the use of wave or particle radiation, e.g. X-rays or neutrons, not covered by groups G01N3/00 – G01N17/00, G01N21/00 or G01N22/00 by transmitting the radiation through the material and forming images of the material
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N23/00Investigating or analysing materials by the use of wave or particle radiation, e.g. X-rays or neutrons, not covered by groups G01N3/00 – G01N17/00, G01N21/00 or G01N22/00
    • G01N23/02Investigating or analysing materials by the use of wave or particle radiation, e.g. X-rays or neutrons, not covered by groups G01N3/00 – G01N17/00, G01N21/00 or G01N22/00 by transmitting the radiation through the material
    • G01N23/06Investigating or analysing materials by the use of wave or particle radiation, e.g. X-rays or neutrons, not covered by groups G01N3/00 – G01N17/00, G01N21/00 or G01N22/00 by transmitting the radiation through the material and measuring the absorption
    • G01N23/18Investigating the presence of flaws defects or foreign matter
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Definitions

  • the present invention relates to a model generation method, a model generation system, and a model generation program for generating an inference model used to detect foreign objects contained in an image showing an object, a foreign object detection method, a foreign object detection system, and a foreign object detection program for detecting foreign objects contained in an image showing an object using the generated inference model, and the generated inference model.
  • Patent Document 1 shows that an inference model generated by machine learning is used to generate a restored image from an inspection target image of the outer appearance of the inspection target, and the inspection target is inspected from the difference between the inspection target image and the restored image.
  • the inference model used for inspection is generated from a good product image of the outer appearance of the inspection target that is judged to be a good product, and a pseudo-defect image that combines an image showing a defect with the good product image. This is said to improve inspection accuracy.
  • the method shown in Patent Document 1 does not always perform appropriate detection of foreign objects, for example, when detecting foreign objects in images of packaged items captured by X-ray.
  • the target object contains multiple objects such as pasta, and the foreign objects are small compared to the individual objects, even if the inference model generated by the method shown in Patent Document 1 is used, foreign objects cannot always be detected appropriately.
  • One embodiment of the present invention has been made in consideration of the above, and aims to provide a model generation method, model generation system, model generation program, foreign object detection method, foreign object detection system, foreign object detection program, and inference model that can detect foreign objects with high accuracy.
  • a model generation method for generating an inference model used to detect foreign objects contained in an image showing an object, and includes a training acquisition step of acquiring, as training images, a first normal image showing a training object, a second normal image showing the training object, a second foreign object image in which a foreign object expected to be detected has been added to the second normal image, a third normal image showing the training object, and a third foreign object image in which a foreign object not expected to be detected has been added to the third normal image, and a model generation step of performing training using the training images acquired in the training acquisition step to generate an inference model, and the training includes training in which information based on the first normal image is used as input to the inference model and information based on the first normal image is used as output from the inference model, training in which information based on the second foreign object image is used as input to the inference model and information based on the second normal image is used as output from the inference model, and
  • a model generation method in addition to normal images, two different types of foreign object images are used for training to generate an inference model.
  • the inference model generated in this manner reflects in the output the target object that appears in the input image, but does not reflect the foreign object. Therefore, by detecting foreign objects using the generated inference model, foreign objects can be detected with high accuracy.
  • Foreign objects that are not expected to be detected may be natural images. With this configuration, an inference model can be generated more appropriately and reliably.
  • the second normal image and the third normal image are the first normal image
  • a foreign object expected to be detected is added to the first normal image to generate and acquire a second foreign object image
  • a foreign object not expected to be detected is added to the first normal image to generate and acquire a third foreign object image.
  • the target object may be a specific type of object
  • the first normal image, the second normal image, the second foreign object image, the third normal image, and the third foreign object image acquired in the training acquisition step may be images in which the specific type of object is captured as the training target object.
  • the ratio of the number of first normal images acquired in the training acquisition step, the number of combinations of the second normal images and the second foreign object images, and the number of combinations of the third normal images and the third foreign object images may be a preset ratio.
  • Foreign objects that are not expected to be detected may be images drawn based on a formula. With this configuration, an inference model can be generated more appropriately and reliably.
  • the third foreign object image may be an image in which a foreign object not expected to be detected is added to the third normal image by at least one of transparent addition and replacement addition.
  • the inference model may include a neural network with multiple layers, have a structure that allows connections between layers, and is a model that adds together the image after the connections and the input image. With this configuration, it is possible to generate an inference model for detecting foreign objects with high accuracy.
  • a new second inference model may be generated by performing new training, in which a part is added to the output side of the generated inference model that outputs information indicating the degree of foreign matter for each position of the image input to the inference model.
  • model generation method invention in addition to being described as a model generation method invention as described above, one embodiment of the present invention can also be described as a model generation system and a model generation program invention as described below. These are essentially the same invention, just in different categories, and have similar functions and effects.
  • the model generation system is a model generation system that generates an inference model used to detect foreign objects contained in an image showing an object, and includes an acquisition means that acquires as training images a first normal image showing a training object, a second normal image showing the training object, a second foreign object image in which a foreign object expected to be detected has been added to the second normal image, a third normal image showing the training object, and a third foreign object image in which a foreign object not expected to be detected has been added to the third normal image, and a model generation means that performs training using the training images acquired by the acquisition means to generate an inference model, and the training includes training in which information based on the first normal image is used as input to the inference model and information based on the first normal image is used as output from the inference model, training in which information based on the second foreign object image is used as input to the inference model and information based on the second normal image is used as output from the inference model, and training in which information based on the third
  • a model generation program is a model generation program that causes a computer to operate as a model generation system that generates an inference model used to detect foreign objects contained in images showing objects, and causes the computer to generate training normal images including a first normal image showing a training object, a second normal image showing the training object, a second foreign object image in which a foreign object expected to be detected has been added to the second normal image, a third normal image showing the training object, and a third foreign object image in which a foreign object not expected to be detected has been added to the third normal image.
  • the training including training in which information based on a first normal image is input to the inference model and information based on the first normal image is output from the inference model, training in which information based on a second foreign object image is input to the inference model and information based on the second normal image is output from the inference model, and training in which information based on a third foreign object image is input to the inference model and information based on the third normal image is output from the inference model.
  • a foreign object detection method is a foreign object detection method that uses an inference model generated by a model generation method to detect foreign objects contained in an image showing an object, and includes a detection acquisition step of acquiring a target image that is to be detected for foreign objects, a calculation step of inputting information based on the target image acquired in the detection acquisition step into the inference model and performing a calculation to obtain an output from the inference model, and a detection step of calculating the difference between the information related to the input to the inference model in the calculation step and the information related to the output from the inference model, and detecting a foreign object contained in the target image from the calculated difference.
  • the above-mentioned inference model is used to detect foreign objects. Therefore, according to the foreign object detection method according to one embodiment of the present invention, foreign objects can be detected with high accuracy.
  • a foreign object detection method is a foreign object detection method that uses a second inference model generated by a model generation method to detect a foreign object contained in an image showing the object, and includes a detection acquisition step of acquiring a target image that is to be detected for foreign objects, a calculation step of inputting information based on the target image acquired in the detection acquisition step into the second inference model and performing a calculation to obtain an output from the second inference model, and a detection step of detecting a foreign object contained in the target image from the output from the second inference model obtained in the calculation step.
  • the second inference model described above is used to detect foreign objects. Therefore, according to the foreign object detection method according to one embodiment of the present invention, foreign objects can be detected with high accuracy.
  • one embodiment of the present invention can also be described as a foreign object detection system and a foreign object detection program invention as described below. These are essentially the same invention, just in different categories, and have similar functions and effects.
  • a foreign object detection system is a foreign object detection system that uses an inference model generated by a model generation method to detect foreign objects contained in an image depicting an object, and includes a detection acquisition means that acquires a target image that is to be detected for foreign objects, a calculation means that inputs information based on the target image acquired by the detection acquisition means to the inference model, performs calculations, and obtains output from the inference model, and a detection means that calculates the difference between the information related to the input to the inference model by the calculation means and the information related to the output from the inference model, and detects foreign objects contained in the target image from the calculated difference.
  • the foreign object detection system is a foreign object detection system that uses a second inference model generated by a model generation method to detect foreign objects contained in an image showing the object, and includes a detection acquisition means for acquiring a target image that is to be detected for foreign objects, a calculation means for inputting information based on the target image acquired by the detection acquisition means into the second inference model and performing a calculation to obtain an output from the second inference model, and a detection means for detecting foreign objects contained in the target image from the output from the second inference model obtained by the calculation means.
  • a foreign object detection program is a foreign object detection program that causes a computer to operate as a foreign object detection system that uses an inference model generated by a model generation method to detect foreign objects contained in an image showing the target object, and causes the computer to function as: a detection acquisition means that acquires a target image that is to be detected for foreign objects; a calculation means that inputs information based on the target image acquired by the detection acquisition means to the inference model, performs calculations, and obtains output from the inference model; and a detection means that calculates the difference between the information related to the input to the inference model by the calculation means and the information related to the output from the inference model, and detects foreign objects contained in the target image from the calculated difference.
  • a foreign object detection program is a foreign object detection program that causes a computer to operate as a foreign object detection system that uses an inference model generated by a model generation method to detect foreign objects contained in an image showing the object, and causes the computer to function as a detection acquisition means that acquires a target image that is to be detected for foreign objects, a calculation means that inputs information based on the target image acquired by the detection acquisition means into a second inference model to perform calculations and obtain output from the second inference model, and a detection means that detects foreign objects contained in the target image from the output from the second inference model obtained by the calculation means.
  • the inference model generated by the model generation method according to one embodiment of the present invention is itself an invention with a novel configuration.
  • the inference model according to one embodiment of the present invention is an inference model for inputting image-based information, performing calculations according to the input, and functioning a computer to output information, and is generated by the model generation method.
  • foreign objects can be detected with high accuracy.
  • FIG. 1 is a diagram illustrating a configuration of a model generation system and a foreign object detection system according to an embodiment of the present invention.
  • FIG. 11 is a diagram showing an example of an abnormality degree map generated as a result of detection of a foreign object;
  • FIG. 1 is a diagram illustrating an inference model.
  • FIG. 2 is a diagram showing an example of a first normal image used for training.
  • FIG. 13 is a diagram showing an example of a combination of a second normal image and a second foreign object image used for training.
  • FIG. 13 is a diagram showing an example of a combination of a third normal image and a third foreign object image used for training.
  • FIG. 13 is a diagram showing an example of an image used to generate a third foreign object image.
  • 4 is a flowchart showing a model generation method which is a process executed in the model generation system according to the embodiment of the present invention.
  • 4 is a flowchart showing a foreign object detection method which is a process executed in the foreign object detection system according to the embodiment of the present invention.
  • 11A and 11B are diagrams showing examples of detection results according to a comparative example and an embodiment of the present invention. A figure showing examples of images used for training, and images and anomaly maps output from the inference model.
  • FIG. 13 is an example of an image of a target object, granola.
  • FIG. 2 is a diagram showing configurations of a model generation program and a foreign object detection program according to an embodiment of the present invention, together with a recording medium.
  • FIG. 13 is a diagram showing an example of a combination of a third normal image and a third foreign object image used for training.
  • FIG. 13 is a diagram showing an example of a combination of a third normal image and a third foreign object image used for training.
  • FIG. 13 is a diagram showing an example of an image used to generate a third foreign object image.
  • FIG. 13 is a diagram showing an example of an image used to generate a third foreign object image.
  • FIG. 13 is a diagram showing an example of an image used to generate a third foreign object image.
  • FIG. 13 is a diagram showing an example of an image used to generate a third foreign object image.
  • 11A and 11B are diagrams showing examples of detection results according to a comparative example and an embodiment of the present invention.
  • 11A and 11B are diagrams showing examples of detection results according to a comparative example and an embodiment of the present invention.
  • FIG. 13 is a diagram showing an example of a third foreign object image used for training.
  • FIG. 13 is a diagram showing an example of a combination of a third normal image and a third foreign object image used for training.
  • FIG. 13 is a diagram showing an example of a combination of a third normal image and a third foreign object image used for training.
  • FIG. 11 is a diagram showing an example of a detection result according to an embodiment of the present invention.
  • FIG. 11 is a diagram showing an example of a detection result according to an embodiment of the present invention.
  • FIG. 1 is a diagram illustrating an example of an inference model.
  • FIG. 1(a) shows a model generation system 10 according to this embodiment.
  • FIG. 1(b) shows a foreign object detection system 20 according to this embodiment.
  • the model generation system 10 is a system (apparatus) that performs machine learning training to generate an inference model (learning model, trained model) used to detect foreign objects included in images showing objects.
  • the foreign object detection system 20 is a system (apparatus) that uses the inference model generated by the model generation system 10 to detect (detect) foreign objects included in images showing objects.
  • Figure 2 shows an example of a target image 30 used to detect foreign objects.
  • foreign object detection is performed on food packaged as a product, for example food in a plastic packaging bag.
  • Foreign object detection is performed, for example, during the manufacturing process of food products, to determine whether the manufactured product is of good quality or not. If no foreign object is detected in the image of the product to be detected, the product is deemed to be of good quality, and if a foreign object is detected in the image of the product to be detected, the product is deemed to be defective.
  • the images used to detect foreign objects are captured using X-rays for each product to be detected.
  • the areas surrounded by dashed lines in the figure are areas where foreign objects are present.
  • the assumed foreign object is, for example, an object that may be included during the manufacturing process.
  • a ball smaller than the food a SUS (Steel Use Stainless) ball, a glass ball
  • the product to be detected for a foreign object is, for example, pasta such as penne.
  • the product to be detected for a foreign object may also be something other than pasta, such as rice or granola.
  • the foreign object does not have to be smaller than the target object such as food, and may be of the same size as the target object or larger than the target object.
  • a single package of a product such as pasta usually contains many objects of similar shape. With conventional methods, it is difficult to accurately detect foreign objects in such cases, but with this embodiment, it is possible to accurately detect foreign objects.
  • the object containing the foreign object (a food product in this embodiment), the foreign object, and the image (an X-ray image in this embodiment) are not limited to those in this embodiment, and may be any object to which this embodiment is applicable.
  • the foreign object to be detected does not necessarily have to be something separate from the object (food in the above example), and may be a defect such as a flaw or flaw that appears on the object. In other words, detection of a foreign object may be detection of whether the object is defective.
  • the model generation system 10 and the foreign object detection system 20 each include a conventional computer including a processor such as a CPU (Central Processing Unit), a memory, a communication module, and other hardware.
  • the functions of the model generation system 10 and the foreign object detection system 20 described below are realized by these components operating through programs or the like.
  • the model generation system 10 and the foreign object detection system 20 are shown as separate systems (devices), but they may be realized by the same system (device).
  • the computer that constitutes the model generation system 10 and the foreign object detection system 20 may be a computer system including multiple computers.
  • the computer may also be configured using cloud computing or edge computing.
  • the model generation system 10 includes a training acquisition unit 11 and a model generation unit 12.
  • the inference model is a model that inputs an image of a target for foreign object detection and outputs (infers) an image from which the foreign object portion of the input image has been removed (it is inferred).
  • Figure 2 shows an example of a target image 30 that is input to the inference model and is the target for foreign object detection, and an example of an image 40 from which the foreign object portion has been removed (it is inferred) that is output when the target image 30 is input to the inference model.
  • a foreign object is visible in the area surrounded by a dashed line in the target image 30, but no foreign object is visible in the same position in the image 40 output from the inference model.
  • Figure 3 shows an anomaly map 50, which is an image of the difference between the target image 30 input to the inference model in Figure 2 and the image 40 output from the inference model.
  • the anomaly map 50 makes it possible to grasp foreign objects. Detection of foreign objects by the foreign object detection system 20 using the inference model corresponds to, for example, the generation of an anomaly map.
  • the inference model includes, for example, a neural network.
  • the neural network may be multi-layered. In other words, the inference model may be generated by deep learning.
  • the neural network may be a convolutional neural network (CNN).
  • Figure 4 shows a schematic diagram of the inference model of this embodiment.
  • the inference model includes an encoder that encodes an input image into features, and a decoder that decodes the features output from the encoder into an image.
  • neurons are provided in the input layer of the encoder to input information based on an image.
  • the information input to the inference model is the pixel value (brightness value) of each pixel of the image.
  • the input layer is provided with neurons equal to the number of pixels in the image, and the pixel value of the corresponding pixel is input to each neuron.
  • the information input to the inference model may be other than the pixel value of each pixel, as long as it is based on the image.
  • the information output from the inference model is the pixel value of each pixel of the image.
  • the output layer is provided with neurons equal to the number of pixels in the image, and each neuron outputs the pixel value of the corresponding pixel.
  • the information output from the inference model may be something other than the pixel value of each pixel, as long as it is capable of generating the output image described above.
  • the inference model may be constructed using something other than a neural network, so long as it is generated through machine learning training and performs the input and output described above.
  • the inference model is expected to be used as a program module that is part of artificial intelligence software.
  • the inference model is used, for example, in a computer equipped with a processor and memory, and the computer's processor operates according to instructions from the model stored in the memory.
  • the computer's processor operates to input information to the model according to the instructions, perform calculations according to the model, and output results from the model.
  • the computer's processor operates to input information to the input layer of the neural network according to the instructions, perform calculations based on parameters such as the learning weighting coefficients in the neural network, and output results from the output layer of the neural network.
  • the training acquisition unit 11 is a training acquisition means for acquiring training images.
  • the training images are a first normal image in which a training object is shown, a second normal image in which a training object is shown, a second foreign object image in which a foreign object expected to be a detection target is added to the second normal image, a third normal image in which a training object is shown, and a third foreign object image in which a foreign object not expected to be a detection target is added to the third normal image.
  • the foreign object not expected to be a detection target may be a natural image.
  • the second normal image and the third normal image may be the first normal image
  • the training acquisition unit 11 may add a foreign object expected to be detected to the first normal image to generate and acquire a second foreign object image, and add a foreign object not expected to be detected to the first normal image to generate and acquire a third foreign object image.
  • the object may be a specific type of object
  • the first normal image, the second normal image, the second foreign object image, the third normal image, and the third foreign object image acquired by the training acquisition unit 11 may be images in which a specific type of object is shown as a training object.
  • the ratio of the number of first normal images acquired by the training acquisition unit 11, the number of combinations of the second normal image and the second foreign object image, and the number of combinations of the third normal image and the third foreign object image may be a preset ratio.
  • the inference model is generated by machine learning training using training images acquired by the training acquisition unit 11.
  • the training of the inference model includes three types of training: training using a first normal image, training using a combination of a second normal image and a second foreign object image, and training using a combination of a third normal image and a third foreign object image.
  • Figure 5 shows an example of the first normal image 61.
  • the first normal image 61 is an image that contains a training object and no foreign object.
  • the first normal image 61 is, for example, an image obtained by capturing an image of a product that has been confirmed to contain no foreign objects under the same conditions as those used to detect foreign objects. Products that have been confirmed to contain no foreign objects are training objects.
  • the product in question is of the same type as the object being detected for foreign objects. That is, if the object being detected for foreign objects is a pasta product, the first normal image 61 is an image of the same type of pasta product.
  • the second normal image 62 is an image in which a training object is captured and no foreign object is captured, and is the same as the first normal image 61.
  • the first normal image 61 may be the second normal image 62.
  • the second foreign object image 72 is an image in which a foreign object (e.g., the small ball described above) assumed to be a detection target is added to the second normal image 62.
  • the second foreign object image 72 is, for example, an image obtained by superimposing an image obtained by capturing only the foreign object assumed to be a detection target on the second normal image 62.
  • the second foreign object image 72 may be generated by performing image processing on the second normal image 62 assuming a foreign object assumed to be a detection target, without using an image obtained by capturing only the foreign object.
  • the image processing may be performed using a simulation technique (e.g., a simulation related to image processing of an X-ray image).
  • a simulation technique e.g., a simulation related to image processing of an X-ray image.
  • a combination of the second foreign object image 72 and the second normal image 62 used to generate the second foreign object image 72 is used.
  • FIG. 7 shows examples of a third normal image 63 and a third foreign object image 73.
  • the third normal image 63 is an image that shows a training object and no foreign object, and is the same as the first normal image 61.
  • the first normal image 61 may also be the third normal image 63.
  • the third foreign object image 73 is an image in which a foreign object that is not expected to be a detection target has been added to the third normal image 63.
  • the third foreign object image 73 is, for example, an image obtained by superimposing an image of a foreign object that is not expected to be a detection target on the third normal image 63.
  • FIG. 8 shows an example of a foreign object image 80 used to generate the third foreign object image 73.
  • the foreign object added to the third normal image 63 to generate the third foreign object image 73 is a natural image.
  • the natural image here is an image of a landscape or a person, etc., that is completely different from the foreign object that is expected to be detected.
  • the third foreign object image 73 shown in FIG. 7 is obtained by superimposing the image of the tank in the upper right of FIG. 8 on the third normal image 63.
  • the third foreign object image 73 may be generated by performing image processing on the third normal image 63 without using an image of a foreign object that is expected to be detected, without considering foreign objects that are expected to be detected.
  • the image processing may be performed using a simulation technique.
  • a combination of the third foreign object image 73 and the third normal image 63 used to generate the third foreign object image 73 is used.
  • the training acquisition unit 11 acquires a combination of a first normal image 61, a second normal image 62, and a second foreign object image 72, and a combination of a third normal image 63 and a third foreign object image 73.
  • the training acquisition unit 11 acquires each image by accepting each image input to the model generation system 10 by a user of the model generation system 10.
  • the training acquisition unit 11 may also acquire each image by any other method.
  • the training acquisition unit 11 acquires only the first normal image 61 from among the above images in the same manner as described above.
  • the first normal image 61 may be acquired by receiving an image transmitted from an imaging device that acquires an image by imaging (for example, an X-ray imaging device that acquires an X-ray image).
  • the training acquisition unit 11 sets the acquired first normal image 61 as the second normal image 62 and the third normal image 63.
  • the training acquisition unit 11 generates and acquires the second foreign object image 72 from the second normal image 62 (first normal image 61).
  • the training acquisition unit 11 acquires an image obtained by imaging only a foreign object expected to be detected, and generates the second foreign object image 72 by superimposing the acquired image and the second normal image 62.
  • the training acquisition unit 11 also generates and acquires a third foreign object image 73 from a third normal image 63 (first normal image 61). For example, the training acquisition unit 11 acquires an image 80 of a foreign object not expected to be detected (for example, a natural image shown in FIG. 8 ), and generates the third foreign object image 73 by superimposing the acquired image and the third normal image 63.
  • the images used to generate the second foreign object image 72 and the third foreign object image 73 may be acquired by the same method as the first normal image 61, or by any other method.
  • the training acquisition unit 11 may store in advance a method of image processing by simulation for generating the second foreign object image 72 and the third foreign object image 73, and may perform image processing on the second normal image 62 and the third normal image 63 by the method to generate the second foreign object image 72 and the third foreign object image 73.
  • image processing by simulation for example, processing may be performed to change the shape and contrast of the foreign object, or to add blurring related to the scintillator and blurring related to the afterglow.
  • image processing may be performed according to changes in the imaging conditions.
  • the image processing by simulation can be realized by a conventional method.
  • the method used to generate the second foreign object image 72 and the third foreign object image 73 may be a combination of the image superimposition method and the image processing by simulation method.
  • the training acquisition unit 11 acquires a number of training images that allows the model generation unit 12 to perform training appropriately.
  • the training acquisition unit 11 acquires training images so that the ratio between the number of first normal images 61, the number of combinations of second normal images 62 and second foreign object images 72, and the number of combinations of third normal images 63 and third foreign object images 73 is a preset ratio.
  • the training acquisition unit 11 acquires training images so that the numbers are the same, that is, so that each number is 1/3 of the total number. This is because the images output by the inference model correspond to this ratio.
  • the training acquisition unit 11 outputs the acquired training images 61, 62, 63, 72, and 73 to the model generation unit 12.
  • the model generation unit 12 is a model generation means that generates an inference model by performing training using training images acquired by the training acquisition unit 11.
  • Training for generating an inference model includes training in which information based on the first normal image 61 is input to the inference model and information based on the first normal image 61 is output from the inference model, training in which information based on the second foreign object image 72 is input to the inference model and information based on the second normal image 62 is output from the inference model, and training in which information based on the third foreign object image 73 is input to the inference model and information based on the third normal image 63 is output from the inference model.
  • the model generation unit 12 generates an inference model, for example, as follows.
  • the model generation unit 12 inputs training images 61, 62, 63, 72, and 73 from the training acquisition unit 11.
  • the model generation unit 12 performs training to generate an inference model for each first normal image 61, each combination of a corresponding second normal image 62 and a corresponding second foreign object image 72, and each combination of a corresponding third normal image 63 and a corresponding third foreign object image 73.
  • the model generation unit 12 performs training with the first normal image 61 as an input to the inference model and the first normal image 61 as an output from the inference model, as shown in FIG. 5.
  • the model generation unit 12 performs training with the second foreign object image 72 as an input to the inference model and the second normal image 62 that corresponds to the second foreign object image 72 as an output from the inference model, as shown in FIG. 6.
  • the model generation unit 12 When training is performed using a combination of a third normal image 63 and a third foreign object image 73 that correspond to each other, the model generation unit 12 performs training with the third foreign object image 73 as an input to the inference model and the third normal image 63 that corresponds to the third foreign object image 73 as an output from the inference model, as shown in FIG. 7.
  • the above-mentioned training i.e., the updating of the parameters of the inference model, may be performed in the same manner as conventional machine learning training. Furthermore, training may be performed collectively for each type of image (first normal image 61, the combination of corresponding second normal image 62 and second foreign object image 72, and the combination of corresponding third normal image 63 and third foreign object image 73), or may be performed by changing the type of image each time.
  • the model generation unit 12 If the inference model is one that inputs information based on images other than the images themselves, the model generation unit 12 generates information based on images 61, 72, and 73 from each of the images 61, 72, and 73 that correspond to the input to the inference model among the training images, and performs training using the generated information as an input to the inference model. Also, if the inference model outputs information corresponding to images other than the images themselves, the model generation unit 12 generates information corresponding to images 61, 62, and 63 (information based on images 61, 62, and 63) from each of the images 61, 62, and 63 that correspond to the output from the inference model among the training images, and performs training using the generated information as an output from the inference model.
  • the model generation unit 12 generates an inference model, for example, by using all of the training images 61, 62, 63, 72, and 73 input from the training acquisition unit 11 for training. Alternatively, the model generation unit 12 may generate an inference model by performing training until a preset condition for the end of training other than the above is satisfied. The generated inference model is used in the foreign object detection system 20. The model generation unit 12 outputs the generated inference model. For example, the model generation unit 12 transmits the inference model to the foreign object detection system 20.
  • the inference model may be input to the foreign object detection system 20 by a method other than the output from the model generation unit 12.
  • the inference model may be input to the foreign object detection system 20 by operating the model generation system 10 or the foreign object detection system 20. The above is the function of the model generation system 10 according to this embodiment.
  • the foreign object detection system 20 is configured with a detection acquisition unit 21, a calculation unit 22, and a detection unit 23.
  • the detection acquisition unit 21 is a detection acquisition means for acquiring a target image 30 that is to be detected for foreign objects.
  • the detection acquisition unit 21 receives and acquires, for example, an image transmitted from an imaging device that acquires an image by imaging (for example, an X-ray imaging device that acquires X-ray images) as the target image 30.
  • the training acquisition unit 11 may also acquire the target image 30 by any other method.
  • the detection acquisition unit 21 outputs the acquired target image 30 to the calculation unit 22.
  • the calculation unit 22 is a calculation unit that inputs information based on the target image 30 acquired by the detection acquisition unit 21 into an inference model, performs calculations, and obtains output from the inference model.
  • the calculation unit 22 inputs and stores the inference model generated by the model generation system 10.
  • the calculation unit 22 inputs the target image 30 from the detection acquisition unit 21.
  • the calculation unit 22 inputs information based on the input target image 30 into the stored inference model, performs calculations, and obtains output from the inference model. If the inference model corresponds to the type of object, the calculation unit 22 uses the inference model corresponding to the type of object related to the target image 30 for calculations. For example, if the object shown in the target image 30 is pasta, the calculation unit 22 uses an inference model for pasta.
  • the information input to the inference model corresponds to the inference model, and is, for example, the target image 30 itself as described above.
  • the information input to the inference model may also be information based on the target image 30 other than the target image 30 itself.
  • the calculation unit 22 generates information to be input to the inference model from the target image 30.
  • the information output from the inference model corresponds to the inference model, and is, for example, image 40 from which the foreign object portion of the target image 30 has been removed (as inferred) as described above.
  • the information output from the inference model may also be information other than the image 40 itself that corresponds to the image 40.
  • the calculation unit 22 outputs information related to the input and output to the inference model to the detection unit 23.
  • the calculation unit 22 outputs the target image 30 and the image 40 output from the inference model to the detection unit 23 as information related to the input and output to the inference model.
  • the calculation unit 22 may also output information corresponding to the target image 30 and the image 40 output from the inference model other than the image 30 and the image 40 output from the inference model to the detection unit 23.
  • the detection unit 23 is a detection means that calculates the difference between the information related to the input to the inference model by the calculation unit 22 and the information related to the output from the inference model, and detects foreign objects contained in the target image 30 from the calculated difference.
  • the detection unit 23 detects a foreign object, for example, as follows. Detection of a foreign object by the detection unit 23 is, for example, as described above, the generation of an anomaly map 50, which is information indicating the detection result as shown in FIG. 3.
  • the detection unit 23 inputs information related to input and output from the calculation unit 22 to the inference model, for example, the target image 30 and the image 40 output from the inference model.
  • the detection unit 23 takes these differences to generate the anomaly map 50. Specifically, it takes the difference in pixel values between the target image 30 and the image 40 output from the inference model for each corresponding pixel to generate the anomaly map 50.
  • the anomaly map 50 parts that have pixel values other than 0, i.e. parts where there is a difference in pixel values between the images 30 and 40, are parts that are detected (estimated) to contain a foreign object.
  • the detection unit 23 outputs an anomaly map 50, which is information indicating the detection result.
  • the information indicating the detection result may be output, for example, to another system (device) or another module, or in a form that can be recognized by the user of the foreign object detection system 20 (for example, display or audio output).
  • the detection unit 23 may also store criteria for detecting foreign objects in advance and determine whether or not a foreign object is included in the target image 30 based on the criteria from the anomaly map 50.
  • the detection unit 23 may also perform other processes as long as it calculates the difference between information related to the input to the inference model and information related to the output from the inference model and detects a foreign object included in the target image 30 from the calculated difference. These are the functions of the foreign object detection system 20 according to this embodiment.
  • training images 61, 62, 63, 72, and 73 are acquired by the training acquisition unit 11 (S01, training acquisition step).
  • the training images are a combination of a first normal image 61, a second normal image 62, and a second foreign object image 72, and a combination of a third normal image 63 and a third foreign object image 73.
  • the first to third normal images 61 to 63 are images in which training objects are shown.
  • the second foreign object image 72 is an image in which a foreign object assumed to be a detection target has been added to the second normal image.
  • the third foreign object image 73 is an image in which a foreign object not assumed to be a detection target has been added to the third normal image.
  • the model generation unit 12 performs training using the training images 61, 62, 63, 72, and 73 to generate an inference model (S02, model generation step).
  • the training includes training in which information based on the first normal image 61 is input to the inference model, and information based on the first normal image 61 is output from the inference model.
  • the training includes training in which information based on the second foreign object image 72 is input to the inference model, and information based on the second normal image 62 is output from the inference model.
  • the training includes training in which information based on the third foreign object image 73 is input to the inference model, and information based on the third normal image 63 is output from the inference model.
  • the generated inference model is output from the model generation unit 12 (S03).
  • the inference model output from the model generation system 10 is stored in the foreign object detection system 20.
  • the above is the model generation method, which is the processing executed by the model generation system 10 according to this embodiment.
  • the detection acquisition unit 21 acquires the target image 30 (S11, detection acquisition step).
  • the calculation unit 22 inputs information based on the target image 30 to an inference model, performs calculations, and obtains an output from the inference model (S12, calculation step).
  • the detection unit 23 calculates the difference between the information related to the input to the inference model and the information related to the output from the inference model as a process for detecting a foreign object contained in the target image 30, and generates an anomaly map (S13, detection step).
  • the generated anomaly map is output from the detection unit 23 as information indicating the detection result of the foreign object (S14).
  • the above is the foreign object detection method, which is a process executed by the foreign object detection system 20 according to this embodiment.
  • an inference model generated in this way reflects the target object, among those captured in the input image, in the output, but does not reflect the foreign object in the output.
  • an inference model with pasta as the target object is a pasta pass filter that passes the structure of pasta but does not pass the structure of foreign objects.
  • foreign objects can be removed from the output image. Therefore, according to this embodiment, foreign objects can be detected with high accuracy by using the generated inference model to detect foreign objects.
  • the foreign object not expected to be detected and used to generate the third foreign object image 73 may be a natural image.
  • an inference model can be generated more appropriately and reliably.
  • the foreign object not expected to be detected may be an image of various textures other than a natural image.
  • the second normal image 62 and the third normal image 63 may be the first normal image 61.
  • a foreign object expected to be detected may be added to the first normal image 61 to generate and acquire the second foreign object image 72
  • a foreign object not expected to be detected may be added to the first normal image 61 to generate and acquire the third foreign object image 73.
  • the target object may be a specific type of object
  • the training images 61, 62, 63, 72, and 73 may be images in which a specific type of object is depicted as the training target object.
  • a specific type of object For example, it may be a pasta product.
  • Inference models for each type of food may also be generated and used. With this configuration, an inference model for detecting foreign objects with high accuracy for a specific type of object can be generated.
  • training images 61, 62, 63, 72, and 73 in which the target object is not limited to a specific type of object may also be used.
  • the ratio between the number of first normal images 61 acquired and used for training, the number of combinations of second normal images 62 and second foreign object images 72, and the number of combinations of third normal images 63 and third foreign object images 73 may be a preset ratio.
  • these numbers may be the same.
  • this ratio does not need to be preset.
  • the model generation system 10 and the foreign object detection system 20 may be provided by the same entity, or may be provided by different entities. Furthermore, the model generation system 10 and the foreign object detection system 20 may be used by the same user, or may be used by different users.
  • FIG. 11 shows an example of the results of actually detecting foreign objects using this embodiment.
  • the results of detecting foreign objects using two conventional methods are compared with the results of this embodiment as comparative examples.
  • the first of the conventional methods is as follows.
  • a non-defective image e.g., normal images 61-63 used in this embodiment
  • a feature amount e.g., a feature vector represented by a vector
  • a feature amount is also calculated for each part of the image.
  • the feature amount of the target image is compared with the feature amount of the non-defective image, and whether or not a foreign object is present for each part is detected based on the comparison. For example, the distance between the feature vectors is calculated, and if the distance between them is equal to or greater than a preset threshold, it is determined that a foreign object is present, and if the distance is less than the threshold, it is determined that no foreign object is present.
  • the second of the conventional methods is as follows.
  • Good product images e.g., normal images 61 to 63 used in this embodiment
  • An autoencoder is generated from the good product images by training machine learning.
  • the generated autoencoder is used as an inference model to detect foreign objects in the same manner as the method using the foreign object detection system 20 of this embodiment.
  • the results shown in Figure 11 are the results of detecting foreign objects when five SUS balls and five glass balls were placed in a pasta product as foreign objects.
  • the table (a) in Figure 11 shows the results using the first method
  • the table (b) shows the results using the second method
  • the table (c) shows the results using this embodiment.
  • the first method two SUS balls and two glass balls were detected, with three false positives (foreign objects were detected even though there were none).
  • the second method three SUS balls were detected, no glass balls were detected, and there were no false positives.
  • FIGS. 12 and 13 show examples of images used for training and images and anomaly maps output from the inference model.
  • the images and anomaly maps shown in FIGS. 12(a)-(f) and 13(a) and (b) are comparative examples, and the images and anomaly maps shown in FIGS. 13(c) and (d) are examples according to this embodiment.
  • Figures 12(a) and (b) show the image and anomaly map output from the inference model when the inference model is generated by training using only the first normal image 61 (i.e., when the inference model is an autoencoder).
  • the image output from the inference model does not erase the foreign object, and no foreign object is detected even in the area surrounded by the ellipse on the anomaly map where the foreign object should be.
  • Figures 12(c) and (d) show the image and anomaly map output from the inference model when the inference model is generated by training using only the combination of the second normal image 62 and the second foreign object image 72.
  • the image output from the inference model has the foreign object removed, but the pasta portion has also been removed in excess. Foreign objects are detected even in the portion of the anomaly map surrounded by an ellipse where there are no foreign objects.
  • Figures 12(e) and (f) show the image and anomaly map output from the inference model when the inference model is generated by training using only the combination of the third normal image 63 and the third foreign object image 73. In this case, the image output from the inference model seems to have the structure of the pasta portion generally removed.
  • Figures 13(a) and (b) show the image and anomaly map output from the inference model when the inference model is generated by training using an equal number of first normal images 61 and a combination of second normal images 62 and second foreign object images 72.
  • the image output from the inference model has foreign objects removed.
  • there has been some overlearning of foreign objects and there are parts of the pasta structure that have been removed as foreign objects.
  • Foreign objects are also detected in the parts of the anomaly map that are surrounded by ellipses where there are no foreign objects.
  • FIG. 13 show images and anomaly maps output from an inference model when an inference model is generated by training using an equal number of first normal images 61, a combination of second normal images 62 and second foreign object images 72, and a combination of third normal images 63 and third foreign object images 73 (i.e., in the case of this embodiment).
  • the images output from the inference model have foreign objects appropriately removed compared to other examples, and the anomaly map also shows that appropriate foreign objects have been detected.
  • Figure 14 shows an example where rice is used as the target.
  • Figure 14 (a) is an example of a target image used to detect foreign objects, (b) is an example of an image output from the inference model when the target image is input to the inference model, and (c) is an example of an anomaly map generated from these images.
  • training images 61, 62, 63, 72, and 73 which show rice as the target, are used for training to generate an inference model.
  • This inference model is a rice-pass filter that passes the structure of rice but does not pass the structure of foreign objects.
  • FIG. 15 shows an example of the target object being granola with added dried fruit.
  • (a) is an example of a target image used to detect foreign objects
  • (b) is an example of an image output from the inference model when the target image is input to the inference model
  • (c) is an example of an anomaly map generated from these images.
  • the area surrounded by dashed lines in the figure is the area where foreign objects exist.
  • training images 61, 62, 63, 72, and 73 which show granola as the target object, are used for training to generate an inference model.
  • This inference model is a granola pass filter that passes the structure of granola but does not pass the structure of foreign objects.
  • the model generation program 100 is stored in a program storage area 111 formed in a computer-readable recording medium 110 that is inserted into a computer and accessed, or that is provided in the computer.
  • the recording medium 110 may be a non-transitory recording medium.
  • the model generation program 100 is configured with a training acquisition module 101 and a model generation module 102.
  • the functions realized by executing the training acquisition module 101 and the model generation module 102 are similar to the functions of the training acquisition unit 11 and the model generation unit 12 of the model generation system 10 described above, respectively.
  • the foreign object detection program 200 is stored in a program storage area 211 formed on a computer-readable recording medium 210 that is inserted into a computer and accessed, or that is provided on the computer.
  • the recording medium 210 may be a non-transitory recording medium. Note that when the model generation program 100 and the foreign object detection program 200 are executed on the same computer, the recording medium 210 may be the same as the recording medium 110.
  • the foreign object detection program 200 is configured with a detection acquisition module 201, a calculation module 202, and a detection module 203.
  • the functions realized by executing the detection acquisition module 201, the calculation module 202, and the detection module 203 are similar to the functions of the detection acquisition unit 21, the calculation unit 22, and the detection unit 23, respectively, of the foreign object detection system 20 described above.
  • the model generation program 100 and the foreign object detection program 200 may be configured so that part or all of them are transmitted via a transmission medium such as a communication line, and are received and recorded (including installed) by other equipment. Furthermore, each module of the model generation program 100 and the foreign object detection program 200 may be installed on one of multiple computers, rather than on one computer. In that case, the above-mentioned series of processes are performed by a computer system consisting of the multiple computers.
  • FIG. 17 shows another example of the third normal image 63 and the third foreign object image 73.
  • the third foreign object image 73 may be one in which multiple partial natural images are superimposed on the third normal image 63.
  • the partial natural images are natural images that are smaller in size than the third normal image 63. Even when such a third foreign object image 73 is used, it is possible to generate an appropriate inference model for detecting foreign objects. In other words, classification is fully possible using the characteristics of the natural image, and it is possible to handle any foreign object structure (unexpected foreign objects).
  • the foreign object added to the third foreign object image 73 may be an image drawn based on a calculation formula.
  • FIG. 18 shows examples of the third normal image 63 and the third foreign object image 73 in this case.
  • the image relating to the foreign object is, for example, an image generated by simulation based on a calculation formula prepared in advance.
  • the image may be generated by a conventional method.
  • the image relating to the foreign object added to the third normal image 63 may be generated by the model generation system 10 (the training acquisition unit 11), or may be generated by something other than the model generation system 10 and acquired by the model generation system 10 (the training acquisition unit 11).
  • the image related to the foreign object added to the third foreign object image 73 and drawn based on a formula may be a geometric pattern image 81 as shown in FIG. 19.
  • the image may also be a procedural texture image (a texture image such as a texture generated based on a formula) 82 as shown in FIG. 20.
  • the image may also be a frequency image 83, which is an image generated based on a formula related to frequency, as shown in FIG. 21, or a combination of multiple frequency images 83.
  • the image may also be an image combining the above images, for example, an image obtained by cutting out a frequency image 83 based on a procedural texture image 82 as shown in FIG. 22.
  • FIG. 23(a) shows a case where foreign objects are detected from a target image 30 used for detecting foreign objects by a conventional simple binarization of an image, and the detected foreign objects are superimposed on the target image 30.
  • FIG. 23(a) shows an anomaly map obtained from the target image 30 using the inference model of this embodiment
  • FIG. 23(c) shows the foreign objects detected from the anomaly map superimposed on the target image 30.
  • FIG. 23(c) with the method of this embodiment, four foreign objects were detected in the upper part of the image, two in the middle part of the image, and six in the lower part of the image.
  • FIG. 24(a) shows a target image 30 (an image different from the target image shown in FIG. 23) used for detecting foreign objects, in which foreign objects are detected by a conventional simple binarization of an image, superimposed on the target image 30.
  • FIG. 24(a) in the conventional method, two foreign objects were detected in the upper part of the image, three in the middle part of the image, and three in the lower part of the image.
  • FIG. 24(b) shows an anomaly map obtained from the target image 30 using the inference model of this embodiment
  • FIG. 24(c) shows the foreign objects detected from the anomaly map superimposed on the target image 30.
  • FIG. 24(b) shows an anomaly map obtained from the target image 30 using the inference model of this embodiment
  • FIG. 24(c) shows the foreign objects detected from the anomaly map superimposed on the target image 30.
  • the method according to this embodiment in the method according to this embodiment, three foreign objects were detected in the upper part of the image, six in the middle part of the image, and five in the lower part of the image. As shown in the examples of FIG. 23 and FIG. 24, the method according to this embodiment detects actual foreign objects that could not be detected by the conventional method. Thus, the method according to this embodiment allows for highly accurate detection of foreign objects.
  • the portion to which the foreign object is added does not have to be the entire third foreign object image 73, but may be a part of the third foreign object image 73.
  • the position of the portion to which the foreign object is added in the third foreign object image 73 may be an irregular position (random position).
  • the size of each individual foreign object in the third foreign object image 73 may also be various sizes (multi-size). This makes it possible to make the inference model capable of appropriately detecting foreign objects even if the foreign objects detected in the target image 30 are in irregular positions or of various sizes.
  • FIG. 25 shows an example of the third foreign object image 73 to which foreign objects are added in irregular positions.
  • the third foreign object image 73 may be an image in which a foreign object not expected to be detected has been added to the third normal image 63 by at least one of transparent addition and replacement addition.
  • FIG. 26 shows the third foreign object image 73 with the foreign object transparently added, and the corresponding third normal image 63.
  • FIG. 27 shows the third foreign object image 73 with the foreign object added by replacement, and the corresponding third normal image 63.
  • Transparent addition of a foreign object refers to adding a foreign object so that both the foreign object and the third normal image 63 before the addition are visible in the portion of the third foreign object image 73 to which the foreign object has been added.
  • transparent addition of a foreign object refers to superimposing a semi-transparent foreign object on the third normal image 63 before the addition in a state in which the third normal image 63 is visible through the foreign object in the portion to which the foreign object is added (or a state in which the foreign object is visible through the third normal image 63).
  • the proportion of the size of the portion to which the foreign object has been added in the entire third foreign object image 73 may be 10% to 100%. By increasing this proportion, the foreign object detection performance of the inference model can be improved.
  • FIG. 28 shows an example of detecting a foreign object from a target image 30, where the target is coffee beans, when an inference model is generated using a third foreign object image 73 with a transparent addition of the foreign object.
  • (a) in FIG. 28 is an anomaly map obtained from the target image 30, and (b) shows the foreign object detected from the anomaly map superimposed on the target image 30.
  • the target image 30 is an image in which the foreign body and other objects are transparently overlapped, as in the case of the transparent addition of the foreign body described above, it is possible to detect foreign bodies with high accuracy.
  • the target image 30 is an X-ray image, it is possible to detect foreign bodies with high accuracy.
  • Addition by foreign object replacement refers to removing the third normal image 63 and adding the foreign object in the portion of the third foreign object image 73 where the foreign object has been added.
  • addition by foreign object replacement refers to superimposing the foreign object on the third normal image 63 before it has been added, with the third normal image 63 being blocked by the foreign object in the portion to be added.
  • the proportion of the size of the portion to which the foreign object has been added in the entire third foreign object image 73 may be 10% to 60%. By increasing this proportion, the foreign object detection performance of the inference model can be improved.
  • FIG. 29 shows an example of detecting a foreign object from a target image 30 of coffee beans as an object when an inference model is generated using a third foreign object image 73 obtained by adding and replacing a foreign object.
  • (a) in FIG. 29 is an anomaly map obtained from the target image 30, and (b) shows the foreign object detected from the anomaly map superimposed on the target image 30.
  • the inference model that is generated is obtained by restoring the occluded portion of the third normal image 63 (for example, restoring it to a normal product without any foreign object) and learning the positional relationship of the objects depicted in the image.
  • the target image is an image similar to MVTecAD, a dataset used to evaluate anomaly detection methods, it is possible to detect foreign objects with a high degree of accuracy.
  • the training acquisition unit 11 may acquire the third foreign object image 73 in the same manner as described above.
  • the training acquisition unit 11 may generate the third foreign object image 73 using conventional techniques of transparent image addition and image replacement.
  • the third foreign object image 73 may be one of transparent addition, replacement addition, or both.
  • the multiple third foreign object images 73 may be composed of any one of the above types, or may include multiple types of the above.
  • a configuration in which the third foreign object image 73 is generated by at least one of transparent addition and replacement addition can also generate an inference model more appropriately and reliably.
  • an image related to information to be output from the inference model may be an image (normal image) related to input to the inference model that has been subjected to image processing other than the above.
  • the image processing is preset, and is, for example, any of rotation, inversion, change of pixel value (brightness distribution), gamma correction, edge enhancement, and smoothing processing.
  • the image processing may be performed on the second foreign object image 72 or the third foreign object image 73.
  • images that have been subjected to the image processing may be used to train the inference model.
  • the inference model generated by the model generation system 10 and used by the foreign object detection system 20 may be a model that includes a neural network having multiple layers, has a structure that performs concatenation (merging) between layers, and adds the image after concatenation to the input image.
  • the inference model is a neural network with the above configuration.
  • the neural network is shown diagrammatically in FIG. 30.
  • the neural network includes an encoder that encodes an input image into features, and a decoder that decodes the features output from the encoder into an image.
  • the encoder has multiple layers (Conv2D Layer, Activation Layer) where two-dimensional convolution and activation are performed. Pooling is performed between the multiple layers of the encoder.
  • the decoder has multiple layers (Conv2D Layer, Activation Layer) where two-dimensional convolution and activation are performed. Unpooling is performed between the multiple layers of the decoder.
  • the encoder layer is concatenated (concat) with a decoder layer of the same size as the encoder layer (concatenation layer). The two concatenated layers are not adjacent to each other. In this way, the neural network is a U-Net type model with a pooling layer.
  • the image input to the encoder is added to the image output from the last layer of the decoder where two-dimensional convolution and activation are performed, and the image obtained by the addition is output from the decoder's output layer (Regression Layer).
  • the addition of the above images is the addition of the pixel values for each corresponding pixel.
  • the image output from the last layer of the decoder where two-dimensional convolution and activation are performed can be an image of the foreign object contained in the input image (more precisely, an image obtained by subtracting the pixel values of pixels related to foreign objects, which can be added to the input image to remove the foreign objects).
  • the inference model can be made to output an image from which the foreign object portions have been appropriately removed. As a result, foreign objects can be detected with high accuracy.
  • the model generation system 10 may generate a second inference model by performing new training based on the above-mentioned inference model. That is, the model generation system 10 may perform two-stage training, namely training to generate an inference model and then training to generate a second inference model.
  • the foreign object detection system 20 may detect a foreign object contained in an image showing an object by using the second inference model generated by the model generation system 10 instead of the above-mentioned inference model. In the following description, when simply referring to an inference model, this refers to the inference model of the above-mentioned embodiment (the inference model generated in the first stage).
  • the model generation unit 12 performs new training to generate a new second inference model in which a part that outputs information indicating the degree of foreign matter for each position of the image input to the inference model is added to the output side of the generated inference model.
  • the model generation unit 12 generates the second inference model by performing transfer learning based on the inference model.
  • the second inference model is a model (discrimination model, classification model) that inputs an image of the target for foreign object detection and outputs (infers) information indicating the degree of foreign object presence at each position in the input image.
  • the second inference model outputs, for each pixel of the target image 30 for foreign object detection, a value of the probability that the pixel is related to a foreign object (probability of pass/fail, class classification value).
  • the second inference model may output a value between 0 and 1 for each pixel as the probability. The closer the output value is to 1, the higher the degree to which the pixel is related to a foreign object, and the closer the output value is to 0, the lower the degree to which the pixel is related to a foreign object.
  • foreign objects are detected by taking the difference between the image input to the inference model and the image output from the inference model.
  • foreign object detection using the second inference model there is no need to take the difference between images as in foreign object detection using an inference model.
  • FIG. 31 shows a schematic example of the second inference model of this embodiment.
  • the second inference model is a neural network.
  • the second inference model is generated by adding a new layer to the output side of the inference model, which is a neural network, and performing new training.
  • the inference model is a neural network including an encoder that encodes an input image into features and a decoder that decodes the features output from the encoder into an image.
  • the encoder has multiple layers (Conv2D Layer, Activation Layer) where two-dimensional convolution and activation are performed. Pooling is performed between the multiple layers of the encoder.
  • the decoder has multiple layers (Conv2D Layer, Activation Layer) where two-dimensional convolution and activation are performed. Unpooling is performed between the multiple layers of the decoder.
  • the encoder layer is concatenated (Concat) with a decoder layer of the same size as the encoder layer (Concatenation Layer). The two concatenated layers are not adjacent to each other.
  • the last layer of the multiple layers of the decoder where two-dimensional convolution and activation are performed is the output layer of the inference model.
  • the inference model used for the second inference model does not necessarily have to be the one shown in FIG. 31, and can be any model that can be used to construct the second inference model.
  • the parts added in the second inference model are multiple layers of a neural network. For example, as shown in FIG. 31, three layers are added in which adjacent layers are connected to each other.
  • the first layer from the inference model side is a layer where convolution and calculations using the Relu function are performed (Conv+Relu, Conv2D Layer, Activation Layer). This layer is connected to the output layer of the first inference model.
  • the second layer is a layer where calculations using the softmax function are performed (softmax).
  • the third layer is an output layer (Pixel Classification) that outputs the above probability values.
  • the input layer of the second inference model is the same as the input layer of the inference model.
  • the output layer is provided with neurons for outputting information indicating the degree of a foreign object for each position of the image related to the information input to the input layer.
  • the information output from the inference model is the probability value of whether each pixel of the image is related to a foreign object, as described above.
  • the output layer is provided with neurons equal to the number of pixels in the image, and each neuron outputs the probability value of the corresponding pixel.
  • the information output from the inference model may be other than the probability value of each pixel, as long as it is information indicating the degree of a foreign object for each position of the image described above.
  • the second inference model may be constructed of something other than a neural network, so long as it is generated by machine learning training and performs the input and output described above. Like the first inference model, the second inference model is also expected to be used as a program module that is part of artificial intelligence software.
  • the second inference model may be based on the type of object, similar to the inference model.
  • the second inference model can be treated the same as the inference model.
  • the second inference model and the inference model may be similar.
  • the training acquisition unit 11 also acquires information for training the second inference model.
  • the training information for the second inference model is a combination of training images for the second inference model and information indicating the degree of foreign objects at each position of the image.
  • FIG. 32 shows an example of an image 91 for training the second inference model and information 92 indicating the degree of foreign objects at each position of the image 91.
  • the image 91 for training the second inference model can be at least any one of the first normal image 61, the second foreign object image 72, and the third foreign object image 73 described above.
  • the training acquisition unit 11 does not need to acquire the image 91 for training the second inference model separately from the image for training the inference model.
  • the training acquisition unit 11 may acquire the image 91 for training the second inference model separately from the image for training the inference model.
  • the training acquisition unit 11 may acquire the image 91 in a manner similar to the method of acquiring images for training the inference model.
  • the information 92 indicating the degree of a foreign object for each position of the image 91 for training the second inference model is, for example, a value indicating whether each pixel of the image 91 for training the second inference model is related to a foreign object.
  • the value of the information 92 is 1 if the pixel is related to a foreign object, and 0 if the pixel is not related to a foreign object.
  • the value of the information 92 does not necessarily have to be the above, and may be any value that corresponds to the output from the second inference model.
  • the training acquisition unit 11 may generate and acquire the above information 92. For example, in the case of a training image 91 for the second inference model, a first normal image 61, a second foreign object image 72, and a third foreign object image 73, the training acquisition unit 11 generates information for each pixel of these images 61, 72, and 73 in which the foreign object portion is set to 1 and the non-foreign object portion is set to 0 as the above information 92.
  • the foreign object portion is, for example, a portion of the image to be added to the normal image as a foreign object.
  • the foreign object portion of the image to be added to the normal image as a foreign object may be detected by an existing detection technology, and the detected portion may be set as the foreign object portion in the above information 92. That is, the above information 92 may be acquired without annotation by the user, that is, annotation-free.
  • the training acquisition unit 11 may also acquire the above information 92 by accepting the above information 92 input to the model generation system 10 by a user of the model generation system 10.
  • the training acquisition unit 11 acquires a sufficient amount of training information for the second inference model to enable the model generation unit 12 to appropriately train the second estimation model.
  • the training acquisition unit 11 outputs the acquired training information for the second inference model to the model generation unit 12.
  • the model generation unit 12 generates the second inference model, for example, as follows.
  • the model generation unit 12 inputs training information for the second inference model from the training acquisition unit 11.
  • the model generation unit 12 performs training for generating the second inference model for each of the above combinations of training information for the second inference model.
  • the training for generating the second inference model is performed after the first inference model is generated by training.
  • the model generation unit 12 performs training by inputting an image 91 for training the second inference model to the second inference model, and outputting information 92 of the probability value corresponding to the image 91 from the second inference model.
  • the encoder part of the inference model in the second inference model is not updated by training. That is, the first encoder part of the second inference model is updated only during training of the inference model (training in the first stage), and the learning rate during training of the second inference model (training in the second stage) is set to 0.
  • the decoder part of the inference model in the second inference model is set to have a lower learning rate than the added part. For example, the learning rate of the decoder part is set to 1/100 of the learning rate of the added part.
  • the cross entropy error is used as the loss function during training.
  • the training of the second inference model may be performed in a manner other than the above. Each of the above trainings themselves, i.e., the update of the parameters of the second inference model, may be performed in the same manner as conventional machine learning training.
  • the model generation unit 12 If the second inference model is one in which information based on an image other than the image itself is input, the model generation unit 12 generates information based on the image 91 from the image 91 that corresponds to the input to the second inference model, and performs training using the generated information as input to the inference model.
  • the model generation unit 12 generates the second inference model, for example, by using all of the training information for the second inference model input from the training acquisition unit 11 for training. Alternatively, the model generation unit 12 may generate the second inference model by performing training until a preset condition for ending training other than the above is satisfied. The generated second inference model is used in the foreign object detection system 20. The model generation unit 12 outputs the generated second inference model. Input and output of the second inference model may be performed in the same manner as the input and output of the above inference model. Furthermore, when the second inference model is used to detect foreign objects, output of the inference model is not necessary.
  • the detection acquisition unit 21 acquires a target image 30 that is to be detected for a foreign object.
  • the detection acquisition unit 21 acquires the target image 30 in the same manner as when the inference model is used, and outputs it to the calculation unit 22.
  • the calculation unit 22 inputs information based on the target image 30 acquired by the detection acquisition unit 21 into a second inference model, performs calculations, and obtains output from the second inference model.
  • the calculation unit 22 inputs and stores the second inference model generated by the model generation system 10.
  • the calculation unit 22 inputs the target image 30 from the detection acquisition unit 21.
  • the calculation unit 22 inputs information based on the input target image 30 into the stored second inference model, performs calculations, and obtains output from the second inference model.
  • the information input to the second inference model corresponds to the second inference model, and is, for example, the target image 30 itself as described above.
  • the information input to the second inference model may also be information based on the target image 30 other than the target image 30 itself.
  • the calculation unit 22 generates information to be input to the second inference model from the target image 30.
  • the information output from the second inference model corresponds to the second inference model, and is, for example, a probability value (class map) for each pixel of the target image 30 as described above.
  • the information output from the second inference model may also be information indicating the degree of foreign matter for each position of the target image 30 other than the above.
  • the calculation unit 22 outputs the information output from the second inference model to the detection unit 23.
  • the detection unit 23 detects foreign objects contained in the target image 30 from the output from the second inference model obtained by the calculation unit 22.
  • the detection unit 23 detects foreign objects, for example, as follows.
  • the detection unit 23 inputs from the calculation unit 22 information indicating the degree of foreign objects at each position of the target image 30, which is the output from the second inference model, for example, the probability value for each pixel of the target image 30.
  • the detection unit 23 stores a standard for detecting foreign objects in advance, for example, a threshold value for detection (for example, 0.5).
  • the detection unit 23 compares the probability value, which is the output from the second inference model, with the threshold value for each pixel of the target image 30.
  • the detection unit 23 determines that the part of the pixel is a foreign object (a foreign object is captured in the part of the pixel). For pixels whose probability is not equal to or greater than the threshold value, the detection unit 23 determines that the part of the pixel is not a foreign object (no foreign object is captured in the part of the pixel and it is normal). Furthermore, the detection unit 23 may detect foreign objects using a method other than the above, as long as the detection unit 23 detects foreign objects contained in the target image 30 from the output of the second inference model obtained by the calculation unit 22.
  • the detection unit 23 outputs information indicating the detection result.
  • the information indicating the detection result may be output in the same manner as described above.
  • Figure 33(a) shows an example of the output (class map) from the second inference model.
  • Figure 33(b) shows a target image on which foreign objects detected using this output are superimposed. In Figure 33, the multiple round parts lined up horizontally are the foreign objects.
  • the second inference model By generating the second inference model as described above and using it to detect foreign objects, foreign objects can be easily and reliably detected. Furthermore, the information output from the second inference model has less variation depending on the various conditions and objects (samples) related to the target image 30 compared to, for example, the anomaly map described above. Therefore, the criteria (for example, the threshold values described above) used when detecting foreign objects do not need to be tailored to the various conditions and objects related to the target image 30 and can be easily set. Therefore, by using the second inference model, foreign objects can be stably and appropriately detected even if a uniform criterion is used regardless of the various conditions and objects related to the target image 30.
  • the criteria for example, the threshold values described above
  • a model generation method for generating an inference model used to detect a foreign object contained in an image showing an object comprising: a training acquisition step of acquiring, as training images, a first normal image showing a training object, a second normal image showing the training object, a second foreign object image in which a foreign object assumed to be a detection target is added to the second normal image, a third normal image showing the training object, and a third foreign object image in which a foreign object not assumed to be a detection target is added to the third normal image;
  • the model generation method includes training in which information based on the first normal image is used as an input to the inference model and information based on the first normal image is used as an output from the inference model, training in which information based on the second foreign object image is used
  • the model generation method according to [1], wherein the foreign object not anticipated as a detection target is a natural image.
  • the second normal image and the third normal image are the first normal image,
  • the object is a specific type of object
  • the model generating method according to any one of [1] to [5], wherein the foreign object not anticipated as a detection target is an image drawn based on a calculation formula.
  • the model generation method according to any one of [1] to [6], wherein the third foreign object image is an image in which a foreign object not expected to be detected is added to the third normal image by at least one of transparent addition and addition by replacement.
  • a model generation method according to any one of [1] to [7], in which the inference model includes a neural network having multiple layers, has a structure for connecting layers, and is a model that adds together the image after the connections and the input image.
  • a model generation system that generates an inference model used to detect a foreign object included in an image showing an object, comprising: an acquisition means for acquiring, as training images, a first normal image showing a training object, a second normal image showing the training object, a second foreign object image in which a foreign object assumed to be a detection target has been added to the second normal image, a third normal image showing the training object, and a third foreign object image in which a foreign object not assumed to be a detection target has been added to the third normal image;
  • a model generation program that causes a computer to operate as a model generation system that generates an inference model used to detect a foreign object included in an image showing an object, comprising: The computer, an acquisition means for acquiring, as training images, a first normal image showing a training object, a second normal image showing the training object, a second foreign object image in which a foreign object assumed to be a detection target has been added to the second normal image, a third normal image showing the training object, and a third foreign object image in which a foreign object not assumed to be a detection target has been added to the third normal image; and a model generation means for generating the inference model by performing training using training images acquired by the acquisition means,
  • the training is a model generation program including: training in which information based on the first normal image is used as input to the inference model and information based on the first normal image is used as output from the inference model; training in which information based on the second foreign object image is used as input to the inference model and information based on the second normal image is used as
  • a foreign object detection method comprising: [13] A foreign object detection method for detecting a foreign object included in an image showing an object by using the second inference model generated by the model generation method according to [9], a detection acquisition step for acquiring a target image that is a target for detecting a foreign object; a calculation step of inputting information based on the target image acquired

Landscapes

  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Theoretical Computer Science (AREA)
  • Biochemistry (AREA)
  • Evolutionary Computation (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Chemical & Material Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

精度よく異物を検出する。 モデル生成方法は、対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成する方法であって、訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する訓練用取得ステップ(S01)と、取得された訓練用の画像を用いた訓練を行って推論モデルを生成するモデル生成ステップ(S02)とを含む。

Description

モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル
 本発明は、対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成方法、モデル生成システム及びモデル生成プログラム、生成された推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出方法、異物検出システム及び異物検出プログラム、並びに生成された推論モデルに関する。
 特許文献1には、機械学習によって生成された推論モデルを用いて検査対象物の外観の検査対象画像から復元画像を生成して、検査対象画像と復元画像との差分から検査対象物を検査することが示されている。特許文献1では、検査に用いられる推論モデルは、良品と判断される検査対象物の外観の良品画像と、良品画像に欠陥を示す画像を合成した疑似欠陥画像とから生成されている。これによって検査精度が向上するとされている。
特開2018-205163号公報
 しかしながら、特許文献1に示される方法では、例えば、包装された物をX線で撮像した画像の異物の検出を行う場合には、必ずしも適切に異物の検出が行えない。特に対象物がパスタ等の複数の物体を含むものであり、異物が個々の物体に比べて小さいものである場合には、特許文献1に示される方法で生成された推論モデルを用いても、必ずしも適切に異物の検出が行えない。
 本発明の一実施形態は、上記に鑑みてなされたものであり、精度よく異物を検出することができるモデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデルを提供することを目的とする。
 上記の目的を達成するために、本発明の一実施形態に係るモデル生成方法は、対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成方法であって、訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する訓練用取得ステップと、訓練用取得ステップにおいて取得された訓練用の画像を用いた訓練を行って推論モデルを生成するモデル生成ステップと、を含み、訓練は、第1の正常画像に基づく情報を推論モデルへの入力とし、当該第1の正常画像に基づく情報を推論モデルからの出力とした訓練、第2の異物画像に基づく情報を推論モデルへの入力とし、第2の正常画像に基づく情報を推論モデルからの出力とした訓練、及び第3の異物画像に基づく情報を推論モデルへの入力とし、第3の正常画像に基づく情報を推論モデルからの出力とした訓練を含む。
 本発明の一実施形態に係るモデル生成方法では、正常画像に加えて、2種類の互いに異なる異物画像が用いられて訓練が行われて、推論モデルが生成される。このように生成された推論モデルは、入力された画像に写っているもののうち、対象物を出力に反映し、異物を出力に反映しないものとなる。従って、生成された推論モデルを用いて異物の検出を行うことで、精度よく異物を検出することができる。
 検出対象として想定されない異物は、自然画像であることとしてもよい。この構成によれば、より適切かつ確実に推論モデルを生成することができる。
 第2の正常画像及び第3の正常画像は、第1の正常画像であり、訓練用取得ステップにおいて、第1の正常画像に対して、検出対象として想定される異物を付加して第2の異物画像を生成して取得し、第1の正常画像に対して、検出対象として想定されない異物を付加して第3の異物画像を生成して取得することとしてもよい。この構成によれば、容易かつ確実に第2の異物画像及び第3の異物画像を取得することができる。その結果、容易かつ確実に推論モデルを生成することができる。
 対象物は、特定の種別の物であり、訓練用取得ステップにおいて取得される第1の正常画像、第2の正常画像、第2の異物画像、第3の正常画像及び第3の異物画像は、特定の種別の物が訓練用の対象物として写っている画像であることとしてもよい。この構成によれば、特定の種別の物について精度よく異物を検出するための推論モデルを生成することができる。
 訓練用取得ステップにおいて取得される第1の正常画像の数、第2の正常画像と第2の異物画像との組み合わせの数、並びに第3の正常画像と第3の異物画像との組み合わせの数の比率は、予め設定された比率であることとしてもよい。この構成によれば、より適切かつ確実に推論モデルを生成することができる。
 検出対象として想定されない異物は、計算式に基づいて描画された画像であることとしてもよい。この構成によれば、より適切かつ確実に推論モデルを生成することができる。
 第3の異物画像は、透過的な付加及び置き換えによる付加の少なくとも何れかによって、検出対象として想定されない異物が第3の正常画像に付加された画像であることとしてもよい。この構成によれば、より適切かつ確実に推論モデルを生成することができる。
 推論モデルは、複数の層を有するニューラルネットワークを含み、層間での連結を行う構造を有し、連結を経由した後の画像と入力した画像とを足し合わせるモデルであることとしてもよい。この構成によれば、精度よく異物を検出するための推論モデルを生成することができる。
 モデル生成ステップにおいて、生成した推論モデルの出力側に、当該推論モデルに入力した画像の位置毎の異物の度合いを示す情報を出力する部分を追加した新たな第2の推論モデルを、新たな訓練を行って生成することとしてもよい。この構成によれば、容易かつ確実に異物を検出するための第2の推論モデルを生成することができる。
 本発明の一実施形態は、上記のようにモデル生成方法の発明として記述できる他に、以下のようにモデル生成システム及びモデル生成プログラムの発明としても記述することができる。これらはカテゴリが異なるだけで、実質的に同一の発明であり、同様の作用及び効果を奏する。
 即ち、本発明の一実施形態に係るモデル生成システムは、対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成システムであって、訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する取得手段と、取得手段によって取得された訓練用の画像を用いた訓練を行って推論モデルを生成するモデル生成手段と、を備え、訓練は、第1の正常画像に基づく情報を推論モデルへの入力とし、当該第1の正常画像に基づく情報を推論モデルからの出力とした訓練、第2の異物画像に基づく情報を推論モデルへの入力とし、第2の正常画像に基づく情報を推論モデルからの出力とした訓練、及び第3の異物画像に基づく情報を推論モデルへの入力とし、第3の正常画像に基づく情報を推論モデルからの出力とした訓練を含む。
 本発明の一実施形態に係るモデル生成プログラムは、コンピュータを、対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成システムとして動作させるモデル生成プログラムであって、当該コンピュータを、訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する取得手段と、取得手段によって取得された訓練用の画像を用いた訓練を行って推論モデルを生成するモデル生成手段と、として機能させ、訓練は、第1の正常画像に基づく情報を推論モデルへの入力とし、当該第1の正常画像に基づく情報を推論モデルからの出力とした訓練、第2の異物画像に基づく情報を推論モデルへの入力とし、第2の正常画像に基づく情報を推論モデルからの出力とした訓練、及び第3の異物画像に基づく情報を推論モデルへの入力とし、第3の正常画像に基づく情報を推論モデルからの出力とした訓練を含む。
 また、上記の目的を達成するために、本発明の一実施形態に係る異物検出方法は、モデル生成方法によって生成された推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出方法であって、異物の検出対象となる対象画像を取得する検出用取得ステップと、検出用取得ステップにおいて取得された対象画像に基づく情報を、推論モデルに入力して演算を行って、推論モデルからの出力を得る演算ステップと、演算ステップにおける推論モデルへの入力に係る情報と、推論モデルからの出力に係る情報との差分を算出して、算出した差分から対象画像に含まれる異物の検出を行う検出ステップと、を含む。
 本発明の一実施形態に係る異物検出方法では、上記の推論モデルが用いられて異物の検出が行われる。従って、本発明の一実施形態に係る異物検出方法によれば、精度よく異物を検出することができる。
 また、上記の目的を達成するために、本発明の一実施形態に係る異物検出方法は、モデル生成方法によって生成された第2の推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出方法であって、異物の検出対象となる対象画像を取得する検出用取得ステップと、検出用取得ステップにおいて取得された対象画像に基づく情報を、第2の推論モデルに入力して演算を行って、第2の推論モデルからの出力を得る演算ステップと、演算ステップにおいて得られた第2の推論モデルからの出力から対象画像に含まれる異物の検出を行う検出ステップと、を含む。
 本発明の一実施形態に係る異物検出方法では、上記の第2の推論モデルが用いられて異物の検出が行われる。従って、本発明の一実施形態に係る異物検出方法によれば、精度よく異物を検出することができる。
 本発明の一実施形態は、上記のように異物検出方法の発明として記述できる他に、以下のように異物検出システム及び異物検出プログラムの発明としても記述することができる。これらはカテゴリが異なるだけで、実質的に同一の発明であり、同様の作用及び効果を奏する。
 即ち、本発明の一実施形態に係る異物検出システムは、モデル生成方法によって生成された推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムであって、異物の検出対象となる対象画像を取得する検出用取得手段と、検出用取得手段によって取得された対象画像に基づく情報を、推論モデルに入力して演算を行って、推論モデルからの出力を得る演算手段と、演算手段による推論モデルへの入力に係る情報と、推論モデルからの出力に係る情報との差分を算出して、算出した差分から対象画像に含まれる異物の検出を行う検出手段と、を備える。
 本発明の一実施形態に係る異物検出システムは、モデル生成方法によって生成された第2の推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムであって、異物の検出対象となる対象画像を取得する検出用取得手段と、検出用取得手段によって取得された対象画像に基づく情報を、第2の推論モデルに入力して演算を行って、第2の推論モデルからの出力を得る演算手段と、演算手段によって得られた第2の推論モデルからの出力から対象画像に含まれる異物の検出を行う検出手段と、を備える。
 本発明の一実施形態に係る異物検出プログラムは、コンピュータを、モデル生成方法によって生成された推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムとして動作させる異物検出プログラムであって、当該コンピュータを、異物の検出対象となる対象画像を取得する検出用取得手段と、検出用取得手段によって取得された対象画像に基づく情報を、推論モデルに入力して演算を行って、推論モデルからの出力を得る演算手段と、演算手段による推論モデルへの入力に係る情報と、推論モデルからの出力に係る情報との差分を算出して、算出した差分から対象画像に含まれる異物の検出を行う検出手段と、として機能させる。
 本発明の一実施形態に係る異物検出プログラムは、コンピュータを、モデル生成方法によって生成された推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムとして動作させる異物検出プログラムであって、当該コンピュータを、異物の検出対象となる対象画像を取得する検出用取得手段と、検出用取得手段によって取得された対象画像に基づく情報を、第2の推論モデルに入力して演算を行って、第2の推論モデルからの出力を得る演算手段と、演算手段によって得られた第2の推論モデルからの出力から対象画像に含まれる異物の検出を行う検出手段と、として機能させる。
 本発明の一実施形態に係るモデル生成方法によって生成される推論モデル自体も、新規な構成を有する発明である。即ち、本発明の一実施形態に係る推論モデルは、画像に基づく情報を入力して、入力に応じた演算を行って情報を出力するようコンピュータを機能させるための推論モデルであって、モデル生成方法によって生成されたものである。
 本発明の一実施形態によれば、精度よく異物を検出することができる。
本発明の実施形態に係るモデル生成システム及び異物検出システムの構成を示す図である。 異物の検出に用いられる対象画像及び対象画像を推論モデルに入力して出力される画像の例を示す図である。 異物の検出結果として生成される異常度マップの例を示す図である。 推論モデルを模式的に示す図である。 訓練に用いられる第1の正常画像の例を示す図である。 訓練に用いられる第2の正常画像と第2の異物画像との組み合わせの例を示す図である。 訓練に用いられる第3の正常画像と第3の異物画像との組み合わせの例を示す図である。 第3の異物画像の生成に用いられる画像の例を示す図である。 本発明の実施形態に係るモデル生成システムで実行される処理であるモデル生成方法を示すフローチャートである。 本発明の実施形態に係る異物検出システムで実行される処理である異物検出方法を示すフローチャートである。 比較例による検出結果と本発明の実施形態による検出結果との例を示す図である。 訓練に用いる画像と、推論モデルから出力される画像及び異常度マップとの例を示す図である。 訓練に用いる画像と、推論モデルから出力される画像及び異常度マップとの例を示す図である。 ライスを対象物とした場合の画像の例である。 グラノーラを対象物とした場合の画像の例である。 本発明の実施形態に係るモデル生成プログラム及び異物検出プログラムの構成を、記録媒体と共に示す図である。 訓練に用いられる第3の正常画像と第3の異物画像との組み合わせの例を示す図である。 訓練に用いられる第3の正常画像と第3の異物画像との組み合わせの例を示す図である。 第3の異物画像の生成に用いられる画像の例を示す図である。 第3の異物画像の生成に用いられる画像の例を示す図である。 第3の異物画像の生成に用いられる画像の例を示す図である。 第3の異物画像の生成に用いられる画像の例を示す図である。 比較例による検出結果と本発明の実施形態による検出結果との例を示す図である。 比較例による検出結果と本発明の実施形態による検出結果との例を示す図である。 訓練に用いられる第3の異物画像の例を示す図である。 訓練に用いられる第3の正常画像と第3の異物画像との組み合わせの例を示す図である。 訓練に用いられる第3の正常画像と第3の異物画像との組み合わせの例を示す図である。 本発明の実施形態による検出結果の例を示す図である。 本発明の実施形態による検出結果の例を示す図である。 推論モデルの例を模式的に示す図である。 第2の推論モデルの例を模式的に示す図である。 第2の推論モデルの生成のための訓練に用いられる画像の例を示す図である。 第2の推論モデルを用いた本発明の実施形態による検出結果の例を示す図である。
 以下、図面と共に本発明に係るモデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデルの実施形態について詳細に説明する。なお、図面の説明においては同一要素には同一符号を付し、重複する説明を省略する。
 図1(a)に本実施形態に係るモデル生成システム10を示す。図1(b)に本実施形態に係る異物検出システム20を示す。モデル生成システム10は、機械学習の訓練を行って、対象物が写った画像に含まれる異物の検出に用いられる推論モデル(学習モデル、学習済モデル)を生成するシステム(装置)である。異物検出システム20は、モデル生成システム10によって生成された推論モデルを用いて、対象物が写った画像に含まれる異物の検出(検知)を行うシステム(装置)である。
 図2に異物の検出に用いられる対象画像30の例を示す。本実施形態における異物の検出は、商品として包装された食品、例えば、プラスチックの包装袋に入れられた食品に対する異物の検出である。異物の検出は、例えば、食品の商品の製造工程において、製造された商品が良品か否かを判断するために行われる。検出対象の商品の画像から異物が検出されなかったら当該商品が良品とされ、検出対象の商品の画像から異物が検出されたら当該商品が不良品とされる。異物の検出に用いられる画像は、X線によって検出対象となる商品毎に撮像されたものである。図中の破線で囲った部分は、異物が存在している部分である。
 想定される異物は、例えば、製造工程で含まれる可能性があるものである。本実施形態では、異物として食品と比べて小さな球(SUS(Steel Use Stainless)の球、ガラスの球)を用いた例を示す。異物の検出対象となる商品は、例えば、ペンネ等のパスタである。また、異物の検出対象となる商品は、パスタ以外のもの、例えば、ライス(米)、グラノーラであってもよい。なお、異物は、食品等の対象物より小さい必要はなく、対象物と同程度の大きさ、又は対象物よりも大きくてもよい。図2の対象画像30に示すように、通常、パスタ等の商品では同様の形状のものが1つの包装に数多く含まれる。従来の方法では、このような場合の異物の検出を精度よく行うことは困難であるが、本実施形態では精度よく異物の検出を行うことができる。
 なお、異物が含まれる対象物(本実施形態の例では食品の商品)、異物及び画像(本実施形態の例ではX線画像)は、本実施形態のものに限られず、本実施形態が適用可能なものであればよい。また、検出対象の異物は、必ずしも対象物(上記の例では食品)とは別の物である必要はなく、対象物上に表れる欠陥、疵等の不良であってもよい。即ち、異物の検出は、対象物が不良品であるかの検出であってもよい。
 モデル生成システム10及び異物検出システム20はそれぞれ、CPU(Central Processing Unit)等のプロセッサ、メモリ、通信モジュール等のハードウェアを含む従来のコンピュータを含んで構成される。モデル生成システム10及び異物検出システム20の後述する各機能は、これらの構成要素がプログラム等により動作することによって発揮される。図1では、モデル生成システム10及び異物検出システム20は、別々のシステム(装置)として示しているが、同じシステム(装置)によって実現されてもよい。モデル生成システム10及び異物検出システム20を構成するコンピュータは、複数のコンピュータを含むコンピュータシステムであってもよい。また、コンピュータは、クラウドコンピューティング又はエッジコンピューティングで構成されていてもよい。
 引き続いて、本実施形態に係るモデル生成システム10及び異物検出システム20の機能を説明する。図1に示すようにモデル生成システム10は、訓練用取得部11と、モデル生成部12とを備えて構成される。
 モデル生成システム10の各機能を説明する前にモデル生成システム10によって生成される推論モデルを説明する。あわせて推論モデルを用いた異物検出システム20による異物の検出の概略を説明する。推論モデルは、異物の検出対象の画像を入力して、入力した画像の異物の部分を除去した(と推論される)画像を出力(推論)するモデルである。図2に、推論モデルに入力される、異物の検出対象となる対象画像30、及び当該対象画像30を推論モデルに入力して出力される、異物の部分を除去した(と推論される)画像40の例を示す。対象画像30中の破線で囲った部分には異物が写っているが、推論モデルから出力される画像40中の同じ位置の部分には異物が写っていない。
 推論モデルへ入力される画像と推論モデルから出力される画像との差分を取ることで、推論モデルで除去された異物のみを示す画像(情報)を得ることができる。図3に、図2の推論モデルへ入力される対象画像30と推論モデルから出力される画像40との差分の画像である異常度マップ50を示す。異常度マップ50によって、異物を把握することができる。推論モデルを用いた異物検出システム20による異物の検出は、例えば、異常度マップの生成に相当する。
 推論モデルは、例えば、ニューラルネットワークを含んで構成される。ニューラルネットワークは、多層のものであってよい。即ち、推論モデルは、深層学習(ディープラーニング)によって生成されたものであってもよい。また、ニューラルネットワークは、畳み込みニューラルネットワーク(CNN:Convolutional Neural Network)であってもよい。
 図4に、本実施形態の推論モデルを模式的に示す。推論モデルは、入力した画像を特徴量にエンコードするエンコーダと、エンコーダから出力される特徴量を画像にデコードするデコーダとを含んで構成される。
 推論モデルには、エンコーダの入力層に、画像に基づく情報を入力するためのニューロンが設けられる。例えば、推論モデルに入力される情報は、画像の各画素の画素値(輝度値)である。この場合、入力層には、画像の画素の数のニューロンが設けられ、それぞれのニューロンには対応する画素の画素値が入力される。なお、推論モデルに入力される情報は、画像に基づくものであれば各画素の画素値以外であってもよい。
 推論モデルには、デコーダの出力層に、画像を出力するためのニューロンが設けられる。例えば、推論モデルから出力される情報は、画像の各画素の画素値である。この場合、出力層には、画像の画素の数のニューロンが設けられ、それぞれのニューロンから対応する画素の画素値が出力される。なお、推論モデルから出力される情報は、上述した出力画像を生成可能なものであれば各画素の画素値以外であってもよい。
 また、推論モデルは、機械学習の訓練によって生成されて上述した入出力を行うものであれば、ニューラルネットワーク以外によって構成されていてもよい。
 推論モデルは、人工知能ソフトウェアの一部であるプログラムモジュールとしての利用が想定される。推論モデルは、例えば、プロセッサ及びメモリを備えるコンピュータにて用いられ、コンピュータのプロセッサが、メモリに記憶されたモデルからの指令に従って動作する。例えば、コンピュータのプロセッサが、当該指令に従って、モデルに対して情報を入力して、モデルに応じた演算を行って、モデルから結果を出力するように動作する。具体的には、コンピュータのプロセッサが、当該指令に従って、ニューラルネットワークの入力層に情報を入力して、ニューラルネットワークにおける学習の重み付け係数等のパラメータに基づく演算を行って、ニューラルネットワークの出力層から結果を出力するように動作する。以上が、モデル生成システム10によって生成される推論モデル、及び推論モデルを用いた異物検出システム20による異物の検出の概略である。
 訓練用取得部11は、訓練用の画像を取得する訓練用取得手段である。訓練用の画像は、訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像である。検出対象として想定されない異物は、自然画像であってもよい。
 第2の正常画像及び第3の正常画像を、第1の正常画像とし、訓練用取得部11は、第1の正常画像に対して、検出対象として想定される異物を付加して第2の異物画像を生成して取得し、第1の正常画像に対して、検出対象として想定されない異物を付加して第3の異物画像を生成して取得してもよい。対象物は、特定の種別の物であり、訓練用取得部11によって取得される第1の正常画像、第2の正常画像、第2の異物画像、第3の正常画像及び第3の異物画像は、特定の種別の物が訓練用の対象物として写っている画像であってもよい。訓練用取得部11によって取得される第1の正常画像の数、第2の正常画像と第2の異物画像との組み合わせの数、並びに第3の正常画像と第3の異物画像との組み合わせの数の比率は、予め設定された比率であってもよい。
 推論モデルは、訓練用取得部11によって取得される訓練用の画像を用いた機械学習の訓練によって生成される。推論モデルの訓練は、第1の正常画像を用いた訓練、第2の正常画像と第2の異物画像との組み合わせを用いた訓練、及び第3の正常画像と第3の異物画像との組み合わせを用いた訓練の3種類の訓練を含む。
 図5に第1の正常画像61の例を示す。第1の正常画像61は、訓練用の対象物が写っており、異物が写っていない画像である。第1の正常画像61は、例えば、異物が含まれていないと確認が取れている商品を、異物の検出の際と同じ条件で撮像して得られる画像である。異物が含まれていないと確認が取れている商品は、訓練用の対象物である。また、当該商品は、異物の検出対象と同じ種別の物とする。即ち、異物の検出対象がパスタの商品であれば、第1の正常画像61を同じ種類のパスタの商品の画像とする。
 図6に第2の正常画像62及び第2の異物画像72の例を示す。第2の正常画像62は、訓練用の対象物が写っており、異物が写っていない画像であり、第1の正常画像61と同様の画像である。第1の正常画像61を第2の正常画像62としてもよい。第2の異物画像72は、検出対象として想定される異物(例えば、上述した小さな球)(の画像)が第2の正常画像62に付加された画像である。第2の異物画像72は、例えば、検出対象として想定される異物のみを撮像して得られる画像を第2の正常画像62に重畳して得られる画像である。あるいは、異物のみを撮像して得られる画像は用いずに、第2の正常画像62に対して検出対象として想定される異物を想定した画像処理を行って、第2の異物画像72を生成してもよい。画像処理は、シミュレーション(例えば、X線画像の画像処理に係るシミュレーション)の技術が用いられて行われてもよい。推論モデルの訓練では、第2の異物画像72と、第2の異物画像72の生成に用いられた第2の正常画像62との組み合わせが用いられる。
 図7に第3の正常画像63及び第3の異物画像73の例を示す。第3の正常画像63は、訓練用の対象物が写っており、異物が写っていない画像であり、第1の正常画像61と同様の画像である。第1の正常画像61を第3の正常画像63としてもよい。第3の異物画像73は、検出対象として想定されない異物が第3の正常画像63に付加された画像である。第3の異物画像73は、例えば、検出対象として想定されない異物の画像を第3の正常画像63に重畳して得られる画像である。
 図8に、第3の異物画像73の生成に用いられる異物の画像80の例を示す。図8に示すように第3の異物画像73の生成のために第3の正常画像63に付加される異物は、自然画像である。ここでの自然画像は、検出対象として想定される異物とは全く異なる、風景又は人物等を撮像した画像である。図7に示す第3の異物画像73は、図8の右上の戦車の画像を第3の正常画像63に重畳したものである。
 あるいは、異物の画像は用いずに、第3の正常画像63に対して検出対象として想定される異物を想定しない画像処理を行って、第3の異物画像73を生成してもよい。画像処理は、シミュレーションの技術が用いられて行われてもよい。推論モデルの訓練では、第3の異物画像73と、第3の異物画像73の生成に用いられた第3の正常画像63との組み合わせが用いられる。
 訓練用取得部11は、第1の正常画像61、第2の正常画像62及び第2の異物画像72の組み合わせ、並びに第3の正常画像63及び第3の異物画像73の組み合わせを取得する。例えば、訓練用取得部11は、モデル生成システム10のユーザがモデル生成システム10に対して入力した各画像を受け付けることで各画像を取得する。また、訓練用取得部11は、それ以外の任意の方法で各画像を取得してもよい。
 あるいは、訓練用取得部11は、上記の各画像のうち、第1の正常画像61のみを上記と同様に取得する。なお、第1の正常画像61の取得のみであれば、撮像によって画像を得る撮像装置(例えば、X線画像を得るX線撮像装置)から送信される画像を受信して取得してもよい。訓練用取得部11は、取得した第1の正常画像61を、第2の正常画像62及び第3の正常画像63とする。訓練用取得部11は、第2の正常画像62(第1の正常画像61)から第2の異物画像72を生成して取得する。例えば、訓練用取得部11は、検出対象として想定される異物のみを撮像して得られる画像を取得して、取得した画像と第2の正常画像62とを重畳して第2の異物画像72を生成する。
 また、訓練用取得部11は、第3の正常画像63(第1の正常画像61)から第3の異物画像73を生成して取得する。例えば、訓練用取得部11は、検出対象として想定されない異物の画像80(例えば、図8に示す自然画像)を取得して、取得した画像と第3の正常画像63とを重畳して第3の異物画像73を生成する。第2の異物画像72及び第3の異物画像73の生成に用いる画像は、第1の正常画像61と同じ方法、又はそれ以外の任意の方法で取得されればよい。
 あるいは、訓練用取得部11は、第2の異物画像72及び第3の異物画像73を生成するための、シミュレーションによる画像処理の方法を予め記憶しておき、その方法によって第2の正常画像62及び第3の正常画像63に対して画像処理を行って第2の異物画像72及び第3の異物画像73を生成してもよい。シミュレーションによる画像処理では、例えば、異物の形状及びコントラストを変更したり、シンチレータに係るボケ及び残光に係るボケを加えたりする処理を行ってもよい。また、上記以外にも、撮像条件の変更に応じた画像処理を行ってもよい。シミュレーションによる画像処理は、従来の方法で実現することができる。また、第2の異物画像72及び第3の異物画像73の生成に用いる方法として、画像を重畳させる方法と、シミュレーションによる画像処理を行う方法とを組み合わせてもよい。
 訓練用取得部11は、モデル生成部12による訓練を適切に行える程度の数の訓練用の画像を取得する。訓練用取得部11は、第1の正常画像61の数、第2の正常画像62と第2の異物画像72との組み合わせの数、並びに第3の正常画像63と第3の異物画像73との組み合わせの数の比率が、予め設定された比率となるように訓練用の画像を取得する。例えば、訓練用取得部11は、それらの数が同数となるよう、即ち、それらの数が全体の数の1/3ずつとなるように訓練用の画像を取得する。推論モデルが出力する画像がこの比率に応じたものとなるためである。訓練用取得部11は、取得した訓練用の画像61,62,63,72,73をモデル生成部12に出力する。
 モデル生成部12は、訓練用取得部11によって取得された訓練用の画像を用いた訓練を行って推論モデルを生成するモデル生成手段である。推論モデル生成のための訓練は、第1の正常画像61に基づく情報を推論モデルへの入力とし、当該第1の正常画像61に基づく情報を推論モデルからの出力とした訓練、第2の異物画像72に基づく情報を推論モデルへの入力とし、第2の正常画像62に基づく情報を推論モデルからの出力とした訓練、及び第3の異物画像73に基づく情報を推論モデルへの入力とし、第3の正常画像63に基づく情報を推論モデルからの出力とした訓練を含む。
 モデル生成部12は、例えば以下のように推論モデルを生成する。モデル生成部12は、訓練用取得部11から訓練用の画像61,62,63,72,73を入力する。モデル生成部12は、第1の正常画像61毎、互いに対応する第2の正常画像62と第2の異物画像72との組み合わせ毎、及び互いに対応する第3の正常画像63と第3の異物画像73との組み合わせ毎に推論モデル生成のための訓練を行う。
 以下では、推論モデルが、画像自体を入力して、画像自体を出力するものである例を説明する。第1の正常画像61を用いた訓練を行う場合には、モデル生成部12は、図5に示すように、第1の正常画像61を推論モデルへの入力とすると共に、当該第1の正常画像61を推論モデルからの出力とした訓練を行う。互いに対応する第2の正常画像62と第2の異物画像72との組み合わせを用いた訓練を行う場合には、モデル生成部12は、図6に示すように、第2の異物画像72を推論モデルへの入力とすると共に、当該第2の異物画像72に対応する第2の正常画像62を推論モデルからの出力とした訓練を行う。互いに対応する第3の正常画像63と第3の異物画像73との組み合わせを用いた訓練を行う場合には、モデル生成部12は、図7に示すように、第3の異物画像73を推論モデルへの入力とすると共に、当該第3の異物画像73に対応する第3の正常画像63を推論モデルからの出力とした訓練を行う。
 上記の各訓練自体、即ち、推論モデルのパラメータの更新は、従来の機械学習の訓練と同様に行われればよい。また、訓練は、画像の種別(第1の正常画像61、互いに対応する第2の正常画像62と第2の異物画像72との組み合わせ及び互いに対応する第3の正常画像63と第3の異物画像73との組み合わせの別)毎にまとめて行ってもよいし、1回ずつ画像の種別を変えて行ってもよい。
 推論モデルが、画像自体以外の画像に基づく情報を入力するものであれば、モデル生成部12は、訓練用の画像のうち、推論モデルへの入力に対応する画像61,72,73のそれぞれから、画像61,72,73に基づく情報を生成して、生成した情報を推論モデルへの入力として訓練を行えばよい。また、推論モデルが、画像自体以外の画像に応じた情報を出力するものであれば、モデル生成部12は、訓練用の画像のうち、推論モデルからの出力に対応する画像61,62,63のそれぞれから、当該画像61,62,63に応じた情報(画像61,62,63に基づく情報)を生成して、生成した情報を推論モデルからの出力として訓練を行えばよい。
 モデル生成部12は、例えば、訓練用取得部11から入力した訓練用の画像61,62,63,72,73を全て訓練に利用して推論モデルを生成する。あるいは、モデル生成部12は、上記以外の予め設定した訓練の終了の条件を満たすまで訓練を行って推論モデルを生成してもよい。生成された推論モデルは、異物検出システム20で用いられる。モデル生成部12は、生成した推論モデルを出力する。例えば、モデル生成部12は、推論モデルを異物検出システム20に送信する。なお、異物検出システム20への推論モデルの入力は、モデル生成部12からの出力以外によって行われてもよい。例えば、異物検出システム20への推論モデルの入力は、モデル生成システム10又は異物検出システム20の操作等によって行われてもよい。以上が、本実施形態に係るモデル生成システム10の機能である。
 図1に示すように異物検出システム20は、検出用取得部21と、演算部22と、検出部23とを備えて構成される。
 検出用取得部21は、異物の検出対象となる対象画像30を取得する検出用取得手段である。検出用取得部21は、例えば、撮像によって画像を得る撮像装置(例えば、X線画像を得るX線撮像装置)から送信される画像を、対象画像30として受信して取得する。また、訓練用取得部11は、それ以外の任意の方法で対象画像30を取得してもよい。検出用取得部21は、取得した対象画像30を演算部22に出力する。
 演算部22は、検出用取得部21によって取得された対象画像30に基づく情報を、推論モデルに入力して演算を行って、推論モデルからの出力を得る演算部である。演算部22は、モデル生成システム10によって生成された推論モデルを入力して記憶しておく。演算部22は、検出用取得部21から対象画像30を入力する。
 演算部22は、入力した対象画像30に基づく情報を、記憶した推論モデルに入力して演算を行って、推論モデルからの出力を得る。推論モデルを対象物の種別に応じたものとした場合には、演算部22は、対象画像30に係る対象物の種別に応じた推論モデルを演算に用いる。例えば、対象画像30に写った対象物がパスタである場合には、パスタ用の推論モデルを用いる。
 推論モデルに入力される情報は、推論モデルに応じたものであり、例えば、上記のように対象画像30自体である。また、推論モデルに入力される情報は、対象画像30自体以外の対象画像30に基づく情報でもよい。その場合、演算部22は、対象画像30から、推論モデルに入力する情報を生成する。推論モデルから出力される情報は、推論モデルに応じたものであり、例えば、上記のように対象画像30の異物の部分を除去した(と推論される)画像40である。また、推論モデルから出力される情報は、当該画像40以外の当該画像40に対応する情報でもよい。
 演算部22は、推論モデルへの入出力に係る情報を検出部23に出力する。例えば、演算部22は、推論モデルへの入出力に係る情報として、対象画像30及び推論モデルからの出力される画像40を検出部23に出力する。また、演算部22は、対象画像30及び推論モデルからの出力される画像40以外のそれらに対応する情報を検出部23に出力してもよい。
 検出部23は、演算部22による推論モデルへの入力に係る情報と、推論モデルからの出力に係る情報との差分を算出して、算出した差分から対象画像30に含まれる異物の検出を行う検出手段である。
 検出部23は、例えば以下のように異物の検出を行う。検出部23による異物の検出は、例えば上述したように、図3に示すような検出結果を示す情報である異常度マップ50の生成である。検出部23は、演算部22から推論モデルへの入出力に係る情報、例えば、対象画像30及び推論モデルからの出力される画像40を入力する。
 検出部23は、これらの差分を取って異常度マップ50を生成する。具体的には、対応する画素毎に対象画像30と推論モデルからの出力される画像40との画素値の差分を取って異常度マップ50を生成する。異常度マップ50において、0以外の画素値を有する部分、即ち、画像30,40間で画素値に差がある部分は異物があると検出(推定)される部分である。
 検出部23は、検出結果を示す情報である異常度マップ50を出力する。検出結果を示す情報の出力は、例えば、他のシステム(装置)又は他のモジュールに対して行われてもよいし、異物検出システム20のユーザが認識できる形式(例えば、表示又は音声出力)で行われてもよい。
 また、検出部23は、異物の検出として、予め異物の検出の基準を予め記憶しておき、当該基準に基づいて異常度マップ50から対象画像30に異物が含まれるか否かの判定を行ってもよい。また、検出部23は、推論モデルへの入力に係る情報と、推論モデルからの出力に係る情報との差分を算出して、算出した差分から対象画像30に含まれる異物の検出を行うものであれば、上記以外の処理を行ってもよい。以上が、本実施形態に係る異物検出システム20の機能である。
 引き続いて、図9及び図10のフローチャートを用いて、本実施形態に係るモデル生成システム10及び異物検出システム20で実行される処理(モデル生成システム10及び異物検出システム20が行う動作方法)を説明する。
 まず、図9のフローチャートを用いて、本実施形態に係るモデル生成システム10で実行される処理であるモデル生成方法を説明する。本処理では、まず、訓練用取得部11によって、訓練用の画像61,62,63,72,73が取得される(S01、訓練用取得ステップ)。訓練用の画像は、第1の正常画像61、第2の正常画像62及び第2の異物画像72の組み合わせ、並びに第3の正常画像63及び第3の異物画像73の組み合わせである。第1~第3の正常画像61~63は、訓練用の対象物が写っている画像である。第2の異物画像72は、検出対象として想定される異物が第2の正常画像に付加された画像である。第3の異物画像73は、検出対象として想定されない異物が第3の正常画像に付加された画像である。
 続いて、モデル生成部12によって、訓練用の画像61,62,63,72,73を用いた訓練が行われて推論モデルが生成される(S02、モデル生成ステップ)。訓練は、第1の正常画像61に基づく情報を推論モデルへの入力とし、当該第1の正常画像61に基づく情報を推論モデルからの出力とした訓練を含む。訓練は、第2の異物画像72に基づく情報を推論モデルへの入力とし、第2の正常画像62に基づく情報を推論モデルからの出力とした訓練を含む。訓練は、第3の異物画像73に基づく情報を推論モデルへの入力とし、第3の正常画像63に基づく情報を推論モデルからの出力とした訓練を含む。
 生成された推論モデルは、モデル生成部12から出力される(S03)。モデル生成システム10から出力された推論モデルは、異物検出システム20に記憶される。以上が、本実施形態に係るモデル生成システム10で実行される処理であるモデル生成方法である。
 続いて、図10のフローチャートを用いて、本実施形態に係る異物検出システム20で実行される処理である異物検出方法を説明する。本処理では、まず、検出用取得部21によって、対象画像30が取得される(S11、検出用取得ステップ)。続いて、演算部22によって、対象画像30に基づく情報が、推論モデルに入力されて演算が行われて、推論モデルからの出力が得られる(S12、演算ステップ)。続いて、検出部23によって、対象画像30に含まれる異物の検出の処理として、推論モデルへの入力に係る情報と、推論モデルからの出力に係る情報との差分が算出されて、異常度マップとされる(S13、検出ステップ)。続いて、異物の検出結果を示す情報として、生成された異常度マップが、検出部23から出力される(S14)。以上が、本実施形態に係る異物検出システム20で実行される処理である異物検出方法である。
 上述した食品の商品の画像のような、概ね同様の形状の対象物(例えば、パスタ)が多数写っている画像からは、従来の方法では異物の検出が困難な場合がある。例えば、第2の正常画像62と第2の異物画像72との組み合わせのみを用いて訓練を行って推論モデルを生成した場合、出力に異物が反映されたり、対象物の一部が欠如したりしてしまう。これは、上記の画像の構造が原因であると考えられる。
 本実施形態に係るモデル生成方法では、正常画像61~63に加えて、2種類の互いに異なる異物画像72,73が用いられて訓練が行われて、推論モデルが生成される。具体的には、上述したように、第1の正常画像61を用いた訓練(図5に示す訓練)、第2の正常画像62及び第2の異物画像72を用いた訓練(図6に示す訓練)、並びに第3の正常画像63及び第3の異物画像73を用いた訓練(図7に示す訓練)の3種類の訓練が行われて、推論モデルが生成される。このように生成された推論モデルは、入力された画像に写っているもののうち、対象物を出力に反映し、異物を出力に反映しないものとなる。即ち、パスタを対象物とする推論モデルは、パスタの構造を通し、異物の構造を通さないパスタパスフィルタとなる。
 従って、本実施形態のようにパスタ等の概ね同一の形状のものが複数写った画像において、小さな異物を検出する場合であっても、出力される画像から異物を除去することができる。従って、本実施形態によれば、生成された推論モデルを用いて異物の検出を行うことで、精度よく異物を検出することができる。
 また、本実施形態のように、第3の異物画像73の生成に用いる検出対象として想定されない異物は、自然画像であってもよい。この構成によれば、より適切かつ確実に推論モデルを生成することができる。但し、検出対象として想定されない異物は、自然画像以外の様々なテクスチャの画像であってもよい。
 また、本実施形態のように、第2の正常画像62及び第3の正常画像63は、第1の正常画像61であってもよい。また、第1の正常画像61に対して、検出対象として想定される異物を付加して第2の異物画像72を生成して取得し、第1の正常画像61に対して、検出対象として想定されない異物を付加して第3の異物画像73を生成して取得することとしてもよい。この構成によれば、正常画像61~63として第1の正常画像61が取得できれば、容易かつ確実に第2の異物画像72及び第3の異物画像73を取得することができる。その結果、全ての訓練用の画像61,62,63,72,73を取得することができ、容易かつ確実に推論モデルを生成することができる。但し、訓練用の画像61,62,63,72,73の取得は、上記のように行われる必要はなく、どのように行われてよい。
 また、本実施形態のように、対象物は、特定の種別の物であってもよく、訓練用の画像61,62,63,72,73は、特定の種別の物が訓練用の対象物として写っている画像であってもよい。例えば、パスタの商品であってもよい。また、食品の種別毎の推論モデルの生成及び利用が行われてもよい。この構成によれば、特定の種別の物について精度よく異物を検出するための推論モデルを生成することができる。但し、対象物を特定の種別の物に限定しない訓練用の画像61,62,63,72,73を用いてもよい。
 また、本実施形態のように、取得され訓練に用いられる第1の正常画像61の数、第2の正常画像62と第2の異物画像72との組み合わせの数、並びに第3の正常画像63と第3の異物画像73との組み合わせの数の比率は、予め設定された比率であることとしてもよい。例えば、上述したようにそれらの数は同一であってもよい。この比率を適切なものとすることで、より適切かつ確実に推論モデルを生成することができる。但し、この比率は予め設定されたものとする必要はない。
 なお、モデル生成システム10と異物検出システム20とは、同一の主体によって提供されるものであってもよいし、それぞれ別の主体によって提供されるものであってもよい。また、モデル生成システム10と異物検出システム20とは、同一のユーザによって用いられてるものであってもよいし、それぞれ別のユーザによって用いられてるものであってもよい。
 図11に、本実施形態によって実際に異物の検出を行った結果の例を示す。ここでは、従来の2つの手法によって異物の検出を行った結果を比較例として、本実施形態に係る結果と比較する。従来の方法のうちの第1の方法は、以下のものである。異物がない対象物の画像である良品画像(例えば、本実施形態に用いる正常画像61~63)を予め用意しておく。異物の検出の対象画像について、画像の部分毎の特徴量(例えば、ベクトルで表される特徴ベクトル)を算出する。良品画像についても、画像の部分毎の特徴量を算出する。対象画像の特徴量と、良品画像の特徴量とを比較して、比較に基づいて部分毎に異物があるかどうかを検出する。例えば、特徴ベクトル同士の距離を算出して、それらの距離が予め設定した閾値以上であれば異物があると判断し、閾値以上でなければ異物がないと判断する。
 従来の方法のうちの第2の方法は、以下のものである。異物がない対象物の画像である良品画像(例えば、本実施形態に用いる正常画像61~63)を予め用意しておく。良品画像から、機械学習の訓練によってオートエンコーダを生成する。生成したオートエンコーダを推論モデルとして、本実施形態の異物検出システム20による方法と同様に異物の検出を行う。
 図11に示す結果は、パスタの商品にSUS球及びガラス球を5個ずつ異物として入れて異物の検出を行った結果である。図11の(a)の表は第1の方法による結果を示しており、(b)の表は第2の方法による結果を示しており、(c)の表は本実施形態による結果を示している。第1の方法では、SUS球及びガラス球をそれぞれ2個検出し、誤検出(異物がないにもかかわらず異物を検出した)が3個あった。第2の方法では、SUS球を3個検出し、ガラス球は検出できず、誤検出はなかった。本実施形態では、SUS球及びガラス球をそれぞれ4個検出し、誤検出はなかった。この結果に示すように従来の方法と比べて、本実施形態では精度よく異物を検出することができる。
 また、図12及び図13に、訓練に用いる画像と、推論モデルから出力される画像及び異常度マップとの例を示す。図12(a)~(f)及び図13(a)(b)に示す画像及び異常度マップは比較例であり、図13(c)(d)に示す画像及び異常度マップは本実施形態に係る例である。
 図12の(a)及び(b)に、第1の正常画像61のみを用いて訓練を行って推論モデルを生成した場合(即ち、推論モデルをオートエンコーダとした場合)の、推論モデルから出力される画像及び異常度マップを示す。この場合、推論モデルから出力される画像は、異物が消されておらず、異常度マップの楕円で囲った異物があるべき部分でも異物が検出されていない。
 図12の(c)及び(d)に、第2の正常画像62及び第2の異物画像72の組み合わせのみを用いて訓練を行って推論モデルを生成した場合の、推論モデルから出力される画像及び異常度マップを示す。この場合、推論モデルから出力される画像は、異物が消されているが、パスタの部分も過剰に除去されている。異常度マップの楕円で囲った異物がない部分でも異物が検出されている。
 図12の(e)及び(f)に、第3の正常画像63及び第3の異物画像73の組み合わせのみを用いて訓練を行って推論モデルを生成した場合の、推論モデルから出力される画像及び異常度マップを示す。この場合、推論モデルから出力される画像は、パスタの部分の構造が全体的に除去され気味となっている。
 図13の(a)及び(b)に、第1の正常画像61と、第2の正常画像62及び第2の異物画像72の組み合わせとを、それぞれ同数ずつ用いて訓練を行って推論モデルを生成した場合の、推論モデルから出力される画像及び異常度マップを示す。この場合、推論モデルから出力される画像は、異物が消されている。しかしながら、若干異物を過学習しており、パスタの構造の中に異物として除去されている部分がある。異常度マップの楕円で囲った異物がない部分でも異物が検出されている。
 図13の(c)及び(d)に、第1の正常画像61と、第2の正常画像62及び第2の異物画像72の組み合わせと、第3の正常画像63及び第3の異物画像73の組み合わせとを、それぞれ同数ずつ用いて訓練を行って推論モデルを生成した場合(即ち、本実施形態の場合)の、推論モデルから出力される画像及び異常度マップを示す。この場合、推論モデルから出力される画像は、他の例に比べて適切に異物が消されており、異常度マップも適切な異物が検出されたことを示すものとなっている。
 以上の説明では、パスタの画像を例としていたが他の種別の物を対象物とした場合の例を示す。図14は、ライスを対象物とした場合の例である。図14の(a)は、異物の検出に用いられる対象画像の例であり、(b)は、対象画像を推論モデルに入力した際の推論モデルから出力される画像の例であり、(c)は、それらの画像から生成される異常度マップの例である。ライスを対象物とする場合、ライスが対象物として写った訓練用の画像61,62,63,72,73が用いられて訓練が行われて推論モデルが生成される。この推論モデルは、ライスの構造を通し、異物の構造を通さないライスパスフィルタとなる。
 図15は、ドライフルーツを加えたグラノーラを対象物とした場合の例である。図15の(a)は、異物の検出に用いられる対象画像の例であり、(b)は、対象画像を推論モデルに入力した際の推論モデルから出力される画像の例であり、(c)は、それらの画像から生成される異常度マップの例である。図中の破線で囲った部分は、異物が存在する部分である。グラノーラを対象物とする場合、グラノーラが対象物として写った訓練用の画像61,62,63,72,73が用いられて訓練が行われて推論モデルが生成される。この推論モデルは、グラノーラの構造を通し、異物の構造を通さないグラノーラパスフィルタとなる。
 引き続いて、上述した一連のモデル生成システム10及び異物検出システム20による処理を実行させるためのモデル生成プログラム及び異物検出プログラムを説明する。図16(a)に示すように、モデル生成プログラム100は、コンピュータに挿入されてアクセスされる、あるいはコンピュータが備える、コンピュータ読み取り可能な記録媒体110に形成されたプログラム格納領域111内に格納される。記録媒体110は、非一時的な記録媒体であってもよい。
 モデル生成プログラム100は、訓練用取得モジュール101と、モデル生成モジュール102とを備えて構成される。訓練用取得モジュール101と、モデル生成モジュール102とを実行させることにより実現される機能は、上述したモデル生成システム10の訓練用取得部11と、モデル生成部12との機能とそれぞれ同様である。
 図16(b)に示すように、異物検出プログラム200は、コンピュータに挿入されてアクセスされる、あるいはコンピュータが備える、コンピュータ読み取り可能な記録媒体210に形成されたプログラム格納領域211内に格納される。記録媒体210は、非一時的な記録媒体であってもよい。なお、モデル生成プログラム100及び異物検出プログラム200が同一のコンピュータで実行される場合には、記録媒体210は、記録媒体110と同一であってもよい。
 異物検出プログラム200は、検出用取得モジュール201と、演算モジュール202と、検出モジュール203とを備えて構成される。検出用取得モジュール201と、演算モジュール202と、検出モジュール203とを実行させることにより実現される機能は、上述した異物検出システム20の検出用取得部21と、演算部22と、検出部23との機能とそれぞれ同様である。
 なお、モデル生成プログラム100及び異物検出プログラム200は、その一部又は全部が、通信回線等の伝送媒体を介して伝送され、他の機器により受信されて記録(インストールを含む)される構成としてもよい。また、モデル生成プログラム100及び異物検出プログラム200の各モジュールは、1つのコンピュータでなく、複数のコンピュータの何れかにインストールされてもよい。その場合、当該複数のコンピュータによるコンピュータシステムよって上述した一連の処理が行われる。
 引き続いて、本発明の実施形態の更なる変形例、実施例について説明する。なお、以下に説明する変形例は、上述した実施形態の一部に置き換えられて、あるいは追加されて実施されてもよい。
 図17に第3の正常画像63及び第3の異物画像73の別の例を示す。図17に示す第3の異物画像73のように、第3の異物画像73は、複数の部分的な自然画像が第3の正常画像63に重畳されたものであってもよい。ここで、部分的な自然画像は、第3の正常画像63よりもサイズが小さい自然画像である。このような第3の異物画像73を用いても、異物の検出のために適切な推論モデルを生成することができる。即ち、自然画像の特徴で分類は十分可能であり、あらゆる異物構造(想定外の異物)にも対応可能である。
 第3の異物画像73に付加されている異物は、計算式に基づいて描画された画像であってもよい。図18にこの場合の第3の正常画像63及び第3の異物画像73の例を示す。図18に示す第3の異物画像73のように、異物に係る画像は、例えば、予め用意された計算式に基づいてシミュレーションによって生成される画像である。当該画像は、従来の方法によって生成されてもよい。第3の正常画像63に付加される異物に係る画像は、モデル生成システム10(の訓練用取得部11)によって生成されてもよいし、モデル生成システム10以外によって生成されてモデル生成システム10(の訓練用取得部11)によって取得されてもよい。
 第3の異物画像73に付加される異物に係ると共に計算式に基づいて描画された画像は、図19に示すような幾何学模様の画像81であってもよい。また、当該画像は、図20に示すようなプロシージャルテクスチャの画像(計算式に基づいて生成される質感等のテクスチャの画像)82であってもよい。また、当該画像は、図21に示すような、周波数に係る計算式に基づいて生成される画像である周波数画像83、又は複数の周波数画像83を組み合わせたものであってもよい。また、当該画像は、上記の各画像を組み合わせた画像、例えば、図22に示すような、プロシージャルテクスチャの画像82に基づいて周波数画像83を切り取った画像であってもよい。
 第3の異物画像73として上記の画像に基づくものを用いた構成によっても、より適切かつ確実に推論モデルを生成することができる。
 続いて、コーヒー豆を対象物として画像から異物を検出した例を示す。図23の(a)は、異物の検出に用いられる対象画像30から、従来の画像の単純2値化によって異物を検出した場合の検出された異物を対象画像30に重畳したものである。図23の(a)に示すように、従来の方法では、画像上段に2個、画像中段に3個、画像下段に2個の異物が検出された。図23の(b)は、本実施形態の推論モデルを用いて対象画像30から得られた異常度マップであり、(c)は異常度マップから検出された異物を対象画像30に重畳したものである。図23の(c)に示すように、本実施形態による方法では、画像上段に4個、画像中段に2個、画像下段に6個の異物が検出された。
 図24の(a)は、異物の検出に用いられる対象画像(図23に示す対象画像とは別の画像)30から、従来の画像の単純2値化によって異物を検出した場合の検出された異物を対象画像30に重畳したものである。図24の(a)に示すように、従来の方法では、画像上段に2個、画像中段に3個、画像下段に3個の異物が検出された。図24の(b)は、本実施形態の推論モデルを用いて対象画像30から得られた異常度マップであり、(c)は異常度マップから検出された異物を対象画像30に重畳したものである。図24の(c)に示すように、本実施形態による方法では、画像上段に3個、画像中段に6個、画像下段に5個の異物が検出された。図23及び図24の例にも示すように、本実施形態による方法によれば、従来の方法では検出できなかった実際の異物を検出している。このように本実施形態による方法によれば、高精度での異物の検出が可能である。
 第3の異物画像73において、異物が付加されている部分は、第3の異物画像73全体である必要はなく、第3の異物画像73の一部であってもよい。また、第3の異物画像73において、異物が付加されている部分の位置は、不規則な位置(ランダムな位置)であってもよい。また、第3の異物画像73における、個々の異物の大きさも様々な大きさ(マルチサイズ)であってもよい。これによって、推論モデルを、対象画像30から検出される異物も不規則な位置にあっても、あるいは様々な大きさであっても、適切に異物を検出できるものとすることができる。図25に、不規則な位置に異物が付加されている第3の異物画像73の例を示す。
 第3の異物画像73は、透過的な付加及び置き換えによる付加の少なくとも何れかによって、検出対象として想定されない異物が第3の正常画像63に付加された画像であってもよい。図26に、異物の透過的な付加による第3の異物画像73、及び対応する第3の正常画像63を示す。図27に、異物の置き換えによる付加による第3の異物画像73、及び対応する第3の正常画像63を示す。
 異物の透過的な付加(ミックスアップ)とは、第3の異物画像73の異物が付加された部分において、異物と付加前の第3の正常画像63との両方が見えるように異物を付加することである。即ち、異物の透過的な付加は、付加する部分において、異物を透かして第3の正常画像63が見える状態(あるいは、第3の正常画像63を透かして異物が見える状態)で、半透明の異物を付加前の第3の正常画像63に重畳することである。異物の透過的な付加を行う場合、第3の異物画像73全体における異物が付加されている部分の大きさの割合は、10%~100%としてもよい。この割合を大きくすることで、推論モデルの異物検出性能を高くすることができる。
 図28に、異物の透過的な付加による第3の異物画像73を用いて推論モデルを生成した場合に、コーヒー豆を対象物として対象画像30から異物を検出した例を示す。図28の(a)は、対象画像30から得られた異常度マップであり、(b)は異常度マップから検出された異物を対象画像30に重畳したものである。
 異物の透過的な付加による第3の異物画像73を用いた場合、特に局所的な異物(例えば、テクスチャの変化(疵又は異常))の検出を高精度で行うことができる。また、対象画像30が、上記の異物の透過的な付加と同様に、異物とそれ以外が透過的に重なり合って写っているものである場合、異物の検出を高精度で行うことができる。例えば、対象画像30がX線画像である場合、異物の検出を高精度で行うことができる。
 異物の置き換えによる付加(ミックスアウト)とは、第3の異物画像73の異物が付加された部分において、第3の正常画像63を取り除いて異物を付加することである。即ち、異物の置き換えによる付加は、付加する部分において、異物で第3の正常画像63を遮蔽した状態で、異物を付加前の第3の正常画像63に重畳することである。異物の置き換えによる付加を行う場合、第3の異物画像73全体における異物が付加されている部分の大きさの割合は、10%~60%としてもよい。この割合を大きくすることで、推論モデルの異物検出性能を高くすることができる。
 図29に、異物の置き換えによる付加による第3の異物画像73を用いて推論モデルを生成した場合に、コーヒー豆を対象物として対象画像30から異物を検出した例を示す。図29の(a)は、対象画像30から得られた異常度マップであり、(b)は異常度マップから検出された異物を対象画像30に重畳したものである。
 異物の置き換えによる付加による第3の異物画像73を用いた場合、特に大局的な異物(例えば、色が違う、欠損又は曲がり)の検出を高精度で行うことができる。この場合、生成される推論モデルが、遮蔽された第3の正常画像63の部分を復元し(例えば、異物がない正常品に復元し)、画像に写ったものの位置関係まで学習されて得られたものだからである。例えば、対象画像が、異常検知手法の評価に用いられるデータセットであるMVTecADに類する画像である場合、異物の検出を高精度で行うことができる。
 第3の異物画像73が、透過的な付加及び置き換えによる付加の少なくとも何れかによるものである場合も、訓練用取得部11は、上述した方法と同様に第3の異物画像73を取得すればよい。訓練用取得部11が、第3の異物画像73を生成する場合、従来の画像の透過的な付加及び画像の置き換えの技術を用いて第3の異物画像73を生成すればよい。第3の異物画像73は、透過的な付加によるもの、置き換えによる付加によるもの、及びそれらの両方によるものの何れかでよい。複数の第3の異物画像73は、上記の何れか一種類のもので構成されていてもよいし、上記の複数の種類のものを含んでいてもよい。
 上記の通り、透過的な付加及び置き換えによる付加の少なくとも何れかによって第3の異物画像73を生成する構成によっても、より適切かつ確実に推論モデルを生成することができる。
 また、推論モデルの訓練の際に、推論モデルからの出力とする情報に係る画像は、推論モデルへの入力に係る画像(正常画像)に上記以外の画像加工が行われたものであってもよい。当該画像加工は、予め設定されたものであり、例えば、回転、反転、画素値の変更(輝度振り)、ガンマ補正、エッジ強調及び平滑化処理の何れかである。当該画像加工は、第2の異物画像72又は第3の異物画像73に対して行われてもよい。また、上述した訓練用の画像61,62,63,72,73以外にも、当該画像加工が行われた画像が、推論モデルの訓練に用いられてもよい。
 モデル生成システム10によって生成され、異物検出システム20によって用いられる推論モデルは、複数の層を有するニューラルネットワークを含み、層間での連結(Concat,Concatenation)(結合)を行う構造を有し、連結を経由した後の画像と入力した画像とを加算するモデルであってもよい。例えば、当該推論モデルは、上記の構成を有するニューラルネットワークである。当該ニューラルネットワークを図30に模式的に示す。
 図30に示すように、当該ニューラルネットワークは、入力した画像を特徴量にエンコードするエンコーダと、エンコーダから出力される特徴量を画像にデコードするデコーダとを含む。エンコーダは、2次元畳み込み及び活性化が行われる複数の層(Conv2D Layer,Activation Layer)を有する。エンコーダの複数の層間では、プーリングが行われる。デコーダは、2次元畳み込み及び活性化が行われる複数の層(Conv2D Layer,Activation Layer)を有する。デコーダの複数の層間では、アンプーリングが行われる。エンコーダの層は、エンコーダの層と同一のサイズのデコーダの層に連結(Concat)される(Concatenation Layer)。連結される2つの層は、互いに隣接していない層である。このように、当該ニューラルネットワークは、プーリング層を持つU-Netタイプのモデルである。
 エンコーダに入力される画像と、デコーダの最後の2次元畳み込み及び活性化が行われる層から出力される画像との加算が行われ、加算によって得られた画像がデコーダの出力層(Regression Layer)から出力される。上記の画像の加算は、対応する画素毎の画素値の加算である。
 上記のニューラルネットワークでは、デコーダの最後の2次元畳み込み及び活性化が行われる層から出力される画像を、入力される画像に含まれる異物の画像(正確には、入力した画像に加算することで異物を除去できる異物に係る画素の画素値にマイナスをかけた画像)とすることができる。この構造によれば、推論モデルを、適切に異物の部分を除去した画像を出力するものにできる。その結果、精度よく異物の検出を行うことができる。
 モデル生成システム10は、上述した推論モデルをベースに新たな訓練を行って第2の推論モデルを生成してもよい。即ち、モデル生成システム10は、推論モデルを生成する訓練、その後の第2の推論モデルを生成する訓練の2段階の訓練を行ってもよい。異物検出システム20は、上述した推論モデルではなく、モデル生成システム10によって生成された第2の推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行ってもよい。なお、以降の説明では、単に推論モデルと記載したら上述した実施形態の推論モデル(1段階目で生成される推論モデル)を指す。
 この場合、モデル生成部12は、生成した推論モデルの出力側に、当該推論モデルに入力した画像の位置毎の異物の度合いを示す情報を出力する部分を追加した新たな第2の推論モデルを、新たな訓練を行って生成する。即ち、モデル生成部12は、推論モデルに基づく転移学習を行って第2の推論モデルを生成する。
 第2の推論モデルは、異物の検出対象の画像を入力して、入力した画像の位置毎の異物の度合いを示す情報を出力(推論)するモデル(識別モデル、クラス分けモデル)である。例えば、第2の推論モデルは、異物の検出対象となる対象画像30の画素毎に、当該画素が異物に係るものであるかの確率(良否の確率、クラスの分類値)の値を出力する。この場合、第2の推論モデルは、当該確率として画素毎に0~1の値を出力してもよい。出力される値が1に近いほど当該画素が異物に係るものである度合いが高く、出力される値が0に近いほど当該画素が異物に係るものである度合いが低いことを示している。
 推論モデルを用いた異物の検出では、推論モデルへ入力される画像と推論モデルから出力される画像との差分を取ることで異物の検出を行っていた。第2の推論モデルを用いた異物の検出では、推論モデルを用いた異物の検出のように画像間の差分を取る必要はない。
 図31に、本実施形態の第2の推論モデルの例を模式的に示す。例えば、第2の推論モデルは、ニューラルネットワークである。第2の推論モデルは、ニューラルネットワークである推論モデルの出力側に新たな層が追加されて、新たな訓練が行われて生成されたものである。
 図31に示す例では、推論モデルは、入力した画像を特徴量にエンコードするエンコーダと、エンコーダから出力される特徴量を画像にデコードするデコーダとを含むニューラルネットワークである。エンコーダは、2次元畳み込み及び活性化が行われる複数の層(Conv2D Layer,Activation Layer)を有する。エンコーダの複数の層間では、プーリングが行われる。デコーダは、2次元畳み込み及び活性化が行われる複数の層(Conv2D Layer,Activation Layer)を有する。デコーダの複数の層間では、アンプーリングが行われる。エンコーダの層は、エンコーダの層と同一のサイズのデコーダの層に連結(Concat)される(Concatenation Layer)。連結される2つの層は、互いに隣接していない層である。デコーダの2次元畳み込み及び活性化が行われる複数の層のうちの最後の層が、推論モデルの出力層である。なお、第2の推論モデルに用いられる推論モデルは、必ずしも図31に示すものである必要はなく、第2の推論モデルを構成可能なものであれば任意のものでよい。
 第2の推論モデルにおいて追加される部分は、ニューラルネットワークの複数の層である。例えば、図31に示すように、互いに隣接する層が接続されている3つの層が追加される。推論モデルの側からの1つめの層は、畳み込み及びRelu関数による演算が行われる層(Conv+Relu、Conv2D Layer,Activation Layer)である。この層は、第1の推論モデルの出力層に接続される。2つめの層は、softmax関数による演算が行われる層(softmax)である。3つめの層は、上記の確率の値を出力する出力層(Pixel Classification)である。
 第2の推論モデルの入力層は、推論モデルの入力層と同じである。第2の推論モデルには、出力層に、入力層に入力される情報に係る画像の位置毎の異物の度合いを示す情報を出力するためのニューロンが設けられる。例えば、推論モデルから出力される情報は、上述したように画像の各画素の当該画素が異物に係るものであるかの確率の値である。この場合、出力層には、画像の画素の数のニューロンが設けられ、それぞれのニューロンから対応する画素の確率の値が出力される。なお、推論モデルから出力される情報は、上述した画像の位置毎の異物の度合いを示す情報であれば各画素の確率の値以外であってもよい。
 また、第2の推論モデルは、機械学習の訓練によって生成されて上述した入出力を行うものであれば、ニューラルネットワーク以外によって構成されていてもよい。第2の推論モデルも、第1の推論モデルと同様に人工知能ソフトウェアの一部であるプログラムモジュールとしての利用が想定される。
 第2の推論モデルは、推論モデルと同様に対象物の種別に応じたものとしてもよい。この場合、この点において、第2の推論モデルは、推論モデルと同様に扱うことができる。また、上記の点以外においても同様とできる点については、第2の推論モデルと、推論モデルとは同様としてもよい。
 続いて、第2の推論モデルに係るモデル生成システム10及び異物検出システム20の機能を説明する。訓練用取得部11は、第2の推論モデルの訓練用の情報も取得する。第2の推論モデルの訓練用の情報は、第2の推論モデルの訓練用の画像と、当該画像の位置毎の異物の度合いを示す情報の組み合わせである。図32に、第2の推論モデルの訓練用の画像91、及び当該画像91の位置毎の異物の度合いを示す情報92の例を示す。第2の推論モデルの訓練用の画像91は、上記の第1の正常画像61、第2の異物画像72及び第3の異物画像73の少なくとも何れかとすることができる。従って、訓練用取得部11は、推論モデルの訓練用の画像とは別に第2の推論モデルの訓練用の画像91を取得する必要はない。但し、訓練用取得部11は、推論モデルの訓練用の画像とは別に第2の推論モデルの訓練用の画像91を取得してもよい。この場合、訓練用取得部11は、推論モデルの訓練用の画像の取得方法と同様の方法で当該画像91を取得すればよい。
 第2の推論モデルの訓練用の情報の一部である、第2の推論モデルの訓練用の画像91の位置毎の異物の度合いを示す情報92は、例えば、第2の推論モデルの訓練用の画像91の画素毎の当該画素が異物に係るものであるかを示す値である。上述した例のように第2の推論モデルからの出力が0~1の値であり、出力される値が1に近いほど当該画素が異物に係るものである度合いが高い場合、当該情報92の値は、当該画素が異物に係るものであれば1、当該画素が異物に係るものでなければ0である。図32における当該情報92は、第2の推論モデルの訓練用の画像91毎の値を示しており、白い部分が1(即ち、白い部分が異物の部分)であり、黒い部分が0(即ち、黒い部分が異物でない部分)である。なお、当該情報92の値は、必ずしも上記である必要はなく、第2の推論モデルからの出力も応じたものであればよい。
 訓練用取得部11は、上記の情報92を生成して取得してもよい。例えば、第2の推論モデルの訓練用の画像91と、第1の正常画像61、第2の異物画像72及び第3の異物画像73とする場合、訓練用取得部11は、これらの画像61,72,73の画素毎に異物の部分を1、異物でない部分を0とした情報を上記の情報92として生成する。異物の部分は、例えば、異物として正常画像に追加される画像の部分とする。あるいは、異物として正常画像に追加される画像のうち、異物である部分を既存の検出の技術で検出して、検出した部分を上記の情報92における異物の部分とすればよい。即ち、上記の情報92は、ユーザによるアノテーションを必要とせずに、即ち、アノテーションフリーで取得され得る。また、訓練用取得部11は、モデル生成システム10のユーザがモデル生成システム10に対して入力した上記の情報92を受け付けることで上記の情報92を取得してもよい。
 訓練用取得部11は、モデル生成部12による第2の推定モデルの訓練を適切に行える程度の数の第2の推論モデルの訓練用の情報を取得する。訓練用取得部11は、取得した第2の推論モデルの訓練用の情報をモデル生成部12に出力する。
 モデル生成部12は、例えば以下のように第2の推論モデルを生成する。モデル生成部12は、訓練用取得部11から第2の推論モデルの訓練用の情報を入力する。モデル生成部12は、第2の推論モデルの訓練用の情報の上記の組み合わせ毎に第2の推論モデル生成のための訓練を行う。第2の推論モデル生成のための訓練は、訓練によって第1の推論モデルが生成された後に行われる。
 以下では、第2の推論モデルが、画像自体を入力して、上記の確率の値を出力するものである例を説明する。モデル生成部12は、図32に示すように、第2の推論モデルの訓練用の画像91を第2の推論モデルへの入力とすると共に、当該画像91に対応する確率の値の情報92を第2の推論モデルからの出力とした訓練を行う。
 第2の推論モデルの訓練の際、第2の推論モデルのうちの推論モデルのエンコーダ部分は、訓練による更新がなされないようにする。即ち、第2の推論モデルのうちの第1のエンコーダ部分は、推論モデルの訓練(1段階目での訓練)でのみ更新されて、第2の推論モデルの訓練(2段階目での訓練)での学習率を0とする。2段階目での訓練の際、第2の推論モデルのうちの推論モデルのデコーダ部分は、追加部分と比べて学習率が低くなるようにする。例えば、デコーダ部分の学習率は、追加部分に対する1/100の学習率とする。また、学習の際の損失関数は、例えば、交差エントロピー誤差が用いられる。第2の推論モデルの訓練は、上記以外のように行われてもよい。上記の各訓練自体、即ち、第2の推論モデルのパラメータの更新は、従来の機械学習の訓練と同様に行われればよい。
 第2の推論モデルが、画像自体以外の画像に基づく情報を入力するものであれば、モデル生成部12は、第2の推論モデルへの入力に対応する画像91から、画像91に基づく情報を生成して、生成した情報を推論モデルへの入力として訓練を行えばよい。
 モデル生成部12は、例えば、訓練用取得部11から入力した第2の推論モデルの訓練用の情報を全て訓練に利用して第2の推論モデルを生成する。あるいは、モデル生成部12は、上記以外の予め設定した訓練の終了の条件を満たすまで訓練を行って第2の推論モデルを生成してもよい。生成された第2の推論モデルは、異物検出システム20で用いられる。モデル生成部12は、生成した第2の推論モデルを出力する。第2の推論モデルの入出力は、上記の推論モデルの入出力と同様に行われればよい。また、異物の検出に第2の推論モデルが用いられる場合には、推論モデルの出力は必要ない。
 第2の推論モデルを用いる場合、異物検出システム20における異物の検出は、以下のように行われる。検出用取得部21は、異物の検出対象となる対象画像30を取得する。検出用取得部21は、推論モデルを用いる場合と同様に対象画像30を取得して演算部22に出力する。
 演算部22は、検出用取得部21によって取得された対象画像30に基づく情報を、第2の推論モデルに入力して演算を行って、第2の推論モデルからの出力を得る。演算部22は、モデル生成システム10によって生成された第2の推論モデルを入力して記憶しておく。演算部22は、検出用取得部21から対象画像30を入力する。
 演算部22は、入力した対象画像30に基づく情報を、記憶した第2の推論モデルに入力して演算を行って、第2の推論モデルからの出力を得る。第2の推論モデルに入力される情報は、第2の推論モデルに応じたものであり、例えば、上記のように対象画像30自体である。また、第2の推論モデルに入力される情報は、対象画像30自体以外の対象画像30に基づく情報でもよい。その場合、演算部22は、対象画像30から、第2の推論モデルに入力する情報を生成する。第2の推論モデルから出力される情報は、第2の推論モデルに応じたものであり、例えば、上記のように対象画像30の画素毎の確率の値(クラスマップ)である。また、第2の推論モデルから出力される情報は、上記以外の対象画像30の位置毎の異物の度合いを示す情報でもよい。演算部22は、第2の推論モデルから出力された情報を検出部23に出力する。
 検出部23は、演算部22によって得られた第2の推論モデルからの出力から対象画像30に含まれる異物の検出を行う。検出部23は、例えば以下のように異物の検出を行う。検出部23は、演算部22から、第2の推論モデルからの出力である対象画像30の位置毎の異物の度合いを示す情報、例えば、対象画像30の画素毎の確率の値を入力する。検出部23は、予め異物の検出の基準、例えば、検出のための閾値(例えば、0.5)を予め記憶しておく。検出部23は、対象画像30の画素毎に、第2の推論モデルからの出力である確率の値と閾値とを比較する。確率が閾値以上である画素について、検出部23は、当該画素の部分が異物である(当該画素の部分に異物が写っている)と判断する。確率が閾値以上ではない画素について、検出部23は、当該画素の部分が異物ではない(当該画素の部分に異物が写っておらず正常である)と判断する。また、検出部23は、演算部22によって得られた第2の推論モデルからの出力から対象画像30に含まれる異物の検出を行うものであれば、上記以外の方法で異物を検出してもよい。
 検出部23は、検出結果を示す情報を出力する。検出結果を示す情報の出力は上述した方法と同様に行われればよい。図33の(a)に、第2の推論モデルからの出力(クラスマップ)の例を示す。また、図33の(b)に、この出力が用いられて検出された異物を重畳した対象画像を示す。図33において、横に並んだ複数の丸い部分が異物の部分である。
 上記のように第2の推論モデルを生成して異物の検出に用いることで、容易かつ確実に異物を検出することができる。また、第2の推論モデルから出力される情報は、例えば、上述した異常度マップと比べて、対象画像30に係る様々な条件、対象物(サンプル)に応じたばらつきが小さいものである。従って、異物を検出する際に用いる基準(例えば、上述した閾値)を、対象画像30に係る様々な条件、対象物に応じたものにする必要がなく、容易に設定することができる。そのため、第2の推論モデルを用いることで、対象画像30に係る様々な条件、対象物にかかわらず一律の基準を用いても、安定的かつ適切に異物の検出を行うことができる。
 本開示のモデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデルは、以下の構成を有する。
 [1] 対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成方法であって、
 訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する訓練用取得ステップと、
 前記訓練用取得ステップにおいて取得された訓練用の画像を用いた訓練を行って前記推論モデルを生成するモデル生成ステップと、を含み、
 前記訓練は、前記第1の正常画像に基づく情報を前記推論モデルへの入力とし、当該第1の正常画像に基づく情報を前記推論モデルからの出力とした訓練、前記第2の異物画像に基づく情報を前記推論モデルへの入力とし、前記第2の正常画像に基づく情報を前記推論モデルからの出力とした訓練、及び前記第3の異物画像に基づく情報を前記推論モデルへの入力とし、前記第3の正常画像に基づく情報を前記推論モデルからの出力とした訓練を含むモデル生成方法。
 [2] 前記検出対象として想定されない異物は、自然画像である[1]に記載されたモデル生成方法。
 [3] 前記第2の正常画像及び前記第3の正常画像は、前記第1の正常画像であり、
 前記訓練用取得ステップにおいて、前記第1の正常画像に対して、検出対象として想定される異物を付加して前記第2の異物画像を生成して取得し、前記第1の正常画像に対して、検出対象として想定されない異物を付加して前記第3の異物画像を生成して取得する[1]又は[2]に記載されたモデル生成方法。
 [4] 前記対象物は、特定の種別の物であり、
 前記訓練用取得ステップにおいて取得される第1の正常画像、第2の正常画像、第2の異物画像、第3の正常画像及び第3の異物画像は、前記特定の種別の物が前記訓練用の対象物として写っている画像である[1]~[3]の何れかに記載されたモデル生成方法。
 [5] 前記訓練用取得ステップにおいて取得される第1の正常画像の数、第2の正常画像と第2の異物画像との組み合わせの数、並びに第3の正常画像と第3の異物画像との組み合わせの数の比率は、予め設定された比率である[1]~[4]の何れかに記載されたモデル生成方法。
 [6] 前記検出対象として想定されない異物は、計算式に基づいて描画された画像である[1]~[5]の何れかに記載されたモデル生成方法。
 [7] 前記第3の異物画像は、透過的な付加及び置き換えによる付加の少なくとも何れかによって、前記検出対象として想定されない異物が前記第3の正常画像に付加された画像である[1]~[6]の何れかに記載されたモデル生成方法。
 [8] 前記推論モデルは、複数の層を有するニューラルネットワークを含み、層間での連結を行う構造を有し、連結を経由した後の画像と入力した画像とを足し合わせるモデルである[1]~[7]の何れかにに記載されたモデル生成方法。
 [9] 前記モデル生成ステップにおいて、生成した前記推論モデルの出力側に、当該推論モデルに入力した画像の位置毎の異物の度合いを示す情報を出力する部分を追加した新たな第2の推論モデルを、新たな訓練を行って生成する[1]~[8]の何れかに記載されたモデル生成方法。
 [10] 対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成システムであって、
 訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する取得手段と、
 前記取得手段によって取得された訓練用の画像を用いた訓練を行って前記推論モデルを生成するモデル生成手段と、を備え、
 前記訓練は、前記第1の正常画像に基づく情報を前記推論モデルへの入力とし、当該第1の正常画像に基づく情報を前記推論モデルからの出力とした訓練、前記第2の異物画像に基づく情報を前記推論モデルへの入力とし、前記第2の正常画像に基づく情報を前記推論モデルからの出力とした訓練、及び前記第3の異物画像に基づく情報を前記推論モデルへの入力とし、前記第3の正常画像に基づく情報を前記推論モデルからの出力とした訓練を含むモデル生成システム。
 [11] コンピュータを、対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成システムとして動作させるモデル生成プログラムであって、
 当該コンピュータを、
 訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する取得手段と、
 前記取得手段によって取得された訓練用の画像を用いた訓練を行って前記推論モデルを生成するモデル生成手段と、として機能させ、
 前記訓練は、前記第1の正常画像に基づく情報を前記推論モデルへの入力とし、当該第1の正常画像に基づく情報を前記推論モデルからの出力とした訓練、前記第2の異物画像に基づく情報を前記推論モデルへの入力とし、前記第2の正常画像に基づく情報を前記推論モデルからの出力とした訓練、及び前記第3の異物画像に基づく情報を前記推論モデルへの入力とし、前記第3の正常画像に基づく情報を前記推論モデルからの出力とした訓練を含むモデル生成プログラム。
 [12] [1]~[8]の何れかに記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出方法であって、
 異物の検出対象となる対象画像を取得する検出用取得ステップと、
 前記検出用取得ステップにおいて取得された前記対象画像に基づく情報を、前記推論モデルに入力して演算を行って、前記推論モデルからの出力を得る演算ステップと、
 前記演算ステップにおける前記推論モデルへの入力に係る情報と、前記推論モデルからの出力に係る情報との差分を算出して、算出した差分から前記対象画像に含まれる異物の検出を行う検出ステップと、
を含む異物検出方法。
 [13] [9]に記載のモデル生成方法によって生成された前記第2の推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出方法であって、
 異物の検出対象となる対象画像を取得する検出用取得ステップと、
 前記検出用取得ステップにおいて取得された前記対象画像に基づく情報を、前記第2の推論モデルに入力して演算を行って、前記第2の推論モデルからの出力を得る演算ステップと、
 前記演算ステップにおいて得られた前記第2の推論モデルからの出力から前記対象画像に含まれる異物の検出を行う検出ステップと、
を含む異物検出方法。
 [14] [1]~[8]の何れかに記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムであって、
 異物の検出対象となる対象画像を取得する検出用取得手段と、
 前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記推論モデルに入力して演算を行って、前記推論モデルからの出力を得る演算手段と、
 前記演算手段による前記推論モデルへの入力に係る情報と、前記推論モデルからの出力に係る情報との差分を算出して、算出した差分から前記対象画像に含まれる異物の検出を行う検出手段と、
を備える異物検出システム。
 [15] [9]に記載のモデル生成方法によって生成された前記第2の推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムであって、
 異物の検出対象となる対象画像を取得する検出用取得手段と、
 前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記第2の推論モデルに入力して演算を行って、前記第2の推論モデルからの出力を得る演算手段と、
 前記演算手段によって得られた前記第2の推論モデルからの出力から前記対象画像に含まれる異物の検出を行う検出手段と、
を備える異物検出システム。
 [16] コンピュータを、[1]~[8]の何れかに記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムとして動作させる異物検出プログラムであって、
 当該コンピュータを、
 異物の検出対象となる対象画像を取得する検出用取得手段と、
 前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記推論モデルに入力して演算を行って、前記推論モデルからの出力を得る演算手段と、
 前記演算手段による前記推論モデルへの入力に係る情報と、前記推論モデルからの出力に係る情報との差分を算出して、算出した差分から前記対象画像に含まれる異物の検出を行う検出手段と、
として機能させる異物検出プログラム。
 [17] コンピュータを、[9]に記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムとして動作させる異物検出プログラムであって、
 当該コンピュータを、
 異物の検出対象となる対象画像を取得する検出用取得手段と、
 前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記第2の推論モデルに入力して演算を行って、前記第2の推論モデルからの出力を得る演算手段と、
 前記演算手段によって得られた前記第2の推論モデルからの出力から前記対象画像に含まれる異物の検出を行う検出手段と、
として機能させる異物検出プログラム。
 [18] 画像に基づく情報を入力して、入力に応じた演算を行って情報を出力するようコンピュータを機能させるための推論モデルであって、
 [1]~[8]の何れかに記載のモデル生成方法によって生成されたものである推論モデル。
 10…モデル生成システム、11…訓練用取得部、12…モデル生成部、20…異物検出システム、21…検出用取得部、22…演算部、23…検出部、100…モデル生成プログラム、101…訓練用取得モジュール、102…モデル生成モジュール、110…記録媒体、111…プログラム格納領域、201…検出用取得モジュール、202…演算モジュール、203…検出モジュール、200…異物検出プログラム、210…記録媒体、211…プログラム格納領域。

Claims (18)

  1.  対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成方法であって、
     訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する訓練用取得ステップと、
     前記訓練用取得ステップにおいて取得された訓練用の画像を用いた訓練を行って前記推論モデルを生成するモデル生成ステップと、を含み、
     前記訓練は、前記第1の正常画像に基づく情報を前記推論モデルへの入力とし、当該第1の正常画像に基づく情報を前記推論モデルからの出力とした訓練、前記第2の異物画像に基づく情報を前記推論モデルへの入力とし、前記第2の正常画像に基づく情報を前記推論モデルからの出力とした訓練、及び前記第3の異物画像に基づく情報を前記推論モデルへの入力とし、前記第3の正常画像に基づく情報を前記推論モデルからの出力とした訓練を含むモデル生成方法。
  2.  前記検出対象として想定されない異物は、自然画像である請求項1に記載されたモデル生成方法。
  3.  前記第2の正常画像及び前記第3の正常画像は、前記第1の正常画像であり、
     前記訓練用取得ステップにおいて、前記第1の正常画像に対して、検出対象として想定される異物を付加して前記第2の異物画像を生成して取得し、前記第1の正常画像に対して、検出対象として想定されない異物を付加して前記第3の異物画像を生成して取得する請求項1又は2に記載されたモデル生成方法。
  4.  前記対象物は、特定の種別の物であり、
     前記訓練用取得ステップにおいて取得される第1の正常画像、第2の正常画像、第2の異物画像、第3の正常画像及び第3の異物画像は、前記特定の種別の物が前記訓練用の対象物として写っている画像である請求項1又は2に記載されたモデル生成方法。
  5.  前記訓練用取得ステップにおいて取得される第1の正常画像の数、第2の正常画像と第2の異物画像との組み合わせの数、並びに第3の正常画像と第3の異物画像との組み合わせの数の比率は、予め設定された比率である請求項1又は2に記載されたモデル生成方法。
  6.  前記検出対象として想定されない異物は、計算式に基づいて描画された画像である請求項1又は2に記載されたモデル生成方法。
  7.  前記第3の異物画像は、透過的な付加及び置き換えによる付加の少なくとも何れかによって、前記検出対象として想定されない異物が前記第3の正常画像に付加された画像である請求項1又は2に記載されたモデル生成方法。
  8.  前記推論モデルは、複数の層を有するニューラルネットワークを含み、層間での連結を行う構造を有し、連結を経由した後の画像と入力した画像とを足し合わせるモデルである請求項1又は2に記載されたモデル生成方法。
  9.  前記モデル生成ステップにおいて、生成した前記推論モデルの出力側に、当該推論モデルに入力した画像の位置毎の異物の度合いを示す情報を出力する部分を追加した新たな第2の推論モデルを、新たな訓練を行って生成する請求項1又は2に記載されたモデル生成方法。
  10.  対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成システムであって、
     訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する取得手段と、
     前記取得手段によって取得された訓練用の画像を用いた訓練を行って前記推論モデルを生成するモデル生成手段と、を備え、
     前記訓練は、前記第1の正常画像に基づく情報を前記推論モデルへの入力とし、当該第1の正常画像に基づく情報を前記推論モデルからの出力とした訓練、前記第2の異物画像に基づく情報を前記推論モデルへの入力とし、前記第2の正常画像に基づく情報を前記推論モデルからの出力とした訓練、及び前記第3の異物画像に基づく情報を前記推論モデルへの入力とし、前記第3の正常画像に基づく情報を前記推論モデルからの出力とした訓練を含むモデル生成システム。
  11.  コンピュータを、対象物が写った画像に含まれる異物の検出に用いられる推論モデルを生成するモデル生成システムとして動作させるモデル生成プログラムであって、
     当該コンピュータを、
     訓練用の対象物が写っている第1の正常画像、訓練用の対象物が写っている第2の正常画像、検出対象として想定される異物が第2の正常画像に付加された第2の異物画像、訓練用の対象物が写っている第3の正常画像、及び検出対象として想定されない異物が第3の正常画像に付加された第3の異物画像を訓練用の画像として取得する取得手段と、
     前記取得手段によって取得された訓練用の画像を用いた訓練を行って前記推論モデルを生成するモデル生成手段と、として機能させ、
     前記訓練は、前記第1の正常画像に基づく情報を前記推論モデルへの入力とし、当該第1の正常画像に基づく情報を前記推論モデルからの出力とした訓練、前記第2の異物画像に基づく情報を前記推論モデルへの入力とし、前記第2の正常画像に基づく情報を前記推論モデルからの出力とした訓練、及び前記第3の異物画像に基づく情報を前記推論モデルへの入力とし、前記第3の正常画像に基づく情報を前記推論モデルからの出力とした訓練を含むモデル生成プログラム。
  12.  請求項1又は2に記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出方法であって、
     異物の検出対象となる対象画像を取得する検出用取得ステップと、
     前記検出用取得ステップにおいて取得された前記対象画像に基づく情報を、前記推論モデルに入力して演算を行って、前記推論モデルからの出力を得る演算ステップと、
     前記演算ステップにおける前記推論モデルへの入力に係る情報と、前記推論モデルからの出力に係る情報との差分を算出して、算出した差分から前記対象画像に含まれる異物の検出を行う検出ステップと、
    を含む異物検出方法。
  13.  請求項9に記載のモデル生成方法によって生成された前記第2の推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出方法であって、
     異物の検出対象となる対象画像を取得する検出用取得ステップと、
     前記検出用取得ステップにおいて取得された前記対象画像に基づく情報を、前記第2の推論モデルに入力して演算を行って、前記第2の推論モデルからの出力を得る演算ステップと、
     前記演算ステップにおいて得られた前記第2の推論モデルからの出力から前記対象画像に含まれる異物の検出を行う検出ステップと、
    を含む異物検出方法。
  14.  請求項1又は2に記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムであって、
     異物の検出対象となる対象画像を取得する検出用取得手段と、
     前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記推論モデルに入力して演算を行って、前記推論モデルからの出力を得る演算手段と、
     前記演算手段による前記推論モデルへの入力に係る情報と、前記推論モデルからの出力に係る情報との差分を算出して、算出した差分から前記対象画像に含まれる異物の検出を行う検出手段と、
    を備える異物検出システム。
  15.  請求項9に記載のモデル生成方法によって生成された前記第2の推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムであって、
     異物の検出対象となる対象画像を取得する検出用取得手段と、
     前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記第2の推論モデルに入力して演算を行って、前記第2の推論モデルからの出力を得る演算手段と、
     前記演算手段によって得られた前記第2の推論モデルからの出力から前記対象画像に含まれる異物の検出を行う検出手段と、
    を備える異物検出システム。
  16.  コンピュータを、請求項1又は2に記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムとして動作させる異物検出プログラムであって、
     当該コンピュータを、
     異物の検出対象となる対象画像を取得する検出用取得手段と、
     前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記推論モデルに入力して演算を行って、前記推論モデルからの出力を得る演算手段と、
     前記演算手段による前記推論モデルへの入力に係る情報と、前記推論モデルからの出力に係る情報との差分を算出して、算出した差分から前記対象画像に含まれる異物の検出を行う検出手段と、
    として機能させる異物検出プログラム。
  17.  コンピュータを、請求項9に記載のモデル生成方法によって生成された前記推論モデルを用いて、対象物が写った画像に含まれる異物の検出を行う異物検出システムとして動作させる異物検出プログラムであって、
     当該コンピュータを、
     異物の検出対象となる対象画像を取得する検出用取得手段と、
     前記検出用取得手段によって取得された前記対象画像に基づく情報を、前記第2の推論モデルに入力して演算を行って、前記第2の推論モデルからの出力を得る演算手段と、
     前記演算手段によって得られた前記第2の推論モデルからの出力から前記対象画像に含まれる異物の検出を行う検出手段と、
    として機能させる異物検出プログラム。
  18.  画像に基づく情報を入力して、入力に応じた演算を行って情報を出力するようコンピュータを機能させるための推論モデルであって、
     請求項1又は2に記載のモデル生成方法によって生成されたものである推論モデル。
PCT/JP2023/032684 2023-01-18 2023-09-07 モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル Ceased WO2024154379A1 (ja)

Priority Applications (5)

Application Number Priority Date Filing Date Title
EP23917591.2A EP4625313A1 (en) 2023-01-18 2023-09-07 Model generation method, model generation system, model generation program, foreign substance detection method, foreign substance detection system, foreign substance detection program, and inference model
JP2023573665A JP7424572B1 (ja) 2023-01-18 2023-09-07 モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル
CN202380091701.8A CN120569753A (zh) 2023-01-18 2023-09-07 模型生成方法、模型生成系统、模型生成程序、异物检测方法、异物检测系统、异物检测程序及推论模型
KR1020257026571A KR20250137617A (ko) 2023-01-18 2023-09-07 모델 생성 방법, 모델 생성 시스템, 모델 생성 프로그램, 이물 검출 방법, 이물 검출 시스템, 이물 검출 프로그램 및 추론 모델
JP2024001044A JP2024102002A (ja) 2023-01-18 2024-01-09 モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
JP2023-006083 2023-01-18
JP2023006083 2023-01-18
JP2023080717 2023-05-16
JP2023-080717 2023-05-16

Publications (1)

Publication Number Publication Date
WO2024154379A1 true WO2024154379A1 (ja) 2024-07-25

Family

ID=91955772

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2023/032684 Ceased WO2024154379A1 (ja) 2023-01-18 2023-09-07 モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル

Country Status (2)

Country Link
TW (1) TW202445505A (ja)
WO (1) WO2024154379A1 (ja)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018225745A1 (ja) * 2017-06-06 2018-12-13 株式会社デンソー 外観検査装置、変換データ生成装置、及びプログラム
JP2022062303A (ja) * 2020-10-08 2022-04-20 株式会社イシダ X線検査装置、x線検査プログラム、x線検査方法、物品検査システム

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018225745A1 (ja) * 2017-06-06 2018-12-13 株式会社デンソー 外観検査装置、変換データ生成装置、及びプログラム
JP2018205163A (ja) 2017-06-06 2018-12-27 株式会社デンソー 外観検査装置、変換データ生成装置、及びプログラム
JP2022062303A (ja) * 2020-10-08 2022-04-20 株式会社イシダ X線検査装置、x線検査プログラム、x線検査方法、物品検査システム

Also Published As

Publication number Publication date
TW202445505A (zh) 2024-11-16

Similar Documents

Publication Publication Date Title
CN110619618B (zh) 一种表面缺陷检测方法、装置及电子设备
WO2020031984A1 (ja) 部品の検査方法及び検査システム
CN114092386A (zh) 缺陷检测方法和设备
CN112823375A (zh) 使用前向扭曲、间隙鉴别器和基于坐标的修复的图像再合成
US12217411B2 (en) Inspection apparatus, unit selection apparatus, inspection method, and computer-readable storage medium storing an inspection program
CN114565594A (zh) 基于软掩膜对比损失的图像异常检测方法
CN113129272A (zh) 一种基于去噪卷积自编码器的缺陷检测方法及装置
CN112528782A (zh) 水下鱼类目标检测方法及装置
CN115830004A (zh) 表面缺陷检测方法、装置、计算机设备和存储介质
EP4107662A1 (en) Out-of-distribution detection of input instances to a model
CN115953347B (zh) 一种单视角下工业缺陷检测方法及系统
CN117058450B (zh) 一种基于自适应掩码重构的异常检测方法及装置
CN119599956B (zh) 一种基于深度学习的键合引线缺陷检测方法
JP2023123387A (ja) 欠陥検出方法およびシステム
CN113034432B (zh) 一种产品缺陷检测方法、系统、装置及存储介质
CN115880176A (zh) 多尺度非成对水下图像增强方法
WO2024154379A1 (ja) モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル
JP2024102002A (ja) モデル生成方法、モデル生成システム、モデル生成プログラム、異物検出方法、異物検出システム、異物検出プログラム及び推論モデル
CN113822286A (zh) 设备视觉检测方法、电子设备、存储介质和程序产品
Si et al. Tfr: Texture defect detection with fourier transform using normal reconstructed template of simple autoencoder
CN115428012A (zh) 图像检查装置、图像检查方法以及学习完毕模型生成装置
CN118072310A (zh) 基于多视角语义距离和约束图像重建的无监督异常检测方法
BAKIR et al. A Deep Learning-Based Approach for Image Denoising: Harnessing Autoencoders for Removing Gaussian and Salt-Peper Noises
CN116342395A (zh) 图像修复方法、图像修复装置、电子设备、介质
CN118072148B (zh) 一种精密滚珠丝杠副检测系统及其方法

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 2023573665

Country of ref document: JP

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23917591

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2023917591

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2023917591

Country of ref document: EP

Effective date: 20250627

WWE Wipo information: entry into national phase

Ref document number: 202380091701.8

Country of ref document: CN

ENP Entry into the national phase

Ref document number: 1020257026571

Country of ref document: KR

Free format text: ST27 STATUS EVENT CODE: A-0-1-A10-A15-NAP-PA0105 (AS PROVIDED BY THE NATIONAL OFFICE)

WWE Wipo information: entry into national phase

Ref document number: 1020257026571

Country of ref document: KR

NENP Non-entry into the national phase

Ref country code: DE

WWP Wipo information: published in national office

Ref document number: 202380091701.8

Country of ref document: CN

WWP Wipo information: published in national office

Ref document number: 2023917591

Country of ref document: EP