Unsupervised image enhancement training method and device, equipment and medium

Through the unsupervised image enhancement training method, high-quality data sets are selected to train OCR models, which solves the problems of high data labeling cost and poor generalization in the SMT industry, improves the robustness and accuracy of the model, and reduces data preparation Cost and time.

CN118918596APending Publication Date: 2024-11-08深圳市识渊科技有限公司 +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411049789.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

In the SMT industry, data labeling costs are high and it is difficult to obtain highly representative training data in a short period of time, resulting in unstable performance of OCR detection and recognition algorithms in scenarios with poor generalization, affecting defect detection of PCB circuit boards.

Method used

Unsupervised image enhancement training method is adopted to enhance the preset number of times of screen printing pictures of PCB circuit boards, enhancement pictures are generated, and the original and enhanced pictures are predicted using the OCR model, and high-quality pictures are selected according to the preset evaluation criteria. Form a training data set for training OCR models.

Benefits of technology

The problem of inflated confidence is greatly avoided, the robustness and generalization ability of the model is improved, the cost and time of data preparation is reduced, and the accuracy and stability of the OCR model in complex environments is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918596A_ABST
    Figure CN118918596A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of industrial image detection, and discloses an unsupervised image enhancement training method and device, equipment and a medium, and the method comprises the steps: carrying out the enhancement processing of a preset number of times on a PCB silk-screen picture, and obtaining a corresponding number of enhanced pictures; based on an OCR model, predicting the PCB silk-screen picture and the enhanced picture to obtain a first prediction result set based on the PCB silk-screen training picture and a second prediction result set based on the enhanced picture; based on a preset evaluation standard, detecting and comparing the first prediction result with the second prediction result set, and confirming a high-quality picture; and collecting and sorting the high-quality pictures to form a training data set for training the OCR model. According to the method, the collection efficiency and the labeling effectiveness of the training data of PCB screen printing detection and identification in the SMT industry can be greatly improved, and the benefits of high precision and stability of the model are achieved with low labor cost and time cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of industrial image detection technology, and in particular to an unsupervised image enhancement training method, device, equipment and medium. Background Art

[0002] Surface Mount Technology (SMT) is a major technology in electronic manufacturing, which realizes the assembly of electronic products by directly mounting electronic components on the surface of Printed Circuit Board (PCB). Compared with traditional through-hole technology, SMT has higher density, better performance and lower cost, so it has been widely used in modern electronic products. In the SMT industry, AI (Artificial Intelligence) has been widely used to detect defects in PCB boards. Among them, the application of OCR (Optical Character Recognition) algorithm in deep learning to detect and identify SMT circuit board silk screen occupies an important position in SMT defect detection. Unlike face detection, pedestrian detection, etc., OCR detection and recognition of silk screen is particularly important for the stability of detection and recognition, and the reasonable selection of training data plays an extremely important role. At present, the application of OCR technology in the SMT industry to detect and identify PCB circuit board silk screen has the following challenges and current status: 1. High data annotation cost: There are very few public SMT-related training data sets on the Internet, and there are even fewer training data for PCB circuit board silk screen, and the generalization is not strong, so it cannot be applied to industrial-level deployment. Because the AI ​​training data in the SMT industry requires a lot of manual annotation, which requires a lot of time and human resources, and is costly. 2. Insufficient data representativeness and pertinence: If the training data for silk screen OCR detection and recognition is not representative and pertinent, even if the training data volume is extremely large, the OCR silk screen detection and recognition algorithm trained on this data set will also have problems with unstable predictions and poor robustness, which will have a great negative impact on PCB circuit board defect detection. Moreover, the huge but insufficiently representative data costs the data annotation personnel extra labor costs, and the cost-effectiveness is extremely poor.

[0003] Therefore, in the existing data training process of the SMT industry, the high cost of manual labeling and the difficulty in obtaining a large amount of representative data in scenarios with poor generalization for actual on-site deployment in a short period of time need to be urgently addressed. Summary of the invention

[0004] The main purpose of this application is to provide an unsupervised image enhancement training method, device, equipment and medium, aiming to solve the technical problems of high manual labeling cost and difficulty in obtaining a large amount of representative data in a short time in the existing SMT industry data training process in the poor generalization scenario of actual on-site deployment.

[0005] The first aspect of the present application proposes an unsupervised image enhancement training method, comprising:

[0006] Performing a preset number of enhancement processing on the PCB circuit board silk screen image to obtain a corresponding number of enhanced images;

[0007] Based on the OCR model, the PCB circuit board silk screen picture and the enhanced picture are predicted to obtain a first prediction result based on the PCB circuit board silk screen training picture and a second prediction result set based on the enhanced picture;

[0008] Based on a preset evaluation standard, the first prediction result is tested and compared with the second prediction result set to identify a high-quality image;

