Automatic testing method and device, electronic equipment, storage medium and product

By preprocessing, segmenting, identifying and comparing target images to improve the efficiency of automated testing, the problem of low image recognition accuracy is solved, and accurate identification of target elements is achieved and testing efficiency is improved.

CN118840352APending Publication Date: 2024-10-25CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410984589.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-10-25

AI Technical Summary

Technical Problem

In the automated testing method based on image recognition, the accuracy of the target elements in the target image is not considered, resulting in low recognition accuracy and affecting test efficiency.

Method used

By acquiring the target image, preprocessing is performed to enhance the contrast and contour information of the target elements, segmenting the image to separate the target elements, intercepting the target element area, and identifying and comparing it with the preset information to improve the recognition accuracy.

Benefits of technology

It improves the accuracy of target image recognition and the efficiency of automated testing, enhances the contrast and detail information of target elements, and achieves clear segmentation of target elements and background.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118840352A_ABST
    Figure CN118840352A_ABST
Patent Text Reader

Abstract

The invention provides an automatic testing method and device, electronic equipment, a storage medium and a product. The method comprises the following steps: acquiring a target image, wherein the target image at least comprises one target element; preprocessing the target image to obtain a high-grayscale image corresponding to the target image; segmenting a high-grayscale image corresponding to the target image to obtain at least one target element graph which at least comprises one target element; intercepting a target element area map from the target element map; identifying the target element area map to obtain identification information of the target image; and comparing the identification information with preset target image information to obtain a comparison result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of automated testing technology, and in particular to an automated testing method, device, electronic device, storage medium and product. Background Art

[0002] In the related automated testing methods based on image recognition, the accuracy of the target elements in the target image is not taken into consideration, resulting in low recognition accuracy of the target image, which in turn affects the efficiency of automated testing. Summary of the invention

[0003] The present disclosure provides an automated testing method, device, electronic device, storage medium and product to solve the problems in the related art.

[0004] The first aspect of the present disclosure provides an automated testing method, the method comprising:

[0005] Acquire a target image, wherein the target image includes at least one target element;

[0006] Preprocessing the target image to obtain a high grayscale image corresponding to the target image;

[0007] Segmenting the high grayscale image corresponding to the target image to obtain at least one target element map, wherein the target element map includes at least one target element;

[0008] intercepting a target element region map from the target element map;

[0009] Identify the target element region map to obtain identification information of the target image;

[0010] The identification information is compared with preset target image information to obtain a comparison result.

[0011] In one embodiment, preprocessing the target image to obtain a high grayscale image corresponding to the target image includes:

[0012] Normalizing the target image to obtain a normalized image; and correcting the target image to obtain a corrected image;

[0013] The normalized image and the corrected image are fused to obtain a high grayscale image corresponding to the target image.

[0014] In one embodiment, performing normalization processing on the target image to obtain a normalized image includes:

[0015] Performing a convolution operation on the target image to obtain a feature image corresponding to the target image;

[0016] Down-sampling the feature image to generate pyramid images of different levels, wherein the pyramid images of different levels include a low-level image and a high-level image;

[0017] Differentiating a low-level image in the pyramid image from a high-level image in the pyramid image to obtain a differential image;

[0018] The differential image is normalized to obtain a normalized image.

[0019] In one embodiment, correcting the target image to obtain a corrected image includes:

[0020] Acquire the number of different grayscale pixels in a preset area in the target image and the number of grayscale pixels in the target image;

[0021] Comparing the number of pixels with different grayscales in a preset area in the target image with the number of grayscale pixels in the target image to obtain a first ratio;

[0022] Determining a dynamic correction size of the target corresponding to the first ratio based on the number of pixels with different grayscales in the preset area and a preset pixel number threshold;

[0023] The target image is corrected according to the target dynamic correction size corresponding to the first ratio to obtain a corrected image.

[0024] In one embodiment, segmenting the high grayscale image corresponding to the target image to obtain at least one target element map includes:

[0025] Obtaining the grayscale value of each pixel in the high grayscale image corresponding to the target image;

[0026] Based on the grayscale value of the target element and the grayscale value of the background element, obtaining at least one first segmentation threshold;

[0027] According to each of the first segmentation thresholds, determining the variance between the grayscale value of the target element and the grayscale value of the background element;

[0028] Determine the first segmentation threshold when the variance between the grayscale value of the target element and the grayscale value of the background element is the largest as the second segmentation threshold;

[0029] The high grayscale image is segmented according to the second segmentation threshold to obtain at least one target element map.

[0030] In one embodiment, the identification information is compared with preset target image information to obtain a comparison result, including:

[0031] Comparing the identification information with preset target image information;

[0032] If the identification information is successfully compared with the preset target image information, a comparison result is obtained;

