Method, apparatus, device, and medium for determining image quality

EP4748073A1Pending Publication Date: 2026-05-27SIEMENS AG
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
EP · EP
Patent Type
Applications
Current Assignee / Owner
SIEMENS AG
Filing Date
2023-08-30
Publication Date
2026-05-27

AI Technical Summary

Technical Problem

On-site engineers face challenges in identifying low-quality images captured by cameras due to aging equipment, lighting conditions, camera focus, and human influences, which can lead to inaccurate vision features and inefficiencies in production lines.

Method used

A method and apparatus for determining image quality by comparing the pixel distribution of an image to be tested with a reference image, using modules to determine pixel distributions, differences, and image quality based on these differences.

Benefits of technology

This approach reduces the reliance on AI models, decreases the cost of training and maintaining them, and enables real-time image quality monitoring in industrial production lines, ensuring efficient product quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023115933_06032025_PF_FP_ABST
    Figure CN2023115933_06032025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a method, apparatus, device, and medium for determining image quality. The method comprising: determining a first pixel distribution in a color mode of an image to be tested; determining a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image; and determining quality of the image to be tested based on the first difference. Algorithm-based image quality determination can reduce dependence on AI models and the cost of training and maintaining AI models, which is particularly suitable for real-time computer vision monitoring in industrial production pipelines.
Need to check novelty before this filing date? Find Prior Art

Description

Method, apparatus, device, and medium for determining image qualityFIELD

[0001] The present disclosure relates to the technical field of computer vision (CV) , in particular to a method, apparatus, device, and medium for determining image quality.BACKGROUND

[0002] Camera issues constantly trouble on-site engineers. Due to equipment’s aging, lighting conditions, camera focus, human influences, etc., cameras may take low quality images for vision analysis. Low-quality images will eventually result in low-quality vision features identifying. More importantly, while the production line is running, if the camera setting or positioning is changed, it will also generate low-quality images. Since the changes for camera setting and positioning are often unexpected, on-site engineers do not know when camera starts to acquire low-quality images and a lot of products on the production line might be produced under the low-quality vision data inputs.SUMMARY

[0003] Embodiments of the present disclosure propose a method, apparatus, device, and medium for determining image quality.

[0004] In a first aspect, a method for determining image quality is provided. The method comprising:

[0005] determining a first pixel distribution in a color mode of an image to be tested;

[0006] determining a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image; and

[0007] determining quality of the image to be tested based on the first difference.

[0008] In a second aspect, an apparatus for determining image quality is provided. The apparatus comprising:

[0009] a first determining module, configured to determine a first pixel distribution in a color mode of an image to be tested;

[0010] a second determining module, configured to determine a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image; and

[0011] a third determining module, configured to determine quality of the image to be tested based on the first difference.

[0012] In a third aspect, an electronic device is provided. The electronic device comprising a processor and a  memory, wherein an application program executable by the processor is stored in the memory for causing the processor to execute a method for determining image quality as described in any of the above.

[0013] In a fourth aspect, a computer-readable medium comprising computer-readable instructions stored thereon is provided, wherein the computer-readable instructions, when executed by a processor, implement a method for determining image quality as described in any of the above.

[0014] In a fifth aspect, a computer program product comprising a computer program, when the computer program is executed by a processor for executing a method for determining image quality as described in any of the above.

[0015] According to the above technical solutions, algorithm-based image quality determination can reduce dependence on AI models, the cost of training and maintaining AI models, which is particularly suitable for real-time computer vision monitoring in industrial production lines.BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to make technical solutions of examples of the present disclosure clearer, accompanying drawings to be used in description of the examples will be simply introduced hereinafter. Obviously, the accompanying drawings to be described hereinafter are only some examples of the present disclosure. Those skilled in the art may obtain other drawings according to these accompanying drawings without creative labor.

[0017] Fig. 1 is an exemplary diagram of low-quality images.

[0018] Fig. 2 is an exemplary flowchart of a method for determining image quality according to an embodiment of the present disclosure.

[0019] Fig. 3A is a first exemplary diagram of an image with slight positional movement and its RGB distribution according to an embodiment of the present disclosure.

[0020] Fig. 3B is a second exemplary diagram of an image with slight position movement and its RGB distribution according to an embodiment of the present disclosure.

[0021] Fig. 3C is a third exemplary diagram of an image with slight position movement and its RGB distribution according to an embodiment of the present disclosure.

