An image sensitive word recognition method and system based on a deep learning model
By using a deep learning model-based image sensitive word recognition method, CTPN, CRNN, and Jieba models for image text region detection and word segmentation, the problems of text fragmentation and garbled characters in image sensitive word recognition are solved, the recognition accuracy is improved, and the accurate recognition of image sensitive words is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGCHUN WHY E SCI & TECH
- Filing Date
- 2023-06-25
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies struggle to accurately identify inappropriate sensitive words displayed as images, resulting in issues such as fragmented text, garbled characters, high difficulty in semantic analysis, and low recognition accuracy.
A deep learning-based image sensitive word recognition method is adopted, including data collection, annotation, segmentation, model training and recognition steps. CTPN, CRNN and Jieba models are used for image text region detection, text recognition and word segmentation to improve the accuracy of sensitive word recognition.
It improves the accuracy of image-sensitive word recognition, reduces the difficulty of semantic analysis, solves the problems of text fragmentation and garbled characters, and achieves accurate recognition of image-sensitive words.
Smart Images

Figure CN116798050B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine vision and natural language processing technology, and in particular relates to an image sensitive word recognition method and system based on a deep learning model. Background Technology
[0002] With the continuous development of network technology, the amount of information on the internet is growing exponentially, and harmful information online is also increasing. As a method for detecting harmful online information, the identification of harmful sensitive words is receiving increasing attention. However, current methods for identifying harmful sensitive words have certain detection vulnerabilities. These vulnerabilities mainly stem from the high accuracy requirements for detecting harmful sensitive words displayed as images, coupled with the increasing prevalence of such image-based displays. This makes traditional methods less effective at identifying harmful sensitive words displayed as images. Website administrators hope to identify and block harmful sensitive words displayed as images. Therefore, accurately identifying harmful sensitive words displayed as images is crucial, and precise identification of such images can be a significant aid in clearing harmful online information.
[0003] Inappropriate sensitive words displayed as images can also be called image-based sensitive words. Identifying image-based sensitive words is more challenging than identifying general text-based sensitive words, primarily due to two factors: First, the accuracy of image-based text recognition. Because image-based sensitive words take many forms, accurately extracting inappropriate sensitive words from image text is a key and challenging aspect of detection and identification. Second, due to the vast number of sensitive word categories, semantic analysis and accurate word segmentation are necessary to improve the accuracy of sensitive word recognition. However, image-based text recognition inherently has errors, leading to issues such as text fragmentation, garbled characters, and unclear recognition during extraction. This increases the difficulty of semantic analysis and reduces the accuracy of image-based sensitive word recognition, which is another challenge in detecting and identifying image-based sensitive words. Summary of the Invention
[0004] The purpose of this invention is to provide an image sensitive word recognition method and system based on a deep learning model, so as to solve the problems of existing image sensitive word recognition methods, such as easy text fragmentation, garbled characters, unclear recognition, high difficulty in semantic analysis, and low recognition accuracy.
[0005] The technical solution adopted by this invention to solve the technical problem is as follows:
[0006] The present invention provides an image-sensitive word recognition method based on a deep learning model, comprising the following steps:
[0007] Step 1: Data Collection;
[0008] Collect image datasets and sensitive word datasets;
[0009] Step 2: Data labeling;
[0010] Capture sensitive words in the image dataset and record the image data sequence number containing the sensitive words, the sensitive words contained, and the number of sensitive words contained.
[0011] Step 3: Dataset partitioning;
[0012] The image dataset is divided into a training set and a test set;
[0013] Step 4: Model Training;
[0014] For the image data in the training set, train the model according to steps S4.1-S4.6:
[0015] Step S4.1: Image text region detection;
[0016] Step S4.2: Text recognition in the image text region;
[0017] Step S4.3: Image-text dataset formation;
[0018] Step S4.4: Initial setup for model training;
[0019] Step S4.5: Sensitive word identification;
[0020] Step S4.6: Model training;
[0021] Step 5: Image-sensitive word recognition;
[0022] For the image data containing the sensitive words to be detected, train the model according to steps S5.1-S5.5:
[0023] Step S5.1: Image text region detection;
[0024] Step S5.2: Text region character recognition;
[0025] Step S5.3: Word segmentation;
[0026] Step S5.4: Image sensitive word identification;
[0027] Step S5.5: Image sensitive word processing, finally obtaining the image sensitive word recognition result of the image data of the sensitive words to be detected.
[0028] Furthermore, in step one, the image dataset has two types: one containing sensitive words and one not containing sensitive words. The image dataset containing sensitive words refers to a collection of image files in which the text contains sensitive words, while the image dataset not containing sensitive words refers to a collection of image files in which the text does not contain sensitive words.
[0029] Furthermore, in step one, the sensitive word dataset includes a text-based sensitive word dataset and a sensitive word category dataset.
[0030] Furthermore, in step three, the ratio of image data volume in the training set to that in the test set is 7:3.
[0031] Furthermore, the specific steps for step four are as follows:
[0032] Step S4.1: Image text region detection;
[0033] The deep learning model CTPN is used to detect text in the images in the training set, forming several image text regions. Each image text region is then labeled with a number in a top-to-bottom and left-to-right order.
[0034] Step S4.2: Text recognition in the image text region;
[0035] The deep learning model CRNN is used to perform text recognition on each image text region in step S4.1 to extract the image text;
[0036] Step S4.3: Image-text dataset formation;
[0037] The image text extracted after text recognition is arranged in the order of the image text regions to form an image text dataset;
[0038] Step S4.4: Initial setup for model training;
[0039] Set the parameters for the deep learning word segmentation model Jieba;
[0040] Step S4.5: Sensitive word identification;
[0041] For the image and text dataset formed in step S4.3, the deep learning word segmentation model Jieba is used to segment the image and text dataset into words; the sensitive word matching degree and the number of sensitive words are compared, and the sensitive word recognition accuracy is calculated by comparing the sensitive word annotation results;
[0042] Step S4.6: Model training;
[0043] When the accuracy of sensitive word recognition is less than 95%, proceed to step S4.4 to continue adjusting the parameters of the deep learning word segmentation model jieba, and then proceed to step S4.5 until the accuracy of sensitive word recognition is greater than 95%, then stop training and determine the final parameters of the deep learning word segmentation model jieba.
[0044] Furthermore, the specific steps for step five are as follows:
[0045] Step S5.1: Image text region detection;
[0046] The deep learning model CTPN is used to detect text regions in the image data of sensitive words to be detected, and several text regions are obtained.
[0047] Step S5.2: Text region character recognition;
[0048] The deep learning model CRNN is used to perform text recognition for each text region in step S5.1, resulting in two types of text datasets: the first is the text dataset of the entire image, and the second is the text dataset of each text region in the entire image.
[0049] Step S5.3: Word segmentation;
[0050] Using the deep learning word segmentation model jieba obtained in step S4.6, word segmentation is performed on the two text datasets obtained in step S5.2, resulting in two word segmentation results: the first is the word segmentation result of the text dataset of the whole image, and the second is the word segmentation result of the text dataset of each text region in the whole image.
[0051] Step S5.4: Image sensitive word identification;
[0052] The two word segmentation results are matched with the sensitive word dataset in step one to obtain two forms of sensitive word recognition results;
[0053] Step S5.5: Image sensitive word processing;
[0054] The two forms of sensitive word recognition results are subjected to duplicate detection to filter out duplicate sensitive word recognition results, and finally the image sensitive word recognition results of the image data to be detected are obtained.
[0055] The present invention also provides an electronic device, comprising: a memory and a processor; the memory storing executable instructions, and the processor being configured to execute the executable instructions in the memory to implement the steps of the image sensitive word recognition method based on a deep learning model.
[0056] The present invention also provides a readable storage medium storing executable instructions, which, when executed by a processor, implement the steps of the image sensitive word recognition method based on a deep learning model.
[0057] The present invention also provides an image sensitive word recognition system based on a deep learning model, the system comprising: an image data acquisition device, an electronic device, and a readable storage medium.
[0058] The beneficial effects of this invention are:
[0059] This invention provides an image sensitive word recognition method and system based on a deep learning model, which can improve the recognition accuracy of image sensitive words and reduce the difficulty of semantic analysis. Furthermore, this invention solves the problems of text fragmentation, garbled characters, and unclear recognition in existing image sensitive word recognition methods. It can be integrated with existing online malicious information detection systems to achieve image sensitive word recognition and thus complete the task of detecting and identifying malicious image sensitive words. Attached Figure Description
[0060] Figure 1 This is a flowchart of an image sensitive word recognition method based on a deep learning model according to the present invention. Detailed Implementation
[0061] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0062] Firstly, this specific embodiment provides an image sensitive word recognition method based on a deep learning model, which mainly includes: data collection → dataset partitioning → model training → image sensitive word recognition; through the image sensitive word recognition method based on a deep learning model of this invention, sensitive words in images can be identified and analyzed, achieving the purpose of accurate image sensitive word recognition.
[0063] like Figure 1 As shown, the specific operation steps of the image sensitive word recognition method based on a deep learning model of the present invention are as follows:
[0064] Step 1: Data Collection;
[0065] We collect image datasets (with or without sensitive words) and sensitive word datasets. There are two types of image datasets: those containing sensitive words and those not containing sensitive words. Image datasets containing sensitive words refer to the collection of image files in which the text contains sensitive words, while image datasets not containing sensitive words refer to the collection of image files in which the text does not contain sensitive words. Sensitive word datasets include a certain number of text-based sensitive word datasets and sensitive word category datasets, etc.
[0066] Step 2: Data labeling;
[0067] The image dataset obtained in step one is labeled with sensitive words, and the image data sequence number containing sensitive words, the sensitive words contained therein, and the number of sensitive words contained therein are recorded.
[0068] Step 3: Dataset partitioning;
[0069] The image dataset is divided into a training set and a test set, with the ratio of image data volume in the training set to that in the test set being 7:3.
[0070] Step 4: Model Training;
[0071] For the image data in the training set, train the model according to steps S4.1-S4.6. The specific steps are as follows:
[0072] Step S4.1: Image text region detection;
[0073] The deep learning model CTPN (ConnectionistTextProposalNetwork) is used to detect text in the images on the training set, forming several image text regions. Each image text region is labeled with a serial number in a top-to-bottom and left-to-right order (since the image data may contain multiple lines of text, an image text region may contain only a portion of one line of text, so the top-to-bottom and left-to-right order refers to starting from the top left corner of the image, from left to right in the horizontal direction and from top to bottom in the vertical direction).
[0074] Step S4.2: Text recognition in the image text region;
[0075] The deep learning model CRNN (Convolutional Recurrent Neural Network) is used to perform text recognition on each image text region in step S4.1 (it should be noted that the text recognition mentioned here is not a direct recognition of the image) to extract the text from the image.
[0076] Step S4.3: Image-text dataset formation;
[0077] The image text extracted after text recognition is arranged in the order of the image text regions to form an image text dataset.
[0078] Step S4.4: Initial setup for model training;
[0079] Configure the parameters of the deep learning word segmentation model Jieba (including pattern, custom dictionary, keyword frequency, maximum number of iterations, etc.). Jieba is an excellent third-party Chinese word segmentation library.
[0080] Step S4.5: Sensitive word identification;
[0081] For the image-text dataset formed in step S4.3, the Jieba deep learning word segmentation model is used to segment the image-text dataset into words. The sensitive word recognition accuracy is calculated by comparing the sensitive word matching degree and the number of sensitive words. During the calculation, for the sample dataset, sensitive words in all image data are manually counted, and the location of sensitive words and the number of sensitive words in each image are marked. This is compared with the manually counted data to obtain the sensitive word recognition accuracy.
[0082] Step S4.6: Model training;
[0083] When the accuracy of sensitive word recognition is less than 95%, proceed to step S4.4 to continue adjusting the parameters of the deep learning word segmentation model jieba, and then proceed to step S4.5 until the accuracy of sensitive word recognition is greater than 95%, then stop training and determine the final parameters of the deep learning word segmentation model jieba.
[0084] Step 5: Image-sensitive word recognition;
[0085] For the image data containing sensitive words to be detected, train the model according to steps S5.1-S5.5. The image data containing sensitive words to be detected can be image data from the test set or other image data containing sensitive words to be detected. The specific steps are as follows:
[0086] Step S5.1: Image text region detection;
[0087] The deep learning model CTPN (ConnectionistTextProposal Network) in step S4.1 is used to detect text regions in the image data of sensitive words to be detected, and several text regions are obtained.
[0088] Step S5.2: Text region character recognition;
[0089] Using the deep learning model CRNN (Convolutional Recurrent Neural Network) in step S4.2, text recognition is performed on each text region in step S5.1, resulting in two types of text datasets: the first is the text dataset of the entire image, and the second is the text dataset of each text region in the entire image.
[0090] Step S5.3: Word segmentation;
[0091] Using the deep learning word segmentation model jieba obtained in step S4.6, word segmentation is performed on the two text datasets obtained in step S5.2, resulting in two word segmentation results: the first is the word segmentation result of the text dataset of the whole image, and the second is the word segmentation result of the text dataset of each text region in the whole image.
[0092] Step S5.4: Image sensitive word identification;
[0093] The two word segmentation results are matched with the sensitive word dataset in step one to obtain two forms of sensitive word recognition results.
[0094] Step S5.5: Image sensitive word processing;
[0095] The two forms of sensitive word recognition results are subjected to duplicate detection to filter out duplicate sensitive word recognition results, and finally the image sensitive word recognition results of the image data to be detected are obtained.
[0096] Secondly, this specific embodiment also provides an electronic device, which includes a memory and a processor. The memory stores executable instructions, and the processor is configured to execute the executable instructions in the memory to implement the steps of the image sensitive word recognition method based on a deep learning model provided in the first aspect. The processor may specifically be a microcontroller unit (MCU), but is not limited to this.
[0097] Thirdly, this specific embodiment also provides a readable storage medium storing executable instructions. When executed by a processor, the executable instructions implement the steps of the image sensitive word recognition method based on a deep learning model provided in the first aspect. Specifically, the storage medium may be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, but is not limited to these.
[0098] Fourthly, this specific embodiment also provides an image sensitive word recognition system based on a deep learning model. The image sensitive word recognition method based on a deep learning model provided in the first aspect, the electronic device provided in the second aspect, and the readable storage medium provided in the third aspect are all applied to an image sensitive word recognition system based on a deep learning model. This image sensitive word recognition system based on a deep learning model mainly includes: an image data acquisition device and a hardware execution terminal. The hardware execution terminal mainly includes the electronic device provided in the second aspect and the readable storage medium provided in the third aspect.
[0099] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for identifying sensitive words in images based on a deep learning model, characterized in that, Includes the following steps: Step 1: Data Collection; Collect image datasets and sensitive word datasets; Step 2: Data labeling; Capture sensitive words in the image dataset and record the image data sequence number containing the sensitive words, the sensitive words contained, and the number of sensitive words contained. Step 3: Dataset partitioning; The image dataset is divided into a training set and a test set; Step 4: Model Training; For the image data in the training set, train the model according to steps S4.1-S4.6: Step S4.1: Image text region detection; The deep learning model CTPN is used to detect text in the images in the training set, forming several image text regions. Each image text region is then labeled with a number in a top-to-bottom and left-to-right order. Step S4.2: Text recognition in the image text region; The deep learning model CRNN is used to perform text recognition on each image text region in step S4.1 to extract the image text; Step S4.3: Image-text dataset formation; The image text extracted after text recognition is arranged in the order of the image text regions to form an image text dataset; Step S4.4: Initial setup for model training; Set the parameters for the deep learning word segmentation model Jieba; Step S4.5: Sensitive word identification; For the image and text dataset formed in step S4.3, the deep learning word segmentation model Jieba is used to segment the image and text dataset into words; the sensitive word matching degree and the number of sensitive words are compared, and the sensitive word recognition accuracy is calculated by comparing the sensitive word annotation results; Step S4.6: Model training; When the accuracy of sensitive word recognition is less than 95%, proceed to step S4.4 to continue adjusting the parameters of the deep learning word segmentation model Jieba, and then proceed to step S4.5 until the accuracy of sensitive word recognition is greater than 95%, stop training, and determine the final parameters of the deep learning word segmentation model Jieba. Step 5: Image-sensitive word recognition; For the image data containing the sensitive words to be detected, train the model according to steps S5.1-S5.5: Step S5.1: Image text region detection; The deep learning model CTPN is used to detect text regions in the image data of sensitive words to be detected, and several text regions are obtained. Step S5.2: Text region character recognition; The deep learning model CRNN is used to perform text recognition for each text region in step S5.1, resulting in two types of text datasets: the first is the text dataset of the entire image, and the second is the text dataset of each text region in the entire image. Step S5.3: Word segmentation; Using the deep learning word segmentation model Jieba obtained in step S4.6, word segmentation is performed on the two text datasets obtained in step S5.2, resulting in two word segmentation results: the first is the word segmentation result of the text dataset of the whole image, and the second is the word segmentation result of the text dataset of each text region in the whole image. Step S5.4: Image sensitive word identification; The two word segmentation results are matched with the sensitive word dataset in step one to obtain two forms of sensitive word recognition results; Step S5.5: Image sensitive word processing; The two forms of sensitive word recognition results are subjected to duplicate detection to filter out duplicate sensitive word recognition results, and finally the image sensitive word recognition results of the image data to be detected are obtained.
2. The image sensitive word recognition method based on a deep learning model according to claim 1, characterized in that, In step one, the image dataset has two types: one containing sensitive words and one not containing sensitive words. The image dataset containing sensitive words refers to the collection of image files in which the text contains sensitive words, and the image dataset not containing sensitive words refers to the collection of image files in which the text does not contain sensitive words.
3. The image sensitive word recognition method based on a deep learning model according to claim 1, characterized in that, In step one, the sensitive word dataset includes a text-based sensitive word dataset and a sensitive word category dataset.
4. The image sensitive word recognition method based on a deep learning model according to claim 1, characterized in that, In step three, the ratio of image data volume in the training set to that in the test set is 7:
3.
5. An electronic device, characterized in that, include: Memory and processor; The memory stores executable instructions, and the processor is configured to execute the executable instructions in the memory to implement the steps of the image sensitive word recognition method based on a deep learning model as described in any one of claims 1 to 4.
6. A readable storage medium, characterized in that, The readable storage medium stores executable instructions, which, when executed by a processor, implement the steps of the image sensitive word recognition method based on a deep learning model as described in any one of claims 1 to 4.
7. An image-sensitive word recognition system based on a deep learning model, characterized in that, The system includes: an image data acquisition device, an electronic device as described in claim 5, and a readable storage medium as described in claim 6.
Citation Information
Patent Citations
Sensitive information identification method based on deep learning technology
CN114218391A
Sensitive picture detection method and device, storage medium and terminal
CN115937574A