[0033] If the comparison between the identification information and the preset target image information fails, the target image is preprocessed.

[0034] A second aspect of the present disclosure provides an automated testing device, the device comprising:

[0035] An acquisition unit, used for acquiring a target image, wherein the target image includes at least one target element;

[0036] A preprocessing unit, used for preprocessing the target image to obtain a high grayscale image corresponding to the target image;

[0037] A segmentation unit, configured to segment the high grayscale image corresponding to the target image to obtain at least one target element map, wherein the target element map includes at least one target element;

[0038] A cutting unit, used for cutting out a target element region map from the target element map;

[0039] An identification unit, used to identify the target element region map and obtain identification information of the target image;

[0040] The comparison unit is used to compare the identification information with preset target image information to obtain a comparison result.

[0041] A third aspect of the present disclosure provides an electronic device, including:

[0042] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the embodiment of the first aspect of the present disclosure.

[0043] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.

[0044] The fifth aspect embodiment of the present disclosure provides a computer program product, including a computer program, which implements the method described in the first aspect embodiment of the present disclosure when executed by a processor.

[0045] In summary, the present disclosure proposes an automated testing method, which includes: acquiring a target image, wherein the target image includes at least one target element; preprocessing the target image to obtain a high-grayscale image corresponding to the target image; segmenting the high-grayscale image corresponding to the target image to obtain at least one target element map, wherein the target element map includes at least one target element; intercepting a target element region map from the target element map; identifying the target element region map to obtain identification information of the target image; comparing the identification information with preset target image information to obtain a comparison result.

[0046] According to the scheme provided by the present disclosure, by acquiring a target image, the target image includes at least one target element; preprocessing the target image to obtain a high-grayscale image corresponding to the target image, the contrast, contour and detail information of the target element in the target image can be enhanced; by segmenting the high-grayscale image corresponding to the target image to obtain at least one target element map, the segmentation of the target element and the target image other than the target element can be achieved; by intercepting a target element region map from the target element map, the region in the target image that is obviously different from other target elements can be determined; by identifying the target element region map, the recognition information of the target image can be obtained, and the accuracy of target image recognition can be improved; by comparing the recognition information with the preset target image information to obtain a comparison result, the efficiency of automated testing based on target image recognition can be improved.

[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0049] Figure 1 A flowchart of an automated testing method provided by an embodiment of the present disclosure;

[0050] Figure 2 A schematic diagram of a process for obtaining a high grayscale image provided by an embodiment of the present disclosure;

[0051] Figure 3 A schematic diagram of a process for obtaining a normalized image provided by an embodiment of the present disclosure;

[0052] Figure 4 A schematic diagram of a flow chart of a method for obtaining a corrected image provided by an embodiment of the present disclosure;

[0053] Figure 5A schematic diagram of a process for obtaining a target element graph provided by an embodiment of the present disclosure;

[0054] Figure 6 A schematic diagram of a platform user registration and login interface provided by an embodiment of the present disclosure;

[0055] Figure 7 A schematic diagram of a platform-defined test task details interface provided in an embodiment of the present disclosure;

[0056] Figure 8 A schematic diagram of a custom test task configuration window provided in an embodiment of the present disclosure;

[0057] Fig. 9 A schematic diagram of a platform test result visualization interface provided by an embodiment of the present disclosure;

[0058] Fig.10 A flowchart of an automated testing method provided for an application example of the present disclosure;

[0059] Fig.11 A schematic diagram of the structure of an automated testing device provided in an embodiment of the present disclosure;

[0060] Fig.12 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0061] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0062] In the related automated testing methods based on image recognition, the accuracy of the target elements in the target image is not taken into consideration, resulting in low recognition accuracy of the target image, which in turn affects the efficiency of automated testing.

[0063] Image recognition automated testing technology has gradually matured, and there are many different tools available for different types of applications. According to the automation theory at the core of testing technology, it can be divided into three categories: recording and playback, test case automated execution, and automated testing.

[0064] Among them, the recording and playback class is a typical image recognition automation testing tool under the recording and playback model, and its main advantage is simplicity and convenience. The test case automation execution class is mainly achieved by automatically executing multiple test cases. This test tool needs to evaluate the feasibility and resource consumption of automation execution case by case in advance, and split the test cases in detail. Finally, it is necessary to write general test execution logic and programs to achieve automation. Its main advantages are that it is relatively convenient and fast, covers a wide range of tests, and supports efficient configuration of test plans. It is also the main image recognition automation testing tool for most computer software companies. Automatic testing tools can support the automated execution of most test tasks. The automation scope covers automatic generation and automatic execution of test cases. It is a tool with higher automation efficiency and lower maintenance cost.

