Material label detection method and device, electronic equipment and storage medium
The material label detection method combining the YOLOv8 model and SIFT algorithm solves the problems of low efficiency and poor accuracy in traditional detection methods, achieving accurate detection of material labels and intuitive display of differences, thus improving detection efficiency and accuracy.
Patent Information
- Application Number
- CN202511412367.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2026-02-10
AI Technical Summary
Traditional material label inspection relies on manual comparison, which is inefficient, prone to errors and omissions, and makes it difficult to identify printing differences and quickly locate differences.
The YOLOv8 model is used for region selection, combined with the SIFT algorithm for feature point detection and matching. Differences are identified through contour comparison, pixel absolute value comparison, and text comparison, and the difference regions are displayed using GIF dynamic display technology.
It enables accurate detection of material labels, quickly locates discrepancies, improves detection efficiency and accuracy, and provides an intuitive display of discrepancies and a traceability mechanism.
Smart Images

Figure CN121505293A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial visual inspection technology, and in particular to a method, apparatus, electronic device and storage medium for material label inspection. Background Technology
[0002] With the rapid development of the manufacturing industry, product quality control has become one of the key factors in enterprise competitiveness. Ensuring the accuracy and consistency of label content is crucial in the production and application of material labels.
[0003] However, traditional methods of comparing material labels mainly rely on manual visual inspection. This process is not only time-consuming and labor-intensive, but also prone to errors and omissions due to human factors. Especially in high-intensity, repetitive work environments, the accuracy and efficiency of manual inspection will significantly decrease, which may lead to serious quality problems, such as incorrect labels entering the market, damaging brand image, or even causing customs inspection failures.
[0004] Traditional comparison techniques, such as simple image comparison software, while alleviating the burden of manual labor to some extent, still have many limitations. These software programs often fail to accurately identify color and detail differences caused by variations in printing materials and methods, and are inefficient when processing large-scale data, making it difficult to meet the high-quality and high-efficiency demands of modern manufacturing.
[0005] In addition, the results of traditional methods are presented in a rather simple way, usually just separating material samples and drawing templates. This requires operators to spend a lot of time carefully comparing them, making it difficult to quickly locate differences.
[0006] Therefore, there is an urgent need for a material labeling detection method that can be automated, efficient, and accurate to improve the efficiency and accuracy of product quality control and reduce human error. Summary of the Invention
[0007] The present invention provides a material label detection method to solve the problems of existing technologies that rely on manual comparison, are inefficient and prone to errors and omissions, and are difficult to identify printing differences and quickly locate differences. The technical solution is as follows:
[0008] According to one aspect of the present invention, a method for detecting material labels includes: acquiring a label sample of a material to be detected; acquiring a drawing template based on the product number of the material to be detected; using a YOLOv8 model to select a region on the drawing template; using a SIFT algorithm to detect feature points on the drawing template and the label sample to obtain feature points, and matching the feature points to obtain matching points; mapping the label sample to the space of the drawing template based on the matching points; comparing the label sample and the drawing template through contour comparison, pixel absolute value comparison, and text comparison, merging differences and filtering allowable offsets to obtain the difference area between the drawing template and the material label sample; using GIF dynamic display technology to switch and display the difference area, and selecting and highlighting the difference area; performing traceability and anomaly processing on the difference area to obtain a detection report and a traceability system.
[0009] In one embodiment, the selection of regions in the drawing template using the YOLOv8 model is achieved through the following steps: using the YOLOv8 model to select key regions in the label sample, obtaining the position parameters of each key region, and performing manual inspection; the key regions include text, barcodes, and icons; the position parameters include the coordinates of the upper left corner, width, height, and category label.
[0010] In one embodiment, feature points are obtained by using the SIFT algorithm to detect feature points in the drawing template and label samples through the following steps: Gaussian pyramids are constructed for the drawing template and label samples respectively; extreme points are located by multi-scale spatial extreme value detection, and low-contrast or edge response points are removed to obtain key points; the gradient direction histogram of the neighborhood of the key points is calculated, a principal direction is assigned to each key point to ensure rotation invariance, the neighborhood around the key points is divided, and local gradient information is statistically analyzed to generate a 128-dimensional feature vector to obtain the feature points.
[0011] In one embodiment, matching the feature points to obtain matching points, and mapping the label sample to the space of the drawing template based on the matching points, is achieved through the following steps: matching the feature points of the drawing template and the label sample using the nearest neighbor matching method KNN, filtering using Lowe's rate test to obtain matching points, calculating the affine transformation matrix based on the matching point pairs, and mapping the label sample image to the coordinate system of the drawing template.
[0012] In one embodiment, the label sample and the drawing template are compared by contour comparison, pixel absolute value comparison, and text comparison. The difference regions between the drawing template and the material label sample are obtained by merging differences and filtering out allowed offsets through the following steps: extracting the contours of the drawing template and the label sample, calculating the average pixel difference degree and the number of significantly different pixels in each contour, and marking the corresponding contour as the first difference if any index exceeds the threshold; performing pixel subtraction on the drawing template and the label sample to generate a difference map, and extracting the contours after binarizing the difference map and marking them as the second difference.
[0013] In one embodiment, the label sample and the drawing template are compared by contour comparison, pixel absolute value comparison, and text comparison. Differences are merged and allowed offsets are filtered to obtain the difference area between the drawing template and the material label sample. The method also includes the following steps: performing OCR recognition on the drawing template and the label sample to obtain relative position and text information; using a matching algorithm to compare the relative position and text information; if the text information corresponding to the same relative position is inconsistent, it is marked as a third difference; performing pixel offset filtering on the first difference and the second difference by matching with the drawing template; if the similarity between the first difference and the second difference meets the set conditions, the first difference and the second difference are merged and the union of the first difference and the third difference is taken to obtain the difference area.
[0014] In one embodiment, the difference area is switched using GIF dynamic display technology, and the difference area is selected and highlighted by means of the following steps: the difference area is automatically looped by alternately displaying the comparison frames of the drawing template and the label sample using GIF dynamic display technology, the difference area is tracked and selected in real time with a red rectangle, and a semi-transparent yellow highlight layer is superimposed. At the same time, manual pause, frame-by-frame stepping and zoom operations are supported.
[0015] According to one aspect of the present invention, a material label detection device includes: a material scanning module for acquiring a label sample of a material to be detected, acquiring a drawing template based on the product number of the material to be detected, and using a YOLOv8 model to select a region of the drawing template; a feature detection module for using a SIFT algorithm to detect feature points on the drawing template and the label sample, obtaining feature points, matching the feature points to obtain matching points, and mapping the label sample to the space of the drawing template based on the matching points; a material comparison module for comparing the label sample and the drawing template through contour comparison, pixel absolute value comparison, and text comparison, merging differences and filtering allowable offsets to obtain the difference area between the drawing template and the material label sample; and a difference display module for using GIF dynamic display technology to switch the display of the difference area, selecting and highlighting the difference area, tracing and handling the difference area, and obtaining a detection report and a traceability system.
[0016] According to one aspect of the present invention, an electronic device includes at least one processor and at least one memory, wherein computer-readable instructions are stored on the memory; the computer-readable instructions are executed by one or more of the processors to cause the electronic device to implement the material label detection method as described above.
[0017] According to one aspect of the present invention, a storage medium has computer-readable instructions stored thereon, which are executed by one or more processors to implement the material label detection method as described above.
[0018] The beneficial effects of the technical solution provided by this invention are:
[0019] In the above technical solution, this invention first obtains a sample of the material label to be inspected, then obtains a drawing template based on the product number, and uses a YOLOv8 model to select key areas of the drawing template for manual inspection. Next, the SIFT algorithm is used to detect feature points on the drawing template and label sample. Feature points are matched and filtered using the KNN nearest neighbor matching method, and an affine transformation matrix is calculated to map the label sample to the drawing template space. Then, through contour comparison, pixel absolute value comparison, and text comparison, contour differences are extracted, a difference map is generated to mark the differences, OCR recognition is performed to compare the marked differences in text information, and pixel offsets are filtered and differences are merged to obtain the final difference area. Finally, GIF dynamic display technology is used to alternately display comparison frames, automatically looping the difference area, selecting the difference parts in real time and overlaying a highlight layer, while also supporting manual operation. This achieves accurate detection of material labels, effectively locates difference areas, and displays them in an intuitive way, facilitating traceability and anomaly handling, improving detection efficiency and accuracy, and providing strong support for material label quality control. It effectively solves the problems of existing technologies that rely on manual comparison, are inefficient and prone to errors and omissions, have difficulty identifying printing differences, and are difficult to quickly locate differences. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating a material label detection method according to an exemplary embodiment;
[0022] Figure 2 This is a block diagram illustrating a material label detection apparatus according to an exemplary embodiment;
[0023] Figure 3 This is a hardware structure diagram of an electronic device according to an exemplary embodiment;
[0024] Figure 4 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0025] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0026] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this disclosure means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0027] This invention provides a material label detection method that, by comprehensively utilizing technologies such as image detection, feature matching, multi-dimensional comparison, and dynamic display, achieves accurate detection and intuitive presentation of differences between material labels and drawing templates. This solves the problems of low efficiency, poor accuracy, and unintuitive difference display in traditional detection methods. This material label detection method is applicable to material label detection devices, which can be electronic devices. The material label detection method in this invention can be applied to various scenarios, such as material label detection, etc.
[0028] Please see Figure 1 This invention provides a method for detecting material labels, which is applicable to electronic devices.
[0029] In the following method embodiments, for ease of description, the execution subject of each step of the method is an electronic device, but this does not constitute a specific limitation.
[0030] like Figure 1 As shown, the method may include the following steps:
[0031] Step 110: Obtain the label sample of the material to be tested, obtain the drawing template according to the product number of the material to be tested, and use the YOLOv8 model to select the area of the drawing template.
[0032] In one possible implementation, the key regions in the labeled samples are selected by rectangular bounding boxes using the YOLOv8 model, and the positional parameters of each key region are obtained and then manually checked.
[0033] The key areas include text, barcodes, icons, etc., and the positional parameters include the coordinates of the top left corner, width, height, and category label, etc., none of which are specified here.
[0034] Specifically, the extracted material label samples to be tested are first placed on a pre-configured scanner, and scanning is started with a single click. The scanned samples are automatically stored in a designated path. Next, the product barcode of the material is scanned using a barcode scanner, and the relevant coding information is read by the PLM system to obtain the corresponding drawing template, while also importing other necessary information.
[0035] Furthermore, the YOLOv8 model is used to select regions from the acquired drawing template. This model can select key regions such as text, barcodes, and icons in the label sample, obtain the positional parameters of each key region (including the coordinates of the upper left corner, width, height, and category label), and perform manual checks to ensure the accuracy of the selection.
[0036] In the above process, the embodiments of the present invention provide basic data and accurate region positioning for subsequent accurate comparison by scanning samples, obtaining templates by scanning codes, and selecting key regions by using the YOLOv8 model. This makes the detection process more targeted and efficient, provides a standardized sample and template matching preparation process, and realizes the automation and accuracy of sample acquisition and template matching.
[0037] Step 120: Use the SIFT algorithm to detect feature points in the drawing template and label samples, obtain feature points, match the feature points to obtain matching points, and map the label samples to the space of the drawing template based on the matching points.
[0038] In one possible implementation, Gaussian pyramids are constructed for the drawing template and label samples respectively. Extreme points are located by multi-scale spatial extremum detection, and low-contrast or edge response points are removed to obtain key points. The gradient direction histogram of the neighborhood of the key points is calculated, and the principal direction is assigned to each key point to ensure rotation invariance. The neighborhood around the key points is divided and the local gradient information is statistically analyzed to generate a 128-dimensional feature vector to obtain the feature points.
[0039] In one possible implementation, the nearest neighbor matching method KNN is used to match the feature points of the drawing template and the label sample, and Lowe's rate test is used to filter and obtain matching points. Based on the matching point pairs, the affine transformation matrix is calculated to map the label sample image to the drawing template coordinate system.
[0040] The purpose of constructing the Gaussian pyramid is to detect feature points at different scales. Material labels may contain detailed features of varying sizes, and multi-scale analysis allows for a more comprehensive capture of these features. During the construction of the Gaussian pyramid, multi-scale spatial extremum detection is used to locate extrema points; the areas containing these extrema points are potential critical regions. For example, in areas with distinctive features such as text, barcodes, and icons on material labels, multi-scale spatial extremum detection can locate extrema points within these areas, thus identifying them as critical regions. Because text, barcodes, and icons contain important information about the material label, they are key areas to focus on during detection. Detecting feature points in these areas can more accurately reflect the characteristics of the material label, providing a reliable basis for subsequent comparisons.
[0041] Furthermore, after locating the extreme points, low-contrast or edge-response points need to be removed to obtain more accurate key points. Low-contrast extreme points may be caused by factors such as noise, and these points have a significant impact on the stability of feature description. By calculating the contrast of the neighborhood of the extreme point, if the contrast is lower than a set threshold, the extreme point is considered a low-contrast point and is removed. For example, in a material label sample, the pixel changes around a certain extreme point are very small, i.e., the contrast is very low, indicating that the point cannot well reflect the characteristics of the material label. Removing it can avoid noise interference and improve the accuracy of feature point detection.
[0042] Furthermore, edge response points are extreme points generated by image edges. These points have a large principal curvature in the edge direction and a small principal curvature in the direction perpendicular to the edge, resulting in poor feature stability. By calculating the Hessian matrix at the extreme point, the principal curvature is obtained. A threshold is set based on the ratio of the principal curvatures. When the ratio exceeds the threshold, the extreme point is determined to be an edge response point and is removed. For example, extreme points at the edge of material labels are easily affected by edge changes, which may lead to instability in subsequent comparisons. Removing them ensures the stability and reliability of the feature points.
[0043] By calculating the neighborhood contrast and principal curvature of extreme points and comparing them with a set threshold, low-contrast or edge-response points are effectively eliminated, so that the retained key points can more accurately reflect the characteristics of the material label, providing a reliable feature point screening method and improving the quality of key points.
[0044] In the above process, the embodiments of the present invention accurately detect feature points through the SIFT algorithm, obtain reliable matching points by filtering with KNN matching and Lowe's rate test, and then realize sample mapping through affine transformation matrix, so that the drawing template and label sample can be accurately compared in the same space, providing a stable feature point matching and sample mapping method, and realizing the consistency of the spatial position of the sample and the template.
[0045] Step 130: Compare the label sample with the drawing template by contour comparison, pixel absolute value comparison and text comparison, merge the differences and filter the allowed offset to obtain the difference area between the drawing template and the material label sample.
[0046] In one possible implementation, the outlines of the drawing template and label sample are extracted, the average pixel difference and the number of significantly different pixels within each outline are calculated, and if any indicator exceeds the threshold, the corresponding outline is marked as the first difference; the pixel subtraction between the drawing template and label sample is performed to generate a difference map, and the outline is extracted and marked as the second difference after binarization of the difference map.
[0047] Furthermore, the matching algorithm compares the relative position and text information. If the text information corresponding to the same relative position is inconsistent, it is marked as the third difference. The first and second differences are filtered by pixel offset by matching with the drawing template. If the similarity between the first and second differences meets the set conditions, the first and second differences are merged and then the union of the first and second differences is taken with the third difference to obtain the difference region.
[0048] In the above process, the embodiments of the present invention comprehensively detect differences from multiple dimensions through contour comparison, pixel absolute value comparison and text comparison, and then filter out invalid differences through difference merging, so that the final difference area is more accurate and reliable. It provides a comprehensive comparison method and a precise difference filtering method, and realizes accurate identification of material label differences.
[0049] Step 140: Use GIF dynamic display technology to switch the display of the difference areas, select and highlight the difference areas, trace and handle the difference areas to obtain the detection report and traceability system.
[0050] One possible implementation uses GIF dynamic display technology to alternately display comparison frames of drawing templates and label samples, automatically looping through the difference areas, using red rectangles to track and select the difference parts in real time, and overlaying a semi-transparent yellow highlight layer, while also supporting manual pause, frame-by-frame stepping and zoom operations.
[0051] In the above process, the embodiments of the present invention use GIF dynamic display technology to intuitively present the difference areas, which makes it convenient for users to quickly locate the problem. At the same time, a traceability system is established to facilitate quality personnel to trace back and handle anomalies. It provides convenient difference display and a sound traceability mechanism, and realizes effective management and utilization of material label inspection results.
[0052] Through the above process, this invention achieves accurate detection of material labels and drawing templates via four closely linked steps: sample acquisition and template matching preparation, feature point detection and sample mapping, multi-dimensional comparison and difference merging and filtering, and dynamic display and traceability processing of difference areas. This solution comprehensively utilizes multiple advanced technologies, forming a complete detection system from sample acquisition to final result display and traceability. It effectively solves the problems of low efficiency, poor accuracy, and unintuitive difference display in traditional detection methods, improving the quality and efficiency of material label detection and providing strong technical support for material label quality control in industrial production.
[0053] In one application scenario, the material label detection method proposed in this invention may specifically include the following steps:
[0054] Step 1: Obtaining and storing material label samples.
[0055] Specifically, employees place the extracted material label samples onto a pre-configured scanner and click the "One-Click Scan" button. The scanned sample image is automatically stored in a path specified by the system. This method aims to quickly and accurately acquire digital images of material label samples, providing foundational data for subsequent automated comparison. Automated acquisition via scanners avoids the image quality instability issues that can arise from manual photography, while the automatic storage function improves data processing efficiency.
[0056] In the above process, the embodiments of the present invention utilize automated scanning and storage technology to make the acquisition of material label samples faster and more accurate, providing high-quality sample image data and realizing the automation and efficiency of data acquisition.
[0057] Step 2: Uploading sample images and matching them with templates.
[0058] Specifically, employees click the "Upload Material Label Sample" button in the system, and the system automatically retrieves the latest scanned material label sample image from the specified directory. Then, employees scan the barcode on the material with a barcode scanner, and the system reads the corresponding drawing template from the PLM system based on the product number and displays it on the interface. The aim is to match the acquired sample image with the correct drawing template, providing a correct reference object for subsequent comparison work. By scanning the barcode and entering the product number, the system can automatically obtain the corresponding drawing template, reducing errors and time costs associated with manual searching.
[0059] In the above process, the embodiments of the present invention, through system integration and automated matching technology, make the matching of sample images and drawing templates more accurate and faster, provide reliable reference objects, and realize the automation and intelligence of the matching process.
[0060] Step 3: Pre-selection and alignment of the drawing template.
[0061] Specifically, the system uses the YOLOv8 model to automatically pre-select the drawing template, identifying the areas to be compared. Simultaneously, employees can manually adjust the selected positions as needed. Subsequently, the system calls an alignment algorithm service to find the corresponding material label sample positions on the drawing template. The aim is to reduce manual operation time and errors, and improve comparison accuracy through automated pre-selection and alignment. The application of the YOLOv8 model makes pre-selection faster and more accurate, while the manual adjustment function provides flexibility to adapt to different scenarios.
[0062] In the above process, the embodiments of the present invention combine the YOLOv8 model with manual adjustment technology to achieve rapid and accurate pre-selection and alignment of drawing templates, providing a flexible and efficient pre-comparison processing method and realizing the automation and intelligence of pre-comparison preparation work.
[0063] Step 4: Multi-dimensional comparison and difference identification.
[0064] Specifically, the system performs multi-dimensional comparisons between the aligned drawing template and the material label sample, including contour comparison, absolute pixel value comparison, and text comparison. During the comparison process, the system filters out invalid differences by allowing a certain amount of pixel offset, and finally merges the results to obtain the difference assessment. The aim is to comprehensively and accurately identify the differences between the material label sample and the drawing template through multi-dimensional comparison. The combined use of contour comparison, absolute pixel value comparison, and text comparison can cover the detection needs of different types of differences. The filtering mechanism that allows pixel offset improves the accuracy of difference identification and avoids misjudgments caused by minor offsets.
[0065] In the above process, the embodiments of the present invention achieve comprehensive and accurate identification of the differences between material label samples and drawing templates through multi-dimensional comparison and difference recognition technology, providing reliable difference detection results and realizing the efficiency and accuracy of difference detection.
[0066] Step 5: Displaying and saving the difference results.
[0067] Specifically, the system uses GIF animations to switch between displaying drawing templates and material label samples, highlighting the final merged discrepancies. Employees can quickly locate discrepancies based on the displayed results and save them to the system. Simultaneously, the system stores the results of each comparison for quality personnel to review and trace later. The aim is to help employees quickly locate discrepancies and improve work efficiency through an intuitive display method. The GIF animation method utilizes the short-term memory characteristics of the human brain, making the discrepancy display more intuitive and easy to understand. At the same time, the result saving function provides a basis for quality traceability, contributing to continuous improvement and optimization of production processes.
[0068] In the above process, the embodiments of the present invention use GIF animation display and result saving technology to achieve intuitive display and reliable saving of differential results, provide convenient and efficient means of viewing and backtracking results, and realize the intelligence and convenience of result display and saving.
[0069] Through the above process, this embodiment of the invention achieves efficient and accurate comparison of material label samples and drawing templates by integrating industrial vision and automation technologies. First, a scanner automatically acquires sample images, and the product number is entered via barcode scanning to automatically match the drawing template, reducing manual operation. Then, a YOLOv8 model is used for pre-selection and alignment of the drawing template, combined with multi-dimensional comparison algorithms (contour comparison, pixel absolute value comparison, and text comparison) to comprehensively identify differences. Invalid differences are filtered out by allowing pixel offsets, improving recognition accuracy. Finally, GIF animations are used to visually display the difference results, facilitating quick location by employees, and the results are saved to the system for quality traceability. This not only improves comparison efficiency and accuracy but also reduces labor costs and error rates through automation and intelligent means, providing an efficient and reliable solution for industrial vision-based incoming material comparison and difference recognition.
[0070] The following are embodiments of the apparatus of the present invention, which can be used to execute the material label detection method involved in the present invention. For details not disclosed in the embodiments of the apparatus of the present invention, please refer to the method embodiments of the material label detection method involved in the present invention.
[0071] Please see Figure 2 This invention provides a material label detection device 800.
[0072] The material label detection device 800 includes, but is not limited to: a material scanning module 810, a feature detection module 830, a material comparison module 850, and a difference display module 870.
[0073] The material scanning module 810 is used to obtain the label sample of the material to be tested, obtain the drawing template according to the product number of the material to be tested, and use the YOLOv8 model to select the area of the drawing template.
[0074] The feature detection module 830 is used to detect feature points on the drawing template and label samples using the SIFT algorithm, obtain feature points, match the feature points to obtain matching points, and map the label samples to the space of the drawing template based on the matching points.
[0075] The material comparison module 850 is used to compare the label sample with the drawing template through contour comparison, pixel absolute value comparison and text comparison, merge the differences and filter the allowed offset to obtain the difference area between the drawing template and the material label sample.
[0076] The difference display module 870 is used to switch the display of difference areas using GIF dynamic display technology, select and highlight the difference areas, trace and handle the difference areas, and obtain detection reports and traceability systems.
[0077] It should be noted that the material label detection provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed. That is, the internal structure of the material label detection device will be divided into different functional modules to complete all or part of the functions described above.
[0078] Furthermore, the material label detection device and the material label detection method provided in the above embodiments belong to the same concept, and the specific way in which each module performs its operation has been described in detail in the method embodiments, and will not be repeated here.
[0079] Figure 3 A schematic diagram of the structure of an electronic device according to an exemplary embodiment is shown.
[0080] It should be noted that this electronic device is merely an example adapted to the present invention and should not be construed as providing any limitation on the scope of use of the present invention. Furthermore, this electronic device should not be interpreted as requiring or depending on having... Figure 3 One or more components of the exemplary electronic device 2000 shown.
[0081] The hardware structure of electronic devices 2000 can vary significantly due to differences in configuration or performance, such as... Figure 3 As shown, the electronic device 2000 includes: a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.
[0082] Specifically, power supply 210 is used to provide operating voltage for various hardware devices on electronic device 2000.
[0083] Interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Of course, in other examples adapted to this invention, interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input / output interface 235, and at least one USB interface 237, etc. Figure 3 As shown, this does not constitute a specific limitation.
[0084] The memory 250 serves as a carrier for resource storage and can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it include the operating system 251, application programs 253, and data 255, etc., and the storage method can be temporary storage or permanent storage.
[0085] The operating system 251 is used to manage and control the various hardware devices and application programs 253 on the electronic device 2000, so as to enable the central processing unit 270 to perform calculations and processing on the massive data 255 in the memory 250. It can be Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0086] Application 253 is a computer-readable instruction based on operating system 251 that performs at least one specific task, and may include at least one module ( Figure 3 (Not shown), each module may contain computer-readable instructions for the electronic device 2000. For example, the material label detection device can be considered as application program 253 deployed on the electronic device 2000.
[0087] Data 255 may be signal information, etc., and is stored in memory 250.
[0088] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer-readable instructions stored in the memory 250, thereby performing calculations and processing on massive amounts of data 255 stored in the memory 250. For example, a material labeling detection method may be performed by the central processing unit 270 reading a series of computer-readable instructions stored in the memory 250.
[0089] Furthermore, the present invention can also be implemented through hardware circuits or a combination of hardware circuits and software. Therefore, the implementation of the present invention is not limited to any specific hardware circuit, software, or combination thereof.
[0090] Please see Figure 4 This invention provides an electronic device 4000, which may include: a desktop computer, a laptop computer, a server, etc., with sensor recognition capabilities.
[0091] exist Figure 4 In this context, the electronic device 4000 includes at least one processor 4001 and at least one memory 4003.
[0092] The data interaction between the processor 4001 and the memory 4003 can be achieved through at least one communication bus 4002. This communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0093] Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.
[0094] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this invention. Processor 4001 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0095] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program instructions or code in the form of instructions or data structures and accessible by the electronic device 4000, but not limited thereto.
[0096] The memory 4003 stores computer-readable instructions, and the processor 4001 can read the computer-readable instructions stored in the memory 4003 through the communication bus 4002.
[0097] The computer-readable instructions are executed by one or more processors 4001 to implement the material label detection methods in the above embodiments.
[0098] Furthermore, this embodiment of the invention provides a storage medium storing computer-readable instructions, which are executed by one or more processors to implement the material label detection method described above.
[0099] This invention provides a computer program product, which includes computer-readable instructions stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, thereby enabling the electronic device to implement the material label detection method as described above.
[0100] Compared with related technologies, the beneficial effects of the present invention are:
[0101] 1. This invention can significantly improve the comparison efficiency between material label samples and drawing templates; by integrating industrial vision and automation technologies, it uses the YOLOv8 model to pre-select and automatically align drawing templates, reducing manual operation time.
[0102] 2. This invention has extremely high accuracy in identifying differences; by combining multi-dimensional comparison algorithms (contour comparison, pixel absolute value comparison, text comparison) with a filtering mechanism that allows pixel offset, it can comprehensively and accurately identify the differences between material label samples and drawing templates.
[0103] 3. This invention can intuitively display the difference results, making it easy for employees to quickly locate the discrepancies; it uses GIF animation to switch back and forth between displaying drawing templates and material label samples, and highlights the final merged difference results by selecting them, taking advantage of the short-term memory characteristics of the human brain.
[0104] 4. This invention has reliable result saving and backtracking functions; by storing the results of each comparison, quality personnel can view and backtrack later, which helps to continuously improve and optimize the production process.
[0105] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0106] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for detecting material labels, characterized in that, The method includes: Obtain a label sample of the material to be tested, obtain a drawing template based on the product number of the material to be tested, and use the YOLOv8 model to select a region of the drawing template; The SIFT algorithm is used to detect feature points in the drawing template and label sample to obtain feature points, and the feature points are matched to obtain matching points. The label sample is then mapped to the space of the drawing template based on the matching points. The label sample and the drawing template are compared by contour comparison, pixel absolute value comparison and text comparison. Differences are merged and allowed offsets are filtered to obtain the difference area between the drawing template and the material label sample. The difference areas are displayed using GIF dynamic display technology, and the difference areas are selected and highlighted. The difference areas are then traced and anomaly handled to obtain a detection report and traceability system.
2. The material label detection method as described in claim 1, characterized in that, The step of using the Yolov8 model to select a region in the drawing template includes: The key regions in the label samples are selected by rectangular bounding using the YoLoV8 model, and the position parameters of each key region are obtained and manually checked. The key regions include text, barcodes, and icons. The position parameters include the coordinates of the top left corner, width, height, and category label.
3. The material label detection method as described in claim 1, characterized in that, The step of using the SIFT algorithm to detect feature points in the drawing template and label sample to obtain feature points includes: Gaussian pyramids are constructed for the drawing templates and label samples respectively. Extreme points are located by multi-scale spatial extreme value detection, and key points are obtained by removing low contrast or edge response points. Calculate the gradient direction histogram of the neighborhood of the key point, assign a principal direction to each key point to ensure rotation invariance, divide the neighborhood around the key point and generate a 128-dimensional feature vector by statistically analyzing the local gradient information, and obtain the feature point.
4. The material label detection method as described in claim 1, characterized in that, The step of matching the feature points to obtain matching points, and mapping the label samples to the space of the drawing template based on the matching points, includes: The nearest neighbor (KNN) matching method is used to match the feature points of the drawing template and the label sample, and Lowe's rate test is used to filter and obtain matching points. Based on the matching point pairs, the affine transformation matrix is calculated to map the label sample image to the drawing template coordinate system.
5. The material label detection method as described in claim 1, characterized in that, The process of comparing the label sample with the drawing template through contour comparison, pixel absolute value comparison, and text comparison, merging differences, and filtering out allowable offsets to obtain the difference areas between the drawing template and the material label sample includes: Extract the outlines of the drawing template and label sample, calculate the average pixel difference and the number of significantly different pixels within each outline, and if any indicator exceeds the threshold, mark the corresponding outline as the first difference. The drawing template and label sample are pixel-subtracted to generate a difference map. The difference map is then binarized, the contour is extracted, and marked as the second difference.
6. The material label detection method as described in claim 5, characterized in that, The method of comparing the label sample with the drawing template through contour comparison, pixel absolute value comparison, and text comparison, merging differences, and filtering out allowable offsets to obtain the difference area between the drawing template and the material label sample, also includes: The drawing template and label sample are subjected to OCR recognition to obtain relative position and text information. A matching algorithm is used to compare the relative position and text information. If the text information corresponding to the same relative position is inconsistent, it is marked as a third difference. By matching with the drawing template, the first difference and the second difference are filtered by pixel offset. If the similarity between the first difference and the second difference meets the set conditions, the first difference and the second difference are merged and then the union of the first difference and the third difference is taken to obtain the difference region.
7. The material label detection method as described in claim 1, characterized in that, The step of using GIF dynamic display technology to switch and display the difference areas, and selecting and highlighting the difference areas, includes: Using GIF dynamic display technology, the comparison frames of the drawing template and label sample are displayed alternately, and the difference areas are automatically looped. The difference parts are tracked and selected in real time with a red rectangle and a semi-transparent yellow highlight layer is superimposed. It also supports manual pause, frame-by-frame stepping and zoom operations.
8. A material labeling detection device, characterized in that, The device includes: The material scanning module is used to obtain label samples of the materials to be inspected, obtain drawing templates based on the product numbers of the materials to be inspected, and use the YoLOV8 model to select regions of the drawing templates. The feature detection module is used to detect feature points in the drawing template and label sample using the SIFT algorithm, and to match the feature points to obtain matching points. Based on the matching points, the label sample is mapped to the space of the drawing template. The material comparison module is used to compare the label sample with the drawing template through contour comparison, pixel absolute value comparison and text comparison, merge the differences and filter the allowed offsets to obtain the difference area between the drawing template and the material label sample; The difference display module is used to switch the display of the difference areas using GIF dynamic display technology, select and highlight the difference areas, trace and handle the difference areas, and obtain a detection report and traceability system.
9. An electronic device, characterized in that, include: At least one processor and at least one memory, wherein, The memory stores computer-readable instructions; The computer-readable instructions are executed by one or more of the processors, causing the electronic device to implement the material label detection method as described in any one of claims 1 to 7.
10. A storage medium having computer-readable instructions stored thereon, characterized in that, The computer-readable instructions are executed by one or more processors to implement the material label detection method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Packaging machine defective product detection method based on machine vision
CN115272341A
Quality detection method, quality detection device and quality detection equipment for printed part
CN115420746A
Visual detection method for abnormal deformation of automobile part die-casting die
CN117764912A
Building prefabricated part quality detection method based on multi-modal vision
CN120563462A
Systems and methods for automated teeth tracking
US20230386045A1