[0009] The high-quality images are collected and sorted to form a training data set for training the OCR model.

[0010] Furthermore, the step of performing a preset number of enhancement processing on the PCB circuit board silk screen training picture to obtain a corresponding number of enhanced pictures includes:

[0011] Acquire a preset operation type for enhanced processing, wherein the operation type does not include an offset operation;

[0012] Get the enhanced parameters corresponding to each operation type;

[0013] Based on the preset operation type and the corresponding enhancement parameters, the PCB circuit board silk screen image is enhanced to obtain a corresponding enhanced image;

[0014] Based on the number of enhanced images to be generated, the enhancement process is repeated until the number of enhanced images is reached, wherein for each enhancement process, a different operation type and enhancement parameter combination is randomly selected.

[0015] Further, the step of predicting the PCB circuit board silk screen image and the enhanced image based on the OCR model to obtain a first prediction result based on the PCB circuit board silk screen training image and a second prediction result set based on the enhanced image includes:

[0016] Loading an OCR model, and inputting the PCB circuit board silk screen image and the enhanced image into the OCR model;

[0017] Obtaining a prediction result of the OCR model on the PCB circuit board silk screen image to obtain a first prediction result;

[0018] Obtain the prediction result of the OCR model for the enhanced image to obtain a second prediction result set; wherein the second prediction result set includes prediction results of multiple enhanced images.

[0019] Furthermore, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality picture includes:

[0020] Calculate the harmonic mean of the detection box in the first prediction result and the detection box included in the second prediction result set under a specified intersection-over-union ratio threshold;

[0021] Determine whether the harmonic mean is less than a specified harmonic mean threshold;

[0022] If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

[0023] Furthermore, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify the high-quality picture further includes:

[0024] Calculate the minimum classification confidence of the angle classification confidence in the first prediction result and the angle classification confidence in the second prediction result set;

[0025] Determine whether the minimum angle classification confidence value is less than the specified angle classification confidence threshold;

[0026] If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

[0027] Furthermore, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify the high-quality picture further includes:

[0028] Calculating the minimum value of the recognition confidence in the first prediction result and the recognition confidence included in the second prediction result set;

[0029] Determine whether the minimum recognition confidence value is less than the specified recognition confidence threshold;

[0030] If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

[0031] Furthermore, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify the high-quality picture further includes:

[0032] Calculating a minimum value of the detection confidence in the first prediction result and the detection confidence in the second prediction result set;

[0033] Determine whether the minimum detection confidence value is less than the specified detection confidence threshold;

[0034] If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

[0035] The second aspect of the present application provides an unsupervised image enhancement training device, comprising:

[0036] An enhancement module is used to perform a preset number of enhancement processes on the PCB circuit board silk screen image to obtain a corresponding number of enhanced images;

[0037] A prediction module, used to predict the PCB circuit board silk screen picture and the enhanced picture based on the OCR model, and obtain a first prediction result based on the PCB circuit board silk screen training picture and a second prediction result set based on the enhanced picture;

[0038] A comparison module, configured to detect and compare the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality image;

[0039] The training module is used to collect and organize the high-quality images to form a training data set for training the OCR model.

[0040] The third aspect of the present application provides an unsupervised image enhancement training device, comprising:

[0041] Industrial camera, used to take pictures of PCB circuit board silk screen;

[0042] processor;

[0043] Memory for storing computer programs;

[0044] Wherein, when the processor executes the computer program, any one of the unsupervised image enhancement training methods described above is implemented.

[0045] The fourth aspect of the present application proposes a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements any of the above-mentioned unsupervised image enhancement training methods.

[0046] Beneficial effects:

[0047] This application uses image enhancement technology to simulate various lighting and environmental changes in actual applications, which greatly avoids the problem of false confidence, solves the interference of environmental factors such as lighting, and enhances the robustness and generalization ability of the model when facing unknown data. It greatly speeds up the discrimination of high-quality data (high-quality pictures). It only needs to mark key scenes, and achieves the benefits of better accuracy and stability of the OCR model with less time, while reducing the cost and time of data preparation. By training the model with selected high-quality data, the accuracy of the OCR algorithm in the PCB circuit board silk screen recognition task can be significantly improved. The model trained with high-quality data sets shows higher stability when dealing with complex and changeable actual scenes, and reduces the recognition error rate caused by environmental factors. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 This is a schematic diagram of the steps of an unsupervised image enhancement training method according to an embodiment of the present application;

[0049] Figure 2 is a schematic block diagram of the structure of an unsupervised image enhancement training device according to an embodiment of the present application;

[0050] Figure 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the present application;

[0051] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0053] It will be appreciated by those skilled in the art that, unless expressly stated, the singular forms "one", "above", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of features, integers, steps, operations, elements, modules, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, modules, components, and / or groups thereof. It should be understood that when an element is said to be "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may also be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any module and all combinations of one or more associated listed items.