[0022] Fig. 3D is a fourth exemplary diagram of an image with slight positional movement and its RGB distribution according to an embodiment of the present disclosure.

[0023] Fig. 3E is a fifth exemplary diagram of an image with slight positional movement and its RGB distribution according to an embodiment of the present disclosure.

[0024] Fig. 3F is a first exemplary diagram with significantly different RGB distribution patterns according to an embodiment of the present disclosure.

[0025] Fig. 3G is a second exemplary diagram with slightly different RGB distribution patterns according to an embodiment of the present disclosure.

[0026] Fig. 4 is an exemplary diagram of a process of determining image quality using sub-block images according to an embodiment of the present disclosure.

[0027] Fig. 5 is an exemplary structural diagram of an apparatus for determining image quality according to an embodiment of the present disclosure.

[0028] Fig. 6 is an exemplary structural diagram of an electronic device according to an embodiment of the present disclosure.

[0029] List of reference numbers: DETAILED DESCRIPTION

[0030] In order to make the purpose, technical scheme, and advantages of the disclosure clearer, the following examples are given to further explain the disclosure in detail.

[0031] In order to be concise and intuitive in description, the scheme of the disclosure is described below by describing several representative embodiments. Many details in the embodiments are only used to help understand the scheme of the disclosure. However, it is obvious that the technical scheme of the disclosure can be realized without being limited to these details. In order to avoid unnecessarily blurring the scheme of the disclosure, some embodiments are not described in detail, but only the framework is given. Hereinafter, "including" refers to "including but not limited to" , "according to... " refers to "at least according to..., but not limited to... " . When the number of an element is not specifically indicated below, it means that the element can be one or more, or can be understood as at least one.

[0032] Fig. 1 is an exemplary diagram of low-quality images. As shown in Fig. 1, normal image 10 shows a dog captured using a camera with predetermined camera parameters. Images 12-18 are abnormal images caused by respective issues. Among them: blur image 12, image 13 with object displacement, image 14 with color distortion, image 15 with high saturation, image 16 with noise, image 17 with corrupted data and image 18 with color aberration.

[0033] The above exemplary description describes the causes of abnormal images, and those skilled in the art may realize that this description is only exemplary and is not intended to limit the scope of protection of embodiments of the present disclosure.

[0034] In the CV related production pipeline, abnormal images can also be caused by various reasons. There is an urgent need to introduce data quality monitoring idea to the CV related production pipeline, either with Artificial Intelligence (AI) approaches or traditional vision approaches, to ensure that on-site engineers will be warned as soon as possible when the system identifies image input from cameras being changed.

[0035] A lot of IT magnates and start-up company starts AI model monitoring on tabular data. Very few of them are doing vision data monitoring. Usually, these start-up companies focusing on model drift monitoring instead of data quality monitoring. Some companies also doing data quality monitoring, but they try to train an AI model to identify abnormal images from input. However, this approach has two problems:

[0036] (1) the AI model must be trained on a relatively large size of data to improve precision. Companies taking this approach need to hire / outsource to AI scientist, and spend a lot of time on labeling data, training model, parameters tuning, etc. which is expensive both financially and timely. if they want to change the  products in their factories, it is highly likely that they need to train a new model specifically for the new products.

[0037] (2) for some production lines owned by median-small companies, it cannot afford high-end GPU to optimize model and accelerate inference speed. Without high-end GPU, it could take about 100-300ms to do the inference, and it will significantly decrease efficiency of production line since vision algorithm only takes about 20ms to do its job.

[0038] Embodiments of the present disclosure provides an algorithm-based image quality detection method that can check whether a given image deviates from a reference image. In addition, unlike the AI approaches which require a lot of training images, embodiments of the present disclosure only require a small number of images as reference data, which has little impact on real-time runtime and therefore does not affect the efficiency of production line. The key point of this algorithm is to compare pixel distribution (such as RGB distribution) of an image to be tested with that of a reference image.

[0039] Fig. 2 is a flowchart of a method for determining image quality according to an embodiment of the present disclosure. As shown in Fig. 2, the method comprises:

[0040] Step 101: determining a first pixel distribution in a color mode of an image to be tested.

[0041] Color mode is an algorithm for representing colors in the digital world. In the digital world, in order to represent various colors, colors are divided into several components. Due to different principles of color synthesis, there are differences in the way colors are generated between color devices such as monitors, projectors, and scanners that directly synthesize colors using colored light, and printing devices such as printers and printers that use pigments.

