An object identification method, device and readable storage medium based on artificial intelligence
Through the object identification method based on artificial intelligence, repaired images with the same or similar imaging conditions are generated, and deep learning matching network comparison is used to solve the problem of misjudgment caused by different product images in the physical manufacturing industry, and improve detection accuracy and quality. Rate.
Patent Information
- Application Number
- CN202011217756.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-04
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-11-04
AI Technical Summary
In the physical manufacturing industry, product images of the same batch of products are different, which can easily lead to non-defective products being misjudged as defective, resulting in a high error rate.
Using an artificial intelligence-based object identification method, the first image of the object to be identified is obtained and input into a pre-trained model to generate a second image with the same or similar imaging conditions. The image of the repaired object is then processed using a deep learning matching network. Compare to determine whether there are defects in the object to be identified.
It improves the accuracy of identifying whether the object to be identified is intact, improves the yield rate, reduces misjudgments, and improves the accuracy of product detection.
Smart Images

Figure CN112419241B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of object identification technology, and in particular to an object identification method, device and readable storage medium based on artificial intelligence. Background Art
[0002] In the physical manufacturing industry, product images are often used to determine whether the product has defects. The specific method is to compare the product image with the product template image and determine whether the product has defects based on the comparison results.
[0003] However, in actual applications, the product images taken for the same batch of products are often different. If product images with different appearances are compared with the same product template image, it is easy to cause non-defective products to be misjudged as defective, with a high error rate. Summary of the invention
[0004] Embodiments of the present invention provide an artificial intelligence-based object identification method, device, and readable storage medium for improving the accuracy of determining whether an object to be identified has defects.
[0005] On the one hand, the present invention provides an object identification method based on artificial intelligence, the method comprising: acquiring a first image, wherein the first image contains an object to be identified; inputting the first image into a pre-trained model to generate a second image, wherein the second image contains a restored object, the restored object in the second image has the same or similar imaging conditions as the object to be identified in the first image, and the restored object represents that the defect on the object to be identified has been repaired; based on the first image and the second image, determining whether the object to be identified has a defect.
[0006] In one possible implementation manner, the model is a GAN model, and the model training process is: inputting a plurality of image samples into the GAN model for training, wherein the plurality of image samples are defect-free samples.
[0007] In one possible implementation, the GAN model applies a loss function based on an absolute error algorithm.
[0008] In one possible implementation, determining whether the object to be identified has defects based on the first image and the second image includes: inputting the first image and the second image into a matching network based on deep learning for comparison, and outputting a comparison result for characterizing whether the object to be identified has defects.
[0009] In one possible implementation manner, inputting the first image and the second image into a deep learning-based matching network for comparison includes: identifying and acquiring an object to be identified in the first image and a restored object in the second image; and inputting the identified object to be identified and the restored object into the matching network for comparison.
[0010] In one possible implementation, the matching network is a twin network.
[0011] In one possible implementation, the first image and the second image include images, videos, and 3D models.
[0012] In one possible implementation manner, the elements of the imaging conditions include the shooting distance, shooting angle and shooting illumination of the image and the position of the object in the image.
[0013] Another aspect of the present invention provides an object identification device based on artificial intelligence, the device comprising: a data acquisition module, used to acquire a first image, wherein the first image contains an object to be identified; a data generation module, used to input the first image into a pre-trained model to generate a second image, wherein the second image contains a repaired object, the repaired object in the second image has the same or similar imaging conditions as the object to be identified in the first image, and the repaired object represents that the defect on the object to be identified has been repaired; a data identification module, used to determine whether the object to be identified has a defect based on the first image and the second image.
[0014] Another aspect of the present invention provides a computer-readable storage medium, which includes a set of computer-executable instructions, and when the instructions are executed, is used to execute any of the above-mentioned artificial intelligence-based object identification methods.
[0015] In an embodiment of the present invention, this scheme generates a second image with the same or similar imaging conditions for each first image. When used, the second image is used as a comparison template to determine whether there are defects in the object to be identified in the first image, which can improve the accuracy of whether the object to be identified is intact and improve the yield rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, in which:
[0017] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0018] Figure 1A schematic diagram of an implementation flow of an object identification method based on artificial intelligence according to an embodiment of the present invention;
[0019] Figure 2 is a schematic diagram of an object to be identified as a nut in an embodiment of the present invention;
[0020] Figure 3 is a schematic diagram of an object to be identified in an embodiment of the present invention being a computer motherboard;
[0021] Figure 4 is a schematic diagram of an object to be identified as a kitten in an embodiment of the present invention;
[0022] Figure 5 is a schematic diagram of a first image and a restored second image in an embodiment of the present invention;
[0023] Figure 6 Schematic diagram of repairing a non-defective object and a defective object in an embodiment of the present invention;
[0024] Figure 7 The figure is a schematic diagram of the structure of an object identification device based on artificial intelligence according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0026] Figure 1 The present invention is a flowchart of an implementation method of an object identification method based on artificial intelligence.
[0027] like Figure 1 As shown, the present invention provides an object identification method based on artificial intelligence, the method comprising:
[0028] Step 101, obtaining a first image, wherein the first image contains an object to be identified;
[0029] Step 102, inputting the first image into a pre-trained model to generate a second image, wherein the second image contains a repaired object, the repaired object in the second image has the same or similar imaging conditions as the object to be identified in the first image, and the repaired object indicates that the defect on the object to be identified has been repaired;
[0030] Step 103: Determine whether the object to be identified has defects based on the first image and the second image.
[0031] In this embodiment, in step 101, the first image and the second image may be images, videos or 3D models. The object to be identified may be food (e.g. Figure 2 Nuts shown), product parts (such as Figure 3 Computer motherboard parts shown) or plants and animals (such as Figure 4 kitten shown).
[0032] In step 102, the pre-trained model may be a TV (Total Variation) model, a GAN model or an ImageNet model, which is mainly used to repair the input first image and generate a second image containing the repaired object. Figure 5 As shown, the nut image in the first image is the object to be identified. It can be seen that there is a black defect on the nut image. After being repaired by the pre-trained model, the black defect on the nut image in the second image has been repaired to form a complete nut image; if the nut image in the first image is a defect-free image, then after the first image is repaired by the pre-trained model, the appearance of the second image is almost the same as the first image.
[0033] Continue to refer Figure 5 As shown, the imaging conditions of the restored object in the second image and the object to be identified in the first image are the same or similar, wherein the same imaging conditions refer to the same position, shape, size, lighting, angle, etc. of the object to be identified and the restored object in the image; similar imaging conditions refer to the object to be identified and the restored object having only slight differences in the overall image comparison, wherein the slight differences include differences in overall shape and size, color, etc. In addition, regarding the background images of the first image and the second image, it should be noted that the background images of the two can be the same, for example, the background images of the first image and the second image are the same grass; the background images of the two can also be inconsistent, for example, the background image of the first image is pure black, while the background image of the second image is pure blue or even no background image.
[0034] In step 103, the method for determining whether the object to be identified has defects can be: identifying and extracting the object in the first image and the second image, and comparing the pixel values of the object to be identified and the restored object, or directly comparing the pixel values of the first image and the second image, and determining whether the object to be identified has defects based on the difference in comprehensive pixel values; or the first image and the second image can be input into a pre-trained network model (such as a twin network) for image similarity comparison for image matching, and determining whether the object to be identified has defects based on the model output result.
[0035] Therefore, this solution generates a second image with the same or similar imaging conditions for each first image. When used, the second image is used as a comparison template to determine whether there are defects in the object to be identified in the first image, which can improve the accuracy of whether the object to be identified is intact and improve the yield rate.
[0036] This solution can be applied to the physical manufacturing industry. For example, if the first image is a computer motherboard, and the object to be identified is a memory slot and there is a fracture defect in the memory slot, then a second image containing a complete memory slot is generated through the model. Since the imaging conditions of the first image and the second image are the same or similar, the generated second image is roughly the same in appearance as the first image, and there is only a difference in pixels at the fracture of the memory slot. At this time, when the second image is used as a template and compared with the first image, it is easy to determine that the memory slot on the current motherboard has a defect and needs to be repaired. If the memory slot in the first image has no defects, then the memory slot in the generated second image is also defective. The first image and the second image are the same or similar in appearance, so it is determined that the memory slot on the current motherboard has no defects.
[0037] This solution can also be applied to art or 3D evaluation teaching. If the first image is a painting or a 3D modeling work, and the object to be identified is a painting content or a modeling model, the first image is restored by a pre-trained model to generate a second image. By comparing the first image and the second image, it can be determined whether the original work is complete. The evaluator can refer to the judgment result to make a comprehensive score.
[0038] This solution can also be applied to the appearance inspection of annual vehicle inspections. In this case, the first image is the vehicle to be inspected, and the object to be identified is the entire vehicle or a part of the vehicle. The first image is repaired by a pre-trained model to generate a second image. By comparing the first image and the second image, it can be determined whether the current vehicle to be inspected is complete. The evaluator can refer to the judgment result to conduct a comprehensive inspection.
[0039] In one possible implementation, the model is a GAN model, and the model training process is:
[0040] A plurality of image samples are input into the GAN model for training, wherein the plurality of image samples are defect-free samples.
[0041] In this embodiment, the GAN model is composed of a generative model and a discriminative model, wherein the generative model is used to capture the distribution of sample data, and uses noise that obeys a certain distribution (uniform distribution, Gaussian distribution, etc.) to generate a sample similar to the real training data, and the effect is to make it as similar to the real sample as possible; the discriminative model is a binary classifier, which estimates the probability that a sample comes from training data (rather than generated data). If the sample comes from the real training data, the discriminative model outputs a high probability, otherwise, the discriminative model outputs a small probability.
[0042] The model training process of this solution is: a large number of defect-free image samples are used as sample data for training to reconstruct the model, so that the model learns the distribution of normal data, and finally the effect achieved by the GAN model is: Figure 6 As shown in the figure, the image of a nut without defects is used as the input of the GAN model, and an image that is almost the same as the nut itself is obtained; the image of a nut with defects is used as the input of the GAN model, and an image with repaired defects is obtained.
[0043] In one embodiment, the GAN model applies a loss function based on an absolute error algorithm.
[0044] In this embodiment, the existing GAN model mainly uses a loss function based on an absolute error algorithm (called L1) and a loss function based on a mean square error algorithm (called L2). This solution uses a loss function based on an absolute error algorithm to make the image closer to reality.
[0045] In one possible implementation, determining whether the object to be identified has defects based on the first image and the second image includes:
[0046] The first image and the second image are input into a matching network based on deep learning for comparison, and a comparison result is output to characterize whether the object to be identified has defects.
[0047] In this embodiment, the matching network can be a twin network, a MatchNet model, etc., preferably a twin network, which is used to compare the similarity of the two images. If the result output by the matching network indicates that the similarity between the two is high, it is determined that the object to be identified in the first image is free of defects. Conversely, if the result output by the matching network indicates that the similarity between the two is low, it is determined that the object to be identified in the first image is defective.
[0048] In one possible implementation, inputting the first image and the second image into a matching network based on deep learning for comparison includes:
[0049] Identify and obtain the object to be identified in the first image and the restored object in the second image;
[0050] The identified object to be identified and the repaired object are input into the matching network for comparison.
[0051] In this embodiment, when comparing images, a mature object model dedicated to this scheme (such as a MobileNet model) can be used to identify the object to be identified in the first image and the restored object in the second image, and then the restored object and the object to be identified are input into the matching network for comparison. Compared with inputting the first image and the second image into the matching network, this scheme can reduce the amount of calculation for the background image in the image and improve the success rate of identification.
[0052] In one possible implementation, the matching network is a twin network.
[0053] In this embodiment, the input value of the twin network is the first image and the second image, and the output is a value representing the similarity between the first image and the second image. If the value is higher than the first preset threshold, it means that the first image and the second image are highly similar, that is, the object to be identified in the first image has no defects; if the value is lower than the second preset threshold, it means that the first image and the second image are less similar, that is, the object to be identified in the first image has defects. The first preset threshold and the second preset threshold can be the same threshold, and the first preset threshold and the second preset threshold can be set according to the precision requirements required in actual use.
[0054] In one possible implementation manner, the elements of the imaging conditions include the shooting distance, shooting angle and shooting illumination of the image and the position of the object in the image.
[0055] In this embodiment, the shooting distance of the image is the distance between the shooting device and the object to be identified, and the shooting angle is the shooting direction of the shooting device. If the imaging conditions are the same, then the restored object in the generated second image is consistent with the object to be identified in the first image in shape, size, color and position of the object in the image.
[0056] Figure 7 The figure is a schematic diagram of the structure of an object identification device based on artificial intelligence according to an embodiment of the present invention.
[0057] like Figure 7 As shown, another aspect of the present invention provides an object identification device based on artificial intelligence, the device comprising:
[0058] The data acquisition module 201 is used to acquire a first image, wherein the first image contains an object to be identified;
[0059] The data generation module 202 is used to input the first image into a pre-trained model to generate a second image, wherein the second image contains a repaired object, the imaging conditions of the repaired object in the second image are the same or similar to those of the object to be identified in the first image, and the repaired object indicates that the defect on the object to be identified has been repaired;
[0060] The data identification module 203 is used to determine whether the object to be identified has defects based on the first image and the second image.
[0061] In this embodiment, in the data acquisition module 201, the first image and the second image can be images, videos or 3D models. The object to be identified can be food (such as Figure 2 Nuts shown), product parts (such as Figure 3 Computer motherboard parts shown) or plants and animals (such as Figure 4 kitten shown).
[0062] In the data generation module 202, the pre-trained model may be a TV (Total Variation) model, a GAN model or an ImageNet model, which is mainly used to repair the input first image and generate a second image containing the repaired object. Figure 5 As shown, the nut image in the first image is the object to be identified. It can be seen that there is a black defect on the nut image. After being repaired by the pre-trained model, the black defect on the nut image in the second image has been repaired to form a complete nut image; if the nut image in the first image is a defect-free image, then after the first image is repaired by the pre-trained model, the appearance of the second image is almost the same as the first image.
[0063] Continue to refer Figure 5 As shown, the imaging conditions of the restored object in the second image and the object to be identified in the first image are the same or similar, wherein the same imaging conditions refer to the same position, shape, size, lighting, angle, etc. of the object to be identified and the restored object in the image; similar imaging conditions refer to the object to be identified and the restored object having only slight differences in the overall image comparison, wherein the slight differences include differences in overall shape and size, color, etc. In addition, regarding the background images of the first image and the second image, it should be noted that the background images of the two can be the same, for example, the background images of the first image and the second image are the same grass; the background images of the two can also be inconsistent, for example, the background image of the first image is pure black, while the background image of the second image is pure blue or even no background image.
[0064] In the data identification module 203, the method for determining whether the object to be identified has defects can be: identifying and extracting the object in the first image and the second image, and comparing the pixel values of the object to be identified and the repaired object, or directly comparing the pixel values of the first image and the second image, and determining whether the object to be identified has defects based on the difference in the comprehensive pixel values; or the first image and the second image can be input into a pre-trained network model (such as a twin network) for image similarity comparison, and determining whether the object to be identified has defects based on the model output result.
[0065] Therefore, this solution generates a second image with the same or similar imaging conditions for each first image. When used, the second image is used as a comparison template to determine whether there are defects in the object to be identified in the first image, which can improve the accuracy of whether the object to be identified is intact and improve the yield rate.
[0066] This solution can be applied to the physical manufacturing industry. For example, if the first image is a computer motherboard, and the object to be identified is a memory slot and there is a fracture defect in the memory slot, then a second image containing a complete memory slot is generated through the model. Since the imaging conditions of the first image and the second image are the same or similar, the generated second image is roughly the same in appearance as the first image, and there is only a difference in pixels at the fracture of the memory slot. At this time, when the second image is used as a template and compared with the first image, it is easy to determine that the memory slot on the current motherboard has a defect and needs to be repaired. If the memory slot in the first image has no defects, then the memory slot in the generated second image is also defective. The first image and the second image are the same or similar in appearance, so it is determined that the memory slot on the current motherboard has no defects.
[0067] This solution can also be applied to art or 3D evaluation teaching. The first image is a painting or a 3D modeling work. If the object to be identified is a painting content or a modeling model, the first image is restored by the model to generate a second image. By comparing the first image and the second image, it can be determined whether the original work is complete, and the judgment result can be used as a reference for scoring.
[0068] This solution can also be applied to the appearance inspection of annual vehicle inspections. In this case, the first image is the vehicle to be inspected, and the object to be identified is the entire vehicle or a part of the vehicle. The first image is repaired by a pre-trained model to generate a second image. By comparing the first image and the second image, it can be determined whether the current vehicle to be inspected is complete. The evaluator can refer to the judgment result to conduct a comprehensive inspection.
[0069] In one embodiment, the data identification module 203 is specifically used for:
[0070] The first image and the second image are input into a matching network based on deep learning for comparison, and a comparison result is output to characterize whether the object to be identified has defects.
[0071] In this embodiment, the matching network can be a twin network, a MatchNet model, etc., preferably a twin network, which is used to compare the similarity of the two images. If the result output by the matching network indicates that the similarity between the two is high, it is determined that the object to be identified in the first image is free of defects. Conversely, if the result output by the matching network indicates that the similarity between the two is low, it is determined that the object to be identified in the first image is defective.
[0072] In one embodiment, when the data identification module 203 inputs the first image and the second image into a matching network based on deep learning for comparison, it is specifically used to:
[0073] Identify and obtain the object to be identified in the first image and the restored object in the second image;
[0074] The identified object to be identified and the repaired object are input into the matching network for comparison.
[0075] In this embodiment, when comparing images, a mature object model dedicated to this scheme (such as a MobileNet model) can be used to identify the object to be identified in the first image and the restored object in the second image, and then the restored object and the object to be identified are input into the matching network for comparison. Compared with inputting the first image and the second image into the matching network, this scheme can reduce the amount of calculation for the background image in the image and improve the success rate of identification.
[0076] Another aspect of the present invention provides a computer-readable storage medium, which includes a set of computer-executable instructions, and when the instructions are executed, is used to execute any of the above-mentioned artificial intelligence-based object identification methods.
[0077] In an embodiment of the present invention, a computer-readable storage medium includes a set of computer-executable instructions, which, when executed, are used to obtain a first image, wherein the first image contains an object to be identified; input the first image into a pre-trained model to generate a second image, wherein the second image contains a restored object, the restored object in the second image has the same or similar imaging conditions as those represented by the object to be identified in the first image, and the restored object represents that a defect on the object to be identified has been repaired; based on the first image and the second image, determine whether the object to be identified has a defect.
[0078] Therefore, this solution generates a second image with the same or similar imaging conditions for each first image. When used, the second image is used as a comparison template to determine whether the object to be identified in the first image has defects. When applied to the physical manufacturing industry, this solution can improve the accuracy of identifying whether the product is intact and improve the yield rate.
[0079] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0080] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0081] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An object identification method based on artificial intelligence, the method comprising: Acquire a first image, wherein the first image contains an object to be identified; Inputting the first image into a pre-trained model to generate a second image, wherein the second image contains a repaired object, the repaired object in the second image has the same or similar imaging conditions as the object to be identified in the first image, the repaired object indicates that the defect on the object to be identified has been repaired, and the elements of the imaging conditions include the shooting distance, shooting angle and shooting illumination of the image and the position of the object in the image; Determining whether the object to be identified has defects based on the first image and the second image; Wherein, determining whether the object to be identified has defects based on the first image and the second image includes: Inputting the first image and the second image into a matching network based on deep learning for comparison, and outputting a comparison result for characterizing whether the object to be identified has defects; The step of inputting the first image and the second image into a matching network based on deep learning for comparison includes: Identify and obtain the object to be identified in the first image and the restored object in the second image; The identified object to be identified and the repaired object are input into the matching network for comparison.
2. According to the method of claim 1, the model is a GAN model, and the model training process is: A plurality of image samples are input into the GAN model for training, wherein the plurality of image samples are defect-free samples.
3. The method according to claim 2, wherein the GAN model applies a loss function based on an absolute error algorithm.
4. According to the method of claim 1, the matching network is a twin network. The method according to claim 1 , wherein the first image and the second image include images, videos and 3D models.
6. An object identification device based on artificial intelligence, the device comprising: A data acquisition module, used for acquiring a first image, wherein the first image contains an object to be identified; a data generation module, configured to input the first image into a pre-trained model to generate a second image, wherein the second image contains a repaired object, the repaired object in the second image has the same or similar imaging conditions as those represented by the object to be identified in the first image, the repaired object represents that the defects on the object to be identified have been repaired, and the elements of the imaging conditions include the shooting distance, shooting angle and shooting illumination of the image and the position of the object in the image; a data identification module, configured to determine whether the object to be identified has defects based on the first image and the second image; Wherein, determining whether the object to be identified has defects based on the first image and the second image includes: Inputting the first image and the second image into a matching network based on deep learning for comparison, and outputting a comparison result for characterizing whether the object to be identified has defects; The step of inputting the first image and the second image into a matching network based on deep learning for comparison includes: Identify and obtain the object to be identified in the first image and the restored object in the second image; The identified object to be identified and the repaired object are input into the matching network for comparison.
7. A readable storage medium, comprising a set of computer executable instructions, which are used to execute the artificial intelligence-based object identification method according to any one of claims 1 to 5 when the instructions are executed.
