A method and terminal for detecting defects on automobile glass surface and trademark printing
Through the acquisition equipment, the automotive glass images are collected and pre-processed, and combined with the pre-trained detection model and trademark extraction algorithm, efficient and accurate detection of automotive glass surfaces and trademark printing defects is achieved, and various problems of defect detection in the prior art are solved.
Patent Information
- Application Number
- CN202411697411.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-11-26
AI Technical Summary
When detecting defects in automotive glass surfaces and trademark printing, the prior art has problems such as feature engineering dependence, low robustness, large impact on scale direction changes, poor real-time performance, limited generalization capability and high demand for computing resources.
A method for detecting defects on the surface and trademark printing of automobile glass is adopted. The image of the automobile glass to be tested is collected through the acquisition equipment, pre-processed and inputted to the pre-trained detection model for detection. Combined with the trademark extraction algorithm and the template, the defect information is summarized and displayed on the image.
It realizes accurate and efficient detection of various types of defects in different scenarios, improves the accuracy and stability of trademark printing defect detection, and ensures the correct identification of missing printing, multiple printing, wrong printing and defects.
Smart Images

Figure CN119180820B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of model detection, and in particular to a method and a terminal for detecting automobile glass surface and trademark printing defects. Background Art
[0002] The automotive glass manufacturing industry has extremely high requirements for product quality, among which trademark printing quality is one of the important considerations. During the production process of automotive curved glass, more than ten kinds of defects may appear on its surface, and the trademark in the printed area may also have various printing defects.
[0003] At present, most domestic manufacturers use traditional machine vision methods (such as template matching with differential algorithm, HALCON operator) to detect trademark defects. It is proposed to use artificial intelligence methods combined with traditional image processing methods to detect defects in glass trademark printing, which has the following disadvantages:
[0004] (1) Feature engineering dependency: Traditional machine vision methods require manual design of feature extractors, which require specific parameters and specific detection scenarios to be designed. Therefore, they are not applicable to all types of images or scenarios.
[0005] (2) Low robustness: Traditional machine vision methods perform poorly in complex backgrounds when faced with problems such as noise, occlusion, or lighting changes in the image. Template matching will be disturbed, resulting in mismatches or missed detections.
[0006] (3) Scale direction change: If the size or direction of the defect changes, especially when the character is deformed in the depth direction, the template matching result will be greatly affected, and the result obtained by the differential algorithm will not match;
[0007] (4) Real-time problem: Although the traditional method has high computational efficiency in some cases, it will cause slow operation for differential algorithms with large computational workload;
[0008] (5) Limited generalization ability: Traditional machine vision methods may miss detections when processing new or unseen data;
[0009] (6) Computational resource requirements: Although traditional methods are computationally efficient in some cases, they usually require carefully designed algorithms to optimize performance to achieve the required detection speed. Summary of the invention
[0010] The technical problem to be solved by the present invention is: the present invention provides a method and a terminal for detecting automobile glass surface and trademark printing defects, so as to realize efficient and accurate detection of automobile glass surface defects and trademark printing defects.
[0011] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0012] A method for detecting automobile glass surface and trademark printing defects, comprising the steps of:
[0013] S1. Numbering a preset number of acquisition devices, and using the acquisition devices to respectively acquire images of the automobile glass to be tested according to a preset range, to obtain a preset number of mother images and number them accordingly according to the numbers of the acquisition devices;
[0014] S2. Crop each mother image a preset number of times, detect the cropped sub-images using a pre-trained detection model, record surface defect information, and save the position coordinates of the area where the trademark is located;
[0015] S3, splicing the mother images according to the number and the position coordinates of each mother image to obtain the original image of the automobile glass to be tested, extracting the trademark image by a preset trademark extraction algorithm, and performing template positive and negative matching with a preset accurate template and a defect template to obtain trademark defect information;
[0016] S4. Summarize the surface defect information and the trademark defect information and output them for display on the original image of the automobile glass to be tested.
[0017] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0018] A terminal for detecting automobile glass surface and trademark printing defects comprises 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 in the above-mentioned method for detecting automobile glass surface and trademark printing defects are implemented.
[0019] The beneficial effects of the present invention are as follows: a method and terminal for detecting automobile glass surface and trademark printing defects of the present invention, collects the image of the automobile glass to be tested by an acquisition device, pre-processes it, and inputs it into a pre-trained detection model to detect the appearance and printing defects of the automobile glass surface, further extracts the trademark image of the automobile glass to be tested by a trademark extraction algorithm and performs front and back template matching, summarizes the defect information obtained from the two tests and displays it on the image of the automobile glass to be tested, thereby achieving accurate and efficient detection of various types of defects in different scenarios. At the same time, when detecting trademark printing defects, the template is used for two tests of front and back matching and one deep learning detection model test, thereby ensuring that missed printing, over-printing, wrong printing and defects can be correctly identified, thereby improving the accuracy and stability of trademark printing defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 This is a flow chart of a method for detecting automobile glass surface and trademark printing defects in this embodiment;
[0021] Figure 2 This is an overall detection flow chart of a method for detecting automobile glass surface and trademark printing defects in this embodiment;
[0022] Figure 3 This is a flow chart of a trademark extraction algorithm in a method for detecting automobile glass surface and trademark printing defects in this embodiment;
[0023] Figure 4 is a performance index curve diagram of a detection model in a method for detecting automobile glass surface and trademark printing defects in this embodiment;
[0024] Figure 5 This is a detection effect diagram of a method for detecting automobile glass surface and trademark printing defects in this embodiment;
[0025] Figure 6 This is a structural diagram of a terminal for detecting automobile glass surface and trademark printing defects according to this embodiment;
[0026] Description of labels:
[0027] 1. Glass number; 2. Test results; 3. Defect information; 4. Defect location;
[0028] 5; Trademark detection results; 100. A terminal for detecting defects on the surface of automobile glass and trademark printing;
[0029] 101. Processor; 102. Memory. DETAILED DESCRIPTION
[0030] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in conjunction with the implementation modes and the accompanying drawings.
[0031] Please refer to Figures 1 to 3 , a method for detecting automobile glass surface and trademark printing defects, comprising the steps of:
[0032] S1. Numbering a preset number of acquisition devices, and using the acquisition devices to respectively acquire images of the automobile glass to be tested according to a preset range, to obtain a preset number of mother images and number them accordingly according to the numbers of the acquisition devices;
[0033] S2. Crop each mother image a preset number of times, detect the cropped sub-images using a pre-trained detection model, record surface defect information, and save the position coordinates of the area where the trademark is located;
[0034] S3, splicing the mother images according to the number and the position coordinates of each mother image to obtain the original image of the automobile glass to be tested, extracting the trademark image by a preset trademark extraction algorithm, and performing template positive and negative matching with a preset accurate template and a defect template to obtain trademark defect information;
[0035] S4. Summarize the surface defect information and the trademark defect information and output them for display on the original image of the automobile glass to be tested.
[0036] From the above description, it can be seen that the beneficial effects of the present invention are: a method for detecting automobile glass surface and trademark printing defects of the present invention, collects the image of the automobile glass to be tested by an acquisition device, pre-processes it, and inputs it into a pre-trained detection model to detect the appearance and printing defects of the automobile glass surface, and further extracts the trademark image of the automobile glass to be tested by a trademark extraction algorithm and performs front and back template matching, summarizes the defect information obtained from the two detections and displays it on the image of the automobile glass to be tested, thereby realizing accurate and efficient detection of various types of defects in different scenarios. At the same time, when detecting trademark printing defects, the template is used for two positive and negative matching detections and one deep learning detection model detection, to ensure that missed printing, over-printing, wrong printing and defects can be correctly identified, thereby improving the accuracy and stability of trademark printing defect detection.
[0037] Furthermore, the pre-trained detection model in step S2 includes:
[0038] Acquire an image of automobile glass and crop the image to generate a sample data set;
[0039] Build a detection model based on a deep neural network and set parameters;
[0040] Training and verifying the detection model according to the sample data set, and evaluating the accuracy of the trained detection model;
[0041] According to the result of the accuracy evaluation, the detection model is deployed to the software platform through a preset model reasoning deployment framework.
[0042] From the above description, it can be seen that in the data preparation stage, image cropping to generate sample data sets improves data diversity and the generalization ability of the model; in the model building and training stage, the reliability of the detection model is improved through flexible parameter settings and the combination of training and verification; in the model deployment stage, the model after accuracy evaluation is deployed to the software platform through the model reasoning deployment framework to optimize and accelerate the model, reduce the reasoning time of the model, facilitate integration with other production management systems, and realize automated defect detection and quality control.
[0043] Furthermore, the acquiring of the image of the automobile glass and cropping the image to generate the sample data set includes:
[0044] The detected automobile glass image is acquired through the acquisition device and cropped a preset number of times. The defects in the cropped image are annotated using the target detection and annotation tool to generate an XML file. The XML file is converted into a text file in a format corresponding to the deep learning model through a file conversion tool. The text file is divided into a training set and a validation set according to a preset ratio to obtain a target sample data set.
[0045] From the above description, we can see that by processing the acquired images, the diversity of samples is enriched to adapt to a variety of practical scenarios, the data scale is effectively expanded to reduce the risk of overfitting; precise annotation guidance is provided through annotation tools to promote the model to accurately learn defect features; the file format is converted accordingly to achieve data format standardization to facilitate model processing and reasonable division of data sets, which is helpful for model evaluation optimization and improving generalization capabilities.
[0046] Furthermore, building a detection model based on a deep neural network and setting parameters include:
[0047] Build a detection model based on a deep neural network and adjust parameter settings at different stages of parameter setting;
[0048] In the training parameter setting stage, the parameters batch, imgsz and cos_lr are set. In the data enhancement parameter setting stage, the parameters flipud, fliplr and mixup are set.
[0049] From the above description, it can be seen that building a detection model based on a deep neural network and setting parameters in stages, including adjusting parameters at different stages and making specific settings for training parameters (such as batch, imgsz, cos_lr) and data enhancement parameters (such as flipud, fliplr, mixup), is conducive to adapting to the deep neural network training process to optimize performance, balance training speed and stability, ensure effective feature extraction and convergence, enhance data diversity and robustness, improve detection accuracy and reliability, promote model generalization capabilities, and accelerate the model development and optimization process.
[0050] Furthermore, the detection model is trained and verified according to the sample data set, and the accuracy evaluation of the trained detection model includes:
[0051] The sample data set is input into the deep neural network for training to obtain model weights, and accuracy is evaluated based on the model weights.
[0052] From the above description, it can be seen that by inputting the sample data set into the deep neural network for training to obtain the model weight, it is possible to fully utilize the automobile glass image information in the sample data set, so that the model can continuously learn and optimize the extraction and recognition capabilities of automobile glass features; at the same time, accuracy evaluation based on the model weights can objectively measure the performance of the model in detecting automobile glass, and timely discover problems with the model and make adjustments, thereby improving the accuracy and reliability of the model and providing more accurate results for automobile glass detection.
[0053] Further, according to the result of the accuracy evaluation, deploying the detection model to the software platform through a preset model reasoning deployment framework includes:
[0054] If the accuracy assessment of the model weights is qualified, the model weights are converted into model weights in a corresponding format through a model reasoning deployment framework, and the detection model is deployed to a software platform according to the model reasoning deployment framework.
[0055] From the above description, it can be seen that when the accuracy of the model weight is evaluated as qualified, it is converted into the model weight in the corresponding format through the model reasoning deployment framework, ensuring that the model can run smoothly on a specific software platform. At the same time, the detection model is deployed to the software platform using this framework, realizing the efficient migration of the model from the training environment to the actual application environment, so that the automotive glass detection can be carried out conveniently and accurately on the software platform, improving the efficiency and practicality of the detection, and providing reliable technical support for the actual application of automotive glass detection.
[0056] Furthermore, the preset trademark extraction algorithm in step S3 includes:
[0057] Perform cropping operation on the original acquired image, and scale the cropped image in equal proportion;
[0058] Obtaining a gradient image of the processed image in the Y direction, and removing noise points in the gradient image by using a closing operation;
[0059] The trademark contour is searched and the position of the trademark contour is determined based on the gradient image processed by the closing operation, and the vertices of the trademark contour are mapped back to the original collected image, thereby extracting the trademark in the original collected image.
[0060] From the above description, it can be seen that by cropping and proportionally scaling the original captured image, it is possible to focus on the key area and unify the image size, which is beneficial to subsequent analysis and processing, and improves processing efficiency and accuracy; obtaining the Y-direction gradient image and using the closed operation to remove noise can enhance the clarity of the trademark edge information, while effectively reducing noise interference, making the trademark features more prominent, and facilitating accurate search for the trademark outline; based on the image processed by the closed operation, the trademark outline is searched and the position is determined, and then mapped back to the original captured image for trademark extraction, which can accurately separate the trademark from the complex original image, improve the accuracy and completeness of trademark extraction, provide high-quality trademark image data for subsequent trademark defect detection and other tasks, and improve the performance and reliability of the entire automotive glass trademark detection system.
[0061] Further, step S3 includes the steps of:
[0062] S31, splicing the mother images according to the number and the position coordinates of each mother image to obtain the original image of the automobile glass to be tested;
[0063] S32, extracting the trademark image by using a preset trademark extraction algorithm. If no accurate template currently exists, executing step S321, otherwise executing step S322;
[0064] S321, determining whether the trademark image is detected, if the trademark image is detected, executing step A1, otherwise executing step A2;
[0065] A1. Confirming whether the trademark image has defects through the detection model and manual detection. If the trademark image has defects, recording and saving trademark defect information;
[0066] Otherwise, saving the trademark image and confirming the trademark image as an accurate template;
[0067] A2. Record trademark defect information;
[0068] S322, performing template front and back matching of the trademark image with the accurate template and the defective template to obtain trademark defect information, wherein the defective template is a sample set composed of trademark images with printing defects.
[0069] From the above description, it can be seen that when there is no accurate template, through the combination of detection model and manual detection, it is possible to accurately determine whether the trademark image has defects and record the defect information when there are defects, and confirm it as an accurate template when there are no defects, thereby realizing automatic and accurate acquisition of the accurate template; when there is an accurate template, the trademark defect information is obtained through positive and negative matching, thereby improving the efficiency and accuracy of automobile glass trademark detection.
[0070] Furthermore, step S4 is specifically as follows:
[0071] The surface defect information and the trademark defect information are summarized, and the surface defect information or the trademark defect information is displayed at the defect position corresponding to the original image of the automobile glass to be tested.
[0072] The surface defect information includes the name, confidence, diameter, location coordinates and the number of the parent image, and the trademark defect information includes the trademark defect detection result.
[0073] From the above description, it can be seen that by summarizing various types of defect information and finally displaying the defect information at the corresponding defect position of the original glass image to be tested, it is helpful for staff to quickly locate and identify defects, improve the visualization and efficiency of detection, and facilitate timely adoption of corresponding measures for processing and improvement; at the same time, detailed information records are helpful for subsequent tracing and analysis of quality problems, providing a strong basis for optimizing production processes and improving product quality.
[0074] Please refer to Figure 6 A terminal for detecting defects on the surface of automobile glass and trademark printing, comprising 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 in the above-mentioned method for detecting defects on the surface of automobile glass and trademark printing are implemented.
[0075] From the above description, it can be seen that the terminal for detecting automobile glass surface and trademark printing defects of the present invention collects the image of the automobile glass to be tested through the acquisition device, pre-processes it, and inputs it into the pre-trained detection model to detect the appearance and printing defects of the automobile glass surface, and further extracts the trademark image of the automobile glass to be tested through the trademark extraction algorithm and performs front and back template matching, summarizes the defect information obtained from the two detections and displays it on the image of the automobile glass to be tested, thereby realizing accurate and efficient detection of various types of defects in different scenarios. At the same time, when detecting trademark printing defects, the template is used for two positive and negative matching detections and one deep learning detection model detection, to ensure that missed printing, over-printing, wrong printing and defects can be correctly identified, thereby improving the accuracy and stability of trademark printing defect detection.
[0076] The present invention provides a method and terminal for detecting automobile glass surface and trademark printing defects, which are suitable for industrially efficiently and accurately detecting automobile glass surface defects and printed area trademarks.
[0077] Please refer to Figures 1 to 5 , Embodiment 1 of the present invention is:
[0078] A method and terminal for detecting automobile glass surface and trademark printing defects, comprising the steps of:
[0079] S1. Numbering a preset number of acquisition devices, and using the acquisition devices to respectively acquire images of the automobile glass to be tested according to a preset range, to obtain a preset number of mother images and number them accordingly according to the numbers of the acquisition devices.
[0080] In this embodiment, multiple line scan cameras are used. In other equivalent embodiments, the acquisition device is not limited to the line scan camera. Through multiple line scan cameras, the field of view is evenly distributed to obtain partial images of the automobile glass to be tested corresponding to the number of line scan cameras, and the partial images are numbered according to the number of the line scan cameras, that is, the partial image of the automobile glass acquired by line scan camera No. 1 will be numbered 1, and so on.
[0081] S2. Crop each mother image a preset number of times, detect the cropped sub-images using a pre-trained detection model, record surface defect information, and save the position coordinates of the area where the trademark is located.
[0082] In this embodiment, since the resolution of each image scanned by the line scan camera is 8000x1000, the acquired image needs to be cropped. Figure 2 As shown, the pre-trained inspection model starts to branch out and perform inspection, detecting appearance and printing defects on the glass and saving surface defect information.
[0083] Wherein, the pre-trained detection model includes:
[0084] A101. Acquire an image of automobile glass and crop the image to generate a sample data set.
[0085] Step A101 is specifically as follows:
[0086] The detected automobile glass image is acquired through the acquisition device and cropped a preset number of times. The defects in the cropped image are annotated using the target detection and annotation tool to generate an XML file. The XML file is converted into a text file in a format corresponding to the deep learning model through a file conversion tool. The text file is divided into a training set and a validation set according to a preset ratio to obtain a target sample data set.
[0087] like Figure 2 As described above, in this embodiment, the acquisition device uses a line scan camera, the target detection and annotation tool uses labelimg, and the deep learning model uses YOLOv8. In other equivalent embodiments, it is not limited to line scan cameras, labelimg and YOLOv8.
[0088] First, the line scan camera is used to capture the input real-time frames to ensure the continuity and real-time nature of the image data. Then, the dataset is created. The resolution of each frame captured by the line scan camera in real time is 8000x1000. It is cropped into 8 images of 1000x1000 using the crop function in OpenCV. Labelimg is used to annotate the defects in the image to generate an xml file. The generated xml file is converted into a txt file in YOLOv8 format through file conversion. Finally, the txt file is divided into a training set and a validation set in a ratio of 6:4 to complete the creation of the sample dataset.
[0089] A102. Build a detection model based on deep neural network and set parameters.
[0090] Step A102 is specifically as follows:
[0091] In the training parameter setting stage, the parameters batch, imgsz and cos_lr are set. In the data enhancement parameter setting stage, the parameters flipud, fliplr and mixup are set.
[0092] In this embodiment, a neural network suitable for high-precision real-time processing tasks is built. In the parameter setting stage, it is divided into training parameters and data enhancement parameters. The training parameter sets batch to 64 to indicate the number of images in each batch. High batch can provide more stable gradient estimation, which helps the model learn a wider range of features; imgsz is 1024 to indicate the input image size, making the features in the image richer; cos_lr is set to true to indicate the use of cosine annealing learning rate, and automatically adjust the learning rate according to the progress of training, so that the model converges more stably. The data enhancement parameter settings flipud and fliplr are 0.5, which means that each image has a 50% probability of being flipped horizontally or vertically during the training process; mosaic is set to 0.5, which means that each image has a 50% probability of applying mosaic enhancement technology during the training process, so that the model can recognize targets in a smaller range; mixup is set to 0.5 to randomly select two images from each batch and mix them at a ratio of 0.5 to generate a new image.
[0093] A103. Train and verify the detection model based on the sample data set, and evaluate the accuracy of the trained detection model.
[0094] Step A103 is specifically as follows:
[0095] The sample data set is input into the deep neural network for training to obtain model weights, and accuracy is evaluated based on the model weights.
[0096] In this embodiment, the data sample is input into the network for training to obtain the model weight pt format, and finally the accuracy of the model weight is evaluated by the performance index (such as Figure 4 As shown in the figure, the cls_loss value gradually tends to 0, indicating that the model's prediction is getting closer and closer to the true value, and the model's performance is improving. mAP50 tends to 90%, that is, at the 50% IoU threshold, the average accuracy of the model is very high and can detect the target well. mAP50-95 tends to 85%, that is, within the IoU threshold range from 50% to 95%, the average accuracy of the model remains at around 85%. This shows that the model not only performs well at a lower IoU threshold, but also maintains a high accuracy at a higher IoU threshold.
[0097] A104. Based on the result of the accuracy evaluation, the detection model is deployed to the software platform through a preset model reasoning deployment framework.
[0098] Step A104 is specifically as follows:
[0099] If the accuracy assessment of the model weights is qualified, the model weights are converted into model weights in a corresponding format through a model reasoning deployment framework, and the detection model is deployed to a software platform according to the model reasoning deployment framework.
[0100] In this embodiment, the model reasoning deployment framework uses TensorRT to convert the model weight pt format into onnx format if it is evaluated as qualified, and then converts it into trt format through TensorRT. Finally, the model weight in trt format is deployed using C++ reasoning code.
[0101] S3. According to the number and the position coordinates of each mother image, the mother images are spliced to obtain the original image of the automobile glass to be tested, the trademark image is extracted by a preset trademark extraction algorithm, and the trademark defect information is obtained by performing template positive and negative matching with the preset accurate template and defect template.
[0102] In this embodiment, since the trademark is not necessarily in only one line scan image, when the detection model recognizes the trademark, it will save the location coordinates of its area, stitch the position or multiple positions together to obtain the complete trademark, and then pass it into the trademark extraction algorithm to extract the trademark image.
[0103] Among them, Figure 3 As shown, the preset trademark extraction algorithm includes:
[0104] Perform cropping operation on the original acquired image, and scale the cropped image in equal proportion;
[0105] Obtaining a gradient image of the processed image in the Y direction, and removing noise points in the gradient image by using a closing operation;
[0106] The trademark contour is searched and the position of the trademark contour is determined based on the gradient image processed by the closing operation, and the vertices of the trademark contour are mapped back to the original collected image, thereby extracting the trademark in the original collected image.
[0107] Step S3 includes the steps of:
[0108] S31, splicing the mother images according to the serial number and the position coordinates of each mother image to obtain the original image of the automobile glass to be tested.
[0109] In this embodiment, there may be overlapping parts between the images captured by the line scan cameras, and the overlapping parts will be cut off when the complete glass image is back-stitched.
[0110] S32. Extract the trademark image using a preset trademark extraction algorithm. If no accurate template currently exists, execute step S321; otherwise, execute step S322.
[0111] In this embodiment, if no accurate template currently exists, step S321 is executed to determine whether the trademark image can be used as an accurate template; otherwise, step S322 is executed to directly detect the trademark image.
[0112] S321, determining whether the trademark image is detected, if the trademark image is detected, executing step A1, otherwise executing step A2.
[0113] A1. Confirming whether the trademark image has defects through the detection model and manual detection. If the trademark image has defects, recording and saving trademark defect information;
[0114] Otherwise, the trademark image is saved and confirmed as an accurate template.
[0115] In this embodiment, the detection model plays a role of auxiliary detection. If the trademark is judged to be a correct trademark without defects, it can be used as an accurate template for subsequent template matching.
[0116] A2. Record trademark defect information.
[0117] S322, performing template front and back matching of the trademark image with the accurate template and the defective template to obtain trademark defect information, wherein the defective template is a sample set composed of trademark images with printing defects.
[0118] In this embodiment, matching the accurate template with the subsequent glass trademark can detect missed printing or wrong printing, and matching the subsequent glass trademark with the defective template can detect multiple printing or wrong printing. Two matches and one model detection are performed in parallel.
[0119] S4. Summarize the surface defect information and the trademark defect information and output them for display on the original image of the automobile glass to be tested.
[0120] Step S4 is specifically as follows:
[0121] The surface defect information and the trademark defect information are summarized, and the surface defect information or the trademark defect information is displayed at the defect position corresponding to the original image of the automobile glass to be tested.
[0122] The surface defect information includes the name, confidence, diameter, location coordinates and the number of the parent image, and the trademark defect information includes the trademark defect detection result.
[0123] In this embodiment, after a defect on the small image is detected, the defect information is recorded, and reverse deduction can be performed based on the coordinate information to know the coordinates of the defect on the original image, and then it can be displayed.
[0124] In this embodiment, after the entire detection process is completed, the detection results are output as follows: Figure 5 As shown. Among them, glass number 1 represents October 23, 2024. At present, 14,816 pieces of glass have been inspected for recording and searching; test result 2 indicates whether the glass is defective (NG) or genuine (OK). As long as there are defects on the glass or the trademark, the glass is judged to be defective (NG). If there are no defects, the glass is judged to be genuine (OK); defect information 3 displays the defects detected on the cropped small picture; defect position 4 indicates the corresponding defect position when it is reversely spliced to the complete original picture; trademark detection result 5 indicates the result of trademark detection. When the corresponding trademark has defects, the character NG is displayed, indicating that the glass is defective. When there are no defects, the character OK is displayed, indicating that the glass is genuine.
[0125] Please refer to Figure 6 , Embodiment 2 of the present invention is:
[0126] A terminal 100 for detecting automobile glass surface and trademark printing defects includes a processor 101, a memory 102, and a computer program stored in the memory 102 and executable on the processor 101. When the processor 101 executes the computer program, the steps of the method for detecting automobile glass surface and trademark printing defects described in Example 1 are implemented.
[0127] In summary, the present invention provides a method and terminal for detecting automobile glass surface and trademark printing defects. The image of the automobile glass to be tested is collected by an acquisition device, and preprocessed, and input into a pre-trained detection model to detect the appearance and printing defects of the automobile glass surface. The trademark image of the automobile glass to be tested is further extracted by a trademark extraction algorithm and the front and back templates are matched. The defect information obtained by the two tests is summarized and displayed on the image of the automobile glass to be tested, so as to realize accurate and efficient detection of various types of defects in different scenarios. At the same time, when detecting trademark printing defects, the template is used for two tests of front and back matching and one deep learning detection model test, so as to ensure that missed printing, over-printing, wrong printing and defects can be correctly identified, thereby improving the accuracy and stability of trademark printing defect detection.
[0128] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for detecting defects on the surface of automobile glass and trademark printing, characterized in that: Includes steps: S1. Numbering a preset number of acquisition devices, and using the acquisition devices to respectively acquire images of the automobile glass to be tested according to a preset range, to obtain a preset number of mother images and number them accordingly according to the numbers of the acquisition devices; S2. Crop each mother image a preset number of times, detect the cropped sub-images using a pre-trained detection model, record surface defect information, and save the position coordinates of the area where the trademark is located; S3, splicing the mother images according to the number and the position coordinates of each mother image to obtain the original image of the automobile glass to be tested, extracting the trademark image by a preset trademark extraction algorithm, and performing template positive and negative matching with a preset accurate template and a defect template to obtain trademark defect information; Step S3 includes the steps of: S31, splicing the mother images according to the number and the position coordinates of each mother image to obtain the original image of the automobile glass to be tested; S32, extracting the trademark image by using a preset trademark extraction algorithm. If no accurate template currently exists, executing step S321, otherwise executing step S322; S321, determining whether the trademark image is detected, if the trademark image is detected, executing step A1, otherwise executing step A2; A1. Confirming whether the trademark image has defects through the detection model and manual detection. If the trademark image has defects, recording and saving trademark defect information; Otherwise, saving the trademark image and confirming the trademark image as an accurate template; A2. Record trademark defect information; S322, performing template front and back matching of the trademark image with an accurate template and a defective template to obtain trademark defect information, wherein the defective template is a sample set composed of trademark images with printing defects; S4. Summarize the surface defect information and the trademark defect information and output them for display on the original image of the automobile glass to be tested.
2. A method for detecting automobile glass surface and trademark printing defects according to claim 1, characterized in that: The pre-trained detection model in step S2 includes: Acquire an image of automobile glass and crop the image to generate a sample data set; Building a detection model based on a deep neural network and setting parameters; training and verifying the detection model according to the sample data set, and evaluating the accuracy of the trained detection model; According to the result of the accuracy evaluation, the detection model is deployed to the software platform through a preset model reasoning deployment framework.
3. A method for detecting automobile glass surface and trademark printing defects according to claim 2, characterized in that: The acquiring an image of the automobile glass and cropping the image to generate a sample data set comprises: The detected automobile glass image is acquired through the acquisition device and cropped a preset number of times. The defects in the cropped image are annotated using the target detection and annotation tool to generate an XML file. The XML file is converted into a text file in a format corresponding to the deep learning model through a file conversion tool. The text file is divided into a training set and a validation set according to a preset ratio to obtain a target sample data set.
4. A method for detecting automobile glass surface and trademark printing defects according to claim 2, characterized in that: Building a detection model based on a deep neural network and setting parameters include: Build a detection model based on a deep neural network and adjust parameter settings at different stages of parameter setting; In the training parameter setting stage, the parameters batch, imgsz and cos_lr are set. In the data enhancement parameter setting stage, the parameters flipud, fliplr and mixup are set.
5. The method for detecting automobile glass surface and trademark printing defects according to claim 2, characterized in that: The detection model is trained and verified according to the sample data set, and the accuracy evaluation of the trained detection model includes: The sample data set is input into the deep neural network for training to obtain model weights, and accuracy is evaluated based on the model weights.
6. A method for detecting automobile glass surface and trademark printing defects according to claim 5, characterized in that: According to the result of the accuracy evaluation, deploying the detection model to the software platform through a preset model reasoning deployment framework includes: If the accuracy assessment of the model weights is qualified, the model weights are converted into model weights in a corresponding format through a model reasoning deployment framework, and the detection model is deployed to a software platform according to the model reasoning deployment framework.
7. A method for detecting automobile glass surface and trademark printing defects according to claim 1, characterized in that: The preset trademark extraction algorithm in step S3 includes: Perform cropping operation on the original acquired image, and scale the cropped image in equal proportion; Obtaining a gradient image of the processed image in the Y direction, and removing noise points in the gradient image by using a closing operation; The trademark contour is searched and the position of the trademark contour is determined based on the gradient image processed by the closing operation, and the vertices of the trademark contour are mapped back to the original collected image, thereby extracting the trademark in the original collected image.
8. The method for detecting automobile glass surface and trademark printing defects according to claim 1, characterized in that: Step S4 is specifically as follows: Summarizing the surface defect information and the trademark defect information, and displaying the surface defect information or the trademark defect information at the defect position corresponding to the original image of the automobile glass to be tested; The surface defect information includes the name, confidence, diameter, location coordinates and the number of the parent image, and the trademark defect information includes the trademark defect detection result.
9. A terminal for detecting defects on the surface of automobile glass and on printed trademarks, 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 for detecting automobile glass surface and trademark printing defects described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Automatic testing system for vehicle glass trademark in mold, and application thereof
CN102809569A
Traffic sign recognition method and system with depth learning model based on compact neural network
CN107220643A
Device and method for automatically detecting flower spot defects of automobile windshield
CN115791617A
Cited By
Detection method and terminal for automobile glass surface and trademark printing defects
CN121810563A