[0042] In one embodiment, color modes include RGB color mode, CMYK color mode, HSB color mode, Lab color mode, index color mode, bitmap color mode, and grayscale color mode, and so on.

[0043] 1. RGB color mode

[0044] RGB color mode is currently the most widely used color mode, and many browsers and displays support this mode. The RGB mode represents the color of each pixel in a color image with three color components (or named as channels) , namely R (red) , G (green) , and B (blue) . These three components specify an intensity value between 0 (black) and 255 (white) for each pixel.

[0045] For example, the bright red R component has a value of 246, the G component has a value of 20, and the B component has a value of 50. When the values of all three components are equal, the result is neutral gray. When the values of all components are 255, the result is pure white; When these values are all 0, the result is pure black. RGB images use three colors or three channels to reproduce colors on the screen. For a 24-bit image, these three  channels convert each pixel into 24-bit color information, with each channel represented by 8 bits and capable of reproducing up to 16.7 million colors. For 48-bit images, each channel is represented by 16 bits, which can reproduce more colors.

[0046] 2. CMYK color mode

[0047] The CMYK mode is mainly used in printing. This mode specifies a percentage value for each type of printing ink for each pixel. The percentage of printing ink color specified for the brightest highlight color is relatively low, while the percentage specified for darker tone colors is relatively high. For example, bright red includes 2%cyan, 93%magenta, 90%yellow, and 0%black. In CMYK images, pure white is generated when the values of all four components are 0%. Although CMYK is a standard color model, the exact color range it represents varies depending on printing conditions. In addition, a CMYK image contains at least 4 channels. Therefore, its file size is usually larger than the same image represented in RGB mode.

[0048] 3. Index Color Mode

[0049] Index color mode generates 8-bit image files with up to 256 colors. When converting RGB mode images to indexed colors, a color lookup table is constructed to store and index the colors in the image. If a certain color in the original image does not appear in the table, the program will select the closest one or use a simulated color to simulate the existing color. Index colors can reduce file size while maintaining sufficient visual quality by limiting the color palette. In this mode, only limited editing can be performed. To further edit, it should be temporarily converted to RGB mode.

[0050] 4. Grayscale color mode

[0051] The grayscale color mode uses 256 levels of grayscale to represent the image. In this mode, each pixel in the image has a brightness value between 0 (black) and 255 (white) . Although the grayscale color mode may not represent color rich images like the RGB color mode, it may also be used in certain situations due to the small size of grayscale images.

[0052] The above exemplary description provides typical examples of color modes, and those skilled in the art may realize that this description is only exemplary and is not intended to limit protection scope of embodiments of the present disclosure.

[0053] Here, pixel distribution refers to a statistic of value for each pixel in an image. Preferably, pixel distribution implemented as pixel probability distribution. The first pixel distribution in the image to be tested can be a single pixel distribution corresponding to corresponding single channel, or multiple pixel distributions respective corresponding to multiple channels.

[0054] Step 102: determining a first difference between the first pixel distribution and a second pixel distribution in  the color mode of a reference image.

[0055] In one embodiment, determining a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image comprises: determining respective pixel distributions of the image to be tested in respective channels of the color mode; determining respective pixel distributions of the reference image in respective channels of the color mode; determining respective differences between the pixel distributions of the image to be tested in respective channels and the pixel distributions of the reference image in respective corresponding channels; combining respective differences into a difference group. In one embodiment, wherein the channel comprises at least one of the following: color channel; chrominance channel; hue channel; saturation channel; brightness channel; colorless channel.

[0056] Taking RGB mode as an example for explanation, each pixel’s color can be converted to RGB values. RGB value is always in range of 0 to 255. Firstly, calculating the occurring possibilities for each value between 0 to 255 and then calculating RGB value separately, we can acquire the RGB distribution. To be more specific, firstly determining respective pixel distributions in the R channel, G channel, and B channel of the image to be tested. Then, determine respective pixel distributions in the R channel, G channel, and B channel of the reference image; Secondly, determining the difference between the pixel distribution in the R channel of the image to be tested and the pixel distribution in the R channel of the reference image, the difference between the pixel distribution in the G channel of the image to be tested and the pixel distribution in the G channel of the reference image, and the difference between the pixel distribution in the B channel of the image to be tested and the pixel distribution in the B channel of the reference image. Thirdly, combining these three differences into a difference group.