[0054] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0055] Reference Figure 1 The present application embodiment provides an unsupervised image enhancement training method, comprising the following steps S1-S4:

[0056] S1, performing a preset number of enhancement processing on the PCB circuit board silk screen image to obtain a corresponding number of enhanced images;

[0057] S2. Based on the OCR model, predict the PCB circuit board silk screen image and the enhanced image to obtain a first prediction result based on the PCB circuit board silk screen training image and a second prediction result set based on the enhanced image;

[0058] S3. Based on a preset evaluation standard, the first prediction result is compared with the second prediction result set to identify a high-quality image;

[0059] S4. Collect and organize the high-quality images to form a training data set for training the OCR model.

[0060] In step S1, first, the original PCB circuit board silk screen picture is selected as input, and then a series of enhanced jitter operations other than offset are performed on the same PCB circuit board silk screen training picture n times, including but not limited to noise addition, color inversion, brightness adjustment, contrast adjustment, saturation adjustment, etc. It is worth noting that the enhanced jitter operation here does not include offset operation, because offset may change the positional relationship of characters in the image. Specifically: Gaussian noise, salt and pepper noise, etc. can be added to simulate image interference that may occur in the actual environment. By adjusting the contrast, brightness and saturation, images of different tones are generated to increase the model's adaptability to color changes. By randomly rotating the picture (such as 90 degrees, 180 degrees) and flipping it horizontally, the model's recognition ability for different orientations is enhanced. By randomly cropping and scaling the image, it is ensured that the model can handle silk screens of different sizes and viewing angles. According to actual needs, the number of enhancements is preset (for example, 5 times, 10 times or more) to ensure that the generated enhanced image has sufficient diversity to cover different feature transformations, and each enhancement operation has a corresponding parameter range. For example, for the noise addition operation, the upper and lower limits of the noise intensity can be set; for the brightness adjustment, the proportional range of the brightness change can be set. The selection of these parameters needs to be adjusted according to the actual situation and the expected effect. For each original PCB circuit board silk screen picture, randomly select one or more from the preset operation types, and then randomly select the enhancement parameters of the operation type for image enhancement processing. For example, you can randomly choose to add Gaussian noise and set the noise intensity to a random value within a specific range. According to the required number of enhanced pictures, repeat the above enhancement processing steps until a sufficient number of enhanced pictures are generated. Each enhancement should randomly select a different combination of operation types and enhancement parameters to ensure the diversity of the enhanced pictures. After the above steps, a set of enhanced pictures derived from the original PCB circuit board silk screen pictures will be obtained. Image enhancement technology can generate more training samples based on limited original data, effectively expanding the scale of the training data set. Enhanced processing can simulate a variety of lighting and environmental changes in actual applications, allowing the model to better adapt to various conditions in the real world. By increasing the diversity of data, the model's dependence on specific training samples can be reduced, preventing the model from overfitting the training data during the training process, allowing the model to maintain good performance when facing unseen data, improving the model's robustness and generalization ability; at the same time, it reduces the demand for high-quality and diverse manually annotated data, and reduces the manpower and time costs in the data preparation stage.

[0061] In step S2, an OCR model architecture suitable for PCB circuit board silk screen text recognition is selected. Commonly used models include CTC (Connectionist Temporal Classification) models based on deep learning, Transformer models, etc.; the original PCB circuit board silk screen images and enhanced images are preprocessed by size normalization, grayscale, etc., so that the model can uniformly process images from different sources. The text on the PCB circuit board is converted into a model-readable encoding form, such as using One-Hot encoding or Token encoding. A prediction process is constructed for each PCB circuit board silk screen image and its enhanced image, which includes loading images, performing preprocessing, and passing to the OCR model for prediction. The original PCB circuit board silk screen image is input into the OCR model for prediction to obtain a first prediction result. All enhanced images are input into the OCR model for prediction to obtain a second prediction result set. The first prediction result of the original image and the second prediction result set of the enhanced image are recorded. These results can be stored as text files or database records for use in subsequent steps. By comparing the prediction results under different conditions, it is possible to find which enhancement strategies are more conducive to model learning, thereby adjusting the composition of the training data set. By using enhanced images for prediction, the model performance can be evaluated more comprehensively, and the information of enhanced images can be used to improve the model. Since enhanced images cover a variety of changes, the model can learn more features when processing these images, thereby improving its robustness in the face of actual application scenarios. Compared with traditional methods, this method does not require additional manual annotation work, and only needs to use the existing OCR model to complete the prediction, which simplifies the data preparation process.