[0065] However, the above three methods all have the problems of poor universality of automated testing processes and low testing efficiency.

[0066] In order to solve the defects in the related schemes, the present disclosure obtains a target image, which includes at least one target element; preprocesses the target image to obtain a high-grayscale image corresponding to the target image, thereby enhancing the contrast, contour and detail information of the target element in the target image; segmentes the high-grayscale image corresponding to the target image to obtain at least one target element map, thereby realizing the segmentation of the target element and the target image other than the target element; captures a target element region map from the target element map to determine the region in the target image that is obviously different from other target elements; obtains identification information of the target image by identifying the target element region map, thereby improving the accuracy of target image recognition; and compares the identification information with preset target image information to obtain a comparison result, thereby improving the efficiency of automated testing based on target image recognition.

[0067] The present disclosure is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0068] like Figure 1 As shown, Figure 1 The following is a flow chart of an automated testing method provided by an embodiment of the present disclosure. The automated testing method provided by an embodiment of the present disclosure comprises the following steps:

[0069] Step 101, obtaining a target image, wherein the target image includes at least one target element;

[0070] In one embodiment, the target image includes target elements and background elements, the target elements are elements that need to be processed or analyzed, and the background elements refer to elements other than the target elements.

[0071] In one embodiment, the target image may be acquired from a public image database.

[0072] In one embodiment, the target image may also be acquired through an image collector.

[0073] In one embodiment, the target image may be acquired by calling an open API interface.

[0074] Step 102, preprocessing the target image to obtain a high grayscale image corresponding to the target image;

[0075] In one embodiment, a high grayscale image refers to an image having a large number of gray levels.

[0076] In one embodiment, in order to improve the effect of preprocessing the target image, the target image is usually first converted into a grayscale image.

[0077] In one embodiment, preprocessing the target image includes normalizing and correcting the target image.

[0078] In one embodiment, by preprocessing the target image to obtain a high grayscale image corresponding to the target image, an image with enhanced contrast of target elements and more accurate contours and details can be obtained.

[0079] Step 103, segmenting the high grayscale image corresponding to the target image to obtain at least one target element map, wherein the target element map includes at least one target element;

[0080] In one embodiment, the high grayscale image corresponding to the target image may be segmented using a fixed threshold method to obtain at least one target element map.

[0081] In one embodiment, the high grayscale image corresponding to the target image may also be segmented by an adaptive threshold method, such as a maximum inter-class variance method, to obtain at least one target element map.

[0082] In one embodiment, the high grayscale image corresponding to the target image may be segmented by edge detection and contour tracking to obtain at least one target element map.

[0083] In one embodiment, by segmenting a high-grayscale image corresponding to the target image to obtain at least one target element map, the target elements and background elements in the target image can be separated, thereby reducing the interference of background elements on target elements in subsequent image recognition.

[0084] Step 104, intercepting a target element region map from the target element map;

[0085] In one embodiment, if the target element map contains only one target element, the target element map is directly determined to be a target element region map.

[0086] In one embodiment, if the target element graph includes two or more target elements, a region graph where a target element that is obviously different from other target elements in the target element graph is located is determined as the target element region graph.

[0087] In one embodiment, a minimum region element interception algorithm may be used to intercept a target element region map from the target element map. The minimum region reflects that the pixel grayscale value of the image element is always smaller than the grayscale value of the pixel in the nearby area.

[0088] In one embodiment, the target element region map may be intercepted from the target element map according to the target element contour.

[0089] Step 105, identifying the target element region map to obtain identification information of the target image;

[0090] In one embodiment, an image recognition network may be used to identify the target element region map to obtain recognition information of the target image, wherein the image recognition network may be a convolutional neural network or a ResNet network.

[0091] In one embodiment, by identifying the target element area map and obtaining the identification information of the target image, external noise interference can be reduced, and the detection of the target element features does not change with changes in external factors such as viewing angle and brightness, and has strong robustness.

[0092] Step 106: Compare the identification information with the preset target image information to obtain a comparison result.

[0093] In one embodiment, the preset target image information refers to preset target image information, such as a parameter to be measured.

[0094] In one embodiment, by comparing the recognition information with the preset target image information to obtain a comparison result, the recognition accuracy of the target image can be determined, and then the effect of the automated test can be measured.

[0095] In one embodiment, if Figure 2 As shown, the target image is preprocessed to obtain a high grayscale image corresponding to the target image, including:

[0096] Step 201, normalizing the target image to obtain a normalized image; and correcting the target image to obtain a corrected image;

[0097] In one embodiment, an image pyramid is constructed to generate a collection of layers of different granularities, different contours, and different sizes, and high-contrast features are used to continuously highlight the area where the target element is located, and the element details, overall image contours, and scales in the image are enhanced to achieve normalized processing of the target image.

