A method and apparatus for detecting irregular data
Patent Information
- Application Number
- CN202211376144.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-04
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-11-04
AI Technical Summary
但是,仍然有些大量广告为了吸引用户而无视这些规定,从而使得物联网上对此口诛笔伐,进而亟需一种能够解决该问题的方案
Smart Images

Figure CN115797944B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and more specifically, to a method and apparatus for detecting illegal data. Background Technology
[0002] Currently, the internet is flooded with various financial advertisements. Although financial regulatory agencies have clear requirements for these advertisements, such as requiring them to display annualized interest rates and prominently display relevant information, many advertisements still disregard these regulations in order to attract users. This has led to widespread criticism on the Internet of Things (IoT) and necessitates a solution to address this problem. Summary of the Invention
[0003] The purpose of this application is to provide a method and apparatus for detecting illegal data, which can automatically detect illegal data in financial advertisements, thereby facilitating more effective supervision by financial regulatory agencies.
[0004] The first aspect of this application provides a method for detecting illegal data, including:
[0005] Receive the image to be detected;
[0006] The image to be detected is subjected to text detection to obtain text detection data;
[0007] Extract the target keyword and surrounding text information from the text detection data according to the preset judgment logic;
[0008] Violation data detection is performed based on the keyword to be detected and the surrounding text information to obtain the detection result;
[0009] Based on the detection results, determine whether the image to be detected contains any illegal data;
[0010] If so, output a message indicating that the image to be detected contains illegal data.
[0011] In the above implementation process, this method can first receive the image to be detected; then, perform text detection on the image to obtain text detection data; next, extract the keywords to be detected and the surrounding text information from the text detection data according to a preset judgment logic; then, perform violation data detection based on the keywords to be detected and the surrounding text information to obtain detection results; then, determine whether the image to be detected contains violation data based on the detection results; finally, if the image to be detected contains violation data, output a prompt message indicating that the image contains violation data. It is evident that implementing this method can automatically detect violation data in financial advertisements, thereby facilitating more effective supervision by financial regulatory agencies.
[0012] Furthermore, the step of detecting violations based on the keyword to be detected and the surrounding text information to obtain the detection result includes:
[0013] The percentage of the text size of the keyword to be detected in the image to be detected is determined based on a preset text size attribute algorithm.
[0014] The background contrast of text and numbers is detected based on a preset text background contrast attribute algorithm and the text information surrounding the keyword.
[0015] The image to be detected is subjected to violation data detection based on the text size ratio and the background contrast to obtain the detection result.
[0016] Further, the step of detecting the proportion of the text size of the keyword to be detected in the image to be detected according to a preset text size attribute algorithm includes:
[0017] Obtain the height of the text detection box for detecting the keyword in the image to be detected;
[0018] Obtain the image size of the image to be detected;
[0019] The height of the text detection box and the size of the image are compared according to a preset text size attribute algorithm to obtain the text size ratio.
[0020] Further, the step of detecting the background contrast between text and numerical information based on a preset text background contrast attribute algorithm and the text information surrounding the keyword includes:
[0021] Based on the text information surrounding the keyword and a preset clustering algorithm, the text foreground and background colors of the image to be detected are clustered to obtain text foreground cluster pixels, foreground cluster pixels, and background cluster pixels.
[0022] Remove redundant noise pixels from the text foreground cluster pixels to obtain the text processing pixels;
[0023] The background contrast of text information and numerical information is determined based on a preset text background contrast attribute algorithm, the text processing image, the foreground clustering pixels, and the background clustering pixels.
[0024] Further, the step of removing redundant noise pixels from the text foreground cluster pixels to obtain text processing pixels includes:
[0025] The distribution map, mean, and standard deviation of the pixels in the foreground cluster of the text were calculated multiple times.
[0026] The standard deviation interval is determined based on the distribution chart, the mean, and the standard deviation.
[0027] The text foreground cluster pixels are filtered according to the standard deviation interval to obtain text processing pixels.
[0028] A second aspect of this application provides a data violation detection device, the data violation detection device comprising:
[0029] The receiving unit is used to receive the image to be detected;
[0030] The first detection unit is used to perform text detection on the image to be detected and obtain text detection data.
[0031] The extraction unit is used to extract the keyword to be detected and the surrounding text information from the text detection data according to a preset judgment logic.
[0032] The second detection unit is used to detect illegal data based on the keyword to be detected and the surrounding text information of the keyword, and obtain the detection result.
[0033] The judgment unit is used to determine whether the image to be detected contains illegal data based on the detection result;
[0034] The output unit is used to output a prompt message indicating that the image to be detected contains illegal data when the image to be detected contains illegal data.
[0035] In the above implementation process, the device can receive an image to be detected through a receiving unit; perform text detection on the image to be detected through a first detection unit to obtain text detection data; extract the keyword to be detected and the surrounding text information from the text detection data through an extraction unit according to a preset judgment logic; perform violation data detection through a second detection unit based on the keyword to be detected and the surrounding text information to obtain a detection result; determine whether the image to be detected contains violation data based on the detection result through a judgment unit; and output a prompt message indicating that the image to be detected contains violation data when the image to be detected contains violation data through an output unit. It is evident that implementing this method can automatically detect violation data in financial advertisements, thereby facilitating more effective supervision by financial regulatory agencies.
[0036] Furthermore, the second detection unit includes:
[0037] The first subunit is used to detect the proportion of the text size of the keyword to be detected in the image to be detected according to a preset text size attribute algorithm;
[0038] The second subunit is used to detect the background contrast between text information and numerical information based on a preset text background contrast attribute algorithm and the text information surrounding the keyword.
[0039] The third subunit is used to perform violation data detection on the image to be detected based on the text size ratio and the background contrast, and obtain the detection result.
[0040] Furthermore, the first subunit includes:
[0041] The acquisition module is used to acquire the height of the text detection box for detecting the keyword in the image to be detected;
[0042] The acquisition module is also used to acquire the image size of the image to be detected;
[0043] The comparison module is used to compare the height of the text detection box with the size of the image according to a preset text size attribute algorithm to obtain the text size ratio.
[0044] Furthermore, the second subunit includes:
[0045] The clustering module is used to cluster the text foreground and background colors of the image to be detected based on the text information surrounding the keyword and a preset clustering algorithm, to obtain text foreground cluster pixels, foreground cluster pixels, and background cluster pixels.
[0046] The removal module is used to remove redundant noise pixels from the text foreground cluster pixels to obtain text processing pixels.
[0047] The determination module is used to determine the background contrast of text information and numerical information based on a preset text background contrast attribute algorithm, the text processing image, the foreground clustering pixels, and the background clustering pixels.
[0048] Furthermore, the removal module is specifically used to calculate the distribution map, mean, and standard deviation of the text foreground cluster pixels multiple times; determine the standard deviation interval based on the distribution map, the mean, and the standard deviation; and filter the text foreground cluster pixels based on the standard deviation interval to obtain text-processed pixels.
[0049] A third aspect of this application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to cause the electronic device to perform the illegal data detection method described in any one of the first aspects of this application.
[0050] A fourth aspect of this application provides a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform the illegal data detection method described in any one of the first aspects of this application. Attached Figure Description
[0051] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 A flowchart illustrating a method for detecting illegal data provided in an embodiment of this application;
[0053] Figure 2 A flowchart illustrating another method for detecting illegal data provided in this application embodiment;
[0054] Figure 3 This is a schematic diagram of the structure of a data violation detection device provided in an embodiment of this application;
[0055] Figure 4 This is a schematic diagram of another illegal data detection device provided in an embodiment of this application;
[0056] Figure 5 This is a schematic diagram illustrating a flowchart of a method for detecting illegal data provided in an embodiment of this application. Detailed Implementation
[0057] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0058] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0059] Example 1
[0060] Please refer to Figure 1 , Figure 1 This embodiment provides a flowchart illustrating a method for detecting illegal data. The method includes:
[0061] S101, Receive the image to be detected.
[0062] S102. Perform text detection on the image to be detected to obtain text detection data.
[0063] S103. Extract the keywords to be detected and the surrounding text information from the text detection data according to the preset judgment logic.
[0064] S104. Based on the keyword to be detected and the surrounding text information, perform violation data detection to obtain the detection results.
[0065] S105. Determine whether there is any illegal data in the image to be detected based on the detection results. If yes, proceed to step S106; otherwise, end the process.
[0066] S106. Output a message indicating that the image to be detected contains illegal data.
[0067] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0068] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0069] As can be seen, the illegal data detection method described in this embodiment can effectively detect whether the promotional page displays annualized interest rate information; it can also determine whether the annualized interest rate indicator is prominent; it can also compare the foreground Chinese numerals with the background when they are in two different colors; and it can distinguish between different foreground text (Chinese expressions and numerical annualized interest rates). It is evident that this method can wrap OpenCV's K-means clustering implementation, thereby significantly improving code computation speed.
[0070] Example 2
[0071] Please refer to Figure 2 , Figure 2 This embodiment provides a flowchart illustrating a method for detecting illegal data. The method includes:
[0072] S201. Receive the image to be detected.
[0073] S202. Perform text detection on the image to be detected to obtain text detection data.
[0074] S203. Extract the keywords to be detected and the surrounding text information from the text detection data according to the preset judgment logic.
[0075] S204. Obtain the height of the text detection box for the keyword to be detected in the image to be detected.
[0076] S205. Obtain the image size of the image to be detected.
[0077] S206. Based on the preset text size attribute algorithm, compare the height of the text detection box with the image size to obtain the text size ratio.
[0078] S207. Based on the text information surrounding the keywords and the preset clustering algorithm, the text foreground and background colors of the image to be detected are clustered to obtain text foreground cluster pixels, foreground cluster pixels, and background cluster pixels.
[0079] S208. Calculate the distribution map, mean and standard deviation of the pixel cluster of the text foreground multiple times.
[0080] S209. Determine the standard deviation interval based on the distribution chart, mean, and standard deviation.
[0081] S210. Filter the text foreground cluster pixels according to the standard deviation interval to obtain the text processing pixels.
[0082] S211. Determine the background contrast of text information and digital information based on the preset text background contrast attribute algorithm, text processing image, foreground clustering pixels and background clustering pixels.
[0083] S212. Based on the text size ratio and background contrast, perform violation data detection on the image to be detected and obtain the detection results.
[0084] S213. Determine whether the image to be detected contains illegal data based on the detection results. If yes, proceed to step S214; otherwise, end the process.
[0085] S214. Output a message indicating that the image to be detected contains illegal data.
[0086] In this embodiment, the method can significantly reduce the resources required to study the salience of specific text. A process specifically designed for this task objective is employed to achieve stability and reliability in a real-world business environment. Specific examples can be found in [reference needed]. Figure 5 .
[0087] Depend on Figure 5 As can be seen, the main part of this scheme is the detection of important information using an Optical Character Recognition (OCR) model and the quantification calculation of the attributes of important information. Specifically, for this task, we debugged existing models to obtain the best parameter combination and encapsulated it. For the OCR detection results, we used logical processing to extract the keyword "annual interest rate" and its surrounding Chinese text (description) and numerical information (annualized interest rate percentage). After obtaining the specific text information, we developed specific algorithms for its text size attribute and its text background contrast attribute.
[0088] The algorithm for the text size attribute is described as follows:
[0089] The contrast between text size and ad image size is calculated by comparing the height of the text detection box and the height of the ad image.
[0090] The algorithm for the contrast between the text box and its background is described as follows:
[0091] ① The k-means clustering algorithm is used at the pixel level to distinguish the colors of the text foreground and background into two categories. If the colors of Chinese characters and numbers in the text are different, the algorithm automatically classifies the one with more numbers in the two clusters as the background, and the rest as the text foreground.
[0092] ② For pixels in the text foreground, an algorithm for removing outliers was developed based on robust statistics. The algorithm repeatedly calculates the pixel distribution map and updates the mean and standard deviation, filtering out excessively large or small values based on the standard deviation range. This algorithm can remove the influence of redundant noise pixels in the text foreground.
[0093] ③ After clustering the text in the important information sections to distinguish between foreground and background, the foreground can be converted from RGB to YUV and a second clustering can be performed using UV chromaticity parameters for the colors of Chinese characters and numbers. The distance between the center points of the two clusters is used as a metric; if it is less than a specified threshold, the colors of the Chinese characters and numbers are considered consistent, and the foreground text portion is output; otherwise, the colors of the Chinese characters and numbers are considered inconsistent, and the Chinese and number portions of the foreground text are output separately.
[0094] ④ If the Chinese and numerical parts in the foreground are different, the text results can be split into two parts for extracting different information:
[0095] ⑤ Calculate the brightness contrast between the Chinese characters and numbers in the foreground and the background based on the output. If the colors of the Chinese characters and numbers are the same, then the contrast between the Chinese characters and numbers and the background is the same. The contrast algorithm is the ratio of the relative brightness L1 of the foreground darker part to the relative brightness L2 of the darker background: L1 / L2. The relative brightness is calculated as 0.2126*R + 0.7152*G + 0.0722*B, where R, G, and B correspond to the linearized RGB values. The linearization equation is as follows:
[0096]
[0097] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0098] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0099] As can be seen, the illegal data detection method described in this embodiment can effectively detect whether the promotional page displays annualized interest rate information; it can also determine whether the annualized interest rate indicator is prominent; it can also compare the foreground Chinese numerals with the background when they are in two different colors; and it can distinguish between different foreground text (Chinese expressions and numerical annualized interest rates). It is evident that this method can wrap OpenCV's K-means clustering implementation, thereby significantly improving code computation speed.
[0100] Example 3
[0101] Please refer to Figure 3 , Figure 3 This is a schematic diagram of a violation data detection device provided in this embodiment. Figure 3 As shown, the illegal data detection device includes:
[0102] The receiving unit 310 is used to receive the image to be detected;
[0103] The first detection unit 320 is used to perform text detection on the image to be detected and obtain text detection data.
[0104] Extraction unit 330 is used to extract the keyword to be detected and the text information around the keyword from the text detection data according to the preset judgment logic;
[0105] The second detection unit 340 is used to detect violations based on the keyword to be detected and the surrounding text information, and to obtain the detection result.
[0106] The judgment unit 350 is used to determine whether the image to be detected contains illegal data based on the detection results.
[0107] The output unit 360 is used to output a prompt message indicating that there is illegal data in the image to be detected.
[0108] In this embodiment, the explanation of the illegal data detection device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated here.
[0109] As can be seen, the illegal data detection device described in this embodiment can effectively detect whether the promotional page displays annualized interest rate information; it can also determine whether the annualized interest rate indicator is prominent; it can also compare the foreground Chinese numerals with the background when they are in two different colors; and it can distinguish between different foreground text (Chinese expressions and numerical annualized interest rates). Therefore, this method can wrap OpenCV's K-means clustering implementation, thereby significantly improving code computation speed.
[0110] Example 4
[0111] Please refer to Figure 4 , Figure 4 This is a schematic diagram of a violation data detection device provided in this embodiment. Figure 4 As shown, the illegal data detection device includes:
[0112] The receiving unit 310 is used to receive the image to be detected;
[0113] The first detection unit 320 is used to perform text detection on the image to be detected and obtain text detection data.
[0114] Extraction unit 330 is used to extract the keyword to be detected and the text information around the keyword from the text detection data according to the preset judgment logic;
[0115] The second detection unit 340 is used to detect violations based on the keyword to be detected and the surrounding text information, and to obtain the detection result.
[0116] The judgment unit 350 is used to determine whether the image to be detected contains illegal data based on the detection results.
[0117] The output unit 360 is used to output a prompt message indicating that there is illegal data in the image to be detected.
[0118] As an optional implementation, the second detection unit 340 includes:
[0119] The first subunit 341 is used to detect the proportion of the text size of the keyword to be detected in the image to be detected according to a preset text size attribute algorithm;
[0120] The second subunit 342 is used to detect the background contrast between text information and numerical information based on a preset text background contrast attribute algorithm and the text information around the keywords.
[0121] The third subunit 343 is used to detect violations in the image to be detected based on the proportion of text size and background contrast, and obtain the detection result.
[0122] As an optional implementation, the first subunit 341 includes:
[0123] The acquisition module is used to obtain the height of the text detection box for the keyword to be detected in the image to be detected;
[0124] The acquisition module is also used to obtain the image size of the image to be detected;
[0125] The comparison module is used to compare the height of the text detection box with the image size based on a preset text size attribute algorithm to obtain the text size ratio.
[0126] As an optional implementation, the second subunit 342 includes:
[0127] The clustering module is used to cluster the text foreground and background colors of the image to be detected based on the text information around the keywords and the preset clustering algorithm, so as to obtain the text foreground cluster pixels, foreground cluster pixels and background cluster pixels;
[0128] The removal module is used to remove redundant noise pixels from the text foreground cluster pixels to obtain the text processing pixels.
[0129] The determination module is used to determine the background contrast of text information and numerical information based on a preset text background contrast attribute algorithm, text processing image, foreground clustered pixels, and background clustered pixels.
[0130] As an optional implementation, the removal module is specifically used to calculate the distribution map, mean, and standard deviation of the text foreground cluster pixels multiple times; determine the standard deviation interval based on the distribution map, mean, and standard deviation; and filter the text foreground cluster pixels based on the standard deviation interval to obtain the text processed pixels.
[0131] In this embodiment, the explanation of the illegal data detection device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated here.
[0132] As can be seen, the illegal data detection device described in this embodiment can effectively detect whether the promotional page displays annualized interest rate information; it can also determine whether the annualized interest rate indicator is prominent; it can also compare the foreground Chinese numerals with the background when they are in two different colors; and it can distinguish between different foreground text (Chinese expressions and numerical annualized interest rates). Therefore, this method can wrap OpenCV's K-means clustering implementation, thereby significantly improving code computation speed.
[0133] This application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to enable the electronic device to perform the illegal data detection method in embodiment 1 or embodiment 2 of this application.
[0134] This application provides a computer-readable storage medium storing computer program instructions. When these computer program instructions are read and executed by a processor, the illegal data detection method in embodiment 1 or embodiment 2 of this application is performed.
[0135] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0136] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0137] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0138] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0139] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0140] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for detecting illegal data, characterized in that, include: Receive the image to be detected; The image to be detected is subjected to text detection to obtain text detection data; Extract the target keyword and surrounding text information from the text detection data according to the preset judgment logic; The percentage of the text size of the keyword to be detected in the image to be detected is determined based on a preset text size attribute algorithm. Based on the text information surrounding the keyword and a preset clustering algorithm, the foreground and background colors of the text in the image to be detected are clustered to obtain foreground clustered pixels and background clustered pixels. The distribution map, mean, and standard deviation of the foreground cluster pixels were calculated multiple times. The standard deviation interval is determined based on the distribution chart, the mean, and the standard deviation. The foreground clustered pixels are filtered according to the standard deviation interval to obtain text processing pixels; The background contrast of text information and numerical information is determined based on a preset text background contrast attribute algorithm, the text processing pixels, the foreground clustering pixels, and the background clustering pixels; Based on the text size ratio and the background contrast, the image to be detected is subjected to violation data detection to obtain the detection result; Based on the detection results, determine whether the image to be detected contains any illegal data; If so, output a message indicating that the image to be detected contains illegal data; Specifically, based on the text information surrounding the keyword and a preset clustering algorithm, the foreground and background colors of the text in the image to be detected are clustered to obtain foreground clustered pixels and background clustered pixels, including: Based on the text information surrounding the keyword, the k-means clustering algorithm is used in pixels to distinguish the colors of the text foreground and background into two categories. If the colors of Chinese characters and numbers in the text are different, the algorithm automatically classifies the one with more numbers in the two clusters as the background, and the rest as the text foreground. The step of clustering the foreground and background colors of the image to be detected based on the surrounding text information of the keyword and a preset clustering algorithm to obtain foreground cluster pixels and background cluster pixels, before repeatedly calculating the distribution map, mean, and standard deviation of the foreground cluster pixels, includes: The foreground is converted from RGB to YUV and then clustered a second time using the UV chromaticity parameters for the colors of Chinese characters and numbers. The distance between the center points of the two clusters is used as a metric. If the distance is less than a specified threshold, the colors of Chinese characters and numbers are considered to be consistent, and the foreground text portion is output. Otherwise, the colors of Chinese characters and numbers are considered to be inconsistent, and the Chinese characters and numbers portions of the foreground text are output separately.
2. The method for detecting illegal data according to claim 1, characterized in that, The step of detecting the proportion of the text size of the keyword to be detected in the image to be detected according to a preset text size attribute algorithm includes: Obtain the height of the text detection box for detecting the keyword in the image to be detected; Obtain the image size of the image to be detected; The height of the text detection box and the size of the image are compared according to a preset text size attribute algorithm to obtain the text size ratio.
3. A device for detecting illegal data, characterized in that, The illegal data detection device includes: The receiving unit is used to receive the image to be detected; The first detection unit is used to perform text detection on the image to be detected and obtain text detection data. The extraction unit is used to extract the keyword to be detected and the surrounding text information from the text detection data according to a preset judgment logic. The second detection unit is used to detect illegal data based on the keyword to be detected and the surrounding text information of the keyword, and obtain the detection result. The judgment unit is used to determine whether the image to be detected contains illegal data based on the detection result; The output unit is used to output a prompt message indicating that the image to be detected contains illegal data when the image to be detected contains illegal data. The second detection unit includes: The first subunit is used to detect the proportion of the text size of the keyword to be detected in the image to be detected according to a preset text size attribute algorithm; The second subunit is used to detect the background contrast between text information and numerical information based on a preset text background contrast attribute algorithm and the text information surrounding the keyword. The third subunit is used to perform violation data detection on the image to be detected based on the text size ratio and the background contrast, and obtain the detection result. The second subunit includes: The clustering module is used to cluster the foreground and background colors of the text in the image to be detected based on the surrounding text information of the keywords and a preset clustering algorithm, to obtain foreground cluster pixels and background cluster pixels; the foreground is converted from RGB to YUV and a second clustering is performed using the UV chromaticity parameters as the colors of Chinese characters and numbers; the distance between the center points of the two clusters is used as a metric. If it is less than a specified threshold, it is considered that the colors of Chinese characters and numbers are consistent and the foreground text part is output; otherwise, it is considered that the colors of Chinese characters and numbers are inconsistent and the Chinese characters and numbers of the foreground text are output separately. The removal module is used to remove redundant noise pixels from the foreground clustered pixels to obtain text processing pixels; The determination module is used to determine the background contrast between text information and numerical information based on a preset text-background contrast attribute algorithm, text processing pixels, foreground clustering pixels, and background clustering pixels. The clustering module is specifically used to use the kmeans clustering algorithm in pixels to distinguish the colors of the text foreground and background in two categories based on the text information surrounding the keyword. If the colors of Chinese characters and numbers in the text are different, the algorithm automatically classifies the one with more numbers in the two clusters as the background, and the rest as the text foreground. The removal module is specifically used to calculate the distribution map, mean, and standard deviation of the foreground cluster pixels multiple times; determine the standard deviation interval based on the distribution map, mean, and standard deviation; and filter the foreground cluster pixels based on the standard deviation interval to obtain the text processing pixels.
4. The illegal data detection device according to claim 3, characterized in that, The first subunit includes: The acquisition module is used to acquire the height of the text detection box for detecting the keyword in the image to be detected; The acquisition module is also used to acquire the image size of the image to be detected; The comparison module is used to compare the height of the text detection box with the size of the image according to a preset text size attribute algorithm to obtain the text size ratio.
5. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the illegal data detection method according to any one of claims 1 to 2.
6. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when read and executed by a processor, perform the illegal data detection method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Voice intelligent broadcasting method and device, computer equipment and storage medium
CN110198464A