[0062] In step S3, thresholds for evaluation are set according to actual conditions, such as harmonic mean (Hmean) thresholds, confidence (confidence) thresholds, etc. Determine indicators for evaluation, including but not limited to the harmonic mean (Hmean) of the detection box, angle classification confidence (cls_confidence), recognition confidence (rec_confidence), etc. Mark all original images that meet the conditions as high-quality images and organize them into a list. By comparing the first prediction result with the second prediction result set, the images that can still maintain high accuracy and stability under different enhancement conditions are screened out. Using these high-quality images as part of the training data can improve the robustness and generalization ability of the model in complex environments. By automatically screening high-quality images, the amount of data that needs to be manually labeled is reduced, saving time and cost. The screened high-quality images can usually represent more challenging scenes, and using these images to train the model can improve the performance of the model in practical applications. In summary, step S3 automatically screens out high-quality images through a series of preset evaluation criteria, providing high-quality data support for subsequent model training, and also greatly improving the efficiency of data preparation and the generalization ability of the model.

[0063] In step S4, based on the high-quality images that have been automatically screened out in steps S1 to S3, these images are carefully annotated to ensure data quality. Semi-automatic tools can be used to assist in annotation, such as preliminary annotation based on model prediction results, followed by manual verification and correction, and the sorted high-quality images are divided into training sets, validation sets, and test sets according to a certain ratio. Ensure that the images and annotation information in the data set meet the input requirements of the OCR model. Select a suitable OCR model architecture according to the needs, such as a model based on deep learning. Use the constructed training data set to train the OCR model, and monitor model performance indicators such as loss function value and accuracy. Tune the model according to the performance of the validation set, such as adjusting hyperparameters, adding regularization terms, etc. By using high-quality images to train the model, the accuracy and stability of the model in complex and changeable actual scenarios can be significantly improved, the amount of data that needs to be manually annotated can be reduced, and the cost of the data preparation stage can be reduced. High-quality images can usually represent more challenging scenarios. Using these images to train the model can improve the robustness and generalization ability of the model. At the same time, using the selected high-quality images as part of the training data can train the model more efficiently and reduce the number of iterations. Step S4 collects and organizes high-quality images to build a high-quality training dataset, which can not only significantly improve the performance of the OCR model, but also reduce the cost and time of data preparation, providing strong support for model training and deployment.

[0064] Through steps S1-S4, this solution can rely on unsupervised algorithms to identify and select data that is judged to be high-quality for PCB circuit board screen printing OCR detection and recognition, greatly reducing the labor cost and time spent on labeling. There is no need to fully label the data, reducing labor and time costs. There is no need to perform 24-hour all-weather discrimination and prediction on actual business scenarios to identify scenes with poor generalization, so as to collect data sets for labeling. By using the method of perturbing the image n times, the problem of false confidence is avoided to the greatest extent, and the interference of environmental factors such as lighting is solved, which greatly speeds up the identification of high-quality data. Only key scenes need to be labeled, and the accuracy and stability of the OCR model can be achieved with less time.

[0065] Compared with this solution, the existing unfocused full-volume labeling method uses a large number of labelers to spend a lot of manpower and time costs to label various different silk screens of different PCB circuit boards, regardless of whether they are high-quality or not, and all are added to the OCR training data for training, using the method of data piling to improve the generalization and stability of the OCR model. This method requires a lot of manpower and time costs, but because there is no targeted labeling, a large amount of similar data may have little effect on improving the performance of the model, and even cause the model to overfit. The existing actual scene discrimination labeling directly applies the OCR model to reason, detect and identify the silk screens of PCB circuit boards in different scenes, and finds scenes with poor generalization through the results of direct reasoning, and then focuses on labeling data for this scene and adds it to the training. This method requires a long time to discriminate data with poor generalization in actual scenes, and considering the influence of lighting and other factors, the generalization judgment of the same scene at different times will also be biased. Even the existing direct labeling by confidence judgment, that is, by applying OCR data to the existing PCB circuit board screen printing data to screen the prediction confidence, screen out the pictures with lower confidence, and focus on labeling such low-confidence scene pictures. Although this method can screen out some high-quality data through the confidence of the OCR model, because the confidence of the model is strongly correlated with the design of the model, it is very easy to cause the OCR model confidence judgment to be falsely high, which easily leads to the omission of high-priority data, and the performance improvement of the model is not significant.

[0066] In one embodiment, the step of performing a preset number of enhancement processing on the PCB circuit board silk screen training image to obtain a corresponding number of enhanced images includes:

[0067] S10, obtaining a preset operation type for enhanced processing, wherein the operation type does not include an offset operation;

[0068] S11, obtaining enhancement parameters corresponding to each operation type;

[0069] S12, based on the preset operation type and the corresponding enhancement parameters, the PCB circuit board silk screen image is enhanced to obtain a corresponding enhanced image;