[0098] In one embodiment, by performing normalization processing on the target image to obtain a normalized image, some high-contrast elements in the target image can be enhanced, thereby enhancing the accuracy of image recognition.

[0099] In one embodiment, the high contrast feature in the above embodiment is mainly realized by image difference, but when the target image is normalized, the generation of the multi-level layers of the pyramid is realized by gradually accumulating the layers by eliminating the pixels of the even rows and columns of the previous layer, and the information of the high layer (small size) comes from the information of the low layer (large size), and as the size becomes smaller, the detail information of the layer becomes less and less, and the contour information becomes more and more, so too much level division will cause the high-level element information to disappear, and part of the image contrast difference work becomes redundant. Therefore, it is also necessary to select an appropriate number and size of pyramid levels to ensure the image quality of each level in the pyramid.

[0100] In one embodiment, the target image is corrected to obtain a corrected image, and the edge contour and detail information of the target in the image are made more accurate and more realistic by dynamically correcting the image difference and size.

[0101] Step 202: Fusing the normalized image and the corrected image to obtain a high grayscale image corresponding to the target image.

[0102] In one embodiment, before fusing the normalized image and the corrected image to obtain a high grayscale image corresponding to the target image, a normalization operator is required to weaken more layers in the strong contrast area and adjust all the normalized images to the same size.

[0103] In one embodiment, the normalized image and the corrected image may be fused using a weighted sum method to obtain a high grayscale image corresponding to the target image, wherein the weight of the normalized image and the weight of the corrected image may be the same or different, which is not limited in the present disclosure.

[0104] In one embodiment, by fusing the normalized image and the corrected image to obtain a high grayscale image corresponding to the target image, an image with more obvious and accurate target elements can be obtained.

[0105] In one embodiment, if Figure 3 As shown, the target image is normalized to obtain a normalized image, including:

[0106] Step 301, performing a convolution operation on the target image to obtain a feature image corresponding to the target image;

[0107] In one embodiment, a feature image at a position corresponding to the target image is obtained by multiplying each weight value in the convolution kernel by the element at the corresponding position of the target image and then adding the multiplication results. The convolution kernel is slid successively in the horizontal and vertical directions according to the sliding step size of the convolution kernel to obtain a feature image corresponding to the target image.

[0108] Step 302, down-sampling the feature image to generate pyramid images of different levels, wherein the pyramid images of different levels include a low-level image and a high-level image;

[0109] In one embodiment, a two-level pyramid image may be generated by retaining odd-numbered row data and odd-numbered column data of the feature image.

[0110] In one embodiment, the feature image may be down-sampled by retaining odd-numbered row data and odd-numbered column data of an image at a previous level to generate pyramid images at different levels.

[0111] In one embodiment, as the pyramid levels go from bottom to top, the resolution of each level image becomes lower and the scale becomes smaller.

[0112] Step 303, performing a difference between the low-level image in the pyramid image and the high-level image in the pyramid image to obtain a difference image;

[0113] In one embodiment, the resolutions of images at different levels in the pyramid are different. The bottom layer is the original image, which has the highest resolution. The higher the resolution, the more detailed information it can reflect. As the layers increase, the resolution of the layers becomes lower and lower. The lower the resolution, the more it can reflect the contour information of the image.

[0114] In one embodiment, since the high-level image has fewer pixels, the high-level image can be processed using a linear interpolation method, and the pixels of the processed high-level image can be calculated, which facilitates differential calculation of images at different levels.

[0115] In one embodiment, after determining the pixel points at all positions in the high-level image, the pixel points at the positions in the low-level image in the pyramid image can be differentiated from the pixel points at the same positions in the high-level image in the pyramid image to obtain a differential image.

[0116] In one embodiment, by performing a difference between a low-level image in the pyramid image and a high-level image in the pyramid image, the difference image obtained can enhance the contrast of a local area.

[0117] Step 304: normalize the difference image to obtain a normalized image.

[0118] In one embodiment, the pixel values ​​of the difference image may be scaled to a specific range by performing normalization processing on the difference image, such as scaling the pixel values ​​of the difference image to between 0 and 1.

[0119] In one embodiment, if Figure 4 As shown, the target image is corrected to obtain a corrected image, including:

[0120] Step 401, obtaining the number of different grayscale pixels in a preset area in the target image and the number of grayscale pixels in the target image;

[0121] In one embodiment, the preset area is usually the area where the target element is located.

[0122] In one embodiment, the number of different grayscale pixels in a preset area of ​​the target image and the number of grayscale pixels in the target image can be obtained through a histogram of the target image, wherein the histogram of the target image can be obtained by calling the calcHist function of OpenCV.