[0057] In one embodiment, the method comprises: acquiring respective available reference images; determining respective pixel distributions in the color mode of the respective available reference images; calculating an average value of the respective pixel distributions; determining the average value as the second pixel distribution. Therefore, by calculating the average pixel distribution of multiple available reference images, the accuracy of the second pixel distribution can be improved.

[0058] For example, suppose there are three available reference images, namely Image 1, Image 2, and Image 3. Calculating the pixel distributions of the R channels, G channels, and B channels for Image 1, Image 2, and Image 3., respectively. Then, calculating the average pixel distribution of the R channels of Image 1, Image 2, and Image 3 to serve as pixel distribution of R channel of the reference image; calculating the average pixel distribution of the G channels of Image 1, Image 2, and Image 3 to serve as pixel distribution of G channel of the reference image; and calculating the average pixel distribution of the B channels of Image 1, Image 2, and Image 3 to serve as pixel distribution of B channel of the reference image.

[0059] In one embodiment, determining a first difference between the first pixel distribution and the second pixel distribution comprises: determining a dispersion between the first pixel distribution and the second pixel distribution; determining the first difference based on the dispersion. Dispersion refers to an indicator used to measure the magnitude of risk by randomly observing the differences between the values of variables. In one embodiment, the degree of dispersion includes: KL degree of dispersion; JS divergence; Discreteness determined based on entropy function; degree of dispersion determined based on the cross-entropy loss function; Kolmogorov-Smirnov test.

[0060] Step 103: determining quality of the image to be tested based on the first difference.

[0061] In one embodiment, determining quality of the image to be tested based on the first difference comprises: determining quality of the image to be tested based on a comparison result between at least one difference in the difference group and a first threshold value; the quality of the image to be tested is determined to be abnormal when the at least one difference is greater than or equal to the first threshold value, or the quality of the image to be tested is determined to be normal when the at least one difference is less than the first threshold value. Users can determine the first threshold value based on specific scenario requirements. For example, the range of values for the first threshold value is [0, 1] . Preferably, the first threshold value is adjustable.

[0062] Here, the image quality of the image to be tested is determined directly based on at least one difference extracted from the difference group.

[0063] In one embodiment, wherein determining quality of the image to be tested based on the first difference comprises: determining at least one transformation value based on at least one difference in the difference group; determine the quality of the image to be tested based on a comparison result between the at least one transformation value and a second threshold value; wherein the quality of the image to be tested is determined to be abnormal when the at least one transformation value is greater than or equal to the second threshold value, or the quality of the image to be tested is determined to be normal when the at least one transformation is less than the second threshold value.

[0064] Transformation value can be determined based on the difference group in multiple ways. For example, the average of all differences in the difference group can be determined as a transformation value. Alternatively, the average of partial differences in the difference group can be determined as a transformation value. Here, image quality is determined based on transformation value determined based on difference group, thereby providing more options.

[0065] In some specific cases, the quality of the tested image cannot be accurately detected based on the first difference or transformation value. For example, pixel distributions of the image to be tested and the reference  image may be the same, but the patterns of the two may be completely different, thus the quality of the image to be tested would be mistakenly determined to be normal based on the above quality determination methods.

[0066] After determining that the image to be tested is normal based on the first difference or transformation value, the image quality is further evaluated based on the comparison of pixel distributions of a sub-block image extracted from the image to be tested and the pixel distributions of corresponding sub-block images extracted from the reference image. The extracted sub-block images can have any scale of 1 / 16, 1 / 8, 1 / 4, 1 / 2, etc. of the original images.

[0067] In one embodiment, the method comprises: extracting a first sub-block image from the image to be tested; extracting a second sub-block image corresponding to the first sub-block image from the reference image; determining a third pixel distribution in the color mode of the first sub-block image; determining a fourth pixel distribution in the color mode of the second sub-block image; determining a second difference between the third pixel distribution and the fourth pixel distribution; determining quality of the image to be tested based on the second difference when the image quality has been previously determined to be normal based on the first difference, wherein the quality of the image to be tested is determined to be abnormal when the second difference is greater than or equal to a third threshold value, or the quality of the image to be tested is determined to be normal when the second difference is less than the third threshold value. After determining the image is normal based on the first difference, if the image is determined to be abnormal based on the second difference, then it is considered abnormal.

[0068] Embodiments of the present disclosure can be applied to various scenarios, suitable for industrial scenarios, especially in the quality detection application of input data for AI models in industrial scenarios. For example, AI models can include: workpiece classification model, workpiece quality inspection model, product quality inspection model, product defect inspection model, and so on.