[0070] S13. Based on the number of enhanced images to be generated, the enhancement process is repeated until the number of enhanced images is reached, wherein for each enhancement process, a different operation type and enhancement parameter combination is randomly selected.

[0071] In this embodiment, the types of operations that can be used for enhancement processing are first clarified, such as rotation, scaling, flipping, brightness adjustment, contrast adjustment, color conversion, etc. Note that in this embodiment, the operation type does not include "offset operation" to avoid changing the position information of the image. A set of reasonable parameter ranges is defined for each enhancement operation. For example, for the rotation operation, the angle range can be set to [-15°, +15°]; for the brightness adjustment, the gain range can be set to [0.8, 1.2], etc. These parameters are stored in a configuration file or database for subsequent use. For each original image, one or more operation types and their parameters are randomly selected for enhancement processing. The original image is enhanced according to the selected operation type and its parameters to obtain an enhanced image. The specific operation type and parameters used for each enhancement processing are recorded for subsequent analysis and tracking. Based on how many enhanced images need to be generated, the above steps are called repeatedly to continuously generate new enhanced images until the predetermined target number is reached. In each cycle, different operation types and enhancement parameter combinations are randomly selected to ensure that the generated enhanced images have sufficient diversity. By performing various types of enhancement processing on the original PCB circuit board silk screen image, various situations in actual application scenarios can be simulated, thereby improving the generalization ability of the model. Through data enhancement, the scale of the training data set can be expanded without increasing the cost of additional data acquisition. Enhancement processing can reduce the dependence on labeled data, thereby simplifying the data preparation process and speeding up the model training. This embodiment effectively increases the diversity and scale of training data through a series of enhancement processing steps, thereby improving the performance and robustness of the OCR model. Compared with traditional methods, it provides a more flexible and efficient data enhancement solution.

[0072] In one embodiment, the step of predicting the PCB circuit board silk screen image and the enhanced image based on the OCR model to obtain a first prediction result based on the PCB circuit board silk screen training image and a second prediction result set based on the enhanced image includes:

[0073] S20, loading an OCR model, and inputting the PCB circuit board silk screen image and the enhanced image into the OCR model;

[0074] S21, obtaining a prediction result of the OCR model on the PCB circuit board silk screen image to obtain a first prediction result;

[0075] S22. Obtain prediction results of the OCR model for the enhanced image to obtain a second prediction result set; wherein the second prediction result set includes prediction results of multiple enhanced images.

[0076] In this embodiment, the OCR model is first loaded to ensure that the model is available in memory. The original PCB circuit board silk screen image and all enhanced images previously generated by data enhancement are prepared. All images (original image (PCB circuit board silk screen image) + enhanced image) are batch input into the OCR model for prediction. If the model supports batch processing, multiple images can be processed simultaneously through a single call. The original PCB circuit board silk screen image is predicted. The prediction result of the original image is extracted from the OCR model output, which is the result of the model directly processing without data enhancement. Batch prediction is performed on all enhanced images to obtain a set containing all enhanced image prediction results. These prediction results are collected to form a set, which is called the second prediction result set. By comparing the prediction results of the original image and the enhanced image, the performance of the OCR model under different conditions can be evaluated. By comparing the first prediction result and the second prediction result set, it can be verified whether the data enhancement strategy effectively improves the accuracy and robustness of the model. In this embodiment, by performing OCR prediction on the original PCB circuit board silk screen image and its enhanced version, not only can the performance of the model under standard conditions be evaluated, but also the effectiveness of the data enhancement strategy can be verified by comparing the prediction results of the enhanced image. This method can not only improve the generalization and robustness of the model, but also help better understand the behavior of the model, thereby achieving better results in practical applications. Compared with the existing OCR model training method, this enhancement strategy can significantly improve the performance of the model in complex environments, reduce the risk of model overfitting, and improve the overall performance of the model.

[0077] In one embodiment, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality image includes:

[0078] S30, calculating the harmonic mean of the detection box in the first prediction result and the detection box included in the second prediction result set under a specified intersection-over-union ratio threshold;

[0079] S31, determining whether the harmonic mean is less than a specified harmonic mean threshold;

[0080] S32: If it is less than, determine that the PCB circuit board silk screen image corresponding to the first prediction result is a high-quality image.

