Small sample color matching method, system and equipment for industrial identification

By determining the initial lighting plan and adjusting the area of ​​interest, combined with industrial large models and template matching, the problem of color recognition under small samples and workpiece offsets in the industrial field is solved, rapid positioning and accurate recognition are achieved, and GPU resource requirements and cost.

CN118864901APending Publication Date: 2024-10-29SPEEDBOT ROBOTICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410897436.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Existing color recognition methods are difficult to achieve rapid positioning and accurate color recognition in the industrial field with a small number of samples and workpiece offsets, and due to the diversity of lighting environments and high-cost GPU resource requirements, existing methods have difficulty maintaining positioning. There are deficiencies in reducing costs without compromising speed and accuracy.

Method used

By determining the initial lighting scheme, obtaining the area of ​​interest with high color discrimination, making a color template, using main color extraction and color feature mean value to perform small sample color matching, and adjusting the lighting scheme or target area when the misrecognition rate is high, Combined with industrial large models and template matching to achieve rapid positioning and color recognition.

Benefits of technology

It achieves rapid positioning and color recognition in the case of a small number of samples and workpiece offsets, improves the accuracy and universality of color recognition of the entire vehicle and small workpieces, and reduces GPU resource requirements and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864901A_ABST
    Figure CN118864901A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision, in particular to a small sample color matching method, system and device for industrial identification and a computer program product, and the method comprises the steps: firstly, preliminarily determining a lighting scheme, and enabling the color of a to-be-detected target color region to be distinguished; and realizing rapid positioning of a target color area by using an industrial large model and a template matching method. And finally, performing small sample color matching by using a main color extraction and color feature mean value method, and performing adjustment aiming at a polishing scheme or a target color region position of the workpiece under the condition of high color matching error recognition rate. Therefore, according to the scene needing color recognition in the industrial fields such as color recognition of a whole vehicle and small workpieces thereof, the color matching algorithm based on target workpiece positioning not only can match colors in the whole image, but also can position specific small workpieces in the image for color matching; and rapid positioning and color identification can be realized under the conditions of a small number of samples and workpiece deviation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a small sample color matching method, system and device for industrial identification. Background Art

[0002] For scenes that require color recognition in the industrial field, such as color recognition of whole vehicles and their small workpieces, the existing color matching algorithms mainly use color cast correction, color balancing algorithms, etc. to remove the interference of the lighting environment on the target color area. Then use the histogram to obtain the color with the most image pixels or perform color recognition by template matching. Usually, these algorithms only compare with the current color and not with other colors. In the industrial field, color recognition is mainly used to prevent workpieces from being misassembled into other color workpieces, so the above methods have poor accuracy in identifying wrong colors. At the same time, since the algorithm has diverse interference with the lighting environment, and different correction parameters are usually designed based on human prior knowledge. Therefore, the effect of correcting the color only through software algorithms in the recognition of similar colors is limited. In the color recognition of whole vehicles including their small workpieces, there is no situation where the area of ​​interest is manually located and then color matching is performed. However, the above color matching method only considers the color matching of the entire area, and there is no corresponding positioning algorithm, so it is not universal in the industrial field.

[0003] For existing target positioning algorithms, they are usually based on target detection models such as YOLOv8 and trained with a large amount of data. However, in the industrial field, facing a new scenario with a small amount of data, how to quickly deploy is an urgent problem to be solved. At the same time, due to the limited GPU resources on the factory site, if all models are used for positioning of small workpieces involved in the whole vehicle, the graphics card cost will be too high. Therefore, the current method still needs to be improved in terms of minimizing costs while maintaining positioning speed and accuracy.

[0004] It can be seen that the existing color recognition methods are difficult to quickly locate and perform color recognition when there are a small number of samples and the workpiece is offset. Summary of the invention

[0005] The present invention provides a small sample color matching method, system, device and computer program product for industrial identification, so as to solve the problem that the existing color identification method is difficult to quickly locate and perform color identification when there are a small number of samples and the workpiece is offset.

[0006] In order to achieve the above object, the present invention is implemented by the following technical solutions:

[0007] In a first aspect, the present invention provides a small sample color matching method for industrial identification, comprising:

[0008] S1: Determine the initial lighting scheme for the target to be detected based on the imaging results of different exposures;

[0009] S2: Determine the color area of ​​the target to be detected under the initial lighting scheme, and obtain N regions of interest whose color distinction exceeds the color distinction threshold; and make a color template corresponding to each color;

[0010] S3: Locate the target color area based on the region of interest and the color template;

[0011] S4: The color with the most pixels is regarded as the main color, and small sample color matching is performed using the main color extraction and color feature mean method;

[0012] S5: When the color matching misrecognition rate exceeds the misrecognition threshold, if the target to be detected is larger than the set threshold, first try to adjust the target area of ​​interest; if the target to be detected is smaller than the set threshold or the target color distinction is smaller than the set distinction threshold, adjust the initial lighting scheme.

[0013] In a second aspect, the present application provides a small sample color matching system for industrial identification, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method of the first aspect when executing the computer program.

[0014] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of the first aspect when executing the computer program.

[0015] Beneficial effects:

[0016] The small sample color matching method for industrial identification provided by the present invention first preliminarily determines the lighting scheme so that the color of the target color area to be inspected is distinguishable. Secondly, the industrial large model and template matching method are used to realize the rapid positioning of the target color area. Finally, the main color extraction and color feature mean method are used to perform small sample color matching. When the color matching misrecognition rate is high, the lighting scheme of the workpiece or the position of the target color area is adjusted; in this way, for scenes requiring color recognition in industrial fields such as color recognition of whole vehicles and their small workpieces, a color matching algorithm based on the positioning of the target workpiece is used, so that the algorithm can not only match the color of the whole picture but also locate the specific small workpiece in the picture for color matching, and can achieve rapid positioning and color recognition in the case of a small number of samples and workpiece offset.

[0017] In a further solution, by comparing templates of different colors and selecting the color classification that best matches the target color ROI area, workpieces with incorrect colors can be detected more accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 One of the flow charts of a small sample color matching method for industrial identification according to a preferred embodiment of the present invention;

[0019] Figure 2 This is the second flow chart of a small sample color matching method for industrial identification according to a preferred embodiment of the present invention;

[0020] Figure 3 It is a schematic diagram of imaging results of different exposure levels in a preferred embodiment of the present invention;

[0021] Figure 4 A schematic diagram of a color template corresponding to each color in a preferred embodiment of the present invention;

[0022] Figure 5 Schematic diagram of the process of locating target color according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0023] The technical solution of the present invention is described clearly and completely below. 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] Unless otherwise defined, the technical terms or scientific terms used in the present invention shall have the usual meanings understood by persons with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one" or "one" do not indicate quantity restrictions, but indicate the existence of at least one. Words such as "connect" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the object being described changes, the relative positional relationship also changes accordingly.

[0025] See also Figure 1-Figure 2 , the present application provides a small sample color matching method for industrial identification, comprising:

[0026] S1: Determine an initial lighting scheme for the target to be detected based on imaging results at different exposure levels.

[0027] In this step, the imaging results of different exposures can be found in Figure 3 ,in, Figure 3(a) is the imaging result of 8000 exposures. Figure 3 (b) is the imaging result of 10000 exposures. Figure 3 (c) is the imaging result of 12000 exposures.

[0028] S2: Determine the color region of the target to be detected under the initial lighting scheme, and obtain N regions of interest whose color distinction exceeds the color distinction threshold; and make a color template corresponding to each color.

[0029] In this step, the value range of N can be 1-5. In one example, N is 1, and in another example, N is 5. This is only an example and is not limited.

[0030] S3: Locate the target color region based on the region of interest and the color template.

[0031] In this step, the region of interest can be abbreviated as ROI. The target color region is located according to the region of interest and the color template, and the target color can be located according to the region of interest ROI and the color template using an industrial large model or a template matching method.

[0032] S4: The color with the most pixels is regarded as the main color, and small sample color matching is performed using the main color extraction and color feature mean method.