[0069] In one embodiment, the method comprising: setting a first label for the real-time image which represents the quality of the real-time image is normal when the quality of the real-time image is determined to be normal; setting a second label for the real-time image which represents the quality of the real-time image is abnormal when the quality of the real-time image is determined to be abnormal; judging on whether to input the real-time image into an industrial AI model or not, by identifying label of the real-time image is the first label or the second label. Normally, it is allowed to send the real-time image to AI models when the recognition result is the first label, and the real-time image is rejected to be sent to AI models and an alarm message would be issued when the recognition result is the second label.

[0070] In one embodiment, wherein the reference image is an image of a workpiece captured using an industrial  camera with predetermined camera parameters, the image to be tested is a real-time image of the workpiece captured using the industrial camera. When embodiments of the present disclosure are applied to production line scenarios, the cost can be significantly reduced by eliminating the needs to train AI models for detecting the quality of input image data. Moreover, it avoids the detection distortion problem caused by repeated use of various AI models.

[0071] The following will provide a detailed explanation of an embodiment of the present disclosure using RGB mode and industrial scenarios as examples.

[0072] Fig. 3A is a first exemplary diagram of an image with slight positional movement and its RGB distribution according to an embodiment of the present disclosure; Fig. 3B is a second exemplary diagram of an image with slight position movement and its RGB distribution according to an embodiment of the present disclosure; Fig. 3C is a third exemplary diagram of an image with slight position movement and its RGB distribution according to an embodiment of the present disclosure; Fig. 3D is a fourth exemplary diagram of an image with slight positional movement and its RGB distribution according to an embodiment of the present disclosure; Fig. 3E is a fifth exemplary diagram of an image with slight positional movement and its RGB distribution according to an embodiment of the present disclosure. In these examples, camera’s position, lighting conditions, focus is fixed. The position of the box under the camera is slightly moved, but ensures that it is still can be observed clearly with all symbols, texts, and shapes in the images. In coordinate system of Histogram in Fig. 3A to Fig. 3D, the horizontal axis represents the pixel value and the vertical axis represents the number of pixels. In fact, the vertical axis can be changed to the probability of the number of pixels in the entire image, forming a pixel probability distribution map.

[0073] In Fig. 3A to Fig. 3D, curves 21 represent the pixel distributions of the R channel, curves 22 represent the pixel distributions of the G channels, and curves 23 represent the pixel distributions of the B channels. By analyzing Fig. 3A to Fig. 3D, we found that all RGB distributions are very similar for images of same object with the same camera setting. From these distributions of Fig. 3A to Fig. 3D, we can clearly see there is a common pattern: peaks appear around value 20-25 for all three colors; a red peak around 200 followed by a green peak around 220; and a high peak for blue at the end.

[0074] There is another example comparing different images in Fig. 3F and Fig. 3G. Fig. 3F is a first exemplary diagram with significantly different RGB distribution patterns according to an embodiment of the present disclosure. Fig. 3G is a second exemplary diagram with slightly different RGB distribution patterns according to an embodiment of the present disclosure. The reference image has the similar distribution to Fig. 3A. The image in Fig. 3G is taken from camera when the lighting turns up a little, resulting in a glowing-white spot on the box.  And we can observe that some distribution features are changed, such as peaks shrinking in region 43 and region 44, and green peak shifts a little in region 45. Also, if we observe Fig. 3F, a different object will generate a different distribution as well, such as peaks enlarge in region 40, addition peaks in region 41 and missing peaks in region 42. In general, if the image to be tested is different from reference image, RGB distribution will be changed as well.

[0075] Since RGB distribution can be used to interpret image content’s change, we can summarize the distribution pattern out of the reference dataset. When the runtime image is received, we can also analyze the RGB distribution of image to be tested and compare it with the summarized pattern and calculate the difference.

[0076] Preferably, we compare the difference with a warning threshold and an error threshold respectively. If it beyond the warning threshold but not reaching the error threshold, the algorithm will show warning that the image slightly changed but not having a major difference; if it beyond the error threshold, then the algorithm would say the input image is very different from expectation, and please check the camera. Thus, the vision data monitoring approach from embodiments of the disclosure comprises:

[0077] Step 1: Standardize Image

