An operator testing method and apparatus
By using a benchmark operator and a randomly selected standard operator to form a test processing chain in the image processing chain, replacing the operator to be tested, and comparing the differences in the output images, the problem of the inability to effectively test the accuracy of operators in the prior art is solved, and the accuracy and robustness of the test are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies cannot effectively test the processing accuracy of the operator under test in complex processing links, which causes small errors of a single operator to be passed on, accumulated, or even amplified in subsequent processing steps, making it difficult to ensure the accuracy of the overall output results.
Obtain a benchmark operator that functions identically to the operator under test, and randomly select N standard image processing operators from the basic operator library to form a test processing chain. Replace the operator under test with the benchmark operator, and determine the test result of the operator under test by comparing the output image differences between the test processing chain and the benchmark processing chain.
It improves the accuracy of operator testing, enables timely detection of error accumulation problems, ensures the compatibility of the tested operators in complex processing chains, and significantly improves the robustness of the algorithm and the success rate of system integration.
Smart Images

Figure CN121214121B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software testing, and in particular to an operator testing method and device. BACKGROUND
[0002] In the related art, in the development and testing process of image processing operators, the mainstream method is a single-operator true value comparison method. That is, when a newly developed image processing operator (referred to as a to-be-tested operator) needs to be verified, a test personnel selects an operator corresponding to a function in a third-party public library that is recognized and has high precision as a reference operator. And under the same test configuration, the to-be-tested operator and the reference operator are respectively run. By comparing whether there is a difference between the output results of the two operators, it is determined whether the development of the to-be-tested operator meets the precision requirement.
[0003] However, in the actual application scenario of the operator, the image processing operator is usually used together with multiple other operators to realize the image processing function. If only the precision of a single operator in the image processing link is verified, the small error of the single operator will be passed, accumulated, or even amplified in the subsequent processing process. Even if all the operators in the image processing link pass the independent single-operator test, when they are integrated into a complete algorithm, the overall final output result may be seriously inconsistent with the expectation.
[0004] Therefore, how to test the processing precision of the to-be-tested operator in the complex processing link becomes a problem to be solved. SUMMARY
[0005] Embodiments of the present application provide an operator testing method and device to solve the problem that the processing precision of a to-be-tested operator in a complex processing link cannot be tested in the prior art.
[0006] Embodiments of the present application provide an operator testing method, which comprises:
[0007] obtaining a reference operator consistent with the function of the to-be-tested operator, and randomly selecting N standard image processing operators in a basic operator library, N being a positive integer;
[0008] arranging the N standard image processing operators and the to-be-tested operator in order to obtain a test processing chain;
[0009] replacing the to-be-tested operator in the test processing chain with the reference operator to obtain a reference processing chain;
[0010] obtaining a test image, sequentially running each operator in the test processing chain to process the test image to obtain a first target image output by the last operator, and sequentially running each operator in the reference processing chain to process the test image to obtain a second target image output by the last operator;
[0011] determine a test result of the to-be-tested operator according to a difference between the first target image and the second target image.
[0012] Further, the arranging the N standard image processing operators and the to-be-tested operator in sequence to obtain a test processing chain comprises:
[0013] randomly arranging the N standard image processing operators to obtain a candidate processing chain;
[0014] randomly inserting the to-be-tested operator into any position in the candidate processing chain to obtain the test processing chain.
[0015] Further, the randomly arranging the N standard image processing operators to obtain a candidate processing chain comprises:
[0016] randomly arranging the N standard image processing operators to obtain a plurality of to-be-selected processing chains and outputting;
[0017] receiving a selected candidate processing chain from the plurality of to-be-selected processing chains, wherein an order of each operator in the selected candidate processing chain meets a preset operator logical dependency requirement.
[0018] Further, after the randomly selecting N standard image processing operators from a basic operator library, and before the replacing the to-be-tested operator in the test processing chain with the benchmark operator, the method further comprises:
[0019] respectively acquiring a three-party standard image processing operator corresponding to each standard image processing operator from a public library, wherein a function of any standard image processing operator is consistent with a function of the corresponding three-party standard image processing operator, but supported application platforms are inconsistent;
[0020] After the replacing the to-be-tested operator in the test processing chain with the benchmark operator, and before the obtaining a benchmark processing chain, the method further comprises:
[0021] for each standard image processing operator in the test processing chain, replacing the standard image processing operator in the test processing chain with a three-party standard image processing operator corresponding to the standard image processing operator.
[0022] Further, after the obtaining a benchmark processing chain, and before the acquiring a test image, the method further comprises:
[0023] acquiring an adjustment parameter name saved in advance for each standard image processing operator;
[0024] randomly selecting an adjustment value corresponding to the adjustment parameter name in a pre-configured preferred parameter space;
[0025] adjusting parameter values in corresponding operators in the test processing chain and the reference processing chain using the adjustment values.
[0026] Further, the determining the test result of the to-be-tested operator according to the difference between the first target image and the second target image comprises:
[0027] determining a full-image difference index according to the first target image and the second target image, the full-image difference index comprising one or more of a structural similarity index, a peak signal-to-noise ratio, and statistical information of pixel-by-pixel difference, the statistical information comprising one or more of a mean value, a variance, and a maximum value;
[0028] if the full-image difference index meets a preset error requirement, determining that the to-be-tested operator passes the end-to-end test.
[0029] Further, the method further comprises:
[0030] obtaining a first input image and a first output image of the to-be-tested operator when each operator in the test processing chain is run;
[0031] respectively determining a first difference value between a first pixel value of each pixel point in the first output image and a second pixel value of a corresponding pixel point in the first input image;
[0032] if the first difference value corresponding to each pixel point outside a target image region is 0, determining that the to-be-tested operator does not modify the pixel points outside the target image region, and passing the side effect detection, wherein the target image region is a region of interest (ROI) when the to-be-tested operator processes an image.
[0033] Further, the method further comprises:
[0034] obtaining a second input image and a second output image of the reference operator when each operator in the reference processing chain is run;
[0035] respectively determining a second difference value between a third pixel value of each pixel point in the second output image and a fourth pixel value of a corresponding pixel point in the second input image;
[0036] if the difference between the first difference value and the second difference value corresponding to each pixel point in the target image region is within a preset error range, determining that the to-be-tested operator passes the function verification.
[0037] Further, the method further comprises:
[0038] record the input / output images of each operator and the parameter configuration of each operator when each operator in the test processing chain and the benchmark processing chain is running.
[0039] The embodiment of the present application also provides an operator testing device, which comprises:
[0040] an acquisition module, configured to acquire a benchmark operator consistent with the function of a to-be-tested operator, and randomly select N standard image processing operators in a basic operator library, where N is a positive integer; arrange the N standard image processing operators and the to-be-tested operator in sequence to obtain a test processing chain; replace the to-be-tested operator in the test processing chain with the benchmark operator to obtain a benchmark processing chain; and acquire a test image;
[0041] a test module, configured to sequentially run each operator in the test processing chain to process the test image, and obtain a first target image output by a last operator; sequentially run each operator in the benchmark processing chain to process the test image, and obtain a second target image output by a last operator; and determine a test result of the to-be-tested operator according to the difference between the first target image and the second target image.
[0042] Further, the acquisition module is specifically configured to randomly arrange the N standard image processing operators to obtain a candidate processing chain; and randomly insert the to-be-tested operator into any position in the candidate processing chain to obtain the test processing chain.
[0043] Further, the acquisition module is specifically configured to randomly arrange the N standard image processing operators to obtain a plurality of to-be-selected processing chains and output; and receive a selected candidate processing chain in the plurality of to-be-selected processing chains, where the order of each operator in the selected candidate processing chain meets a preset operator logical dependency requirement.
[0044] Further, the acquisition module is further configured to acquire, in a public library, a corresponding three-party standard image processing operator for each standard image processing operator, where the function of any standard image processing operator is consistent with the function of the corresponding three-party standard image processing operator, but the supported application platforms are inconsistent; and replace, for each standard image processing operator in the test processing chain, the standard image processing operator in the test processing chain with the corresponding three-party standard image processing operator of the standard image processing operator.
[0045] Further, the acquisition module is further configured to acquire an adjustment parameter name saved in advance for each standard image processing operator; and randomly select an adjustment value corresponding to the adjustment parameter name in a preconfigured preferred parameter space.
[0046] an adjusting module configured to adjust parameter values in corresponding operators in the test processing chain and the reference processing chain using the adjustment values.
[0047] Further, the test module is specifically configured to determine a full-image difference index according to the first target image and the second target image, the full-image difference index including one or more of a structural similarity index, a peak signal-to-noise ratio, and statistical information of pixel-by-pixel differences, the statistical information including one or more of a mean value, a variance, and a maximum value; and if the full-image difference index meets a preset error requirement, determining that the to-be-tested operator passes the end-to-end test.
[0048] Further, the obtaining module is further configured to obtain a first input image and a first output image of the to-be-tested operator when each operator in the test processing chain is running.
[0049] The test module is further configured to determine a first difference value between a first pixel value of each pixel point in the first output image and a second pixel value of a corresponding pixel point in the first input image; and if the first difference value of each pixel point outside a target image region is 0, determining that the to-be-tested operator does not modify the pixel points outside the target image region and passes the side effect detection, where the target image region is a region of interest (ROI) when the to-be-tested operator processes an image.
[0050] Further, the obtaining module is further configured to obtain a second input image and a second output image of the reference operator when each operator in the reference processing chain is running.
[0051] The test module is further configured to determine a second difference value between a third pixel value of each pixel point in the second output image and a fourth pixel value of a corresponding pixel point in the second input image; and if a difference between the first difference value and the second difference value of each pixel point in the target image region is within a preset error range, determining that the to-be-tested operator passes the function verification.
[0052] Further, the apparatus further includes:
[0053] A recording module is configured to record input / output images of each operator and parameter configurations of each operator when each operator in the test processing chain and the reference processing chain is running.
[0054] Embodiments of the present application also provide an electronic device including a processor configured to implement the steps of the operator test method described above.
[0055] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the operator testing method in any one of the above.
[0056] The embodiment of the present application further provides a computer program product, which comprises computer program code, and when the computer program code is run on a computer, the computer program code makes the computer execute the steps of the operator testing method in any one of the above.
[0057] In the embodiment of the present application, the reference operator consistent with the function of the to-be-tested operator is acquired, N standard image processing operators are randomly selected from the basic operator library, the N standard image processing operators and the to-be-tested operator are arranged in sequence to obtain a test processing chain, in order to be able to compare the to-be-tested operator, the to-be-tested operator in the test processing chain is replaced by the reference operator to obtain a reference processing chain, then each operator in the test processing chain and each operator in the reference processing chain are respectively run to process a test image, a first target image output by a last operator in the test processing chain and a second target image output by a last operator in the reference processing chain are obtained, then according to the difference between the first target image and the second target image, a test result of the to-be-tested operator is determined. The to-be-tested operator is integrated into the randomly generated processing chain, the processing accuracy of the to-be-tested operator is reflected by analyzing the result output by the last operator in the processing chain, and the accuracy of operator testing is improved. The error accumulation problem can be detected in time, and the compatibility of the to-be-tested operator in a complex processing chain is ensured. BRIEF DESCRIPTION OF DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0059] Figure 1 An operator testing process schematic diagram in the related art;
[0060] Figure 2 An operator testing process schematic diagram provided by the embodiment of the present application;
[0061] Figure 3 A test processing chain and a basic processing chain schematic diagram provided by the embodiment of the present application;
[0062] Figure 4 An operator testing process schematic diagram provided by the embodiment of the present application;
[0063] Figure 5An operator testing device structure schematic diagram provided for an embodiment of the present application;
[0064] Figure 6 An electronic device structure schematic diagram provided for an embodiment of the present application. DETAILED DESCRIPTION
[0065] For the purpose and implementation of the present application to be more clear, the following will combine the drawings in the exemplary embodiments of the present application to clearly and completely describe the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only a part of the embodiments of the present application, but not all the embodiments.
[0066] It should be noted that the brief description of the terms in the present application is only for the convenience of understanding the subsequently described embodiments, and is not intended to limit the embodiments of the present application. Unless otherwise specified, these terms should be understood according to their ordinary and general meanings.
[0067] The terms "first", "second", "third" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit the specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchanged under appropriate circumstances.
[0068] The terms "include" and "have" and any variations thereof are intended to cover but not exclusive inclusion, for example, a product or device including a series of components does not necessarily limit to all the components clearly listed, but can include other components not clearly listed or inherent to these products or devices.
[0069] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or combination of hardware or / and software code capable of performing functions related to the element.
[0070] The following will be combined Figure 1 The process of operator testing in the related art is described, Figure 1 An operator testing process schematic diagram in the related art. The input image is input into the operator to be tested and the reference operator respectively, and the output result A of the operator to be tested and the output result B of the reference operator are obtained. Then, by comparing the difference between the output result A and the output result B, it is judged whether the test of the operator to be tested is passed.
[0071] The operator test method in the related art lacks end-to-end integrated perspective test. An image processing algorithm is usually composed of multiple operators to form a processing link. The related art only verifies the accuracy of a single "node" in the link. However, in actual application, a slight error of a single operator will be passed, accumulated, or even amplified in the subsequent processing process. In the related art, there is a lack of a unified test framework and an automated process, making it difficult to perform large-scale and efficient regression testing, and the test cost is high and key test scenarios are easily missed.
[0072] To solve the problem that the processing accuracy of a to-be-tested operator in a complex processing link cannot be tested in the prior art, an embodiment of the present application provides an operator test method and device. In the method, a reference operator consistent with the function of the to-be-tested operator is obtained, and N standard image processing operators are randomly selected from a basic operator library, where N is a positive integer. The N standard image processing operators and the to-be-tested operator are arranged in sequence to obtain a test processing link. The to-be-tested operator in the test processing link is replaced with the reference operator to obtain a reference processing link. A test image is obtained, each operator in the test processing link is sequentially run, and a first target image output by a last operator is obtained. Each operator in the reference processing link is sequentially run, and a second target image output by a last operator is obtained. A test result of the to-be-tested operator is determined according to the difference between the first target image and the second target image.
[0073] The operator test method provided in the embodiment of the present application places the to-be-tested operator in a random and complex processing link for end-to-end testing, which can expose error amplification and accumulation problems that occur only in the integrated environment in advance, and significantly improves the robustness of the algorithm and the success rate of system integration. Test data shows that the operator test method provided in the embodiment of the present application can discover more than 85% of the integration stage problems in advance.
[0074] Before introducing the operator test method provided in the embodiment of the present application, some terms related to the embodiment of the present application are first explained below.
[0075] Region of Interest (ROI): a region in an image that needs to be processed or analyzed.
[0076] Structural Similarity Index (SSIM): an index for measuring the similarity between two images, with a value range of [0, 1], and the closer the value is to 1, the more similar the images are.
[0077] Peak Signal-to-Noise Ratio (PSNR): an index for measuring image quality, with a unit of decibel (dB), and the larger the value is, the better the image quality is.
[0078] Open Source Computer Vision Library (OpenCV): a widely used image processing and computer vision algorithm library.
[0079] NVIDIA Performance Primitives (NPP): provides a series of image processing and signal processing functions optimized for GPU.
[0080] Vector Signal Image Processing Library (VSIPL): a standard signal processing library specification.
[0081] BGR / GRAY / HSV / YUV: different color space representations, BGR for blue-green-red color space, GRAY for grayscale space, HSV for hue saturation value space, and YUV for luminance chrominance space.
[0082] Delta image: represents the pixel difference between two images, usually used to analyze image changes or operator effects.
[0083] Embodiment 1:
[0084] Figure 2 An operator test process diagram is provided for the embodiments of the present application, which includes:
[0085] S201: Obtain a benchmark operator consistent with the function of the to-be-tested operator, and randomly select N standard image processing operators in the basic operator library, N being a positive integer.
[0086] The operator test method provided in the embodiments of the present application is applied to an electronic device, which can be a personal computer (PC), a server, etc.
[0087] After a new image processing operator is developed, in order to determine whether the accuracy of the image processing operator meets the requirements, in the embodiments of the present application, a "true value comparison operator" consistent in function with the newly developed image processing operator can be obtained. For ease of description, in the embodiments of the present application, the newly developed image processing operator can be referred to as a to-be-tested operator, and the true value comparison operator can be referred to as a benchmark operator.
[0088] In the embodiments of the present application, the reference operator can be a user of the electronic device, or sent by another electronic device, or found from a public library. The public library can be a recognized and high-precision third-party public library, such as OpenCV, NPP, VSIPL, etc. In the embodiments of the present application, an operator similar to the name of the to-be-tested operator can be found in the public library as the reference operator.
[0089] In order to be able to test the to-be-tested operator in a real "processing environment", in the embodiments of the present application, N standard image processing operators can be randomly selected from the basic operator library, where N is a positive integer. For example, the N standard image processing operators can be randomly selected from the basic operator library. Of course, a person skilled in the art can set the specific value of N according to the needs.
[0090] In a possible implementation, in order to ensure that the obtained standard image processing operators are not repeated, in the embodiments of the present application, when selecting operators from the basic operator library, N standard image processing operators can be randomly selected without replacement.
[0091] In a possible implementation, the weight of being selected can be set for each operator according to the complexity, usage frequency and other factors of each operator. The greater the weight corresponding to any operator, the higher the probability of the operator being randomly selected as a standard image processing operator. For example, a lower weight, such as 0.2, 0.15, etc., can be set for an operator with higher complexity, and a higher weight, such as 0.8, 0.7, etc., can be set for an operator with higher usage frequency. A person skilled in the art can configure as needed.
[0092] In the embodiments of the present application, the basic operator library can be pre-constructed, and the basic operator library can include a plurality of commonly used image processing operators. For example, the image processing operators can come from a verified third-party library, such as OpenCV, to ensure the correctness of the operators included in the basic operator library. The image processing operators can also be internally developed and tested operators. For ease of description, each image processing operator saved in the basic operator library can be referred to as a standard image processing operator.
[0093] For example, the basic operator library can include various types of operators, such as:
[0094] Spatial domain processing operators: filter operators and morphological operation operators, where the filter operators can include operators with Gaussian filtering, median filtering and bilateral filtering functions; the morphological operation operators can include operators with functions of corrosion, expansion, opening operation and closing operation;
[0095] Color space conversion operators: These can include operators that can convert between BGR and GRAY, BGR and HSV, and BGR and YUV.
[0096] Geometric transformation operators: These can include operators that perform rotation, scaling, translation, affine transformations, and other functions.
[0097] Statistical operators: These can include operators with functions such as mean, variance, and histogram equalization;
[0098] Thresholding operators: These can include operators with functions such as binarization and adaptive thresholding.
[0099] S202: Arrange the N standard image processing operators and the operators to be tested in sequence to obtain the test processing chain.
[0100] To test the operator in a real "processing environment," after obtaining N standard image processing operators, these N standard image processing operators and the operator to be tested can be arranged sequentially to obtain a test processing chain. For example, the operators can be arranged alphabetically by the first letter of their names, by their complexity, or by their frequency of use.
[0101] S203: Replace the operator to be tested in the test processing chain with the benchmark operator to obtain the benchmark processing chain.
[0102] After obtaining the test processing chain, the positions of the operators to be tested in the test processing chain can be replaced with the baseline operators to obtain the baseline processing chain. In other words, it is ensured that the positions of each standard image processing operator in the baseline processing chain and the test processing chain are consistent.
[0103] For example, such as Figure 3 As shown, Figure 3 This is a schematic diagram of a test processing chain and a basic processing chain provided in an embodiment of this application. Figure 3 Three standard image processing operators were obtained: the grayscale operator CvtColor, the edge detection operator Sobel, and the binarization operator Threshold. Sorting the standard image processing operators and the operator to be tested Target_F, the resulting test processing chain is: grayscale operator -> operator to be tested -> edge detection operator -> binarization operator. Replacing the position of the operator to be tested in the test processing chain with the baseline operator yields the corresponding baseline processing chain: grayscale operator -> basic operator -> edge detection operator -> binarization operator.
[0104] S204: Obtain a test image, sequentially run each operator in the test processing chain to obtain a first target image output by a last operator, and sequentially run each operator in the reference processing chain to obtain a second target image output by a last operator.
[0105] In the embodiments of the present application, in order to facilitate testing, a diversified test image set can be pre-configured, and a test image can be obtained from the test image set subsequently.
[0106] Exemplarily, the test image set can include images of different sizes, images of different contents, images of different color spaces, images of different noise levels, etc. The images of different sizes can include images of sizes of 640x480, 1280x720, 1920x1080, etc. The images of different contents can include images of contents of natural scenes, persons, buildings, texts, etc. The images of different color spaces can include images of color spaces of BGR, GRAY, YUV, HSV, etc.
[0107] In the embodiments of the present application, testing can be performed based on the determined test processing chain and reference processing chain. When testing, a test image can be obtained. The number of test images can be one or multiple.
[0108] In the embodiments of the present application, for the test processing chain and the reference processing chain, the same test image can be loaded respectively.
[0109] Each operator in the test processing chain is sequentially run to process the test image, and a final output image of the test processing chain is obtained. That is, an image output by an operator arranged at the end in the test processing chain, which can be referred to as a first target image for ease of description.
[0110] Meanwhile, each operator in the reference processing chain is sequentially run to process the test image, and a final output image of the reference processing chain is obtained. That is, an image output by an operator arranged at the end in the reference processing chain, which can be referred to as a second target image for ease of description.
[0111] S205: Determine a test result of the to-be-tested operator according to a difference between the first target image and the second target image.
[0112] Since the reference operators in the reference test chain are operators that are recognized in the industry and have high precision, after the second target image output by the reference processing chain including the reference operators is obtained, the test result of the to-be-tested operator can be determined according to the difference between the first target image and the second target image.
[0113] Specifically, similarity between the first target image and the second target image can be determined, and if the similarity is greater than a preset threshold, it can be determined that the first target image and the second target image have high similarity, and it can be determined that the precision of the to-be-tested operator meets the requirement, and it is confirmed that the to-be-tested operator passes the test.
[0114] In the embodiment of the application, the reference operator consistent with the function of the to-be-tested operator is obtained, N standard image processing operators are randomly selected from the basic operator library, the N standard image processing operators and the to-be-tested operator are arranged in sequence to obtain a test processing chain, in order to be able to compare the to-be-tested operator, the to-be-tested operator in the test processing chain is replaced by the reference operator to obtain a reference processing chain, then each operator in the test processing chain and each operator in the reference processing chain is run respectively to process a test image, a first target image output by a last operator in the test processing chain and a second target image output by a last operator in the reference processing chain are obtained, then the test result of the to-be-tested operator is determined according to the difference between the first target image and the second target image. The to-be-tested operator is integrated into the randomly generated processing chain, the processing precision of the to-be-tested operator is reflected by analyzing the result output by the last operator in the processing chain, and the accuracy of operator testing is improved. The error accumulation problem can be detected in time, and the compatibility of the to-be-tested operator in the complex processing chain is ensured.
[0115] Embodiment 2:
[0116] In order to further improve the accuracy of operator testing, on the basis of the above-mentioned embodiment, in the embodiment of the application, the N standard image processing operators and the to-be-tested operator are arranged in sequence to obtain a test processing chain, comprising:
[0117] The N standard image processing operators are randomly arranged to obtain a candidate processing chain;
[0118] The to-be-tested operator is randomly inserted into any position in the candidate processing chain to obtain the test processing chain.
[0119] In order to be able to place the to-be-tested operator in a dynamically generated "processing environment" composed of multiple standard image processing operators for testing, simulate the complex processing chain in real application, and thus detect the performance of the to-be-tested operator in the integrated environment. In the embodiment of the application, in the process of arranging the N standard image processing operators and the to-be-tested operator in sequence to obtain a test processing chain, the N standard image processing operators can be randomly arranged to obtain a candidate processing chain. And the to-be-tested operator is randomly inserted into any position in the candidate processing chain to form a test processing chain containing N+1 operators. Wherein, any position includes the beginning and end of the candidate processing chain, and of course also includes the middle position of the candidate processing chain.
[0120] To further improve the accuracy of the operator test, on the basis of the above embodiments, in the embodiment of the application, the N standard image processing operators are randomly arranged to obtain a candidate processing chain, comprising:
[0121] The N standard image processing operators are randomly arranged to obtain a plurality of to-be-selected processing chains and output.
[0122] Receiving a selected candidate processing chain in the plurality of to-be-selected processing chains, wherein the order of each operator in the selected candidate processing chain meets a preset operator logical dependency requirement.
[0123] Since the test processing chain is obtained by random arrangement when constructing the test processing chain, there may be a problem that the dependency relationship between each operator in the test processing chain is unreasonable. Therefore, in order to ensure the rationality of the generated test processing chain and further improve the accuracy of the operator test, in the embodiment of the application, the N standard image processing operators can be randomly arranged to obtain a plurality of to-be-selected processing chains and output, so as to facilitate the user of the electronic device to select a reasonable to-be-selected processing chain in the plurality of to-be-selected processing chains. Exemplarily, the number of to-be-selected processing chains can be 10, 20, 100, etc. any number.
[0124] In the embodiment of the application, the order of each operator in the selected processing chain can be predetermined to meet a preset operator logical dependency requirement. When each operator in a certain candidate processing chain meets the preset operator logical dependency requirement, the candidate processing chain can be considered to be reasonable. Exemplarily, the preset operator logical dependency requirement can be that when the input / output data types between adjacent operators in the to-be-selected processing chain are matched and the sizes are matched, the to-be-selected processing chain can be considered to be reasonable. Wherein, the input / output data types matching can be understood as the data type of the output data of the previous operator being consistent with the data type of the input data of the next operator. The size matching can be understood as the resolution of the output data output by the previous operator being consistent with the resolution of the input data that can be processed by the next operator.
[0125] When the electronic device monitors that the user of the electronic device selects a candidate processing chain in the output plurality of to-be-selected processing chains, it can be confirmed that the candidate processing chain is received.
[0126] In the embodiment of the application, the number of candidate processing chains can be one or more.
[0127] When the number of candidate processing chains is multiple, the determined test processing chains are also multiple. When the test processing chains are multiple, the first target image output by the last operator of each test processing chain can be acquired respectively. Then, according to the deviation between the multiple first target images and the second target image, the test result of the to-be-tested operator is determined. Exemplarily, the similarity between each first target image and the second target image can be determined respectively, and if each similarity is greater than a preset threshold, it can be determined that the accuracy of the to-be-tested operator meets the requirement, and it can be confirmed that the to-be-tested operator passes the test.
[0128] Embodiment 3
[0129] In order to further improve the accuracy of operator testing, on the basis of the above embodiments, in the embodiment of the present application, after the N standard image processing operators are randomly selected from the basic operator library, before the to-be-tested operator in the test processing chain is replaced by the benchmark operator, the method further comprises:
[0130] In the public library, a corresponding three-party standard image processing operator is acquired for each standard image processing operator, wherein the function of any standard image processing operator is consistent with the function of the corresponding three-party standard image processing operator, but the supported application platform is inconsistent;
[0131] After the to-be-tested operator in the test processing chain is replaced by the benchmark operator, before the benchmark processing chain is obtained, the method further comprises:
[0132] For each standard image processing operator in the test processing chain, the standard image processing operator in the test processing chain is replaced by the corresponding three-party standard image processing operator of the standard image processing operator.
[0133] Since some operators can only support running in GPUs provided by some developers, when the test processing chain and the benchmark processing chain need to run tests in GPUs provided by different developers, the selected standard image processing operator may not match the GPU version, thereby causing the problem that the operator cannot run. Therefore, in the embodiment of the present application, after the standard image processing operator is acquired, before the to-be-tested operator in the test processing chain is replaced by the benchmark operator, a corresponding three-party standard image processing operator is acquired for each standard image processing operator in the public library. Wherein, the public library can include various standard image processing operators that can run in the target GPU version. Wherein, the target GPU version can be the version of the GPU of the running environment corresponding to the benchmark processing chain. That is, in the public library, a standard image processing operator with the same function as the standard image processing operator is searched. In order to facilitate description, the searched standard image processing operator can be referred to as a three-party standard image processing operator.
[0134] After obtaining the three-party standard image processing operators corresponding to each standard image processing operator, after replacing the to-be-tested operator in the test processing chain with the benchmark operator, for each standard image processing operator in the test processing chain, the standard image processing operator in the test processing chain is replaced with the three-party standard image processing operator corresponding to the standard image processing operator. That is, each standard image processing operator in the test processing chain is replaced with the corresponding three-party standard image processing operator, so as to ensure that the obtained benchmark processing chain can run smoothly in the corresponding GPU.
[0135] Specifically, it is assumed that the to-be-tested operator and the standard image processing operators included in the basic operator library can only run smoothly in GPU1 and cannot run smoothly in GPU2. Three standard image processing operators A, B, and C are obtained from the basic operator library. According to the three standard image processing operators and the to-be-tested operator, the obtained test processing chain is A->B->to-be-tested operator->C. In order to enable the operators in the benchmark processing chain to run in GPU2, in the embodiment of the present application, each three-party standard image processing operator that is consistent in function with each standard image processing operator can be obtained in the corresponding public library. It is assumed that the three-party standard image processing operator that is consistent in function with the standard image processing operator A is A'; the three-party standard image processing operator that is consistent in function with the standard image processing operator B is B'; and the three-party standard image processing operator that is consistent in function with the standard image processing operator C is C'. After replacing each operator in the test processing chain, the obtained benchmark processing chain is A'->B'->benchmark operator->C'.
[0136] Embodiment 4:
[0137] In order to further improve the accuracy of operator testing, on the basis of the above embodiments, in the embodiment of the present application, after obtaining the benchmark processing chain, before obtaining the test image, the method further comprises:
[0138] Obtaining an adjustment parameter name saved in advance for each standard image processing operator;
[0139] Randomly selecting an adjustment value corresponding to the adjustment parameter name in the pre-configured preferred parameter space;
[0140] Adjusting the parameter values in the corresponding operators in the test processing chain and the benchmark processing chain using the adjustment value.
[0141] In the related art, fixed test cases and parameter combinations are usually used, which are difficult to cover various boundary conditions and parameter combinations that operators may encounter in real application scenarios, and the test coverage is limited. Since in actual application scenarios, the parameter values of the same parameter in the same operator are also different in different application scenarios, in order to simulate the real "processing environment" as much as possible, in the embodiments of the present application, after obtaining the benchmark processing chain, the parameter values of each operator in the test processing chain and the benchmark processing chain can be adjusted before obtaining the test image.
[0142] In the embodiments of the present application, the adjustment parameter name saved in advance for each standard image processing operator can be obtained. The adjustment parameter name is a parameter that can be adjusted in parameter value.
[0143] In order to facilitate subsequent determination of the adjusted adjustment value, in the embodiments of the present application, a preferred parameter space can be pre-configured, which includes the adjustment values that can be selected by each adjustment parameter name. For example, the preferred parameter space can include the size of the image filter kernel, and the selectable adjustment values can be 3x3, 5x5, 7x7, etc.; it can also include selectable standard deviations, such as 0.5, 1.0, 1.5, 2.0, etc.; it can also include selectable threshold values, such as 50, 100, 150, 200, etc. Of course, those skilled in the art can also configure other operator characteristics parameters in the preferred parameter space according to needs.
[0144] In the embodiments of the present application, the adjustment value corresponding to the adjustment parameter name can be randomly selected in the preferred parameter space. And the selected adjustment value is used to adjust the parameter value in the corresponding operator in the test processing chain and the benchmark processing chain. In the embodiments of the present application, the operator adjusted by the adjustment value can include the standard image processing operator and the three-party standard image processing operator described in the above embodiments.
[0145] In a possible implementation, when the adjustment value is randomly selected, a random tree seed can be generated, and the adjustment value corresponding to the adjustment parameter name is selected in the preferred parameter space based on the random tree seed.
[0146] Specifically, it is assumed that the test processing chain and the benchmark processing chain include a standard image operator A, a standard image operator B, and a standard image operator C. The adjustment parameter name 1 is saved in advance for the standard image operator A, the adjustment parameter name 2 is saved for the standard image operator B, and the adjustment parameter name 3 is saved for the standard image operator C. The adjustment value corresponding to the adjustment parameter name 1 randomly selected in the preferred parameter space is m, the adjustment value corresponding to the adjustment parameter name 2 is a, and the adjustment value corresponding to the adjustment parameter name 3 is s. Then, the parameter value corresponding to the adjustment parameter name 1 in the standard image operator A in the test processing chain and the benchmark processing chain can be adjusted to m; the parameter value corresponding to the adjustment parameter name 2 in the standard image operator B in the test processing chain and the benchmark processing chain is adjusted to a; and the parameter value corresponding to the adjustment parameter name 3 in the standard image operator C in the test processing chain and the benchmark processing chain is adjusted to s.
[0147] In the embodiments of the present application, the generation (operator selection, sequence, parameter) of the test processing chain is automatic and random, and a plurality of different test cases with great differences can be easily generated, and high-coverage automatic testing is realized. When a new operator needs to be tested, it can be added to the test framework, which has good scalability. A single test can generate more than several hundred different test processing chains. By randomly generating diversified test chains, high-coverage automatic testing is realized, and potential problems of operators under various parameter combinations and processing environments can be found.
[0148] Embodiment 5
[0149] To further improve the accuracy of operator testing, on the basis of the above embodiments, in the embodiments of the present application, the test result of the to-be-tested operator is determined according to the difference between the first target image and the second target image, and includes:
[0150] According to the first target image and the second target image, a full-image difference index is determined, the full-image difference index includes one or more of a structural similarity index, a peak signal-to-noise ratio, and statistical information of pixel-by-pixel differences, and the statistical information includes one or more of a mean value, a variance, and a maximum value.
[0151] If the full-image difference index meets the preset error requirement, it is determined that the to-be-tested operator passes the end-to-end test.
[0152] To further improve the accuracy of the operator test, in the embodiments of the present application, when determining the test result of the to-be-tested operator according to the difference between the first target image and the second target image, a full-image difference index can be determined according to the first target image and the second target image. The full-image difference index can include one or more of a structural similarity index, a peak signal-to-noise ratio, and statistical information of pixel-by-pixel differences. The statistical information can include one or more of a mean value, a variance, and a maximum value.
[0153] If the determined global difference index meets the preset error requirement, it can be determined that the to-be-tested operator passes the end-to-end test.
[0154] Specifically, an index threshold value can be configured for each item in the full-image difference index in advance. If each item in the determined full-image difference index is greater than the corresponding index threshold value, it can be determined that the to-be-tested operator passes the end-to-end test. For example, the index threshold value corresponding to SSIM can be 0.99. The index threshold value corresponding to PSNR can be 40 dB. It should be noted that a person skilled in the art can configure the index threshold value corresponding to each item in the global difference index as needed.
[0155] Embodiment 6:
[0156] To further improve the accuracy of the operator test, on the basis of the above embodiments, in the embodiments of the present application, the method further comprises:
[0157] Obtaining a first input image and a first output image of the to-be-tested operator when each operator in the test processing chain is running;
[0158] Determining a first difference value of each pixel value in the first output image and a second pixel value in the corresponding pixel in the first input image, respectively;
[0159] If the first difference value corresponding to each pixel point outside the target image region is 0, it is determined that the to-be-tested operator does not modify the pixel points outside the target image region, and passes the side effect detection, wherein the target image region is a region of interest (ROI) when the to-be-tested operator processes the image.
[0160] In related technologies, when performing operator testing, only independent "black box" testing is performed on the to-be-tested operator. The test focus is usually concentrated on the output correctness of the "region of interest" of the operator core processing. This leads to a serious testing blind area: if the to-be-tested operator has code defects and incorrectly modifies the pixel values outside the ROI, this destructive side effect cannot be captured by the true value comparison method, resulting in missed testing and hidden dangers for subsequent algorithm integration.
[0161] In order to be able to detect whether the to-be-tested operator modifies the pixels outside the ROI, in the embodiments of the present application, the input image and the output image of the to-be-tested operator when each operator in the test processing chain is run can also be obtained. For the convenience of description, the input image of the to-be-tested operator can be referred to as a first input image, and the output image of the to-be-tested operator can be referred to as a first output image.
[0162] After the first input image and the first output image are obtained, a first difference value of a first pixel value of each pixel point in the first output image and a second pixel value of a corresponding pixel point in the first input image can be determined.
[0163] If the first difference value corresponding to each pixel point outside the target image region is 0, it can be determined that the to-be-tested operator does not modify the pixel points outside the target image region through the side effect detection.
[0164] In the embodiments of the present application, the target image region is the ROI when the to-be-tested operator performs image processing. That is, the target image region is the only pixel region that the to-be-tested operator is allowed to modify.
[0165] In a possible implementation, an "impact mask" M can be defined, which is theoretically the only pixel region that the to-be-tested operator (or the reference operator) is allowed to modify. This mask is given by the ROI parameter. The impact mask is used to identify a binary mask of the pixel region that the operator is allowed to modify, and the region with a mask value of 1 indicates that modification is allowed, and the region with a mask value of 0 indicates that modification is prohibited.
[0166] Specifically, the first input image of the to-be-tested operator can be denoted as I_before (F), and the first output image can be denoted as I_after (F). The actual effect of the to-be-tested operator can be calculated pixel by pixel: where i represents the index identifier of the pixel point, and i can be 1, 2, 3, …, n, where n represents the number of pixel points included in the first input image. Then, represents the first difference value corresponding to the pixel point i; represents the pixel value of the pixel point i in the first output image; represents the pixel value of the pixel point i in the first input image. If the first difference value corresponding to each pixel point outside the target image region is 0, it can be determined that the to-be-tested operator does not modify the pixel points outside the target image region through the side effect detection. If the first difference value corresponding to each pixel point outside the target image region is not 0, it can be determined that the to-be-tested operator causes tampering in the irrelevant region, and it can be determined that the to-be-tested operator passes the side effect detection.
[0167] In a possible implementation, a difference image can be determined according to the first input image and the first output image, so as to quickly determine whether each pixel point outside the target image region is modified based on the difference image.
[0168] To further improve the accuracy of operator testing, on the basis of the above embodiments, in the embodiments of the present application, the method further comprises:
[0169] obtaining a second input image and a second output image of the reference operator when each operator in the reference processing chain is running;
[0170] determining a third pixel value of each pixel point in the second output image and a second difference value of a fourth pixel value of a corresponding pixel point in the second input image, respectively;
[0171] if a difference between the first difference value and the second difference value of each pixel point in the target image region is within a preset error range, determining that the to-be-tested operator passes the function verification.
[0172] To be able to verify the correctness of the core function of the to-be-tested operator itself, in the embodiments of the present application, the input image and the output image of the reference operator when each operator in the reference processing chain is running can be obtained. For ease of description, the input image of the reference operator can be referred to as a second input image, and the output image of the reference operator can be referred to as a second output image.
[0173] After the second input image and the second output image are obtained, a third pixel value of each pixel point in the second output image and a second difference value of a fourth pixel value of a corresponding pixel point in the second input image can be determined, respectively.
[0174] In the embodiments of the present application, a difference between the first difference value and the second difference value of each pixel point in the target image region can be determined. If each difference is within a preset error range, it can be determined that the to-be-tested operator passes the function verification. That is, when each difference is within an allowable fluctuation range, it can be determined that the to-be-tested operator passes the function verification. A person skilled in the art can configure the preset error range as needed. Exemplarily, the preset error range can be that the PSNR is higher than a certain threshold, or the average value / maximum value of the pixel difference is less than a certain threshold.
[0175] Specifically, the second input image of the reference operator can be denoted as I_before (F'), and the second output image can be denoted as I_after (F'). The standard effect of the reference operator can be calculated pixel by pixel: wherein i represents an index identifier of a pixel point, the value of i can be 1, 2, 3, …, n, wherein n represents the number of pixel points included in the second input image. Then, This indicates that pixel i corresponds to the second difference; This represents the pixel value of pixel i in the second output image; This represents the pixel value of pixel i in the second input image. If the first difference is found for each pixel within the target image region... The second difference If the differences are all less than the set value, it can be determined that the function of the operator under test is accurate, and that the operator under test has passed the functional verification. For example, the set value can be 1, 2, etc., and those skilled in the art can configure the set value as needed.
[0176] In this embodiment of the application, by capturing the image state before and after the operator is executed, calculating the difference image, and accurately analyzing the actual influence range of the operator, the accurate detection of modifications outside the ROI is achieved.
[0177] Example 7:
[0178] To facilitate the analysis of the testing process, based on the above embodiments, the method in this application embodiment further includes:
[0179] Record the input / output image of each operator and the parameter configuration of each operator when running each operator in the test processing chain and the benchmark processing chain.
[0180] To facilitate analysis of the testing process, such as identifying which operator in the test and benchmark processing chains has accuracy errors, this embodiment records the input / output images and parameter configurations of each operator during the execution of each operator in the test and benchmark processing chains. This facilitates subsequent problem localization. Alternatively, detailed test logs can also be recorded.
[0181] In this embodiment of the application, by saving intermediate states and detailed test logs, the test results have good traceability, which facilitates problem location and analysis.
[0182] Example 8:
[0183] The following is combined Figure 4 The operator testing process is explained. Figure 4 The figure shows a schematic diagram of an operator testing process provided in an embodiment of this application. The operator testing process mainly includes building a basic operator library, generating a randomly combined processing chain, executing tests and capturing intermediate states, multi-level verification and result analysis.
[0184] In the embodiments of this application, the process of constructing a basic operator library can obtain a basic operator library, and during the operator testing process, benchmark operators and standard image processing operators can be obtained from this basic operator library.
[0185] The process of generating the random combination of processing chains can generate the test processing chain and the benchmark processing chain. The above embodiments have described how to generate the test processing chain and the benchmark processing chain, and the process will not be described again in the embodiments of the present application.
[0186] The process of performing the test and capturing the intermediate state can capture the input image, the output image and the final output image of the operator to be tested in the test processing chain. Meanwhile, the input image, the output image and the final output image of the benchmark operator in the benchmark processing chain are obtained.
[0187] In the process of multi-level verification and result analysis, the global consistency check can be performed according to the final output image of the test processing chain and the final output image of the benchmark processing chain. The local influence accurate check can be performed according to the input image, the output image of the operator to be tested and the input image, the output image of the benchmark operator.
[0188] In the embodiments of the present application, the local influence accurate check is performed on the images before and after the operator to be tested, which can accurately capture any pixel modification of the operator to be tested outside the ROI, fill the huge gap in the operator test in the related art, and significantly improve the reliability of the test. In actual test, the boundary out-of-bounds modification problem missed by the traditional method can be detected.
[0189] The operator test method provided by the embodiments of the present application simultaneously solves the three problems of "isolated function correctness", "side effect detection" and "system integration compatibility", so that the test work is more systematic and more in-depth, and the test efficiency and quality are greatly improved. Through the integration level test in the development stage, the potential problems of the operator in the complex environment can be found in the early stage.
[0190] The operator test method provided by the embodiments of the present application simultaneously solves the three problems of "isolated function correctness", "side effect detection" and "system integration compatibility", so that the test work is more systematic and more in-depth, and the test efficiency and quality are greatly improved. Through the integration level test in the development stage, the potential problems of the operator in the complex environment can be found in the early stage. Figure 1 The operator test method provided by the embodiments of the present application simultaneously solves the three problems of "isolated function correctness", "side effect detection" and "system integration compatibility", so that the test work is more systematic and more in-depth, and the test efficiency and quality are greatly improved. Through the integration level test in the development stage, the potential problems of the operator in the complex environment can be found in the early stage.
[0191] Embodiment 9:
[0192] Based on the same inventive concept, the embodiments of the present application provide an operator test device, Figure 5 The operator test device provided by the embodiments of the present application is shown in the structural schematic diagram, and the device comprises:
[0193] The acquisition module 501 is configured to acquire a benchmark operator consistent with the operator function to be tested, and randomly select N standard image processing operators in a basic operator library, where N is a positive integer; arrange the N standard image processing operators and the operator to be tested in sequence to obtain a test processing chain; replace the operator to be tested in the test processing chain with the benchmark operator to obtain a benchmark processing chain; and acquire a test image.
[0194] The test module 502 is configured to sequentially run each operator in the test processing chain to process the test image to obtain a first target image output by a last operator; sequentially run each operator in the benchmark processing chain to process the test image to obtain a second target image output by a last operator; and determine a test result of the operator to be tested according to a difference between the first target image and the second target image.
[0195] In a possible implementation, the acquisition module 501 is specifically configured to randomly arrange the N standard image processing operators to obtain a candidate processing chain; and randomly insert the operator to be tested into any position in the candidate processing chain to obtain the test processing chain.
[0196] In a possible implementation, the acquisition module 501 is specifically configured to randomly arrange the N standard image processing operators to obtain a plurality of to-be-selected processing chains and output; and receive a selected candidate processing chain in the plurality of to-be-selected processing chains, where the order of each operator in the selected candidate processing chain meets a preset operator logical dependency requirement.
[0197] In a possible implementation, the acquisition module 501 is further configured to respectively acquire, in a public library, a corresponding three-party standard image processing operator of each standard image processing operator, where the function of any standard image processing operator is consistent with the function of the corresponding three-party standard image processing operator, but the supported application platforms are inconsistent; and for each standard image processing operator in the test processing chain, replace the standard image processing operator in the test processing chain with the corresponding three-party standard image processing operator of the standard image processing operator.
[0198] In a possible implementation, the acquisition module 501 is further configured to acquire an adjustment parameter name saved in advance for each standard image processing operator; and randomly select an adjustment value corresponding to the adjustment parameter name in a preconfigured preferred parameter space.
[0199] The adjustment module 503 is configured to use the adjustment value to adjust a parameter value in a corresponding standard image processing operator in the test processing chain and the benchmark processing chain.
[0200] In one possible implementation, the testing module 502 is specifically used to determine a full-image difference index based on the first target image and the second target image. The full-image difference index includes one or more of the following: structural similarity index, peak signal-to-noise ratio, and statistical information on pixel-by-pixel differences. The statistical information includes one or more of the following: mean, variance, and maximum value. If the full-image difference index meets the preset error requirements, then the operator to be tested is determined to have passed the end-to-end test.
[0201] In one possible implementation, the acquisition module 501 is further configured to acquire the first input image and the first output image of the operator to be tested when each operator in the test processing chain is running;
[0202] The test module 502 is further configured to determine the first pixel value of each pixel in the first output image and the first difference between the first pixel value and the second pixel value of the corresponding pixel in the first input image; if the first difference for each pixel outside the target image region is 0, it is determined that the operator under test has not modified the pixels outside the target image region, and side effect detection is performed, wherein the target image region is the region of interest (ROI) when the operator under test performs image processing.
[0203] In one possible implementation, the acquisition module 501 is further configured to acquire the second input image and the second output image of the benchmark operator when each operator in the benchmark processing chain is running;
[0204] The test module 502 is further configured to determine the third pixel value of each pixel in the second output image and the second difference between the third pixel value and the fourth pixel value of the corresponding pixel in the second input image; if the difference between the first difference and the second difference corresponding to each pixel in the target image region is within a preset error range, then the operator to be tested is determined to have passed the functional verification.
[0205] In one possible implementation, the device further includes:
[0206] The recording module 504 is used to record the input / output image of each operator and the parameter configuration of each operator when running each operator in the test processing chain and the benchmark processing chain.
[0207] Example 10:
[0208] Based on the same inventive concept, embodiments of this application provide an electronic device that can implement the steps of the operator testing method described above. Figure 6 This application provides a schematic diagram of an electronic device structure, such as... Figure 6As shown, the device includes a processor 601, a communication interface 602, a memory 603, and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604;
[0209] The memory 603 stores a computer program, which, when executed by the processor 601, causes the processor 601 to perform the following steps:
[0210] Obtain a benchmark operator consistent with the function of the to-be-tested operator, and randomly select N standard image processing operators in a basic operator library, N being a positive integer;
[0211] Arrange the N standard image processing operators and the to-be-tested operator in order to obtain a test processing chain;
[0212] Replace the to-be-tested operator in the test processing chain with the benchmark operator to obtain a benchmark processing chain;
[0213] Obtain a test image, sequentially run each operator in the test processing chain to process the test image, and obtain a first target image output by a last operator; and sequentially run each operator in the benchmark processing chain to process the test image, and obtain a second target image output by a last operator;
[0214] Determine a test result of the to-be-tested operator according to a difference between the first target image and the second target image.
[0215] In a possible implementation, the arranging the N standard image processing operators and the to-be-tested operator in order to obtain a test processing chain includes:
[0216] Randomly arrange the N standard image processing operators to obtain a candidate processing chain;
[0217] Randomly insert the to-be-tested operator into any position in the candidate processing chain to obtain the test processing chain.
[0218] In a possible implementation, the randomly arranging the N standard image processing operators to obtain a candidate processing chain includes:
[0219] Randomly arrange the N standard image processing operators to obtain a plurality of to-be-selected processing chains and output;
[0220] Receive a selected candidate processing chain in the plurality of to-be-selected processing chains, wherein an order of each operator in the selected candidate processing chain meets a preset operator logical dependency requirement.
[0221] In a possible implementation, after the random selection of the N standard image processing operators in the basic operator library, and before the replacement of the to-be-tested operator in the test processing chain with the benchmark operator, the method further includes:
[0222] obtaining, respectively, a three-party standard image processing operator corresponding to each standard image processing operator in the public library, wherein the function of any standard image processing operator is consistent with the function of the corresponding three-party standard image processing operator, but the supported application platforms are inconsistent;
[0223] after the replacement of the to-be-tested operator in the test processing chain with the benchmark operator, and before the obtaining of the benchmark processing chain, the method further includes:
[0224] for each standard image processing operator in the test processing chain, replacing the standard image processing operator in the test processing chain with the three-party standard image processing operator corresponding to the standard image processing operator.
[0225] In a possible implementation, after the obtaining of the benchmark processing chain, and before the obtaining of the test image, the method further includes:
[0226] obtaining an adjustment parameter name saved in advance for each standard image processing operator;
[0227] randomly selecting an adjustment value corresponding to the adjustment parameter name in a preconfigured preferred parameter space;
[0228] adjusting the parameter value in the corresponding standard image processing operator in the test processing chain and the benchmark processing chain using the adjustment value.
[0229] In a possible implementation, the determining of the test result of the to-be-tested operator according to the difference between the first target image and the second target image includes:
[0230] determining a full-image difference index according to the first target image and the second target image, the full-image difference index including one or more of a structural similarity index, a peak signal-to-noise ratio, and statistical information of pixel-by-pixel difference, and the statistical information including one or more of mean value, variance, and maximum value;
[0231] if the full-image difference index meets a preset error requirement, determining that the to-be-tested operator passes the end-to-end test.
[0232] In a possible implementation, the method further includes:
[0233] obtaining a first input image and a first output image of the to-be-tested operator when each operator in the test processing chain is running;
[0234] determining a first difference value of a first pixel value of each pixel point in the first output image and a second pixel value of a corresponding pixel point in the first input image, respectively;
[0235] If the first difference value of each pixel point outside the target image region is 0, it is determined that the to-be-tested operator does not modify the pixel points outside the target image region, and the side effect detection is performed, wherein the target image region is a region of interest (ROI) when the to-be-tested operator performs image processing.
[0236] In a possible implementation, the method further includes:
[0237] obtaining a second input image and a second output image of the reference operator when each operator in the reference processing chain is run;
[0238] determining a third pixel value of each pixel point in the second output image and a fourth pixel value of a corresponding pixel point in the second input image, respectively;
[0239] If the difference between the first difference value and the second difference value of each pixel point in the target image region is within a preset error range, it is determined that the to-be-tested operator passes the function verification.
[0240] In a possible implementation, the method further includes:
[0241] recording the input / output image of each operator and the parameter configuration of each operator when each operator in the test processing chain and the reference processing chain is run.
[0242] Since the principle of solving the problem of the above electronic device is similar to the operator testing method, the implementation of the above electronic device can refer to the embodiments of the method, and the repeated parts will not be described again.
[0243] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 602 is used for communication between the above electronic device and other devices. The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0244] The above processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; can also be a Digital Signal Processing (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0245] Embodiment 11:
[0246] Based on the same inventive concept, the embodiments of the present application also provide a computer readable storage medium, which stores a computer program executable by a processor, and when the program runs on the processor, the processor executes the following steps:
[0247] obtaining a benchmark operator consistent with the operator function to be tested, and randomly selecting N standard image processing operators in the basic operator library, N being a positive integer;
[0248] arranging the N standard image processing operators and the operator to be tested in order to obtain a test processing chain;
[0249] replacing the operator to be tested in the test processing chain with the benchmark operator to obtain a benchmark processing chain;
[0250] obtaining a test image, sequentially running each operator in the test processing chain to process the test image, obtaining a first target image output by the last operator; and sequentially running each operator in the benchmark processing chain to process the test image, obtaining a second target image output by the last operator;
[0251] According to a difference between the first target image and the second target image, a test result of the to-be-tested operator is determined.
[0252] In a possible implementation, the arranging the N standard image processing operators and the to-be-tested operator in sequence to obtain the test processing chain comprises:
[0253] The N standard image processing operators are randomly arranged to obtain a candidate processing chain.
[0254] The to-be-tested operator is randomly inserted into any position in the candidate processing chain to obtain the test processing chain.
[0255] In a possible implementation, the arranging the N standard image processing operators to obtain a candidate processing chain comprises:
[0256] The N standard image processing operators are randomly arranged to obtain a plurality of to-be-selected processing chains and output.
[0257] A selected candidate processing chain in the plurality of to-be-selected processing chains is received, wherein an order of each operator in the selected candidate processing chain meets a preset operator logical dependency requirement.
[0258] In a possible implementation, after the randomly selecting N standard image processing operators from the basic operator library, and before the replacing the to-be-tested operator in the test processing chain with the benchmark operator, the method further comprises:
[0259] A three-party standard image processing operator corresponding to each standard image processing operator is respectively acquired from a public library, wherein a function of any standard image processing operator is consistent with a function of the corresponding three-party standard image processing operator, but supported application platforms are inconsistent.
[0260] After the replacing the to-be-tested operator in the test processing chain with the benchmark operator, and before the obtaining the benchmark processing chain, the method further comprises:
[0261] For each standard image processing operator in the test processing chain, the standard image processing operator in the test processing chain is replaced with the three-party standard image processing operator corresponding to the standard image processing operator.
[0262] In a possible implementation, after the obtaining the benchmark processing chain, and before the acquiring the test image, the method further comprises:
[0263] An adjustment parameter name saved in advance for each standard image processing operator is acquired.
[0264] An adjustment value corresponding to the adjustment parameter name is randomly selected in a preconfigured preferred parameter space.
[0265] adjusting a parameter value in a corresponding standard image processing operator in the test processing chain and the reference processing chain using the adjustment value.
[0266] In a possible implementation, the determining the test result of the to-be-tested operator according to the difference between the first target image and the second target image comprises:
[0267] determining a full-image difference index according to the first target image and the second target image, the full-image difference index comprising one or more of a structural similarity index, a peak signal-to-noise ratio, and statistical information of pixel-by-pixel difference, the statistical information comprising one or more of a mean value, a variance, and a maximum value;
[0268] if the full-image difference index meets a preset error requirement, determining that the to-be-tested operator passes the end-to-end test.
[0269] In a possible implementation, the method further comprises:
[0270] obtaining a first input image and a first output image of the to-be-tested operator when each operator in the test processing chain is run;
[0271] respectively determining a first difference value between a first pixel value of each pixel point in the first output image and a second pixel value of a corresponding pixel point in the first input image;
[0272] if the first difference value corresponding to each pixel point outside a target image region is 0, determining that the to-be-tested operator does not modify the pixel point outside the target image region, and passing the side effect detection, wherein the target image region is a region of interest (ROI) when the to-be-tested operator processes an image.
[0273] In a possible implementation, the method further comprises:
[0274] obtaining a second input image and a second output image of the reference operator when each operator in the reference processing chain is run;
[0275] respectively determining a second difference value between a third pixel value of each pixel point in the second output image and a fourth pixel value of a corresponding pixel point in the second input image;
[0276] if a difference between the first difference value and the second difference value corresponding to each pixel point in the target image region is within a preset error range, determining that the to-be-tested operator passes the function verification.
[0277] In a possible implementation, the method further comprises:
[0278] record the input / output images of each operator and the parameter configuration of each operator when each operator in the test processing chain and the benchmark processing chain is running.
[0279] Since the principle of solving the problem of the above computer readable storage medium is similar to the operator test method, the implementation of the above computer readable storage medium can refer to the implementation of the method, and the repeated parts will not be described.
[0280] Embodiment 12:
[0281] Based on the same inventive concept, the embodiments of the present application also provide a computer program product, which comprises computer program code, when the computer program code runs on a computer, so that the computer executes any one of the operator test methods discussed in the foregoing. Since the principle of solving the problem of the above computer program product is similar to the operator test method, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be described.
[0282] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0283] The present application is described with reference to flowcharts and / or block diagrams according to the methods, devices (systems), and computer program products of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 means for performing the functions specified in the flowchart
[0284] These computer program instructions can also be stored in a computer readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including instruction means, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 means for performing the functions specified in the flowchart
[0285] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of user operations steps are performed on the computer or other programmable data processing devices to generate a computer implemented process, so that the instructions executed on the computer or other programmable data processing devices provide a process for implementing the flowchart Figure 1 one or more flows and / or blocks Figure 1 one or more blocks or steps of the functions specified in the flowchart
[0286] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application belong to the scope of the claims of the present application and their equivalents, the present application also intends to include these modifications and variations.
Claims
1. An operator testing method characterized by, The method includes: Obtain a baseline operator that is consistent with the function of the operator to be tested, and randomly select N standard image processing operators from the basic operator library according to the weight of each operator in the basic operator library, where N is a positive integer. The weight is used to describe the probability of the corresponding operator being selected, and the weight is determined according to the complexity and frequency of use of the corresponding operator. Arrange the N standard image processing operators and the operators to be tested in sequence to obtain the test processing chain; The test operator in the test processing chain is replaced with the benchmark operator to obtain the benchmark processing chain; A test image is acquired, and each operator in the test processing chain is sequentially run to process the test image to obtain the first target image output by the last operator; and each operator in the benchmark processing chain is sequentially run to process the test image to obtain the second target image output by the last operator. The test result of the operator to be tested is determined based on the difference between the first target image and the second target image.
2. The method of claim 1, wherein, The step of arranging the N standard image processing operators and the operator to be tested in sequence to obtain the test processing chain includes: The N standard image processing operators are randomly arranged to obtain a candidate processing chain; The operator to be tested is randomly inserted into any position in the candidate processing chain to obtain the test processing chain.
3. The method of claim 2, wherein, The step of randomly arranging the N standard image processing operators to obtain a candidate processing chain includes: The N standard image processing operators are randomly arranged to obtain multiple processing chains to be selected and output. The system receives a candidate processing chain selected from the plurality of candidate processing chains, wherein the order of the operators in the selected candidate processing chain satisfies a preset operator logical dependency requirement.
4. The method according to claim 1, characterized in that, After randomly selecting N standard image processing operators from the basic operator library, and before replacing the operator to be tested in the test processing chain with the benchmark operator, the method further includes: Obtain the corresponding third-party standard image processing operators for each standard image processing operator from the public library. The function of any standard image processing operator is the same as that of the corresponding third-party standard image processing operator, but the supported application platforms are different. After replacing the operator to be tested in the test processing chain with the benchmark operator, and before obtaining the benchmark processing chain, the method further includes: For each standard image processing operator in the test processing chain, the standard image processing operator in the test processing chain is replaced with the corresponding third-party standard image processing operator.
5. The method according to claim 1 or 2, characterized in that, After obtaining the benchmark processing chain and before acquiring the test image, the method further includes: Retrieve the names of the adjustment parameters that have been saved in advance for each standard image processing operator; Randomly select the adjustment value corresponding to the adjustment parameter name from the pre-configured preferred parameter space; The adjustment value is used to adjust the parameter values in the corresponding operators in the test processing chain and the benchmark processing chain.
6. The method according to claim 1, characterized in that, Determining the test result of the operator to be tested based on the difference between the first target image and the second target image includes: Based on the first target image and the second target image, a whole-image difference index is determined. The whole-image difference index includes one or more of the following: structural similarity index, peak signal-to-noise ratio, and statistical information on pixel-by-pixel differences. The statistical information includes one or more of the following: mean, variance, and maximum value. If the full-map difference index meets the preset error requirements, then the operator to be tested is determined to have passed the end-to-end test.
7. The method according to claim 1, characterized in that, The method further includes: Acquire the first input image and the first output image of the operator to be tested when each operator in the test processing chain is run; Determine the first pixel value of each pixel in the first output image and the first difference between the second pixel value of the corresponding pixel in the first input image; If the first difference for each pixel outside the target image region is 0, it is determined that the operator under test has not modified the pixels outside the target image region. This is achieved through side effect detection, where the target image region is the region of interest (ROI) when the operator under test performs image processing.
8. The method according to claim 7, characterized in that, The method further includes: Acquire the second input image and the second output image of the benchmark operator when each operator in the benchmark processing chain is run; The third pixel value of each pixel in the second output image is determined, and the second difference between the third pixel value and the fourth pixel value of the corresponding pixel in the second input image is determined. If the difference between the first difference and the second difference corresponding to each pixel in the target image region is within a preset error range, then the operator to be tested is determined to have passed the functional verification.
9. The method according to claim 1, characterized in that, The method further includes: Record the input / output image of each operator and the parameter configuration of each operator when running each operator in the test processing chain and the benchmark processing chain.
10. An electronic device, characterized in that, The electronic device includes a processor that executes a computer program stored in a memory to implement the steps of the operator testing method as described in any one of claims 1-9.
Citation Information
Patent Citations
Operator precision verification method and device, server and medium
CN119294445A