[0081] In this embodiment, a reasonable intersection-and-union ratio threshold is first determined, which is used to measure the degree of overlap between two detection frames. For each detection frame in the first prediction result, find the detection frame with the highest intersection-and-union ratio in the second prediction result set. Calculate the intersection-and-union ratio of each pair of matching detection frames, that is, the overlapping area of ​​the two detection frames divided by their union area. For each detection frame in the first prediction result, according to its intersection-and-union ratio with the detection frame in the second prediction result set, if it meets the intersection-and-union ratio threshold, calculate the harmonic mean. The harmonic mean can better reflect the influence of extreme values ​​and is suitable for measuring the average performance of a set of data. A harmonic mean threshold is preset, which is used to judge the performance of the first prediction result relative to the second prediction result set. Compare the mean of the harmonic mean with the preset harmonic mean threshold. If the mean of the harmonic mean is less than the preset harmonic mean threshold, it is considered to be a high-quality image. In this embodiment, by detecting and comparing the first prediction result and the second prediction result set, it is possible to effectively screen out those original PCB circuit board silk screen images that can obtain good prediction results even without data enhancement. This method can not only improve the efficiency of model training and reduce resource consumption, but also improve the robustness and accuracy of the model in practical applications. Compared with existing methods, it provides a more efficient and targeted way to optimize the data set for model training, thereby achieving better model performance.

[0082] In one embodiment, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify the high-quality image further includes:

[0083] S40, calculating the minimum classification confidence of the angle classification confidence in the first prediction result and the angle classification confidence in the second prediction result set;

[0084] S41, determining whether the minimum angle classification confidence value is less than a specified angle classification confidence threshold;

[0085] S42: If it is less than, determine that the PCB circuit board silk screen image corresponding to the first prediction result is a high-quality image.

[0086] In this embodiment, the angle classification confidence refers to the confidence level of the model in the angle classification result, that is, how confident the model is in the identified angle direction. The angle classification confidence is extracted from the first prediction result, and the confidence values ​​of all angle classifications are extracted from the second prediction result set. The minimum value of the angle classification confidence in the first prediction result and all angle classification confidence values ​​contained in the second prediction result set is calculated. This is because it is necessary to pay attention to the most uncertain situation to ensure that the model still performs well in the worst case. An angle classification confidence threshold is preset, and this threshold is used to judge the angle classification performance of the first prediction result and the second prediction result set. If the minimum angle classification confidence value is less than the preset angle classification confidence threshold, it is considered that the original PCB circuit board silk screen image corresponding to the first prediction result is considered to be a high-quality image.

[0087] In one embodiment, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify the high-quality image further includes:

[0088] S50, calculating the minimum value of the recognition confidence in the first prediction result and the recognition confidence in the second prediction result set;

[0089] S51, determining whether the minimum recognition confidence value is less than a specified recognition confidence threshold;

[0090] S52: If it is less than, determine that the PCB circuit board silk screen image corresponding to the first prediction result is a high-quality image.

[0091] In this embodiment, recognition confidence refers to how confident the model is in the recognized text content. The recognition confidence is extracted from the first prediction result, and all recognition confidence values ​​are extracted from the second prediction result set. The recognition confidence in the first prediction result and the minimum value of all recognition confidence values ​​in the second prediction result set are calculated. This is because it is necessary to pay attention to the most uncertain situation to ensure that the model still performs well in the worst case. A recognition confidence threshold is preset, and this threshold is used to compare with the minimum recognition confidence value. If the minimum recognition confidence value is less than the preset recognition confidence threshold, the original PCB circuit board silk screen image corresponding to the first prediction result is considered to be a high-quality image.

[0092] In one embodiment, the step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify the high-quality image further includes:

[0093] S60, calculating the minimum value of the detection confidence in the first prediction result and the detection confidence in the second prediction result set;

[0094] S61, determining whether the minimum detection confidence value is less than a specified detection confidence threshold;

[0095] S62: If it is less than, determine that the PCB circuit board silk screen image corresponding to the first prediction result is a high-quality image.

[0096] In this embodiment, the detection confidence refers to the confidence level of the model in the detected object, that is, how confident the model is in the detection result. The detection confidence is extracted from the first prediction result, and all the detection confidence values ​​are extracted from the second prediction result set to find the minimum value. A detection confidence threshold is preset. If the detection confidence minimum value is less than the preset detection confidence threshold, the original PCB circuit board silk screen image corresponding to the first prediction result is considered to be a high-quality image because it shows good performance without data enhancement of the model. The preset detection confidence threshold is a standard for evaluating the detection performance of the model. If the detection confidence of the model is lower than this threshold, it means that the model is not confident enough in the detection result, that is, the performance of the model is poor. The detection confidence minimum value is the lowest confidence found from all the detection confidence values ​​in the first prediction result and the second prediction result set. This minimum value represents the worst performance of the model in this set of data. If this minimum value is still higher than the preset detection confidence threshold, it means that even in the worst case, the detection performance of the model is acceptable. On the contrary, if the minimum value is lower than the threshold, it indicates that in at least one case, the detection confidence of the model is lower than the expected standard. Even the worst detection confidence in the original image is still lower than the set threshold, which indicates that the detection performance of the model on the original image is lower than the expected standard without enhancement. It means that the original image has reached the expected low performance standard without enhancement, and the detection result of the enhanced image has not significantly improved the performance of the model. If the minimum detection confidence value is less than the preset detection confidence threshold, it can be said that the first prediction result (the detection result of the original image) performs better than the second prediction result set (the detection result set of the enhanced image). This means that the original image itself has good detection performance, and the model can complete the detection task well even without enhancement. This shows that the original image is of high quality and can be used as part of the training data set to further improve the performance of the model.