[0078] Image files could have different color modes, such as CMYK, Lab, HSB, etc., and RGB is one of the color modes. Therefore, the algorithm will check the color mode and convert the image into RGB if it originally was not.

[0079] Step 2: Calculate RGB Distribution of Reference Images

[0080] In this step, the algorithm will calculate the RGB distribution for each reference images. Although reference images share similar RGB distribution pattern, but it will inevitably vary a little bit. In order to summarize the common pattern out of reference images. The Algorithm will take average of values in RGB distributions of all reference images.

[0081] Step 3: Normalize RGB Distribution

[0082] Next, the algorithm will normalize the average RGB distribution from step 2 and create a probability distribution instead. This step has two merits: first, later when the algorithm calculates differences between reference image pattern and runtime real images, possibility distribution is more standard and can be applied to many statistics tools. Also, it allows the algorithm to work on image with different definitions. For example, if there are two identical images except for their definitions: one is 1280*1024, the other is 1920 *1280. Assume it has 15%of color is pure red, then statistic of R channel at 255 for two images should be 1280 *1024 *0.15 =196,608 and 1920 *1280 *0.15=368,640. This difference will be obstacles when analyze data, but if using possibility distribution, it should be always 15%. Therefore, the image in different definitions could be easily  handled.

[0083] Step 4: Calculate Difference between Reference Pattern and that of Runtime Images

[0084] Since we have the summarized RGB distribution pattern for reference-images, and input image’s RGB distribution. We need a proper method to evaluate the differences between two patterns and use a parameter to describe the differences degree. There are various statistics tools to choose from, such as entropy, cross-entropy loss function, Kullback-Leibler divergence (refer as KL Divergence) , Jensen-Shannon (refer as JS Divergence) divergence, etc., and each of these statistics tool has their own merits and drawbacks. We can choose proper way to calculate the differences between reference patterns and runtime image pattern after evaluating specific use-case scenarios.

[0085] Here, an example is provided using JS divergence:

[0086] KL Divergence:

[0087] JS Divergence:

[0088] Among them: P is the image to be tested, Q is the reference image, P (x) is the probability of each pixel in the image to be tested corresponding to each pixel value x in the horizontal axis; Q (x) is the probability of each pixel in the reference image corresponding to each pixel value x in the horizontal axis.

[0089] From the nature of JS Divergence, smaller the result is, less difference two distributions have. And users need setup threshold based on this result to define how much difference they will accept it as warning and will not accept and mark it as an error. If another statistics method is applied here, the threshold value should also be set based on the method chosen.

[0090] Step 5: (Optional) Sub-block Cross Validation

[0091] In an extreme condition, which is not usually found in a real case, the RGB distribution could be same or very similar, but the image pattern is different.

[0092] Fig. 4 is an exemplary diagram of a process of determining image quality using sub-block images according to an embodiment of the present disclosure. For an example in Fig. 4, the RGB statistics of reference image 51 and image to be tested 50 are the same, but these two images are not identical.

[0093] In this case, to ensure the integrity of this algorithm, it needs to spend more runtime to investigate the sub-blocks of the images. Firstly, defining a dimension of cover layer. Then, the algorithm will use the cover layer to look at only certain sub-sections of image to be tested 50 and reference image 51, and then repeat Steps 1-4 on this sub-block images. As the result, the first sub-block of 2x2, and 3x3 example has the major difference: one image still has half blue, half white, and the other is pure blue. In this way, we can distinguish image’s RGB  distribution more accurately.

[0094] Performing first processing 52 which comprises: extracting 1 / 4 of the image area from the top left corner of the image to be tested 50 and calculating the probability distribution of this area; extracting 1 / 4 of the image area from the top left corner of reference image 51 and calculating the probability distribution of this area; comparing the difference between the probability distributions of those two 1 / 4 areas, and determining the image quality based on the difference.

[0095] Alternatively, performing second processing 53 which comprises: extracting 1 / 9 of the image area from the top left corner of the image to be tested 50 and calculating the probability distribution of this area; extracting 1 / 9 of the image area from the top left corner of reference image 51 and calculating the probability distribution of this area; comparing the difference between the probability distributions of those two 1 / 9 areas, and determining the image quality based on the difference.

[0096] However, keep in mind that the bigger dimension it is, more sub-blocks the algorithm will check, more accurate the result will be, and longer time the algorithm will use. Thus, it’s a trade between accuracy and runtime. And the algorithm will keep it as a parameter and let user to choose if they want to do sub-block check, and for which dimensions they want to use in this algorithm.