[0123] Step 402, comparing the number of different grayscale pixels in a preset area in the target image with the number of grayscale pixels in the target image to obtain a first ratio;

[0124] In one embodiment, the size of the first ratio can assist in determining the size of the target element, and further support the selection of the number of pyramid scales. When the first ratio is large, it means that the target element accounts for a large proportion of the target image, and the number of pyramid levels needs to be reduced; when the first ratio is small, it means that the target element accounts for a small proportion of the target image, and the number of pyramid levels needs to be increased.

[0125] Step 403, determining a target dynamic correction size corresponding to the first ratio based on the number of pixels with different grayscales in the preset area and a preset pixel number threshold;

[0126] In one embodiment, the threshold values ​​of the number of preset pixel points at different levels of the pyramid are different.

[0127] In one embodiment, the target dynamic correction size refers to the size that the current target element needs to be enlarged or reduced.

[0128] In one embodiment, the target dynamic correction sizes of the same target element at different levels of the pyramid may be the same or different.

[0129] Step 404: Correct the target image according to the target dynamic correction size corresponding to the first ratio to obtain a corrected image.

[0130] In one embodiment, by correcting the target image according to the target dynamic correction size corresponding to the first ratio, the accuracy of target recognition can be improved, thereby improving the effect of automated testing.

[0131] In one embodiment, if Figure 5 As shown, the high grayscale image corresponding to the target image is segmented to obtain at least one target element map, including:

[0132] Step 501, obtaining the grayscale value of each pixel in the high grayscale image corresponding to the target image;

[0133] In one embodiment, the grayscale value of each pixel in the high grayscale image corresponding to the target image may be obtained by traversing each pixel in the high grayscale image.

[0134] Step 502, obtaining at least one first segmentation threshold based on the grayscale value of the target element and the grayscale value of the background element;

[0135] In one embodiment, the first segmentation threshold is used to segment the target element and the background element.

[0136] In one embodiment, since there may be one, two, or more target elements, there may also be one, two, or more first segmentation thresholds for segmenting target elements and background elements.

[0137] Step 503, determining the variance between the grayscale value of the target element and the grayscale value of the background element according to each of the first segmentation thresholds;

[0138] In one embodiment, the first segmentation thresholds are different, and the elements determined as target elements and background elements are also different.

[0139] In one embodiment, by determining the variance between the grayscale value of the target element and the grayscale value of the background element according to each first segmentation threshold, the difference between the target element and the background element can be determined. The larger the variance, the greater the difference between the target element and the background element, and the smaller the variance, the smaller the difference between the target element and the background element.

[0140] Step 504, determining the first segmentation threshold when the variance between the grayscale value of the target element and the grayscale value of the background element is the largest as the second segmentation threshold;

[0141] In one embodiment, by determining the first segmentation threshold when the variance between the grayscale value of the target element and the grayscale value of the background element is the largest as the second segmentation threshold, the optimal segmentation threshold for segmenting the target element and the background element in the high grayscale image can be obtained.

[0142] In one embodiment, the segmentation threshold determined by determining the variance between the grayscale value of the target element and the grayscale value of the background element may not be affected by the brightness and contrast of the image.

[0143] Step 505: segment the high grayscale image according to the second segmentation threshold to obtain at least one target element map.

[0144] In one embodiment, by segmenting the high grayscale image according to the second segmentation threshold, the accuracy of segmenting the target elements and background elements in the high grayscale image can be improved.

[0145] In one embodiment, the identification information of the target image is compared with preset target image information to obtain a comparison result, including:

[0146] Comparing the identification information with preset target image information;

[0147] If the identification information is successfully compared with the preset target image information, a comparison result is obtained;

[0148] In one embodiment, the comparison result includes target element information in the identification information.

[0149] If the comparison between the identification information and the preset target image information fails, the target image is preprocessed.

[0150] In one embodiment, after the target image is preprocessed, the target elements in the target image are identified again, and the identification information is compared with the preset target image information.

[0151] In one embodiment, after obtaining the comparison results, a lightweight springboot is used as a development framework, and Thymeleaf is used as a template engine to extract front-end page information from the HttpRequest object and map it to the task custom task object. First, the data is stored in the method body, and the custom task is stored in the database. Then, by executing the task execution function in the Service object, the task object is passed to the test task generation and running component to obtain an automated testing platform based on the target image rapid recognition cloud service technology.

[0152] In one embodiment, if Figure 6 As shown in the figure, the user registration and login interface designed for the automated testing platform based on the target image rapid recognition cloud service technology, users can register and log in to the platform through this interface, and the user's registered identity information and authentication will be automatically stored in the database (mysql, oracle, etc.) to control the access rights of different users. Every time a user uses the automated testing platform, he or she must perform the login operation, including entering the user name, login password and dynamic verification code.