[0097] refer to Figure 2 , an unsupervised image enhancement training device, comprising:

[0098] The enhancement module 100 is used to perform a preset number of enhancement processes on the PCB circuit board silk screen image to obtain a corresponding number of enhanced images;

[0099] A prediction module 200 is used to predict the PCB circuit board silk screen image and the enhanced image based on the OCR model, and obtain a first prediction result based on the PCB circuit board silk screen training image and a second prediction result set based on the enhanced image;

[0100] A comparison module 300 is used to detect and compare the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality picture;

[0101] The training module 400 is used to collect and organize the high-quality images to form a training data set for training the OCR model.

[0102] Furthermore, the enhancement module 100 includes:

[0103] A type acquisition unit, used to acquire a preset operation type of enhanced processing, wherein the operation type does not include an offset operation;

[0104] A parameter acquisition unit, used to acquire enhanced parameters corresponding to each operation type;

[0105] An enhancement start unit, used to enhance the PCB circuit board silk screen image based on the preset operation type and the corresponding enhancement parameters to obtain a corresponding enhanced image;

[0106] The repeated enhancement unit is used to repeat the enhancement process based on the number of enhanced pictures to be generated until the number of enhanced pictures is reached, wherein for each enhancement process, a different operation type and enhancement parameter combination is randomly selected.

[0107] Furthermore, the prediction module 200 includes:

[0108] An input unit, used for loading an OCR model, and inputting the PCB circuit board silk screen image and the enhanced image into the OCR model;

[0109] A result acquisition unit is used to acquire a prediction result of the OCR model on the PCB circuit board silk screen image to obtain a first prediction result;

[0110] The set acquisition unit is used to acquire the prediction result of the OCR model for the enhanced image to obtain a second prediction result set; wherein the second prediction result set includes the prediction results of multiple enhanced images.

[0111] Furthermore, the comparison module 300 includes:

[0112] A first calculation unit is used to calculate the harmonic mean of the detection box in the first prediction result and the detection box included in the second prediction result set under a specified intersection-over-union ratio threshold;

[0113] A first judging unit, configured to judge whether the harmonic mean is less than a specified harmonic mean threshold;

[0114] The first determination unit is configured to determine that the PCB circuit board silk-screen image corresponding to the first prediction result is a high-quality image if it is less than.

[0115] Furthermore, the comparison module 300 further includes:

[0116] A second calculation unit, used to calculate the minimum classification confidence of the angle classification confidence in the first prediction result and the angle classification confidence in the second prediction result set;

[0117] A second judgment unit, used to judge whether the minimum angle classification confidence value is less than a specified angle classification confidence threshold;

[0118] The second determination unit is configured to determine that the PCB circuit board silk-screen image corresponding to the first prediction result is a high-quality image if it is less than.

[0119] Furthermore, the comparison module 300 further includes:

[0120] A third calculation unit, used to calculate the minimum value of the recognition confidence in the first prediction result and the recognition confidence included in the second prediction result set;

[0121] A third judgment unit, used to judge whether the minimum recognition confidence value is less than a specified recognition confidence threshold;

[0122] The third determination unit is configured to determine that the PCB circuit board silk-screen image corresponding to the first prediction result is a high-quality image if it is less than.

[0123] Furthermore, the comparison module 300 further includes:

[0124] A fourth calculation unit, used to calculate a minimum value of the detection confidence in the first prediction result and the detection confidence in the second prediction result set;

[0125] A fourth judgment unit, used to judge whether the minimum detection confidence value is less than a specified detection confidence threshold;

[0126] The fourth determination unit is configured to determine that the PCB circuit board silk-screen image corresponding to the first prediction result is a high-quality image if it is less than.

[0127] Reference Figure 3 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3As shown. The computer device includes a processor, a memory, a network interface and a database connected by a bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores operations, computer programs and databases. The internal memory provides an environment for the operation of the operations and computer programs in the non-volatile storage medium. The database of the computer device is used to store data such as unsupervised image enhancement training methods. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an unsupervised image enhancement training method is implemented, including the steps of: performing a preset number of enhancement processing on a PCB circuit board silk screen picture to obtain a corresponding number of enhanced pictures; based on the OCR model, predicting the PCB circuit board silk screen picture and the enhanced picture, obtaining a first prediction result based on the PCB circuit board silk screen training picture and a second prediction result set based on the enhanced picture; based on a preset evaluation standard, the first prediction result and the second prediction result set are detected and compared to confirm a high-quality picture; collecting and arranging the high-quality pictures to form a training data set for training the OCR model. An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, an unsupervised image enhancement training method is implemented, including the steps of: performing enhancement processing on a PCB circuit board silk screen picture for a preset number of times to obtain a corresponding number of enhanced pictures; based on an OCR model, predicting the PCB circuit board silk screen picture and the enhanced picture to obtain a first prediction result based on the PCB circuit board silk screen training picture and a second prediction result set based on the enhanced picture; based on a preset evaluation standard, detecting and comparing the first prediction result with the second prediction result set to identify high-quality pictures; collecting and organizing the high-quality pictures to form a training data set for training the OCR model.