[0097] Step 5: Compare Entropy Difference with Threshold to Generate Result

[0098] From steps 1-5, we will have difference degree for all three colors: RGB. Then the algorithm will compare the results with user-defined threshold. If any one result from RGB is beyond threshold, the algorithm will send out warning messages, or error messages.

[0099] Based on the above analysis, it can be concluded that embodiments of the present disclosure have at least the following advantages: (1) Embodiments of the present disclosure provide a novel approach to detect anomaly images from reference image data. (2) Embodiments of the present disclosure provide an algorithm that can be easily applied to both AI vision use cases and traditional vision use cases. (3) Embodiments of the present disclosure provides a novel approach of real-time model monitoring on vision data.

[0100] Fig. 5 is an exemplary structural diagram of an apparatus for determining image quality according to an embodiment of the present disclosure. As shown in Fig. 5,

[0101] An apparatus for determining image quality 500, comprising: a first determining module 501, configured to determine a first pixel distribution in a color mode of an image to be tested; a second determining module 502, configured to determine a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image; and a third determining module 503, configured to determine quality of the image to be tested based on the first difference.

[0102] In one embodiment, the first determining module 501, configured to determine respective pixel distributions of the image to be tested in respective channels of the color mode; determine respective pixel distributions of the reference image in respective channels of the color mode; determine respective differences between the pixel distributions of the image to be tested in respective channels and the pixel distributions of the reference image in respective corresponding channels; combine respective differences into a difference group.

[0103] In one embodiment, the channel comprises at least one of the following: color channel; chrominance channel; hue channel; saturation channel; brightness channel; colorless channel.

[0104] In one embodiment, the second determining module 502, configured to determine a dispersion between the first pixel distribution and the second pixel distribution and determine the first difference based on the dispersion.

[0105] In one embodiment, the third determining module 503, configured to determine quality of the image to be tested based on a comparison result between at least one difference in the difference group and a first threshold value; wherein the quality of the image to be tested is determined to be abnormal when the at least one difference is greater than or equal to the first threshold value, or the quality of the image to be tested is determined to be normal when the at least one difference is less than the first threshold value.

[0106] In one embodiment, the third determining module 503, configured to determine at least one transformation value based on at least one difference in the difference group; determine the quality of the image to be tested based on a comparison result between the at least one transformation value and a second threshold value; wherein the quality of the image to be tested is determined to be abnormal when the at least one transformation value is greater than or equal to the second threshold value, or the quality of the image to be tested is determined to be normal when the at least one transformation is less than the second threshold value.

[0107] In one embodiment, the third determining module 503, configured to extract a first sub-block image from the image to be tested; extracting a second sub-block image corresponding to the first sub-block image from the reference image; determine a third pixel distribution in the color mode of the first sub-block image; determining a fourth pixel distribution in the color mode of the second sub-block image; determine a second difference between the third pixel distribution and the fourth pixel distribution; determine quality of the image to be tested based on the second difference when the image quality has been previously determined to be normal based on the first difference.

[0108] In one embodiment, the second determining module 502, configured to acquire multiple available reference images; determine respective pixel distributions in the color mode of the multiple available reference images; calculate an average value of the respective pixel distributions; determining the average value as the second pixel distribution.

[0109] Embodiments of the present disclosure also propose an electronic device with a processor memory architecture. Figure 6 is an exemplary structural diagram of an electronic device with a processor memory architecture according to an embodiment of the present disclosure. As shown in Figure 6, electronic device 600 includes a processor 601, a memory 602, and a computer program stored on memory 602 that can run on processor 601. When the computer program is executed by processor 901, the method for determining image quality as described in either of the above is implemented. Among them, memory 602 can be implemented as various storage media such as electrically erasable programmable read-only memory (EEPROM) , flash memory, programmable program read-only memory (PROM) , etc. Processor 601 can be implemented to include one or more central processors or one or more field programmable gate arrays, wherein the field programmable gate array integrates one or more central processor cores. Specifically, the central processing unit or core can be implemented as a CPU, MCU, DSP, and so on.

[0110] It should be noted that not all steps and modules in the above processes and structural diagrams are necessary, and some steps or modules can be ignored according to actual needs. The execution sequence of each step is not fixed and can be adjusted as needed. The division of each module is only for the convenience of describing the functional division used. In actual implementation, a module can be divided into multiple modules, and the functions of multiple modules can also be implemented by the same module. These modules can be in the same device or different devices.