[0153] In one embodiment, if Figure 7 As shown in the figure, the test task interface of the automated test platform based on the target image rapid recognition cloud service technology is divided into two parts, left and right. The blue sidebar on the far left is the task bar, which displays the image recognition sub-services that support the test from top to bottom, such as image recognition. When the user clicks on a sub-module, the right page will automatically switch to the corresponding test task interface. When the user clicks on the "Image Recognition" sub-module, the entire interface is displayed as the image recognition service test interface. At the same time, users can also create new test tasks in the service test interface, and support viewing the test task execution status of the cloud service platform.

[0154] In one embodiment, if Figure 8 As shown in the figure, the automated testing platform based on the cloud service technology of rapid recognition of target images supports users to customize test tasks and can customize test tasks according to the cloud platform related services. When the user clicks the "Customize Task" button, the main interface on the right will display a list of all custom tasks created by the user. When the user clicks the name or details of a task in the list, it will automatically jump to the corresponding test display interface. When the user clicks on the new task, a test task configuration window will pop up automatically to support the user to configure the parameters of the custom test task. At the same time, the platform also supports users to add custom test sets and select data sets to start testing. The http request body contains a JSON format string. Users can add fields according to the actual situation of the cloud platform. The automated testing platform will parse the JSON format string, and the rest of the information does not need to be adjusted and is directly placed in the http request body, so as to avoid differences between platforms due to different service requests. Click "OK" to create and complete the custom test task. The page will jump to the custom task list. The defined test tasks will be automatically executed in the background. Users can view the test results by clicking on the details after the task is executed.

[0155] In one embodiment, if Fig. 9 As shown in the figure, in the automated testing platform based on the target image rapid recognition cloud service technology, when the user clicks the "Public Cloud Platform" button on the left, the main interface on the right will display the test result statistics visualization page, which allows users to freely select cloud services to view the test status. At the same time, users can also choose to view the status of executed historical test tasks in the date selection box. For example, when viewing the face recognition cloud service test task, the page will display the comparison of corresponding indicator parameters of different cloud service platforms, including recognition accuracy, task processing time, request error rate and comprehensive score CM, etc.

[0156] In summary, the solution provided by the present disclosure is:

[0157] First, a target image is acquired, wherein the target image includes at least one target element; the target image is preprocessed to obtain a high-grayscale image corresponding to the target image, thereby enhancing the contrast, contour and detail information of the target element in the target image; the high-grayscale image corresponding to the target image is segmented to obtain at least one target element map, thereby realizing the segmentation of the target element and the target image other than the target element; the target element region map is intercepted from the target element map, thereby determining the region in the target image that is obviously different from other target elements; the recognition information of the target image is obtained by identifying the target element region map, thereby improving the accuracy of target image recognition; the recognition information is compared with the preset target image information to obtain a comparison result, thereby improving the efficiency of automated testing based on target image recognition.

[0158] Secondly, the segmentation threshold determined by determining the variance between the grayscale value of the target element and the grayscale value of the background element can be unaffected by the brightness and contrast of the image.

[0159] The following is an application example to further illustrate the automated testing method provided by the present disclosure:

[0160] like Fig.10 As shown, Fig.10 A flowchart of an automated testing method provided for an application example of the present disclosure. The automated testing method provided for an application example of the present disclosure comprises the following steps:

[0161] Step 1001, obtaining a target image, wherein the target image includes at least one target element;

[0162] Step 1002, performing a convolution operation on the target image to obtain a feature image corresponding to the target image;

[0163] Step 1003, down-sampling the feature image to generate pyramid images of different levels, wherein the pyramid images of different levels include a low-level image and a high-level image;

[0164] Step 1004, performing a difference between the low-level image in the pyramid image and the high-level image in the pyramid image to obtain a difference image;

[0165] Step 1005, normalizing the difference image to obtain a normalized image;

[0166] Step 1006, obtaining the number of different grayscale pixels in a preset area in the target image and the number of grayscale pixels in the target image;

[0167] Step 1007, comparing the number of different grayscale pixels in a preset area in the target image with the number of grayscale pixels in the target image to obtain a first ratio;

[0168] Step 1008, determining a target dynamic correction size corresponding to the first ratio based on the number of pixels with different grayscales in the preset area and a preset pixel number threshold;

[0169] Step 1009, correcting the target image according to the target dynamic correction size corresponding to the first ratio to obtain a corrected image;

[0170] Step 1010, fusing the normalized image and the corrected image to obtain a high grayscale image corresponding to the target image;

[0171] Step 1011, obtaining the grayscale value of each pixel in the high grayscale image corresponding to the target image;