[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in the present application and used in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0129] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. An unsupervised image enhancement training method, characterized in that: include: Performing a preset number of enhancement processing on the PCB circuit board silk screen image to obtain a corresponding number of enhanced images; Based on the OCR model, the PCB circuit board silk screen picture and the enhanced picture are predicted to obtain a first prediction result based on the PCB circuit board silk screen training picture and a second prediction result set based on the enhanced picture; Based on a preset evaluation standard, the first prediction result is compared with the second prediction result set to identify a high-quality image; The high-quality images are collected and sorted to form a training data set for training the OCR model.

2. The unsupervised image enhancement training method according to claim 1, characterized in that: The step of performing a preset number of enhancement processing on the PCB circuit board silk screen training picture to obtain a corresponding number of enhanced pictures comprises: Acquire a preset operation type of enhanced processing, wherein the operation type does not include an offset operation; Get the enhanced parameters corresponding to each operation type; Based on the preset operation type and the corresponding enhancement parameters, the PCB circuit board silk screen image is enhanced to obtain a corresponding enhanced image; Based on the number of enhanced images to be generated, the enhancement process is repeated until the number of enhanced images is reached, wherein for each enhancement process, a different operation type and enhancement parameter combination is randomly selected.

3. The unsupervised image enhancement training method according to claim 1, characterized in that: The step of predicting the PCB circuit board silk screen image and the enhanced image based on the OCR model to obtain a first prediction result based on the PCB circuit board silk screen training image and a second prediction result set based on the enhanced image includes: Loading an OCR model, and inputting the PCB circuit board silk screen image and the enhanced image into the OCR model; Obtaining a prediction result of the OCR model on the PCB circuit board silk screen image to obtain a first prediction result; Obtain the prediction result of the OCR model for the enhanced image to obtain a second prediction result set; wherein the second prediction result set includes prediction results of multiple enhanced images.

4. The unsupervised image enhancement training method according to claim 1, characterized in that: The step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality image includes: Calculate the harmonic mean of the detection box in the first prediction result and the detection box included in the second prediction result set under a specified intersection-over-union ratio threshold; Determine whether the harmonic mean is less than a specified harmonic mean threshold; If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

5. The unsupervised image enhancement training method according to claim 1, characterized in that: The step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality picture further includes: Calculate the minimum classification confidence of the angle classification confidence in the first prediction result and the angle classification confidence in the second prediction result set; Determine whether the minimum angle classification confidence value is less than the specified angle classification confidence threshold; If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

6. The unsupervised image enhancement training method according to claim 1, characterized in that: The step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality picture further includes: Calculating the minimum value of the recognition confidence in the first prediction result and the recognition confidence included in the second prediction result set; Determine whether the minimum recognition confidence value is less than the specified recognition confidence threshold; If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

7. The unsupervised image enhancement training method according to claim 1, characterized in that: The step of detecting and comparing the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality picture further includes: Calculate the minimum value of the detection confidence in the first prediction result and the detection confidence in the second prediction result set; Determine whether the minimum detection confidence value is less than the specified detection confidence threshold; If it is less than, the PCB circuit board silk screen image corresponding to the first prediction result is determined to be a high-quality image.

8. An unsupervised image enhancement training device, characterized in that: include: An enhancement module is used to perform a preset number of enhancement processes on the PCB circuit board silk screen image to obtain a corresponding number of enhanced images; A prediction module, used to predict the PCB circuit board silk screen picture and the enhanced picture based on the OCR model, and obtain a first prediction result based on the PCB circuit board silk screen training picture and a second prediction result set based on the enhanced picture; A comparison module, configured to detect and compare the first prediction result and the second prediction result set based on a preset evaluation standard to identify a high-quality image; The training module is used to collect and organize the high-quality images to form a training data set for training the OCR model.

9. An unsupervised image enhancement training device, characterized in that: include: Industrial camera, used to take pictures of PCB circuit board silk screen; processor; Memory for storing computer programs; Wherein, when the processor executes the computer program, the unsupervised image enhancement training method described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the unsupervised image enhancement training method according to any one of claims 1 to 7 is implemented.