[0111] The hardware modules in each implementation can be implemented mechanically or electronically. For example, a hardware module can include specially designed permanent circuits or logic devices (such as dedicated processors, such as FPGA or ASIC) to complete specific operations. Hardware modules can also include programmable logic devices or circuits temporarily configured by software (such as general-purpose processors or other programmable processors) for performing specific operations. As for the specific use of mechanical methods, either dedicated permanent circuits or temporarily configured circuits (such as software configuration) to implement hardware modules, it can be determined based on cost and time considerations.

[0112] The above is only a preferred embodiment of the present disclosure and is not intended to limit the scope of protection of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1.A method for determining image quality, comprising:determining (101) a first pixel distribution in a color mode of an image to be tested;determining (102) a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image; anddetermining (103) quality of the image to be tested based on the first difference.2.The method of claim 1, wherein determining (102) a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image comprises:determining respective pixel distributions of the image to be tested in respective channels of the color mode;determining respective pixel distributions of the reference image in respective channels of the color mode;determining respective differences between the pixel distributions of the image to be tested in respective channels and the pixel distributions of the reference image in respective corresponding channels;combining respective differences into a difference group.3.The method of claim2, wherein the channel comprises at least one of the following:color channel; chrominance channel; hue channel; saturation channel; brightness channel; colorless channel.4.The method of claim 1, wherein determining (102) a first difference between the first pixel distribution and the second pixel distribution comprises:determining a dispersion between the first pixel distribution and the second pixel distribution;determining the first difference based on the dispersion.5.The method of claim 2, wherein determining (103) quality of the image to be tested based on the first difference comprises:determining quality of the image to be tested based on a comparison result between at least one difference in the difference group and a first threshold value;wherein the quality of the image to be tested is determined to be abnormal when the at least one difference is greater than or equal to the first threshold value, or the quality of the image to be tested is determined to be normal when the at least one difference is less than the first threshold value.6.The method of claim 2, comprising:determining at least one transformation value based on at least one difference in the difference group;determining the quality of the image to be tested based on a comparison result between the at least one transformation value and a second threshold value;wherein the quality of the image to be tested is determined to be abnormal when the at least one transformation value is greater than or equal to the second threshold value, or the quality of the image to be tested is determined to be normal when the at least one transformation is less than the second threshold value.7.The method of claim 1, comprising:extracting a first sub-block image from the image to be tested;extracting a second sub-block image corresponding to the first sub-block image from the reference image;determining a third pixel distribution in the color mode of the first sub-block image;determining a fourth pixel distribution in the color mode of the second sub-block image;determining a second difference between the third pixel distribution and the fourth pixel distribution;determining quality of the image to be tested based on the second difference when the image quality has been previously determined to be normal based on the first difference.8.The method of any one of claims 1-7, comprising:acquiring multiple available reference images;determining respective pixel distributions in the color mode of the multiple available reference images;calculating an average value of the respective pixel distributions;determining the average value as the second pixel distribution.9.The method of any one of claims 1-7, wherein the reference image is an image of a workpiece captured by an industrial camera with predetermined camera parameters.10.The method of claim 9, wherein the image to be tested is a real-time image of the workpiece captured by the industrial camera.11.The method of claim 10, comprising:setting a first label for the real-time image which represents the quality of the real-time image is normal when the quality of the real-time image is determined to be normal;setting a second label for the real-time image which represents the quality of the real-time image is abnormal when the quality of the real-time image is determined to be abnormal;judging on whether to input the real-time image into an industrial artificial intelligence model or not, by identifying label of the real-time image is the first label or the second label.12.An apparatus for determining image quality, comprising:a first determining module (501) , configured to determine a first pixel distribution in a color mode of an image to be tested;a second determining module (502) , configured to determine a first difference between the first pixel distribution and a second pixel distribution in the color mode of a reference image; anda third determining module (503) , configured to determine quality of the image to be tested based on the first difference.13.An electronic device, comprising a processor (601) and a memory (602) , wherein an application program executable by the processor (601) is stored in the memory (602) for causing the processor (601) to execute a method for determining image quality according to any one of claims 1-11.14.A computer-readable medium comprising computer-readable instructions stored thereon, wherein the computer-readable instructions for executing a method for determining image quality according to any one of claims 1-11.15.A computer program product comprising a computer program, upon the computer program is executed by a processor for executing a method for determining image quality according to any one of claims 1-11.