[0172] Step 1012, obtaining at least one first segmentation threshold based on the grayscale value of the target element and the grayscale value of the background element;

[0173] Step 1013, determining the variance between the grayscale value of the target element and the grayscale value of the background element according to each of the first segmentation thresholds;

[0174] Step 1014, determining the first segmentation threshold when the variance between the grayscale value of the target element and the grayscale value of the background element is the largest as the second segmentation threshold;

[0175] Step 1015, segmenting the high grayscale image according to the second segmentation threshold to obtain at least one target element map;

[0176] Step 1016, intercepting a target element region map from the target element map;

[0177] Step 1017, identifying the target element region map to obtain identification information of the target image;

[0178] Step 1018: compare the identification information with the preset target image information to obtain a comparison result.

[0179] In order to implement the automated testing method provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides an automated testing device, such as Fig.11 shown. Fig.11 The schematic diagram of the structure of the automated testing device provided in the embodiment of the present disclosure is as follows:

[0180] An acquisition unit 1101 is used to acquire a target image, where the target image includes at least one target element;

[0181] A preprocessing unit 1102 is used to preprocess the target image to obtain a high grayscale image corresponding to the target image;

[0182] A segmentation unit 1103 is used to segment the high grayscale image corresponding to the target image to obtain at least one target element map, wherein the target element map includes at least one target element;

[0183] A cutting unit 1104 is used to cut out a target element region map from the target element map;

[0184] The identification unit 1105 is used to identify the target element region map and obtain the identification information of the target image;

[0185] The comparison unit 1106 is used to compare the recognition information with the preset target image information to obtain a comparison result.

[0186] In one embodiment, the preprocessing unit 1101 is specifically configured to:

[0187] Normalizing the target image to obtain a normalized image; and correcting the target image to obtain a corrected image;

[0188] The normalized image and the corrected image are fused to obtain a high grayscale image corresponding to the target image.

[0189] In one embodiment, the preprocessing unit 1101 is specifically configured to:

[0190] Performing a convolution operation on the target image to obtain a feature image corresponding to the target image;

[0191] Down-sampling the feature image to generate pyramid images of different levels, wherein the pyramid images of different levels include a low-level image and a high-level image;

[0192] Differentiating a low-level image in the pyramid image from a high-level image in the pyramid image to obtain a differential image;

[0193] The differential image is normalized to obtain a normalized image.

[0194] In one embodiment, the preprocessing unit 1101 is specifically configured to:

[0195] Acquire the number of different grayscale pixels in a preset area in the target image and the number of grayscale pixels in the target image;

[0196] Comparing the number of pixels with different grayscales in a preset area in the target image with the number of grayscale pixels in the target image to obtain a first ratio;

[0197] Determining a dynamic correction size of the target corresponding to the first ratio based on the number of pixels with different grayscales in the preset area and a preset pixel number threshold;

[0198] The target image is corrected according to the target dynamic correction size corresponding to the first ratio to obtain a corrected image.

[0199] In one embodiment, the preprocessing unit 1103 is specifically configured to:

[0200] Obtaining the grayscale value of each pixel in the high grayscale image corresponding to the target image;

[0201] Based on the grayscale value of the target element and the grayscale value of the background element, obtaining at least one first segmentation threshold;

[0202] According to each of the first segmentation thresholds, determining the variance between the grayscale value of the target element and the grayscale value of the background element;

[0203] Determine the first segmentation threshold when the variance between the grayscale value of the target element and the grayscale value of the background element is the largest as the second segmentation threshold;

[0204] The high grayscale image is segmented according to the second segmentation threshold to obtain at least one target element map.

[0205] In one embodiment, the comparison unit 1106 is specifically configured to:

[0206] Comparing the identification information with preset target image information;

[0207] If the identification information is successfully compared with the preset target image information, a comparison result is obtained;

[0208] If the comparison between the identification information and the preset target image information fails, the target image is preprocessed.

[0209] It should be noted that: the automated testing device provided in the above embodiment only uses the division of the above program modules as an example when performing automated testing. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the automated testing device is divided into different program modules to complete all or part of the processing described above. In addition, the automated testing device provided in the above embodiment and the automated testing method embodiment provided in the embodiment of the present disclosure belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0210] Fig.12 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Fig.12 As shown, the electronic device 1200 includes at least one processor 1202; and a memory 1201 that is communicatively connected to the at least one processor 1202; wherein the memory 1201 stores instructions that can be executed by the at least one processor 1202, and the instructions are executed by the at least one processor 1202 to implement the steps of the automated testing method of the embodiment of the present disclosure.

[0211] Optionally, the electronic device may specifically be an automated testing device in an embodiment of the present application, and the electronic device may implement corresponding processes implemented by the automated testing device in various methods in the embodiments of the present application, which will not be described in detail here for the sake of brevity.

