A page anomaly detection method, device, electronic device and storage medium
By graying the page image and calculating the information entropy, combined with regional features, the problem of low detection efficiency in the existing technology is solved, and efficient and accurate detection of different types of page anomalies is achieved.
Patent Information
- Application Number
- CN202210682577.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-16
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2042-06-16
AI Technical Summary
Existing page anomaly detection methods require frequent replacement of preset color blocks or images when facing different types of page anomalies, resulting in low detection efficiency and difficulty in identifying local anomalies.
After grayscale processing of the page image to be tested, the candidate area is divided, the global and local information entropy are calculated, and the pre-trained classifier is used to determine whether the candidate area is an abnormal blank area based on the regional scale characteristics.
The applicability and efficiency of page anomaly detection are improved, and different types of page anomalies can be accurately identified without the need to frequently change detection methods, thereby enhancing detection accuracy.
Smart Images

Figure CN117291859B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of interface detection, and in particular to a page anomaly detection method, device, electronic device, and storage medium. Background Art
[0002] The system page is an important medium for information interaction between users and the system. It converts the system's internal information into information that users can receive. Therefore, whether the system page is displayed normally will greatly affect the user experience.
[0003] Typically, page anomaly detection can be achieved by comparing the sampled page image with a preset color block color or a preset picture. However, during the detection process, the above method needs to redefine the preset color block color or picture for different page anomalies, which has poor versatility. At the same time, frequent changes to the preset color block color or picture result in low detection efficiency. Moreover, the preset color block and picture method is only applicable to full-screen anomalies and is difficult to identify in the case of local anomalies. Summary of the Invention
[0004] The embodiments of the present disclosure at least provide a page anomaly detection method, device, electronic device, and storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides a page anomaly detection method, comprising:
[0006] Acquire an image of a page to be tested, and perform image preprocessing on the image of the page to be tested to obtain a preprocessed image; the image preprocessing includes grayscale processing;
[0007] Segmenting the preprocessed image to obtain a plurality of candidate regions according to the position and size of each interface element in the preprocessed image;
[0008] For each candidate region, determining the global information entropy of the candidate region and / or the local information entropy corresponding to the sampling frame obtained by sampling the candidate region based on one or more preset sampling frames;
[0009] For each candidate region, based on the global information entropy of the candidate region and / or one or more local information entropies of the candidate region and the corresponding regional scale features, call a pre-trained classifier to classify the candidate region to obtain an abnormality recognition result for characterizing whether the candidate region is abnormally blank;
[0010] The candidate regions classified as abnormal blanks are fused to obtain abnormal regions in the image of the page to be tested.
[0011] In an optional implementation, determining, for each candidate region, the global information entropy of the candidate region includes:
[0012] Determine the first occurrence number of each grayscale level in the candidate area based on the grayscale value of each pixel in the candidate area;
[0013] Determine a first occurrence probability of each grayscale number in the candidate area based on the first occurrence count and a first total number of pixels in the candidate area;
[0014] The global information entropy of the candidate region is determined based on the product of the first occurrence probability of each gray level and the negative logarithm corresponding to the first occurrence probability.
[0015] In an optional embodiment, determining, for each candidate region, one or more local information entropies of the candidate region obtained by sampling the candidate region based on one or more preset sampling frames includes:
[0016] For each sampling frame preset in the candidate area, determining the second occurrence number of each grayscale level in the sampling frame based on the grayscale value of each pixel point in the sampling frame;
[0017] Determining a second occurrence probability of each grayscale number in the sampling frame based on the second occurrence number and a second total number of pixels in the sampling frame;
[0018] The local information entropy corresponding to the sampling frame is determined based on the product of the second occurrence probability of the grayscale number and the negative logarithm corresponding to the second occurrence probability.
[0019] In an optional embodiment, the method of obtaining the image of the page to be tested and performing image preprocessing on the image of the page to be tested to obtain a preprocessed image includes grayscale processing, including:
[0020] Scaling the page image to be tested so that the similarity between the scaled page image and the page image to be tested before scaling is greater than a first preset threshold, and the resolution of the scaled page image is lower than a second preset threshold;
[0021] Convert the color value of each pixel in the scaled page image into a grayscale value to obtain an initial grayscale image;
[0022] Perform detail enhancement processing and / or contrast enhancement processing on the initial grayscale image to obtain the preprocessed image.
[0023] In an optional embodiment, the candidate region includes a target interface element candidate region; the preprocessed image is segmented according to the position and size of each interface element in the preprocessed image to obtain multiple candidate regions, including:
[0024] Determining a plurality of interface element regions in the preprocessed image according to the position and size of each interface element in the preprocessed image;
[0025] Based on the position information of each interface element area, the interface element areas whose overlap rate meets the preset conditions are merged to obtain multiple initial interface element candidate areas;
[0026] Based on the position information of the multiple initial interface element candidate regions and the non-maximum suppression mechanism, the target interface element candidate region is screened out from the multiple initial interface element candidate regions.
[0027] In an optional embodiment, the candidate region further includes a non-interface element candidate region; and the segmenting of the preprocessed image according to the position and size of each interface element in the preprocessed image to obtain multiple candidate regions further includes:
[0028] Determining at least one initial non-interface element candidate region in the preprocessed image based on the position information of the target interface element candidate region;
[0029] Each of the initial non-interface element candidate regions is cut into a plurality of non-interface element candidate regions of preset shapes.
[0030] In an optional embodiment, after the candidate regions classified as abnormal blanks are fused to obtain the abnormal regions in the image of the page to be tested, the method further includes:
[0031] Based on the interface element type information corresponding to each abnormally blank candidate area in the abnormal area and the color information of the candidate area before image preprocessing, the detection result of the page image to be tested is generated, and the detection page result includes the abnormal type corresponding to the page image to be tested.
[0032] In a second aspect, an embodiment of the present disclosure further provides a page anomaly detection device, comprising:
[0033] An image preprocessing module is used to obtain an image of a page to be tested and perform image preprocessing on the image to be tested to obtain a preprocessed image; the image preprocessing includes grayscale processing;
[0034] a segmentation module, configured to segment the pre-processed image into a plurality of candidate regions according to the position and size of each interface element in the pre-processed image;
[0035] An information entropy module is used to determine, for each candidate region, a global information entropy of the candidate region and / or a local information entropy corresponding to one or more preset sampling frames obtained by sampling the candidate region;
[0036] A classification module is configured to, for each candidate region, call a pre-trained classifier to classify the candidate region based on the global information entropy of the candidate region and / or one or more local information entropies of the candidate region and corresponding regional scale features to obtain an abnormality recognition result for characterizing whether the candidate region is abnormally blank;
[0037] The fusion module is used to fuse the candidate areas classified as abnormal blanks to obtain the abnormal areas in the image of the page to be tested.
[0038] In an optional implementation, when determining the global information entropy of each candidate region, the information entropy module is configured to:
[0039] Determine the first occurrence number of each grayscale level in the candidate area based on the grayscale value of each pixel in the candidate area;
[0040] Determine a first occurrence probability of each grayscale number in the candidate area based on the first occurrence count and a first total number of pixels in the candidate area;
[0041] The global information entropy of the candidate region is determined based on the product of the first occurrence probability of each gray level and the negative logarithm corresponding to the first occurrence probability.
[0042] In an optional embodiment, when determining, for each candidate region, to obtain one or more local information entropies of the candidate region by sampling the candidate region based on one or more preset sampling frames, the information entropy module is configured to:
[0043] For each sampling frame preset in the candidate area, determining the second occurrence number of each grayscale level in the sampling frame based on the grayscale value of each pixel point in the sampling frame;
[0044] Determining a second occurrence probability of each grayscale number in the sampling frame based on the second occurrence number and a second total number of pixels in the sampling frame;
[0045] The local information entropy corresponding to the sampling frame is determined based on the product of the second occurrence probability of the grayscale number and the negative logarithm corresponding to the second occurrence probability.
[0046] In an optional embodiment, when the image preprocessing module acquires the image of the page to be tested and performs image preprocessing on the image to be tested to obtain a preprocessed image, and the image preprocessing includes grayscale processing, it is configured to:
[0047] Scaling the page image to be tested so that the similarity between the scaled page image and the page image to be tested before scaling is greater than a first preset threshold, and the resolution of the scaled page image is lower than a second preset threshold;
[0048] Convert the color value of each pixel in the scaled page image into a grayscale value to obtain an initial grayscale image;
[0049] Perform detail enhancement processing and / or contrast enhancement processing on the initial grayscale image to obtain the preprocessed image.
[0050] In an optional embodiment, the candidate area includes a target interface element candidate area; the segmentation module includes the target interface element candidate area in the candidate area; and when the pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain multiple candidate areas, it is used to:
[0051] Determining a plurality of interface element regions in the preprocessed image according to the position and size of each interface element in the preprocessed image;
[0052] Based on the position information of each interface element area, the interface element areas whose overlap rate meets the preset conditions are merged to obtain multiple initial interface element candidate areas;
[0053] Based on the position information of the multiple initial interface element candidate regions and the non-maximum suppression mechanism, the target interface element candidate region is screened out from the multiple initial interface element candidate regions.
[0054] In an optional embodiment, the candidate region also includes a non-interface element candidate region; and the segmentation module segments the preprocessed image according to the position and size of each interface element in the preprocessed image to obtain multiple candidate regions, and is further used to:
[0055] Determining at least one initial non-interface element candidate region in the preprocessed image based on the position information of the target interface element candidate region;
[0056] Each of the initial non-interface element candidate regions is cut into a plurality of non-interface element candidate regions of preset shapes.
[0057] In an optional embodiment, the device further includes a full-screen abnormality determination module, configured to:
[0058] Determining whether the pre-processed image is a full-screen abnormal page based on interface elements in the pre-processed image;
[0059] According to the position and size of each interface element in the pre-processed image, the pre-processed image is segmented to obtain multiple candidate regions, including:
[0060] In the case that the pre-processed image is not a full-screen abnormal page, the pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain a plurality of candidate regions.
[0061] In an optional embodiment, the device further includes an abnormality type determination module, configured to:
[0062] Based on the interface element type information corresponding to each abnormally blank candidate area in the abnormal area and the color information of the candidate area before image preprocessing, the detection result of the page image to be tested is generated, and the detection page result includes the abnormal type corresponding to the page image to be tested.
[0063] In a third aspect, an embodiment of the present disclosure further provides an electronic device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are performed.
[0064] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed.
[0065] The embodiments of the present disclosure provide a page anomaly detection method, device, electronic device and storage medium. After performing image preprocessing on the acquired page to be tested, a preprocessed image is obtained. The candidate area is divided, and its global information entropy and one or more local information entropies determined based on the sampling frame are calculated. In combination with the regional scale characteristics of the candidate area, a classifier is used to determine whether the candidate area is an abnormal blank area. In the present disclosure, the page image is grayscaled to convert the page image from a color image into a grayscale image, so that different types of page abnormal blanks can be determined using the information entropy based on the grayscale image. In the field of page abnormal blank detection, the scope of application is wider, and there is no need to frequently change the detection method for different types of page abnormal blanks, which greatly improves the detection efficiency. The information entropy can characterize the amount of information in the candidate area, that is, the image details. The greater the information entropy, the richer the image details, and the smaller the information entropy, the closer the image is to blank. The information entropy is used to determine the page abnormal blank, and the regional scale characteristics of the candidate area are combined to make the determination result more accurate.
[0066] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments. The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and, together with the specification, are used to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without inventive effort.
[0068] Figure 1 A flow chart of a page anomaly detection method provided by an embodiment of the present disclosure is shown;
[0069] Figure 2 A schematic diagram of a pre-processed image provided by an embodiment of the present disclosure is shown;
[0070] Figure 3 A schematic diagram of determining multiple candidate areas of interface elements provided by an embodiment of the present disclosure is shown;
[0071] Figure 4 A schematic diagram of fusing candidate areas of interface elements whose overlap ratio meets a preset condition provided by an embodiment of the present disclosure is shown;
[0072] Figure 5 A schematic diagram of determining a candidate area of a target interface element provided by an embodiment of the present disclosure is shown;
[0073] Figure 6 A flowchart of another page anomaly detection method provided by an embodiment of the present disclosure is shown;
[0074] Figure 7 A flowchart of a blank determination module provided by an embodiment of the present disclosure is shown;
[0075] Figure 8 A schematic diagram of a page anomaly detection device provided by an embodiment of the present disclosure is shown;
[0076] Figure 9 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0077] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the disclosure for which protection is sought, but merely represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.
[0078] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0079] The term "and / or" herein simply describes an association relationship, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, and the existence of B alone. In addition, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.
[0080] Research has found that existing methods for detecting page anomalies typically compare the page to be detected with a preset color block or image and calculate their similarity. This requires changing the preset color block or image depending on the type of page anomaly. For example, to detect global page blanks, the preset image is a blank one. If a portion of the page is partially blank, the page cannot be correctly detected by comparing it with the blank image. Consequently, the detection process is time-consuming, requiring a lot of effort to replace the preset image, making it inefficient. Furthermore, the preset color block and image approach only works for full-screen anomalies and is difficult to identify in the case of localized anomalies.
[0081] Based on the above research, the present disclosure provides a page anomaly detection method, which performs image preprocessing on the acquired page to be tested to obtain a preprocessed image; divides the candidate area, calculates its global information entropy and one or more local information entropies determined based on the sampling frame, and combines the regional scale characteristics of the candidate area to determine whether the candidate area is an abnormal blank area through a classifier. In the present disclosure, the page image is grayscaled to convert the page image from a color image into a grayscale image, so that different types of page abnormal blanks can be determined using the information entropy based on the grayscale image. In the field of page abnormal blank detection, the scope of application is wider, and there is no need to frequently change the detection method for different types of page abnormal blanks, which greatly improves the detection efficiency; information entropy can characterize the amount of information in the candidate area, that is, the image details. The larger the information entropy, the richer the image details, and the smaller the information entropy, the closer the image is to blank. Using information entropy to determine page abnormal blanks, while combining the regional scale characteristics of the candidate area, makes the determination result more accurate.
[0082] To facilitate understanding of this embodiment, we first provide a detailed introduction to a page anomaly detection method disclosed in an embodiment of the present disclosure. The page anomaly detection method provided in this embodiment of the present disclosure is generally executed by a computer device with certain computing capabilities, such as a terminal device, a server, or other processing device. In some possible implementations, the page anomaly detection method can be implemented by a processor invoking computer-readable instructions stored in a memory.
[0083] See also Figure 1 FIG. 1 is a flow chart of a page anomaly detection method provided by an embodiment of the present disclosure, the method comprising steps S101 to S105, wherein:
[0084] S101: Acquire a page image to be tested, and perform image preprocessing on the page image to be tested to obtain a preprocessed image; the image preprocessing includes grayscale processing.
[0085] The page image to be tested can specifically be a screenshot of an application interface. Image grayscale processing refers to converting the color values of each pixel in a color page image into grayscale values. This process can be implemented using the additive color mixing model (RGB model, where R represents red, G represents green, and B represents blue). In the RGB model, if R=G=B, the color represents a grayscale color. The value where R=G=B is called the grayscale value. Therefore, each pixel in a grayscale image only requires one byte to store the grayscale value (also known as intensity value or brightness value).
[0086] Exemplarily, the image preprocessing step may include:
[0087] (1) Scaling the page image to be tested so that the similarity between the scaled page image and the page image to be tested before scaling is greater than a first preset threshold, and the resolution of the scaled page image is lower than a second preset threshold.
[0088] Resolution refers to the image resolution, which determines the fineness of image details. Generally speaking, the higher the image resolution, the more pixels it contains, and the clearer the image. However, it also increases the storage space occupied by the file and takes longer for the system to process the image.
[0089] The page image is scaled to reduce the page image to a preset size, and the resolution of the page image is reduced so that the similarity between the scaled page image and the page image before scaling is greater than a first preset threshold. In this way, the scaled page image still retains sufficient picture details, avoiding overscaling, which causes the page image to lose some details and affects the page anomaly detection results. For example, the first preset threshold can be 70% to 90%. At the same time, the resolution of the scaled page image is lower than the second preset threshold, so that the size of the page image after being reduced to the preset size is constant, and the resolution of the page image is reduced as much as possible while retaining necessary details, thereby improving the processing speed of the page image. The resolution refers to the amount of information stored in the image, which is the number of pixels per inch in the image. The second preset threshold can be 50 to 300 pixels per inch (PPI), that is, after the page image is reduced to the preset size, the resolution of the page image is reduced to 50 to 300 PPI. The above-mentioned preset size, first preset threshold and second preset threshold can be set according to needs.
[0090] (2) Convert the color value of each pixel in the scaled page image into a grayscale value to obtain an initial grayscale image.
[0091] Grayscale is a numerical value that indicates the brightness or darkness of an image, or the color depth of a point in a black and white image. It generally ranges from 0 to 255, with white at 255 and black at 0. A larger grayscale value indicates a brighter image, so black and white images are also called grayscale images.
[0092] (3) Perform detail enhancement and / or contrast enhancement processing on the initial grayscale image to obtain a preprocessed image.
[0093] Detail enhancement can be achieved through guided filtering, bilateral filtering, or weighted least squares, while contrast enhancement can be achieved through grayscale transformation or histogram adjustment. These operations improve the visual quality of the initial grayscale image and convert it into a form more suitable for machine analysis. This process highlights information that is relevant to machine analysis, suppresses unnecessary information, and improves the image's usability, ultimately resulting in a preprocessed image.
[0094] For example, Figure 2 As shown in FIG, a schematic diagram of a pre-processed image is shown. After the page image to be tested is scaled, a page image with the lowest possible resolution is obtained while retaining the main details of the image. Then, the page image is grayscaled to change the page image from a color image to a grayscale image. Finally, detail enhancement and / or contrast enhancement are performed on the page image to obtain a pre-processed image, as shown in FIG. Figure 2 As shown, the color of the processed search box is black, the background color of the search box is white, the colors of the text and icons in the search box are also white, the color contrast is enhanced, and the image display effect is clearer.
[0095] S102: Segment the pre-processed image according to the position and size of each interface element in the pre-processed image to obtain a plurality of candidate regions.
[0096] Among them, the candidate area can include target interface element candidate areas and non-target interface element candidate areas. Interface elements refer to a series of elements that meet user interaction requirements contained in software or system interfaces that can meet interaction needs, such as windows, menus, views or status bars, etc. Therefore, the interface element area refers to the area where the interface elements are located in the preprocessed image. The non-interface element area refers to the area in the preprocessed image other than the interface element area. After segmenting the interface element area, you can choose to mask it to obtain the non-interface element candidate area.
[0097] For example, the following steps may be performed to segment the interface element region to obtain the target interface element candidate region:
[0098] (1) Based on the position and size of each interface element in the preprocessed image, multiple interface element regions in the preprocessed image are determined.
[0099] For details, see Figure 3 As shown, it is a schematic diagram of determining multiple candidate areas of interface elements provided by an embodiment of the present disclosure. In the figure, the menu, text view, picture view and status bar are all interface elements, which are divided into multiple interface element areas based on their corresponding positions and sizes. Among them, the menu bar also includes candidate area 301 and candidate area 302 divided based on the "user" icon.
[0100] (2) Based on the position information of each interface element region, the interface element regions whose overlap ratios meet the preset conditions are fused to obtain multiple initial interface element candidate regions.
[0101] After determining multiple interface element candidate regions in the preprocessed image, the candidate regions may overlap. In this case, the interface element regions whose overlap rates meet preset conditions can be fused to obtain multiple initial interface element candidate regions.
[0102] For details, see Figure 4 As shown, it is a schematic diagram of the fusion of interface element candidate areas with an overlapping rate that meets preset conditions provided by an embodiment of the present disclosure. In the figure, there are overlapping areas among the interface element candidate areas 401 to 404. At this time, it is necessary to fuse the interface element candidate areas 401 to 404 to obtain a fused initial interface element candidate area 405. Compared with before fusion, the number of candidate areas to be detected in the preprocessed image becomes smaller, thereby avoiding the waste of resources caused by repeated detection of the same area.
[0103] (3) Based on the position information of multiple initial interface element candidate regions and the non-maximum suppression mechanism (NMS), the target interface element candidate region is screened out from the multiple initial interface element candidate regions.
[0104] As the name suggests, NMS suppresses non-maximal elements and can be understood as a local maximum search. This local area represents a neighborhood, which has two variable parameters: the neighborhood dimension and the neighborhood size. It is commonly used in computer vision for edge detection and object recognition. NMS can identify meaningless candidate regions, or ensure that the candidate regions retained by NMS contain useful information within the deleted candidate regions.
[0105] See also Figure 5 The figure shows a schematic diagram of determining a target interface element candidate region provided by an embodiment of the present disclosure, and a schematic diagram of the fusion of all interface element candidate regions whose overlap ratios meet preset conditions in the pre-processed image. The overlap ratio can be 60% to 80%. Figure 3 In comparison, the “User” icon in the menu bar at the bottom of the figure removes the candidate region 301 and retains the candidate region 302 containing the useful information in the candidate region 301 .
[0106] For example, the non-interface element region can be segmented by the following steps to obtain the non-target interface element candidate region:
[0107] (1) Based on the position information of the target interface element candidate area, determine at least one initial non-interface element candidate area in the preprocessed image.
[0108] (2) Each initial non-interface element candidate region is cut into multiple non-interface element candidate regions of preset shapes.
[0109] The preset shape may be a rectangle, a square or other shapes.
[0110] S103: For each candidate region, determine the global information entropy of the candidate region and / or the local information entropy corresponding to the sampling frame obtained by sampling the candidate region based on one or more preset sampling frames.
[0111] Information entropy refers to the average amount of information after excluding redundant information. It is used to describe the uncertainty of the occurrence of various possible events in the information source. The amount of information of an event can be considered as the negative logarithm of the probability of the event. Mathematically, information entropy is actually the expected amount of information. It is defined as follows: a discrete random variable, which has n possible situations: U1, U2...U n The probability of each situation occurring is P i , i = 1, 2, 3...n, then its information entropy H(U) is:
[0112]
[0113] Extending the definition of information entropy to the image field, the random variable n is the grayscale level. The grayscale level is a number of levels divided by a logarithmic relationship between white and black, which is used to indicate the maximum number of different grayscales in an image. The larger the grayscale level, the larger the brightness range of the image. The probability of a random event occurring P i It is the ratio of the number of times a certain grayscale level appears in the entire image to the total number of pixels. Therefore, to calculate the information entropy of an image, we only need to perform grayscale histogram statistics on the image, then calculate the probability of each grayscale level, and finally use the definition of information entropy to calculate the information entropy of the image.
[0114] Specifically, information entropy includes global information entropy and local information entropy. Global information entropy refers to the information entropy calculated based on the entire image corresponding to a candidate region; local information entropy refers to the information entropy calculated based on the local image in the candidate region after dividing it into one or more sampling frames. The candidate region can contain multiple local images.
[0115] The above sampling frames are used to sample the candidate regions. The position, size, and number of sampling frames can be flexibly adjusted based on requirements. The closer the positions of the different sampling frames, the smaller their sizes, and the greater their number, the greater the local information entropy obtained. However, this also increases the computational complexity and slows down the calculation speed. Therefore, the position, size, and number of sampling frames can be determined based on actual requirements.
[0116] The global information entropy of the candidate region is obtained, including:
[0117] Based on the grayscale value of each pixel in the candidate area, determining the first occurrence number of each grayscale level in the candidate area;
[0118] Determining a first occurrence probability of each grayscale number in the candidate area based on the first occurrence count and the total number of first pixels in the candidate area;
[0119] The global information entropy feature of the candidate region is determined based on the first occurrence probability of each gray level and the product of the negative logarithm corresponding to the first occurrence probability.
[0120] The local information entropy of the candidate region is obtained, including:
[0121] For each sampling frame preset in the candidate area, based on the grayscale value of each pixel point in the sampling frame, determine the second occurrence number of each grayscale level in the sampling frame;
[0122] Determining a second occurrence probability of each grayscale number in the sampling frame based on the second occurrence number and the second total number of pixels in the sampling frame;
[0123] Based on the second occurrence probability of the gray level and the product of the negative logarithm corresponding to the second occurrence probability, a local information entropy feature corresponding to the sampling frame is determined.
[0124] S104: For each candidate region, based on the global information entropy of the candidate region and / or one or more local information entropies of the candidate region and the corresponding regional scale features, call a pre-trained classifier to classify the candidate region to obtain an abnormality recognition result for characterizing whether the candidate region is abnormally blank.
[0125] When using a pre-trained classifier to classify the candidate region, the local information entropy used can be the average local information entropy obtained by averaging the local information entropies corresponding to different sampling frames in the candidate region, or the local information entropy corresponding to each sampling frame in the candidate region can be directly used.
[0126] For example, the region scale feature may be the position and size of the candidate region.
[0127] A classifier is a general term for methods used in data mining to classify samples, including algorithms such as decision trees, logistic regression, naive Bayes, and neural networks. Sufficient sample data is collected to train the classifier. The trained classifier can then classify candidate regions based on their global information entropy and / or one or more local information entropies, as well as corresponding regional scale features. The classification results can be divided into candidate regions with and without abnormal gaps.
[0128] S105: Fusing the candidate regions classified as abnormal blanks to obtain abnormal regions in the image of the page to be tested.
[0129] When there are two or more adjacent candidate regions classified as abnormal blanks, they are fused and the redundant regions are removed.
[0130] Optionally, before dividing the preprocessed image into regions according to the position and size of each interface element in the preprocessed image to obtain multiple candidate regions, it is possible to first determine whether there are interface elements in the preprocessed image. If there are no interface elements, the preprocessed image is determined to be a full-screen abnormal page, and its corresponding abnormality type is full-screen abnormality; if there are any interface elements, the preprocessed image is determined to be a non-full-screen abnormal page. At this time, the preprocessed image is divided into regions according to the position and size of each interface element in the preprocessed image.
[0131] Optionally, after the candidate areas classified as abnormal blanks are fused to obtain abnormal areas in the image of the page to be tested, the detection result of the image of the page to be tested is generated based on the interface element type information corresponding to each candidate area classified as abnormal blank in the abnormal area and the color information of the candidate area before image preprocessing, and the detection page result includes the abnormal type corresponding to the image of the page to be tested.
[0132] Specifically, the abnormality type may include two categories: full-screen abnormal blank or partial abnormal blank. First, based on the interface element type, determine whether the abnormal blank is full-screen abnormal blank or partial abnormal blank. For example, if there is no interface element in the candidate area, it is a full-screen abnormality. If the interface element type of the candidate area is a view, it may be an element missing or element loading abnormality. If the interface element type of the candidate area is a window, it may be a page layout abnormality. According to the interface element type information, the abnormality type can also be refined, such as image abnormality, user interface abnormality, text abnormality, etc. At the same time, according to the color information of the candidate area before image preprocessing, it can be determined whether the abnormal blank is a white screen, a green screen or a black screen, etc. In this way, the abnormality type can be determined through the interface element type information of each candidate area in the abnormal area and its corresponding color information before preprocessing.
[0133] The present disclosure provides a page anomaly detection method, which performs image preprocessing on the acquired page to be tested to obtain a preprocessed image; divides the candidate area, calculates its global information entropy and one or more local information entropies determined based on the sampling frame, and combines the regional scale characteristics of the candidate area to determine whether the candidate area is an abnormal blank area through a classifier. In the present disclosure, the page image is grayscaled to convert the page image from a color image into a grayscale image, so that different types of page abnormal blanks can be determined using the information entropy based on the grayscale image. In the field of page abnormal blank detection, the scope of application is wider, and there is no need to frequently change the detection method for different types of page abnormal blanks, which greatly improves the detection efficiency; information entropy can characterize the amount of information in the candidate area, that is, the image details. The greater the information entropy, the richer the image details, and the smaller the information entropy, the closer the image is to blank. Using information entropy to determine page abnormal blanks, while combining the regional scale characteristics of the candidate area, makes the determination result more accurate.
[0134] See also Figure 6 FIG. 1 is a flowchart of another method for detecting page anomalies provided by an embodiment of the present disclosure, the method comprising the following steps:
[0135] Obtain the page image to be detected and perform blank area detection on it. First, use the blank area determination module to determine whether the page image to be detected is abnormally blank in the entire screen:
[0136] If the entire screen is abnormally blank, the detection result is output and the abnormality detection process of this page ends;
[0137] If the entire screen is not abnormally blank, the image of the page to be detected is preprocessed to obtain a preprocessed image that retains the main details of the image, has a lower resolution, and has a stronger contrast. The preprocessed image is then divided into candidate areas:
[0138] If the candidate area after division is an interface element candidate area, all interface element candidate areas whose overlap rate meets the preset conditions are merged to obtain a regular area;
[0139] If the candidate area after division is a non-interface element candidate area, the non-interface element candidate area is the area in the page image to be detected other than the interface element candidate area, which is usually an irregular shape, and the system is more efficient in detecting regular shapes. In order to improve the detection efficiency, it is cut into multiple non-interface element candidate areas of preset shapes to obtain a regular area.
[0140] For the regular area, the blank determination module is used again to determine whether there are abnormal blanks in the local regular area:
[0141] If there are abnormal blank areas in the local regular area, after the abnormal blank areas are merged, the abnormal type is further determined. The abnormal types include: element blank, abnormal record; element missing, layout abnormality; abnormal color block, rendering abnormality, etc. Finally, the detection result and the position coordinates of the corresponding blank area are output, and the page abnormality detection process ends;
[0142] If there is no abnormal blank in the local regular area, it is a normal interface area. Finally, the detection result is output and the abnormality detection process of this page ends.
[0143] Among them, see Figure 7 FIG. 1 is a flowchart of a blank determination module provided by an embodiment of the present disclosure. The blank determination module performs the following steps:
[0144] First, a candidate region is input, and the information entropy of the region based on the grayscale level is calculated, wherein the information entropy can be global information entropy or local information entropy;
[0145] Combined with the scale characteristics of the candidate regions, a classifier is used to classify the detection results into abnormal blank areas and normal areas. The classifier can flexibly adopt current mainstream machine learning classifiers, such as decision tree classifiers, selection tree classifiers, or evidence classifiers.
[0146] Those skilled in the art will understand that in the above-mentioned method of the specific implementation method, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0147] Based on the same inventive concept, the embodiment of the present disclosure also provides a page anomaly detection device corresponding to the page anomaly detection method. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned page anomaly detection method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0148] Reference Figure 8 FIG. 1 is a schematic diagram of a page anomaly detection device provided by an embodiment of the present disclosure, wherein the device includes
[0149] The image preprocessing module 801 is used to obtain an image of a page to be tested and perform image preprocessing on the image to be tested to obtain a preprocessed image; the image preprocessing includes grayscale processing;
[0150] A segmentation module 802 is configured to segment the pre-processed image into a plurality of candidate regions according to the position and size of each interface element in the pre-processed image;
[0151] Information entropy module 803, for each candidate region, determining the global information entropy of the candidate region and / or the local information entropy corresponding to the sampling frame obtained by sampling the candidate region based on one or more preset sampling frames;.
[0152] A classification module 804 is configured to, for each candidate region, call a pre-trained classifier to classify the candidate region based on the global information entropy of the candidate region and / or one or more local information entropies of the candidate region and corresponding regional scale features to obtain an abnormality recognition result indicating whether the candidate region is abnormally blank;
[0153] The fusion module 805 is configured to fuse the candidate regions classified as abnormal blanks to obtain abnormal regions in the image of the page to be tested.
[0154] In an optional implementation, when determining the global information entropy of each candidate region, the information entropy module 803 is configured to:
[0155] Determine the first occurrence number of each grayscale level in the candidate area based on the grayscale value of each pixel in the candidate area;
[0156] Determine a first occurrence probability of each grayscale number in the candidate area based on the first occurrence count and a first total number of pixels in the candidate area;
[0157] The global information entropy of the candidate region is determined based on the product of the first occurrence probability of each gray level and the negative logarithm corresponding to the first occurrence probability.
[0158] In an optional implementation, when determining, for each candidate region, to obtain one or more local information entropies of the candidate region by sampling the candidate region based on one or more preset sampling frames, the information entropy module 803 is configured to:
[0159] For each sampling frame preset in the candidate area, determining the second occurrence number of each grayscale level in the sampling frame based on the grayscale value of each pixel point in the sampling frame;
[0160] Determining a second occurrence probability of each grayscale number in the sampling frame based on the second occurrence number and a second total number of pixels in the sampling frame;
[0161] The local information entropy corresponding to the sampling frame is determined based on the product of the second occurrence probability of the grayscale number and the negative logarithm corresponding to the second occurrence probability.
[0162] In an optional embodiment, the image preprocessing module 801, when acquiring the image of the page to be tested and performing image preprocessing on the image to be tested to obtain a preprocessed image, and the image preprocessing includes grayscale processing, is configured to:
[0163] Scaling the page image to be tested so that the similarity between the scaled page image and the page image to be tested before scaling is greater than a first preset threshold, and the resolution of the scaled page image is lower than a second preset threshold;
[0164] Convert the color value of each pixel in the scaled page image into a grayscale value to obtain an initial grayscale image;
[0165] Perform detail enhancement processing and / or contrast enhancement processing on the initial grayscale image to obtain the preprocessed image.
[0166] In an optional embodiment, the candidate area includes a target interface element candidate area; the segmentation module 802 includes the target interface element candidate area in the candidate area; and when the pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain multiple candidate areas, it is used to:
[0167] Determining a plurality of interface element regions in the preprocessed image according to the position and size of each interface element in the preprocessed image;
[0168] Based on the position information of each interface element area, the interface element areas whose overlap rate meets the preset conditions are merged to obtain multiple initial interface element candidate areas;
[0169] Based on the position information of the multiple initial interface element candidate regions and the non-maximum suppression mechanism, the target interface element candidate region is screened out from the multiple initial interface element candidate regions.
[0170] In an optional embodiment, the candidate region also includes a non-interface element candidate region; and the segmentation module 802 segments the preprocessed image according to the position and size of each interface element in the preprocessed image to obtain multiple candidate regions, and is further configured to:
[0171] Determining at least one initial non-interface element candidate region in the preprocessed image based on the position information of the target interface element candidate region;
[0172] Each of the initial non-interface element candidate regions is cut into a plurality of non-interface element candidate regions of preset shapes.
[0173] In an optional embodiment, the device further includes a full-screen abnormality determination module, configured to:
[0174] Determining whether the pre-processed image is a full-screen abnormal page based on interface elements in the pre-processed image;
[0175] According to the position and size of each interface element in the pre-processed image, the pre-processed image is segmented to obtain multiple candidate regions, including:
[0176] In the case that the pre-processed image is not a full-screen abnormal page, the pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain a plurality of candidate regions.
[0177] In an optional embodiment, the device further includes an abnormality type determination module, configured to:
[0178] Based on the interface element type information corresponding to each abnormally blank candidate area in the abnormal area and the color information of the candidate area before image preprocessing, the detection result of the page image to be tested is generated, and the detection page result includes the abnormal type corresponding to the page image to be tested.
[0179] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0180] Corresponding to Figure 1 The page anomaly detection method in the present disclosure also provides an electronic device 900, such as Figure 9 FIG. 1 is a schematic diagram of the structure of an electronic device 900 provided in an embodiment of the present disclosure, including:
[0181] Processor 91, memory 92, and bus 93; memory 92 is used to store execution instructions, including internal memory 921 and external memory 922; the internal memory 921 is also called internal memory, which is used to temporarily store operation data in the processor 91 and data exchanged with external memory 922 such as a hard disk. The processor 91 exchanges data with the external memory 922 through the internal memory 921. When the electronic device 900 is running, the processor 91 communicates with the memory 92 via the bus 93, so that the processor 91 executes the following instructions:
[0182] Acquire an image of a page to be tested, and perform image preprocessing on the image of the page to be tested to obtain a preprocessed image; the image preprocessing includes grayscale processing;
[0183] Segmenting the preprocessed image to obtain a plurality of candidate regions according to the position and size of each interface element in the preprocessed image;
[0184] For each candidate region, determining the global information entropy of the candidate region and / or the local information entropy corresponding to the sampling frame obtained by sampling the candidate region based on one or more preset sampling frames;
[0185] For each candidate region, based on the global information entropy of the candidate region and / or one or more local information entropies of the candidate region and the corresponding regional scale features, call a pre-trained classifier to classify the candidate region to obtain an abnormality recognition result for characterizing whether the candidate region is abnormally blank;
[0186] The candidate regions classified as abnormal blanks are fused to obtain abnormal regions in the image of the page to be tested.
[0187] In an optional implementation, in the instructions executed by the processor 91, determining, for each candidate region, the global information entropy of the candidate region includes:
[0188] Determine the first occurrence number of each grayscale level in the candidate area based on the grayscale value of each pixel in the candidate area;
[0189] Determine a first occurrence probability of each grayscale number in the candidate area based on the first occurrence count and a first total number of pixels in the candidate area;
[0190] The global information entropy of the candidate region is determined based on the product of the first occurrence probability of each gray level and the negative logarithm corresponding to the first occurrence probability.
[0191] In an optional embodiment, in the instructions executed by the processor 91, determining, for each candidate region, one or more local information entropies of the candidate region obtained by sampling the candidate region based on one or more preset sampling frames includes:
[0192] For each sampling frame preset in the candidate area, determining the second occurrence number of each grayscale level in the sampling frame based on the grayscale value of each pixel point in the sampling frame;
[0193] Determining a second occurrence probability of each grayscale number in the sampling frame based on the second occurrence number and a second total number of pixels in the sampling frame;
[0194] The local information entropy corresponding to the sampling frame is determined based on the product of the second occurrence probability of the grayscale number and the negative logarithm corresponding to the second occurrence probability.
[0195] In an optional embodiment, the instructions executed by the processor 91 include obtaining an image of the page to be tested and performing image preprocessing on the image of the page to be tested to obtain a preprocessed image, wherein the image preprocessing includes grayscale processing, including:
[0196] Scaling the page image to be tested so that the similarity between the scaled page image and the page image to be tested before scaling is greater than a first preset threshold, and the resolution of the scaled page image is lower than a second preset threshold;
[0197] Convert the color value of each pixel in the scaled page image into a grayscale value to obtain an initial grayscale image;
[0198] Perform detail enhancement processing and / or contrast enhancement processing on the initial grayscale image to obtain the preprocessed image.
[0199] In an optional embodiment, in the instructions executed by the processor 91, the candidate area includes a candidate area of a target interface element; and the preprocessed image is segmented according to the position and size of each interface element in the preprocessed image to obtain multiple candidate areas, including:
[0200] Determining a plurality of interface element regions in the preprocessed image according to the position and size of each interface element in the preprocessed image;
[0201] Based on the position information of each interface element area, the interface element areas whose overlap rate meets the preset conditions are merged to obtain multiple initial interface element candidate areas;
[0202] Based on the position information of the multiple initial interface element candidate regions and the non-maximum suppression mechanism, the target interface element candidate region is screened out from the multiple initial interface element candidate regions.
[0203] In an optional embodiment, in the instructions executed by the processor 91, the candidate area also includes a non-interface element candidate area; and the segmenting of the preprocessed image according to the position and size of each interface element in the preprocessed image to obtain multiple candidate areas further includes:
[0204] Determining at least one initial non-interface element candidate region in the preprocessed image based on the position information of the target interface element candidate region;
[0205] Each of the initial non-interface element candidate regions is cut into a plurality of non-interface element candidate regions of preset shapes.
[0206] In an optional embodiment, in the instructions executed by the processor 91, before segmenting the preprocessed image to obtain multiple candidate regions based on the position and size of each interface element in the preprocessed image, the method further includes:
[0207] Determining whether the pre-processed image is a full-screen abnormal page based on interface elements in the pre-processed image;
[0208] According to the position and size of each interface element in the pre-processed image, the pre-processed image is segmented to obtain multiple candidate regions, including:
[0209] In the case that the pre-processed image is not a full-screen abnormal page, the pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain a plurality of candidate regions.
[0210] In an optional embodiment, in the instructions executed by the processor 91, after the candidate regions classified as abnormal blanks are fused to obtain the abnormal regions in the image of the page to be tested, the method further includes:
[0211] Based on the interface element type information corresponding to each abnormally blank candidate area in the abnormal area and the color information of the candidate area before image preprocessing, the detection result of the page image to be tested is generated, and the detection page result includes the abnormal type corresponding to the page image to be tested.
[0212] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program executes the steps of the page anomaly detection method described in the above method embodiment. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0213] The embodiments of the present disclosure also provide a computer program product, which carries program code. The instructions included in the program code can be used to execute the steps of the page anomaly detection method described in the above method embodiment. For details, please refer to the above method embodiment and will not be repeated here.
[0214] The computer program product may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0215] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0216] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0217] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0218] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0219] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure shall be subject to the scope of protection of the claims.
Claims
1. A page anomaly detection method, characterized in that: include: Acquire an image of a page to be tested, and perform image preprocessing on the image of the page to be tested to obtain a preprocessed image; The image preprocessing includes grayscale processing; Segmenting the preprocessed image to obtain a plurality of candidate regions according to the position and size of each interface element in the preprocessed image; For each candidate region, determine the global information entropy of the candidate region and / or sample the candidate region based on one or more preset sampling frames to obtain the local information entropy corresponding to the sampling frame; For each candidate region, based on the global information entropy of the candidate region and / or one or more local information entropies of the candidate region and the corresponding regional scale features, call a pre-trained classifier to classify the candidate region to obtain an abnormality recognition result for characterizing whether the candidate region is abnormally blank; The candidate regions classified as abnormal blanks are fused to obtain abnormal regions in the image of the page to be tested.
2. The method according to claim 1, characterized in that For each candidate region, determining the global information entropy of the candidate region includes: Determine the first occurrence number of each grayscale level in the candidate area based on the grayscale value of each pixel in the candidate area; Determine a first occurrence probability of each grayscale number in the candidate area based on the first occurrence count and a first total number of pixels in the candidate area; The global information entropy of the candidate region is determined based on the product of the first occurrence probability of each gray level and the negative logarithm corresponding to the first occurrence probability.
3. The method according to claim 1, characterized in that For each candidate region, determining one or more local information entropies of the candidate region obtained by sampling the candidate region based on one or more preset sampling frames includes: For each sampling frame preset in the candidate area, determining the second occurrence number of each grayscale level in the sampling frame based on the grayscale value of each pixel point in the sampling frame; Determining a second occurrence probability of each grayscale number in the sampling frame based on the second occurrence number and a second total number of pixels in the sampling frame; The local information entropy corresponding to the sampling frame is determined based on the product of the second occurrence probability of the grayscale number and the negative logarithm corresponding to the second occurrence probability.
4. The method according to claim 1, wherein The step of obtaining the image of the page to be tested and performing image preprocessing on the image of the page to be tested to obtain a preprocessed image, wherein the image preprocessing includes grayscale processing, includes: Scaling the page image to be tested so that the similarity between the scaled page image and the page image to be tested before scaling is greater than a first preset threshold, and the resolution of the scaled page image is lower than a second preset threshold; Convert the color value of each pixel in the scaled page image into a grayscale value to obtain an initial grayscale image; Perform detail enhancement processing and / or contrast enhancement processing on the initial grayscale image to obtain the preprocessed image.
5. The method according to claim 1, wherein The candidate area includes a target interface element candidate area; The pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain multiple candidate regions, including: Determining a plurality of interface element regions in the preprocessed image according to the position and size of each interface element in the preprocessed image; Based on the position information of each interface element area, the interface element areas whose overlap rate meets the preset conditions are merged to obtain multiple initial interface element candidate areas; The target interface element candidate region is screened out from the multiple initial interface element candidate regions based on the position information of the multiple initial interface element candidate regions and a non-maximum suppression mechanism.
6. The method according to claim 5, characterized in that The candidate regions also include non-interface element candidate regions; the pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain multiple candidate regions, further comprising: Determining at least one initial non-interface element candidate region in the preprocessed image based on the position information of the target interface element candidate region; Each of the initial non-interface element candidate regions is cut into a plurality of non-interface element candidate regions of preset shapes.
7. The method according to claim 1, characterized in that Before segmenting the preprocessed image to obtain a plurality of candidate regions based on the position and size of each interface element in the preprocessed image, the method further includes: Determining whether the preprocessed image is a full-screen abnormal page based on interface elements in the preprocessed image; According to the position and size of each interface element in the pre-processed image, the pre-processed image is segmented to obtain multiple candidate regions, including: In the case that the pre-processed image is a non-full-screen abnormal page, the pre-processed image is segmented according to the position and size of each interface element in the pre-processed image to obtain a plurality of candidate regions.
8. The method according to claim 1, characterized in that After the candidate regions classified as abnormal blanks are fused to obtain the abnormal regions in the image of the page to be tested, the method further includes: Based on the interface element type information corresponding to each abnormally blank candidate area in the abnormal area and the color information of the candidate area before image preprocessing, a detection result of the page image to be tested is generated, and the detection result includes the abnormal type corresponding to the page image to be tested.
9. A page anomaly detection device, characterized in that: include: An image preprocessing module is used to obtain an image of a page to be tested and perform image preprocessing on the image of the page to be tested to obtain a preprocessed image; The image preprocessing includes grayscale processing; a segmentation module, configured to segment the pre-processed image into a plurality of candidate regions according to the position and size of each interface element in the pre-processed image; An information entropy module is used to determine, for each candidate region, a global information entropy of the candidate region and / or a local information entropy corresponding to one or more preset sampling frames obtained by sampling the candidate region; A classification module is configured to, for each candidate region, call a pre-trained classifier to classify the candidate region based on the global information entropy of the candidate region and / or one or more local information entropies of the candidate region and corresponding regional scale features to obtain an abnormality recognition result for characterizing whether the candidate region is abnormally blank; The fusion module is used to fuse the candidate areas classified as abnormal blanks to obtain the abnormal areas in the image of the page to be tested.
10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate via the bus. When the machine-readable instructions are executed by the processor, the steps of the page anomaly detection method as described in any one of claims 1 to 8 are performed.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the page anomaly detection method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method for information processing and electronic device
CN103870103A
Method and device for recognizing website
CN106294535A