[0033] S5: When the color matching misrecognition rate exceeds the misrecognition threshold, if the target to be detected is larger than the set threshold, first try to adjust the target area of ​​interest; if the target to be detected is smaller than the set threshold or the target color distinction is smaller than the set distinction threshold, adjust the initial lighting scheme.

[0034] The above-mentioned small sample color matching method for industrial identification first preliminarily determines the lighting scheme so that the color of the target color area to be inspected is distinguishable. Secondly, the industrial large model and template matching method are used to quickly locate the target color area. Finally, the main color extraction and color feature mean method are used to perform small sample color matching. When the color matching misrecognition rate is high, the lighting scheme of the workpiece or the position of the target color area is adjusted; in this way, for scenes that require color recognition in industrial fields such as color recognition of complete vehicles and their small workpieces, the color matching algorithm based on the positioning of the target workpiece can not only match the color of the entire image, but also locate the specific small workpiece in the image for color matching, which can achieve rapid positioning and color recognition in the case of a small number of samples and workpiece offsets.

[0035] Furthermore, the above method also includes:

[0036] S6: When the workpiece in the captured image is offset, the target region of interest is adjusted according to the magnitude of the offset. In this way, adjustments can be made according to the offset of the workpiece to ensure the final recognition accuracy.

[0037] like Figure 4 As shown, to make a color template corresponding to each color, 1-2 pictures of workpieces of each color can be selected to make the color template.

[0038] Alternatively, if Figure 5 As shown, S3 includes:

[0039] For the target workpiece that meets the first set condition, a template matching method is used for positioning;

[0040] For target workpieces that do not meet the first set condition, the target detection model is used for positioning.

[0041] In this embodiment, the first setting condition includes: the edge feature clarity is higher than the clarity threshold, and the deformation degree of the workpiece when it is offset is less than the deformation threshold.

[0042] In the following, to simplify the description, the region of interest is referred to as ROI.

[0043] Optionally, S4 includes:

[0044] S41: Split the region of interest into RGB three-channel images, satisfying the following relationship:

[0045] I=I R +I G +I B ;

[0046] In the formula, I R Represents the red channel of the ROI image, I G Indicates the green channel of the ROI image, I B Represents the blue channel of ROI image;

[0047] S42: Find the color with the most pixels as the main color according to the histogram of the RGB three channels, satisfying the following relationship:

[0048]

[0049] In the formula, Indicates the color with the most pixels in each channel, maxLoc indicates the color with the most pixels located, hist indicates the calculated image histogram, I x Represents each channel of the ROI image;

[0050] S43: Compare the main color with the main color of the color template, and calculate the similarity distance between the main color of the region of interest and the main color of the color template, satisfying the following relationship:

[0051]

[0052] In the formula, abs represents the absolute value, Indicates the color with the most pixels in each channel of the region of interest, Indicates the color with the most pixels in each channel of the color template.

[0053] In S4, if the target workpiece color calculated by the similarity of the main color of the region of interest does not match its actual color, the HSV average color similarity is used again for comparison. Compared with the main color analysis that only considers the workpiece color, the HSV average color analysis can comprehensively consider the color and material of the workpiece based on factors such as the reflection of the workpiece to determine the target color of the workpiece. This can improve the final color recognition accuracy.

[0054] Among them, the HSV average color similarity is used for comparison, including:

[0055] Convert the original image to HSV space to satisfy the following relationship:

[0056] I HSV =RGB2HSV(I);

[0057] Extract the average color features of the ROI area, satisfying the following relationship:

[0058] f=mean(I HSV );

[0059] The L1 loss function is used to calculate the similarity between the target workpiece and each color template to obtain the color matching result:

[0060] S HSV =L1(f).

[0061] Its expansion formula is: In this formula, the right side of the equal sign is the expansion of the L1 function, and the left side is the result of the L1 calculation, which is equivalent to S in the above formula. HSV .

[0062] Optionally, S5 includes:

[0063] In the case of batch color misdetection, first adjust the color ROI area, and then change the lighting scheme according to the color misdetection results. For example, when the exposure is 8000, if gray is misdetected as black, you need to adjust the exposure to 10000 or above, and test whether the misdetection still occurs after changing the exposure.

[0064] The present application also provides a small sample color matching system for industrial identification, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above method are implemented.

[0065] The small sample color matching system for industrial identification can implement various embodiments of the above-mentioned small sample color matching method for industrial identification, and can achieve the same beneficial effects, which will not be described in detail here.

[0066] The present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0067] The computer device can implement various embodiments of the above-mentioned small sample color matching method for industrial identification, and can achieve the same beneficial effects, which will not be described in detail here.

[0068] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. A small sample color matching method for industrial identification, characterized in that: include: S1: Determine the initial lighting scheme for the target to be detected based on the imaging results of different exposures; S2: Determine the color region of the target to be detected under the initial lighting scheme, and obtain N regions of interest whose color distinction exceeds the color distinction threshold; and create a color template corresponding to each color; S3: locating a target color region according to the region of interest and the color template; S4: The color with the most pixels is regarded as the main color, and small sample color matching is performed using the main color extraction and color feature mean method; S5: When the color matching misrecognition rate exceeds the misrecognition threshold, if the target to be detected is larger than the set threshold, first try to adjust the target area of ​​interest; if the target to be detected is smaller than the set threshold or the target color distinction is smaller than the set distinction threshold, adjust the initial lighting scheme.

2. The small sample color matching method for industrial identification according to claim 1 is characterized in that: The method further comprises: S6: When the workpiece in the captured image is offset, the target region of interest is adjusted according to the magnitude of the offset.

3. The small sample color matching method for industrial identification according to claim 1 is characterized in that: The S3 includes: For the target workpiece that meets the first set condition, a template matching method is used for positioning; For target workpieces that do not meet the first set condition, the target detection model is used for positioning.

4. The small sample color matching method for industrial identification according to claim 3 is characterized in that: The first setting condition includes: the edge feature clarity is higher than the clarity threshold, and the deformation degree of the workpiece when it is offset is less than the deformation threshold.

5. The small sample color matching method for industrial identification according to claim 3 is characterized in that: The S4 includes: S41: Split the region of interest into RGB three-channel images, satisfying the following relationship: I=I R +I G +I B ; In the formula, I R Represents the red channel of the ROI image, I G Indicates the green channel of the ROI image, I B Represents the blue channel of the ROI image; S42: Find the color with the most pixels as the main color according to the histogram of the RGB three channels, satisfying the following relationship: In the formula, Indicates the color with the most pixels in each channel, maxLoc indicates the color with the most pixels located, hist indicates the calculated image histogram, I x Represents each channel of the ROI image; S43: Compare the main color with the main color of the color template, and calculate the similarity distance between the main color of the region of interest and the main color of the color template, satisfying the following relationship: In the formula, abs represents the absolute value, Indicates the color with the most pixels in each channel of the region of interest, Indicates the color with the most pixels in each channel of the color template.

6. The small sample color matching method for industrial identification according to claim 5 is characterized in that: If the target artifact color calculated by the similarity of the main color of the region of interest does not match its true color, the HSV average color similarity is used again for comparison.

7. The small sample color matching method for industrial identification according to claim 6 is characterized in that: The comparison using HSV average color similarity includes: Convert the ROI image from RGB space to HSV space to satisfy the following relationship: I HSV =rGB2HSV(I); Extract the average color features of the ROI area, satisfying the following relationship: f=mean(I HSV ); The L1 loss function is used to calculate the similarity between the target workpiece and each color template to obtain the color matching result: S HSV =L1(f); Among them, the L1 loss function satisfies the following relationship: In the formula, y i is the average color feature of the color template, f i is the average color feature of the ROI area.

8. The small sample color matching method for industrial identification according to claim 1 is characterized in that: The S5 includes: In the case of batch color misdetection, first adjust the color ROI area to the area with higher color distinction of the workpiece, and then change the lighting plan according to the color misdetection results.

9. A small sample color matching system for industrial identification, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 8 are implemented.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.