Screen detection model training method and device, equipment and storage medium
By constructing an initial sample training set of defect-free region images and using the GMM model to train the screen detection model, the problem of long training cycles in existing technologies is solved, and efficient screen defect detection is achieved.
Patent Information
- Application Number
- CN202111572369.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2041-12-21
AI Technical Summary
Existing technologies require a large number of defective screen images as training samples when training network models for screen defect detection, resulting in long training cycles and low efficiency.
By acquiring defect-free region images of a preset screen image, an initial image sample training set is constructed, and a Gaussian Mixture Model (GMM) is used for model training. By combining filtering and loss function optimization, the number of samples and training time are reduced.
It improves the training efficiency of the screen detection model, reduces the dependence on defective screen images, shortens the training cycle, and enhances the detection accuracy of the model.
Smart Images

Figure CN114359186B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a screen detection model training method, apparatus, device, and storage medium. Background Technology
[0002] With the continuous development of technology, LCD screens have been widely used in social life and industrial fields. However, whether it is an LCD (Liquid Crystal Display) screen or an OLED (Organic Light-Emitting Diode) screen, defects such as pinholes may occur during the production process or during use.
[0003] Existing technologies typically require a large number of defective screen images as training samples when training network models for screen defect detection. However, there are many types of defective screen images, and they are difficult to collect. Furthermore, the large number of training samples results in a slow training cycle and low training efficiency. Summary of the Invention
[0004] This application provides a screen detection model training method, apparatus, device, and storage medium to improve the training efficiency of screen detection models.
[0005] In a first aspect, embodiments of this application provide a screen detection model training method, the method comprising:
[0006] Obtain defect-free region images of a preset screen image to obtain an initial image sample training set of the defect-free region images;
[0007] Based on the initial image sample training set and the preset screen detection model, the screen detection model is trained according to the preset model training parameters, so as to perform defect detection on the screen image to be tested according to the trained screen detection model.
[0008] Secondly, embodiments of this application also provide a screen detection model training device, the device comprising:
[0009] The sample training set acquisition module is used to acquire defect-free region images of a preset screen image and obtain an initial image sample training set of the defect-free region images.
[0010] The model training module is used to train the screen detection model based on the initial image sample training set and the preset screen detection model, and based on the preset model training parameters, so as to perform defect detection on the screen image to be tested according to the trained screen detection model.
[0011] Thirdly, embodiments of this application also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the screen detection model training method as described in any of the embodiments of this application.
[0012] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, wherein the program, when executed by a processor, implements the screen detection model training method as described in any of the embodiments of this application.
[0013] This application's embodiment obtains an initial image sample training set of defect-free region images from a preset screen image. Based on the initial image sample training set and a preset screen detection model, and using preset model training parameters, the screen detection model is trained to detect defects in the screen image under test. This solution avoids the need to acquire a large number of difficult-to-collect defective screen images, thus reducing the required initial image sample training set to only require defect-free region images. Compared to acquiring defective screen images, collecting defect-free region images is less difficult, reducing the model training cycle and improving training efficiency. Attached Figure Description
[0014] Figure 1A This is a flowchart illustrating a screen detection model training method according to Embodiment 1 of this application;
[0015] Figure 1B This is a schematic diagram of the division position of the defect-free image in the preset screen image in Embodiment 1 of this application;
[0016] Figure 2A This is a flowchart illustrating a screen detection model training method according to Embodiment 2 of this application;
[0017] Figure 2B This is a schematic diagram of the filtering result of filtering a defect-free region image in Embodiment 2 of this application;
[0018] Figure 3 This is a schematic diagram of the local image to be tested, the detection result image, and the target result image in Embodiment 2 of this application;
[0019] Figure 4 This is a structural block diagram of a screen detection model training device according to Embodiment 4 of this application;
[0020] Figure 5This is a schematic diagram of the structure of an electronic device according to Embodiment 5 of this application. Detailed Implementation
[0021] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present application, not the entire structure.
[0022] Example 1
[0023] Figure 1A This is a flowchart illustrating a screen detection model training method provided in Embodiment 1 of this application. This embodiment is applicable to defect detection of screen images. The method can be executed by a screen detection model training device, which can be implemented in software and / or hardware. As shown in Figure 1, the method specifically includes the following steps:
[0024] S110. Obtain the defect-free region image of the preset screen image to obtain the initial image sample training set of the defect-free region image.
[0025] Screen images can be acquired using image acquisition devices, such as AOI (Automatic Optical Inspection) equipment. The defect-free area image of the screen can be predetermined by relevant technicians. For example, at least one region can be divided from a defect-free screen image as a defect-free area image, or other regions besides the defective region can be selected from a defective screen image as defect-free area images. The shape of the defect-free area image can be arbitrary; for example, it can be a square or a rectangle. The size of the defect-free area image can be predetermined by relevant technicians; for example, if the defect-free area image is square, its size can be 256×256 pixels.
[0026] At least one defect-free region image can be used as the initial image sample training set. For example, the number of defect-free region images used as the initial image sample training set can be predetermined by relevant technicians based on practical experience or experimental values. Specifically, it can also be related to the selected screen detection model. When a suitable screen detection model is selected, the number of defect-free region images in the initial image sample training set can be relatively small. For example, if the selected screen detection model is a GMM (Gaussian Mixed Model), the number of defect-free region images in the initial image sample training set can be 5.
[0027] It should be noted that since the image imaging varies at different locations within a defect-free screen image, when determining the defect-free region image, multiple defect-free region images can be selected from different locations within a single defect-free screen image to increase the diversity of the initial image sample training set and avoid poor training results due to an overly singular initial image sample training set.
[0028] In one optional embodiment, obtaining a defect-free region image of a preset screen image includes: in response to an image region division instruction issued by a user, determining at least one defect-free region image in the preset screen image.
[0029] The preset screen image can be a preset defect-free screen image. The image region division command issued by the user can be an instruction to divide the preset screen image into at least one defect-free region image according to a preset division rule. For example, considering the differences in image imaging at different locations within the defect-free screen image, the division rule could be to divide the preset defect-free screen image into nine different regions; for instance, it could be to divide the preset defect-free screen image into nine different locations: top, bottom, left, right, upper left, upper right, lower left, and lower right, with each location representing a defect-free region image. The division positions of the defect-free images within the preset screen image can be as follows: Figure 1B As shown.
[0030] It should be noted that the rules for dividing the defect-free area image in the preset defect-free screen image can be customized by the user. For example, the preset defect-free screen image can be divided into a 5×5 grid, and then the corresponding defect-free area image can be determined in any grid.
[0031] This optional embodiment achieves the acquisition of defect-free region images at any location within a preset screen image by determining at least one defect-free region image in response to a user-issued image region segmentation command. The preset screen image can be either defective or defect-free, with lower requirements for the screen image, thus reducing the difficulty of acquiring defect-free region images. Considering the differences in image imaging, defect-free region images can be selected at different locations within a single screen image, improving the diversity of the initial image sample training set.
[0032] S120. Based on the initial image sample training set and the preset screen detection model, the screen detection model is trained according to the preset model training parameters, so as to perform defect detection on the screen image to be tested according to the trained screen detection model.
[0033] The screen detection model can be pre-defined by relevant technical personnel. For example, the screen detection model can be a convolutional neural network model. Preferably, the screen detection model can also be a Gaussian probability density function (GMM) model. The Gaussian probability density function in the GMM model can accurately quantify an object, decomposing it into several models based on the Gaussian probability density function. The shape of the Gaussian distribution is similar to the distribution shape of most data, which can well characterize the spatial distribution and characteristics of data in the parameter space. Moreover, the Gaussian probability density function has advantages such as ease of parameter estimation. Therefore, the GMM model can be preferentially selected for screen detection. The model training parameters can be pre-defined by relevant technical personnel. For example, the model training parameters can include the number of iterations, loss function, and learning rate. Specifically, different model training parameters can be preset according to the selected screen detection model.
[0034] For example, the preset screen detection model can be a Gaussian Mixture Model (GMM). Correspondingly, the initial image sample training set can contain 5 defect-free screen regions. Based on preset iteration counts and loss functions, the GMM model is trained, and the trained screen detection model is used to detect defects in the screen image under test. The screen image under test can be the screen image for which point-type defect detection is to be performed, and can be acquired through an image acquisition device, such as an AOI device. Alternatively, the screen image under test can be acquired by loading an image of an existing screen display area, which can be the screen display area of any device, such as the screen display area of a mobile phone.
[0035] This application's embodiment obtains an initial image sample training set of defect-free region images from a preset screen image. Based on the initial image sample training set and a preset screen detection model, and using preset model training parameters, the screen detection model is trained to detect defects in the screen image under test. This solution avoids the need to acquire a large number of difficult-to-collect defective screen images, thus reducing the required initial image sample training set to only require defect-free region images. Compared to acquiring defective screen images, collecting defect-free region images is less difficult, reducing the model training cycle and improving training efficiency.
[0036] Example 2
[0037] Figure 2A This is a flowchart illustrating a screen detection model training method provided in Embodiment 2 of this application. This embodiment is an optimization and improvement based on the above-mentioned technical solutions.
[0038] Furthermore, after the step "obtaining defect-free region images of the preset screen image to obtain an initial image sample training set of defect-free region images," a step "filtering any defect-free region image in the initial image sample training set according to a preset filtering algorithm to obtain a target image sample training set" is added to improve the preprocessing process of the initial image sample training set. The model training parameters include a loss function, and the screen detection model is a Gaussian mixture model. Correspondingly, the step "training the screen detection model based on the initial image sample training set and the preset screen detection model, using preset model training parameters" is refined to "inputting the target image sample training set into the preset screen detection model; obtaining the defect-free screen image feature value of any defect-free filtered image in the target image sample training set according to the preset Gaussian probability density function; determining the current loss value of the defect-free screen image feature value based on the defect-free screen image feature value and the preset loss function; determining whether the current loss value meets the preset loss value judgment condition; if so, determining the defect-free screen image feature value as the target feature value, and completing the screen detection model training." to improve the training process of the screen detection model.
[0039] like Figure 2A As shown, the method includes the following specific steps:
[0040] S210. Obtain the defect-free region image of the preset screen image to obtain the initial image sample training set of the defect-free region image.
[0041] S220. According to the preset filtering algorithm, filter any defect-free region image in the initial image sample training set to obtain the target image sample training set.
[0042] To enhance the image features of defect-free regions in the initial image sample training set, and to facilitate better feature recognition and extraction during subsequent model training, the defect-free regions in the initial image sample training set can be pre-filtered before model training.
[0043] A preset filtering algorithm can be used to filter any defect-free region image in the initial image sample training set. This filtering algorithm can be a mean filter, median filter, or Gaussian filter, among others. For example, if the initial image sample training set contains five defect-free region images, then each of these five images can be filtered using the preset algorithm to obtain the target image sample training set. This target image sample training set can be composed of the filtered defect-free region images.
[0044] It should be noted that, in order to perform filtering on any defect-free region image in the initial image sample training set more comprehensively, filtering can be performed on the defect-free region image in various directions according to at least one preset filtering kernel.
[0045] In one optional embodiment, filtering is performed on any defect-free region image in the initial image sample training set according to a preset filtering algorithm to obtain a target image sample training set, including: filtering any defect-free region image in the initial image sample training set according to at least one preset filtering kernel; and using the filtered defect-free filtered image as the target image sample training set.
[0046] The filter kernel can be a weight matrix. The number, dimension, and size of the filter kernels can be preset by relevant technical personnel. For example, the number of filter kernels can be 5, the dimension can be five-dimensional, and the size can be 5×5. Filter kernels with different dimensions can also be set. For example, filter kernels with different filtering directions such as horizontal filtering kernels, vertical filtering kernels, and diagonal filtering kernels can be set.
[0047] For example, five filter kernels can be set: two horizontal filter kernels, two vertical filter kernels, and one diagonal filter kernel. Each filter kernel is a 5×5 matrix. The weight values of the two horizontal filter kernels and the two vertical filter kernels can be different. For instance, the weight values of the two horizontal filter kernels can correspond to matrices A and B, respectively, as follows:
[0048]
[0049] Similarly, the matrices C and D corresponding to the filter kernel weights of the two vertical filters can be different, or the filter kernel weights of the two vertical filters can be the filter kernel weights of the two horizontal filters, i.e., matrices A and B. Using a 5×5 filter kernel, the filtering results obtained after filtering the defect-free region image based on different filtering directions are as follows. Figure 2B As shown.
[0050] Among them, (a) is the image of the defect-free region; (b) and (c) are the images obtained by horizontal filtering of the image of the defect-free region based on filter kernels with different weight values; (d) and (e) are the images obtained by vertical filtering of the image of the defect-free region based on filter kernels with different weight values; and (f) is the image obtained by diagonal filtering of the image of the defect-free region based on filter kernels with preset weight values.
[0051] For example, by using 5×5 filter kernels with 5 different weight values, filtering is performed on any defect-free region image in the initial image sample training set based on three different directions: horizontal, vertical, and diagonal, resulting in 25 filtered defect-free region images, which are used as the target image sample training set.
[0052] This optional embodiment achieves filtering of defect-free region images in the initial image sample training set in all directions by filtering any defect-free region image in the initial image sample training set according to at least one preset filtering kernel. This makes the filtering of defect-free region images more comprehensive, thereby better enhancing the image features of defect-free region images and facilitating better feature recognition and extraction during subsequent model training.
[0053] S230. Input the target image sample training set into the GMM model.
[0054] Before inputting the target image sample training set into the GMM model, the model training parameters of the GMM model can be preset. For example, the model training parameters may include the loss function and the number of iterations.
[0055] S240. Based on the preset Gaussian probability density function, obtain the defect-free screen image feature value of any defect-free filtered image in the target image sample training set.
[0056] The Gaussian probability density function is a pre-defined probability distribution density function in the GMM model. A defect-free filtered image can be a filtered image obtained by filtering an image of a defect-free region. The feature values of a defect-free screen image can characterize the image features of the defect-free screen image. For example, image features characterizing a defect-free screen image can be RGB pixel features, grayscale features, contrast features, or texture features, etc.
[0057] For example, the Gaussian probability density function of the GMM model can be used to train the defect-free filtered images in the target image sample training set, obtaining feature values that characterize the image features of the defect-free screen image during the training process. For instance, the defect-free screen image feature value can be the grayscale value corresponding to the defect-free screen image, which could be 128, or it can be the grayscale range corresponding to the defect-free screen image, for example, the grayscale range could be 120–130. Optionally, the defect-free screen image feature value obtained through training can also be the contrast value or RGB pixel value corresponding to the defect-free screen image, or it can be that the contrast value, RGB pixel value, and grayscale value corresponding to the defect-free screen image obtained through training are all used as the defect-free screen image feature value.
[0058] S250. Determine the current loss value of the feature value of the defect-free screen image based on the feature value of the defect-free screen image and the preset loss function.
[0059] The loss function can be predetermined by relevant technical personnel; for example, it can be a logarithmic loss function, a squared loss function, or an exponential loss function. The current loss value can be the loss value calculated based on the feature values of the defect-free screen image and the preset loss function at the current iteration number.
[0060] S260. Determine whether the current loss value meets the preset loss value judgment condition. If so, determine the defect-free screen image feature value as the target feature value, and the screen detection model training is completed.
[0061] The loss judgment condition can be whether the current loss value is greater than or equal to a preset loss value threshold. This threshold can be predetermined by relevant technical personnel; for example, it could be 0.75. For instance, if the current loss value is greater than or equal to the preset loss value threshold, and if so, the defect-free screen image feature value is determined as the target feature value, and the screen detection model training is complete. If not, iterative training of the screen detection model continues. The target feature value can be the defect-free screen image feature value output when the training termination condition is met.
[0062] Optionally, if the model training parameters include the number of iterations, the completion of screen detection model training can also be determined by the number of iterations. For example, it can be determined whether the current iteration number meets a preset iteration number judgment condition, where the iteration number judgment condition can be that the current iteration number equals the iteration number set in the model training parameters. If yes, the defect-free screen image feature value is determined as the target feature value, and the screen detection model training is complete; otherwise, iterative training of the screen detection model continues.
[0063] It should be noted that after the screen detection model is trained, defective and undefective screen images can be used as test sample sets to test the screen detection model. Based on the test results, the training effect of the screen detection model is determined, and the screen detection model that passes the test is used for screen image detection.
[0064] In an optional embodiment, after the screen detection model is trained, the method further includes: acquiring a screen image to be tested, obtaining at least one local image to be tested according to a preset image segmentation rule; inputting the local image to be tested into the screen detection model, and determining the detection result image of the screen image to be tested according to the target feature value in the screen detection model.
[0065] The image segmentation rules can be preset by relevant technical personnel. Specifically, the screen image to be tested can be segmented according to a preset shape and preset size, resulting in at least one local image to be tested. For example, the preset shape can be a square, the preset size can be 256×256 pixels, and the local image to be tested can be at least one local image obtained after segmenting the screen image to be tested.
[0066] At least one local image to be tested is input into the screen detection model. Based on the target feature values in the screen detection model, the detection result image of the screen image to be tested is determined. The detection result image can be a defective local image to be tested. Testers can identify the defective screen image to be tested and the defective parts within it based on the detection result image.
[0067] Optionally, after obtaining the detection result image, an image segmentation algorithm and segmentation threshold can be pre-set to perform threshold segmentation on the detection result image. Regions that meet the segmentation threshold are highlighted with color markings and used as the target result image output by the model. This allows testers to more intuitively see the defective areas of the screen image under test through the target result image. The local image to be tested, the detection result image, and the target result image are as follows: Figure 3 As shown in the figure. Where a1, a2, and a3 are the local images to be tested; b1 is the detection result image corresponding to local image a1, b2 is the detection result image corresponding to local image a2, and b3 is the detection result image corresponding to local image a3; c1 is the target result image corresponding to local image a1, c2 is the target result image corresponding to local image a1, and c3 is the target result image corresponding to local image a1.
[0068] This optional embodiment acquires a local image of the screen image under test based on a preset image segmentation rule. The local image is then input into a screen detection model, and the detection result image of the screen image under test is determined based on the target feature values in the screen detection model.
[0069] In one optional embodiment, determining the detection result image of the screen image to be tested based on the target feature value in the screen detection model includes: determining the current feature value of the local image to be tested based on the local image to be tested and the trained screen detection model; comparing the current feature value with the target feature value to determine whether the current feature value meets the preset target feature value comparison condition; if not, determining that there is a defect in the local image to be tested; stitching the local image to be tested of the screen image to be tested together, representing the defect in the screen image to be tested according to the preset defect identifier, and outputting the detection result image of the screen image to be tested.
[0070] The current feature value can be the feature value corresponding to the local image to be tested. The current feature value is compared with the target feature value to determine whether the current feature value meets the preset target feature value comparison condition. The preset target feature value comparison condition can be to compare whether the current feature value and the target feature value are consistent. For example, if the target feature value is the target gray value, the gray values of each pixel in the currently acquired local image to be tested can be compared to the target gray value. If they are consistent, it can be determined whether the current feature value meets the preset target feature value comparison condition; if not, it can be determined that the current feature value does not meet the preset target feature value comparison condition.
[0071] If the current feature value meets the preset target feature value comparison condition, it can be determined that the local image under test is free of defects. If the current feature value does not meet the preset target feature value comparison condition, it can be determined that the local image under test is defective. The local image under test with defects is stitched together with the local image under test without defects to obtain a complete screen image under test. Defects in the screen image under test can be represented by preset defect markers, that is, the defective local image under test is indicated. The screen image under test with defect markers is output. The defect markers can be preset by relevant technical personnel. For example, the defect markers can be color markers, that is, the defective local image under test is highlighted with color; the defect markers can also be wireframe markers, that is, the defective local image under test is marked by selecting it with a wireframe. Optionally, the defective local image under test can also be directly output, and the defective screen image under test can be determined based on the output defective local image under test.
[0072] This optional embodiment determines whether the current feature value meets the preset target feature value comparison condition by comparing the current feature value with the target feature value, thereby identifying the screen image under test with defects; this improves the accuracy of defect detection of the screen image under test, making the output detection result image of the screen image under test more accurate.
[0073] This embodiment's scheme inputs the target image sample training set into the Gaussian Mixture Model (GMM); based on the preset Gaussian probability density function in the GMM model, it obtains the defect-free screen image feature value of any defect-free filtered image in the target image sample training set; based on the defect-free screen image feature value and a preset loss function, it determines the current loss value of the defect-free screen image feature value; and based on preset loss value judgment conditions, it determines whether the screen detection model has completed training. This scheme, by using the GMM model to train the target image sample training set, effectively reduces the number of defect-free region images in the target image sample training set and reduces the model training time of the screen detection model, thus improving model training efficiency.
[0074] Example 3
[0075] Based on the technical solutions of the above embodiments, this application provides a preferred implementation method. This embodiment uses a GMM model for training to obtain feature information of defect-free images, and then uses this feature information to detect the screen image to be tested. The advantage of using this model is that only a small number of defect-free images are needed for model training to achieve good detection results, essentially eliminating the reliance on manual detection. The process of training the screen detection model and using the trained model for defect detection is as follows:
[0076] Step 1: Use an AOI device to capture screen images. Crop the captured screen images into nine 256*256 images without any defects. It should be noted that the initial image sample training set during the model training phase usually selects nine images to avoid poor training results due to differences in imaging at different locations. Extract defect-free local images from the nine regions of the AOI-captured screen images: top, middle, bottom, left, right, upper left, lower left, upper right, and lower right, to construct the initial image sample training set.
[0077] Step 2: Use five 5*5 filter kernels of different dimensions, namely two horizontal filter kernels, two vertical filter kernels, and one diagonal filter kernel, to filter the local images in the initial image sample training set that have no defects.
[0078] Step 3: Input the 9 local images of defect-free regions from the initial image sample training set into the GMM model for training to obtain the trained screen detection model. Then test the trained screen detection model to evaluate its training effect.
[0079] Step 4: Segment the screen image to be tested acquired by AOI into local region images of size 256*256, and then call the trained screen detection model to detect defects in the screen image to be tested.
[0080] Example 4
[0081] Figure 4 This is a schematic diagram of a screen detection model training device provided in Embodiment 4 of this application. The screen detection model training device provided in this embodiment is applicable to defect detection of screen images, and can be implemented using software and / or hardware. Figure 4 As shown, the device specifically includes: a sample training set acquisition module 401 and a model training module 402. Among them,
[0082] The sample training set acquisition module 401 is used to acquire the defect-free region image of the preset screen image and obtain the initial image sample training set of the defect-free region image.
[0083] The model training module 402 is used to train the screen detection model based on the initial image sample training set and the preset screen detection model, and based on the preset model training parameters, so as to perform defect detection on the screen image to be tested according to the trained screen detection model.
[0084] This application's embodiment obtains an initial image sample training set of defect-free region images from a preset screen image. Based on the initial image sample training set and a preset screen detection model, and using preset model training parameters, the screen detection model is trained to detect defects in the screen image under test. This solution avoids the need to acquire a large number of difficult-to-collect defective screen images, thus reducing the required initial image sample training set to only require defect-free region images. Compared to acquiring defective screen images, collecting defect-free region images is less difficult, reducing the model training cycle and improving training efficiency.
[0085] Optionally, the sample training set acquisition module 401 includes:
[0086] A defect-free region image determination unit is used to determine at least one defect-free region image in the preset screen image in response to an image region division command issued by the user.
[0087] Optionally, the device further includes:
[0088] The target image sample training set acquisition module is used to filter any defect-free region image in the initial image sample training set according to a preset filtering algorithm to obtain the target image sample training set.
[0089] Optionally, the target image sample training set acquisition module includes:
[0090] The filtering processing unit is used to perform filtering processing on any defect-free region image in the initial image sample training set according to at least one preset filtering kernel.
[0091] The target image sample training set acquisition unit is used to use the defect-free filtered image obtained after filtering as the target image sample training set.
[0092] Optionally, the model training parameters include a loss function, and the screen detection model is a Gaussian mixture model;
[0093] Optionally, the model training module 402 includes:
[0094] The sample input unit is used to input the target image sample training set into a preset screen detection model;
[0095] The feature value determination unit is used to obtain the defect-free screen image feature value of any defect-free filtered image in the target image sample training set according to a preset Gaussian probability density function.
[0096] The current loss value determination unit is used to determine the current loss value of the defect-free screen image feature value based on the defect-free screen image feature value and a preset loss function;
[0097] The loss value condition judgment unit is used to determine whether the current loss value meets the preset loss value judgment condition. If so, the defect-free screen image feature value is determined as the target feature value, and the screen detection model training is completed.
[0098] Optionally, the feature value of the defect-free screen image when the current loss value meets the preset loss value judgment condition is determined as the target feature value;
[0099] Accordingly, the device also includes:
[0100] The test local image acquisition module is used to acquire the test screen image after training the screen detection model based on the initial image sample training set and the preset screen detection model and the preset model training parameters, and to obtain at least one test local image according to the preset image segmentation rules.
[0101] The detection result image determination module is used to input the local image to be tested into the screen detection model, and determine the detection result image of the screen image to be tested based on the target feature values in the screen detection model.
[0102] Optionally, the detection result image determination module includes:
[0103] The current feature value determination unit is used to determine the current feature value of the local image to be tested based on the local image to be tested and the trained screen detection model.
[0104] The comparison condition determination unit is used to compare the current feature value with the target feature value and determine whether the current feature value meets the preset target feature value comparison condition.
[0105] The defect determination unit is used to determine that the local image to be tested has a defect if the current feature value does not meet the preset target feature value comparison condition.
[0106] The detection result image output unit is used to stitch together the local images of the screen image to be tested, represent the defects in the screen image to be tested according to the preset defect identifier, and output the detection result image of the screen image to be tested.
[0107] The screen detection model training device described above can execute the screen detection model training method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing each screen detection model training method.
[0108] Example 5
[0109] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of this application. Figure 5 A block diagram is shown that is suitable for implementing an exemplary electronic device 500 of the present application. Figure 5 The electronic device 500 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0110] like Figure 5 As shown, the electronic device 500 is presented in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to: one or more processors or processing units 501, system memory 502, and bus 503 connecting different system components (including system memory 502 and processing unit 501).
[0111] Bus 503 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0112] Electronic device 500 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 500, including volatile and non-volatile media, removable and non-removable media.
[0113] System memory 502 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 504 and / or cache memory 505. Electronic device 500 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 506 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 5 Not shown; usually referred to as a "hard drive"). Although Figure 5 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 503 via one or more data media interfaces. Memory 502 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.
[0114] A program / utility 508 having a set (at least one) of program modules 507 may be stored, for example, in memory 502. Such program modules 507 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 507 typically perform the functions and / or methods described in the embodiments of this application.
[0115] Electronic device 500 can also communicate with one or more external devices 509 (e.g., keyboard, pointing device, display 510, etc.), and with one or more devices that enable a user to interact with the electronic device 500, and / or with any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 511. Furthermore, electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 512. As shown, network adapter 512 communicates with other modules of electronic device 500 via bus 503. It should be understood that, although... Figure 5 As not shown, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0116] The processing unit 501 executes various functional applications and data processing by running programs stored in the system memory 502, such as implementing a screen detection model training method provided in the embodiments of this application.
[0117] Example 6
[0118] Embodiment Six of this application also provides a storage medium containing computer-executable instructions, on which a computer program is stored. When the program is executed by a processor, it implements the screen detection model training method provided in the embodiments of this application, including: acquiring defect-free region images of a preset screen image to obtain an initial image sample training set of the defect-free region images; training the screen detection model based on the initial image sample training set and a preset screen detection model, and based on preset model training parameters, to perform defect detection on the screen image to be tested according to the trained screen detection model.
[0119] The computer storage medium in this application embodiment can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0120] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0121] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0122] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0123] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the appended claims.
Claims
1. A screen detection model training method, characterized in that, include: In response to an image region segmentation command issued by a user, at least one defect-free region image is determined in a preset screen image to obtain an initial image sample training set of the defect-free region images; the image region segmentation command includes segmentation rules; the segmentation rules are to segment defect-free region images into nine different regions of the preset screen image; Based on at least one preset filter kernel, any defect-free region image in the initial image sample training set is filtered; the number of filter kernels is 5, namely 2 horizontal filter kernels, 2 vertical filter kernels and 1 diagonal filter kernel; wherein, the weight values of the 2 horizontal filter kernels are different, and the weight values of the 2 vertical filter kernels are different. The defect-free filtered image obtained after filtering is used as the target image sample training set; The target image sample training set is input into a preset screen detection model; the screen detection model is a Gaussian mixture model. Based on a preset Gaussian probability density function, the defect-free screen image feature value of any defect-free filtered image in the target image sample training set is obtained; the defect-free screen image feature value is used to characterize the image features of the defect-free screen image; the image features are any one of RGB pixel features, grayscale features, contrast features, and texture features; the Gaussian probability density function is a preset probability distribution density function in the Gaussian mixture model; the defect-free screen image feature value is the feature value characterizing the image features of the defect-free screen image; the defect-free screen image feature value is generated during the training process of the defect-free filtered images in the target image sample training set through the Gaussian probability density function of the Gaussian mixture model. Based on the defect-free screen image feature values and a preset loss function, determine the current loss value of the defect-free screen image feature values; Determine whether the current loss value meets the preset loss value judgment condition. If so, determine the defect-free screen image feature value as the target feature value. The screen detection model training is completed, and defect detection is performed on the screen image to be tested based on the trained screen detection model.
2. The method according to claim 1, characterized in that, The feature value of the defect-free screen image when the current loss value meets the preset loss value judgment condition is determined as the target feature value; Accordingly, after training the screen detection model based on the initial image sample training set and the preset screen detection model using preset model training parameters, the method further includes: Acquire the screen image to be tested, and obtain at least one local image to be tested according to the preset image segmentation rules; The local image to be tested is input into the screen detection model, and the detection result image of the screen image to be tested is determined based on the target feature value in the screen detection model.
3. The method according to claim 2, characterized in that, Based on the target feature values in the screen detection model, the detection result image of the screen image to be tested is determined, including: Based on the local image to be tested and the trained screen detection model, determine the current feature value of the local image to be tested; The current feature value is compared with the target feature value to determine whether the current feature value meets the preset target feature value comparison condition. If not, then it is determined that the local image to be tested has a defect; The test local images of the screen image to be tested are stitched together, and the defects in the screen image to be tested are represented by preset defect labels, and the detection result image of the screen image to be tested is output.
4. A screen detection model training device, characterized in that, include: The sample training set acquisition module is used to acquire defect-free region images of a preset screen image and obtain an initial image sample training set of the defect-free region images. The model training module is used to train the screen detection model based on the initial image sample training set and the preset screen detection model, and based on the preset model training parameters, so as to perform defect detection on the screen image to be tested according to the trained screen detection model. The sample training set acquisition module includes: A defect-free region image determination unit is used to determine at least one defect-free region image in the preset screen image in response to an image region division instruction issued by a user; the image region division instruction includes a division rule; the division rule is to divide the defect-free region image into nine different regions of the preset screen image. The device further includes: The target image sample training set acquisition module is used to filter any defect-free region image in the initial image sample training set according to a preset filtering algorithm to obtain the target image sample training set. The target image sample training set acquisition module includes: The filtering unit is used to perform filtering processing on any defect-free region image in the initial image sample training set according to at least one preset filtering kernel; the number of filtering kernels is 5, namely 2 horizontal filtering kernels, 2 vertical filtering kernels and 1 diagonal filtering kernel; wherein, the weight values of the 2 horizontal filtering kernels are different, and the weight values of the 2 vertical filtering kernels are different. The target image sample training set acquisition unit is used to use the defect-free filtered image obtained after filtering as the target image sample training set. The model training parameters include a loss function, and the screen detection model is a Gaussian mixture model; the model training module includes: The sample input unit is used to input the target image sample training set into a preset screen detection model; The feature value determination unit is used to obtain the defect-free screen image feature value of any defect-free filtered image in the target image sample training set according to a preset Gaussian probability density function. The current loss value determination unit is used to determine the current loss value of the defect-free screen image feature value based on the defect-free screen image feature value and a preset loss function; The loss value condition judgment unit is used to determine whether the current loss value meets the preset loss value judgment condition. If so, the defect-free screen image feature value is determined as the target feature value, and the screen detection model training is completed. The image feature is any one of RGB pixel features, grayscale features, contrast features, and texture features. The Gaussian probability density function is a preset probability distribution density function in the Gaussian mixture model. The defect-free screen image feature value is the feature value that characterizes the image features of the defect-free screen image. The defect-free screen image feature value is generated during the training process by training the defect-free filtered images in the target image sample training set using the Gaussian probability density function of the Gaussian mixture model.
5. An electronic device, 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 program, it implements the screen detection model training method as described in any one of claims 1-3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the screen detection model training method as described in any one of claims 1-3.
Citation Information
Patent Citations
Abnormity detection method for defect-free sample learning
CN113689390A