[0212] It is understood that the electronic device also includes a communication interface 1203. The various components in the electronic device are coupled together through a bus system 1204. It is understood that the bus system 1204 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 1204 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig.12 Various buses are labeled as bus system 1204.

[0213] It can be understood that the memory 1201 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 1201 described in the embodiments of the present invention is intended to include but is not limited to these and any other suitable types of memories.

[0214] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 1202, or implemented by the processor 1202. The processor 1202 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 1202 or the instruction in the form of software. The above processor 1202 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 1202 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 1201, and the processor 1202 reads the information in the memory 1201 and completes the steps of the above method in combination with its hardware.

[0215] In an exemplary embodiment, the electronic device may be implemented by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general purpose processors, controllers, MCUs, microprocessors, or other electronic components to execute the aforementioned method.

[0216] This public security embodiment also provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the steps of the automated testing method of the embodiment of the present invention when executed.

[0217] Optionally, the computer-readable storage medium can be applied to the automated testing device in the embodiments of the present application, and the computer instructions enable the computer to execute the corresponding processes implemented by the automated testing device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.

[0218] The embodiment of the present disclosure also provides a computer program product, including a computer program, which implements the steps of the automated testing method provided by the embodiment of the present invention when executed by a processor.

[0219] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0220] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0221] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0222] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.

[0223] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0224] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. An automated testing method, characterized in that: include: Acquire a target image, wherein the target image includes at least one target element; Preprocessing the target image to obtain a high grayscale image corresponding to the target image; Segmenting the high grayscale image corresponding to the target image to obtain at least one target element map, wherein the target element map includes at least one target element; intercepting a target element region map from the target element map; Identify the target element region map to obtain identification information of the target image; The identification information is compared with preset target image information to obtain a comparison result.

2. The method according to claim 1, characterized in that The preprocessing of the target image to obtain a high grayscale image corresponding to the target image includes: Normalizing the target image to obtain a normalized image; and correcting the target image to obtain a corrected image; The normalized image and the corrected image are fused to obtain a high grayscale image corresponding to the target image.

3. The method according to claim 2, characterized in that The step of performing normalization processing on the target image to obtain a normalized image includes: Performing a convolution operation on the target image to obtain a feature image corresponding to the target image; Down-sampling the feature image to generate pyramid images of different levels, wherein the pyramid images of different levels include a low-level image and a high-level image; Differentiating a low-level image in the pyramid image from a high-level image in the pyramid image to obtain a differential image; The differential image is normalized to obtain a normalized image.

4. The method according to claim 2, characterized in that: The step of correcting the target image to obtain a corrected image includes: Acquire the number of different grayscale pixels in a preset area in the target image and the number of grayscale pixels in the target image; Comparing the number of pixels with different grayscales in a preset area in the target image with the number of grayscale pixels in the target image to obtain a first ratio; Determining a dynamic correction size of the target corresponding to the first ratio based on the number of pixels with different grayscales in the preset area and a preset pixel number threshold; The target image is corrected according to the target dynamic correction size corresponding to the first ratio to obtain a corrected image.

5. The method according to claim 1, characterized in that The step of segmenting the high grayscale image corresponding to the target image to obtain at least one target element map includes: Obtaining the grayscale value of each pixel in the high grayscale image corresponding to the target image; Based on the grayscale value of the target element and the grayscale value of the background element, obtaining at least one first segmentation threshold; According to each of the first segmentation thresholds, determining the variance between the grayscale value of the target element and the grayscale value of the background element; Determine the first segmentation threshold when the variance between the grayscale value of the target element and the grayscale value of the background element is the largest as the second segmentation threshold; The high grayscale image is segmented according to the second segmentation threshold to obtain at least one target element map.

6. The method according to claim 1, characterized in that The step of comparing the identification information of the target image with preset target image information to obtain a comparison result includes: Comparing the identification information with preset target image information; If the identification information is successfully compared with the preset target image information, a comparison result is obtained; If the comparison between the identification information and the preset target image information fails, the target image is preprocessed.

7. An automated testing device, characterized in that: include: An acquisition unit, used for acquiring a target image, wherein the target image includes at least one target element; A preprocessing unit, used for preprocessing the target image to obtain a high grayscale image corresponding to the target image; A segmentation unit, configured to segment the high grayscale image corresponding to the target image to obtain at least one target element map, wherein the target element map includes at least one target element; A cutting unit, used for cutting out a target element region map from the target element map; The recognition unit is used to recognize the target element area map and obtain the recognition information of the target image. The comparison unit is used to compare the identification information with preset target image information to obtain a comparison result.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, wherein the computer program implements the method according to any one of claims 1 to 6 when executed by a processor.