Image desensitization processing method, medium and device containing sensitive text information

CN122087869BActive Publication Date: 2026-09-18SHANJIE INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610534573.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-22
Publication Date
2026-09-18
Estimated Expiration
2046-04-22

AI Technical Summary

Technical Problem

然而,上述脱敏处理过度依赖检测精度,若漏检、误检或定位不准会导致敏感信息残留或非敏感信息被错误遮盖,遮盖处理手段单一且不可逆,易导致原始信息丢失同时遮盖痕迹明显影响图像的观感和可用性,在部分敏感信息周围只有图像没有文字的图片场景中,检测内容的定义和样本覆盖不足,易导致漏检,难以界定“敏感区域”边界,难以生成含文字的补全图像,即便有文字生成,也难以与原有图像文字格式统一,遮盖手段与视觉一致性差

Benefits of technology

[0013] This application can achieve at least the following beneficial effects: This application proposes an image desensitization processing method, medium and device containing sensitive text information, which realizes image desensitization, improves the accuracy of sensitive area identification by partitioning the image to be processed, reduces the risk of information leakage and false occlusion, realizes high-quality and natural image completion, and improves the overall visual effect and user experience of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122087869B_ABST
    Figure CN122087869B_ABST
Patent Text Reader

Abstract

The application provides an image desensitization processing method, medium and equipment containing sensitive text information, belonging to the technical field of information security. The method obtains a to-be-processed image, identifies a sensitive area and a nearby area in a non-sensitive area adjacent to the sensitive area, generates a background area matching the size of the sensitive area based on the pixel information of the nearby area and the pixel information of the sensitive area, identifies sensitive text information in the sensitive area, calls a preset text generation model to generate pseudo-sensitive content adapted to the font style of the sensitive text information, fuses the pseudo-sensitive content, the background area and the to-be-processed image, and forms a desensitized image. The application improves the sensitive area recognition accuracy, reduces the information leakage risk and miscovering, realizes high-quality and natural image completion, and improves the overall visual effect of the image and the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information security technology, and more specifically, to a method, medium, and device for desensitizing images containing sensitive text information. Background Technology

[0002] Existing image desensitization methods often employ object detection models (such as YOLO and Faster R-CNN) to locate sensitive regions in images. These regions are then masked using techniques like blurring, masking, or pixelation, or replaced with default text to achieve effective information desensitization. However, these methods heavily rely on detection accuracy. Missed detections, false detections, or inaccurate localization can lead to residual sensitive information or incorrect masking of non-sensitive information. Masking methods are often simplistic and irreversible, easily resulting in the loss of original information and noticeable masking marks that negatively impact image appearance and usability. In scenarios where sensitive information is surrounded only by images without text, insufficient definition and sample coverage can lead to missed detections, difficulty in defining "sensitive region" boundaries, and difficulty in generating complete images with text. Even when text is generated, it's difficult to maintain consistency with the original image's text format, resulting in poor visual consistency between the masking method and the target text. Therefore, an improved solution is urgently needed to address these technical problems. Summary of the Invention

[0003] In view of this, this application proposes an image desensitization processing method and electronic device containing sensitive text information. By partitioning the image to be processed, the accuracy of sensitive area identification is improved, the risk of information leakage and false occlusion is reduced, high-quality and natural image completion is achieved, and the overall visual effect and user experience of the image are improved.

[0004] Firstly, this application proposes a method for desensitizing images containing sensitive text information, the method comprising: Obtain the image to be processed; Identify sensitive regions in the image to be processed and neighboring regions among non-sensitive regions adjacent to the sensitive regions; A background region matching the size of the sensitive region is generated based on the pixel information of the adjacent region and the pixel information of the sensitive region. Identify sensitive text information in the sensitive area, and call a preset text generation model to generate pseudo-sensitive content that matches the font style of the sensitive text information; The pseudo-sensitive content, the background area, and the image to be processed are merged to form a desensitized image.

[0005] Optionally, the sensitive text information includes a style vector reflecting the font style of the sensitive text; the identification of sensitive text information in the sensitive area includes: The sensitive region is segmented into characters to obtain several character sub-images; Binarize several character sub-images to obtain a binary mask for each character sub-image; A pre-trained style encoder performs style encoding on at least one character image and its corresponding binary mask to obtain a style vector that represents the font style of the text.

[0006] Optionally, the training process of the style encoder includes: Prepare a training dataset containing various font samples. Each font sample includes a text image of a specific font, a binary mask corresponding to the text image, and character labels. Based on the training dataset, a contrastive learning task is constructed. A pre-trained encoder is trained using a preset loss function to maximize the similarity of different samples under the same font style in the feature space and minimize the similarity of samples with different font styles in the feature space. After training, a style encoder that can output style vectors is obtained, which can capture font style information such as the shape and stroke thickness of the text.

[0007] Optionally, constructing the contrastive learning task based on the training dataset includes: Select any text image and its corresponding binary mask from the training dataset as anchor samples, select text images with the same font as the anchor samples and their corresponding binary masks as positive samples, and select text images with different fonts than the anchor samples and their corresponding binary masks as negative samples to form sample triples. The training dataset is input into the pre-trained encoder to obtain the encoding vectors corresponding to the anchor samples, positive samples, and negative samples, respectively. The loss function is constructed based on the encoding vectors and preset hyperparameters.

[0008] Optionally, the text generation model is a GAN-based font generation network; the step of calling a preset text generation model to generate pseudo-sensitive content that matches the font style of the sensitive text information includes: Based on the sensitive text information, the corresponding pseudo-sensitive text is determined; Obtain the character label sequence of the pseudo-sensitive text, and use the character label sequence of the pseudo-sensitive text and the style vector of the sensitive text as input to the font generation network; The font generation network converts the character label sequence of pseudo-sensitive text into a one-hot vector, and then passes it through an embedding layer and an RNN network to obtain a text sequence feature vector. The text sequence feature vector is then fused with the style feature vector to generate pseudo-sensitive content.

[0009] Optionally, generating a background region matching the size of the sensitive region based on the pixel information of the neighboring region and the pixel information of the sensitive region includes: The sensitive area is masked, and a preset image processing model is invoked to complete the content of the sensitive area based on the neighboring areas, thereby forming the background area.

[0010] Optionally, the step of masking the sensitive area and calling a preset image processing model to complete the content of the sensitive area based on the neighboring area to form the background area includes: Step S1: Replace the sensitive area with preset pixels to eliminate sensitive information in the sensitive area; Step S2: Use a preset image processing model to perform forward noise diffusion on the adjacent region to obtain a first image that matches the size of the sensitive region; Step S3: Perform reverse noise reduction on the sensitive areas where sensitive information has been removed to obtain a second image that matches the size of the sensitive areas; Step S4: Merge the first image and the second image to form a merged image; Using the newly formed fused image as the input for the next time step, steps S2 to S4 are repeated multiple times, thereby using the final fused image as the background region.

[0011] Secondly, embodiments of this disclosure provide an electronic device, including: one or more processors; A memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to perform the method described in any one of the embodiments of this application.

[0012] Thirdly, embodiments of this disclosure provide a computer-readable storage medium having executable instructions stored thereon, wherein when executed by one or more processors, the executable instructions cause the processors to perform the method described in any implementation of the first aspect.

[0013] This application can achieve at least the following beneficial effects: This application proposes an image desensitization processing method, medium and device containing sensitive text information, which realizes image desensitization, improves the accuracy of sensitive area identification by partitioning the image to be processed, reduces the risk of information leakage and false occlusion, realizes high-quality and natural image completion, and improves the overall visual effect and user experience of the image. Attached Figure Description

[0014] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation on the scope of this application.

[0015] Figure 1 This is a flowchart illustrating an image desensitization method containing sensitive text information according to one embodiment of this application; Figure 2 This is a flowchart illustrating the process of identifying sensitive text information in the sensitive area according to one embodiment of this application; Figure 3 This is a flowchart illustrating the training process of a style encoder according to one embodiment of this application; Figure 4 This is a flowchart illustrating the construction of a contrastive learning task based on the training dataset according to one embodiment of this application; Figure 5 This is a flowchart illustrating the process of generating pseudo-sensitive content that matches the font style of the sensitive text information by calling a preset text generation model according to one embodiment of this application. Figure 6 This is a flowchart illustrating the process of masking the sensitive area according to one embodiment of the present application, calling a preset image processing model to complete the content of the sensitive area based on the neighboring area, thereby forming the background area. Figure 7 This is a flowchart illustrating the process of fusing the pseudo-sensitive content, the background area, and the image to be processed to form a desensitized image according to one embodiment of this application. Figure 8 This is a schematic diagram of Poisson image editing and fusion according to one embodiment of this application; Figure 9 This is a schematic diagram of the structure of an image desensitization processing apparatus containing sensitive text information according to an embodiment of this application; Figure 10 This is a schematic diagram of the structure of an electronic device according to one embodiment of this application. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0017] All terms used in this application (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0018] For example, the terms "first" and "second" used in this application are only used to distinguish similar objects and differentiate the first object from another object, rather than to describe a specific order or sequence, nor should they be interpreted as indicating or implying relative importance.

[0019] This application proposes a method for desensitizing images containing sensitive text information, combined with... Figure 1 As shown, the method includes: Step S101: Obtain the image to be processed.

[0020] In this embodiment, the executing entity can be a local device (real-time acquisition by the device, acquisition by the field device) or a remote electronic device connected to the network (automatic capture, third-party interface call, network upload) to acquire the image to be processed.

[0021] The image to be processed refers to the original image containing sensitive information, which is an industry-specific carrier of sensitive information, including but not limited to various images containing text information, such as: photos of ID cards, passports and other identification documents; personal photos and screenshots uploaded to social media; document photos taken with a mobile phone; document images containing sensitive information, such as contracts and reports, scanned or photographed in office settings; images containing personal identification information or license plate numbers captured by surveillance cameras; screenshots of emails and chat logs, etc. This disclosure does not make specific limitations on this.

[0022] Step S102: Identify the sensitive region in the image to be processed and the neighboring region in the non-sensitive region adjacent to the sensitive region.

[0023] In this embodiment, a sensitive area refers to the part of an image that contains personal privacy information, trade secrets, or other sensitive information; a non-sensitive area refers to the part of an image that does not contain sensitive information, such as background, environment, objects, etc., which do not involve personal privacy or sensitive data. After identifying a sensitive area, areas that are not marked as sensitive are considered non-sensitive areas; an adjacent area refers to a non-sensitive area adjacent to a sensitive area. It can be determined by calculating the boundary of the sensitive area and extending it outward by a certain number of pixels. Usually, the width of the adjacent area can be set according to specific application requirements, such as 5-10 pixels. These areas may visually contact the sensitive area and are usually used to take into account contextual information during image processing to avoid unnatural effects after processing.

[0024] Furthermore, sensitive regions in images can be identified by training deep learning models such as YOLO, Faster R-CNN, or SSD. Taking YOLO (You Only Look Once) as an example, the image is first preprocessed by reading it and adjusting it to the input size required by the YOLO model. The detection results are then parsed to extract the bounding boxes and category labels. The bounding box is a rectangle used to identify the location information of an object in the image, usually defined by two coordinate points: the coordinates of the top left and bottom right corners. The category label is a classification identifier for the objects in the image, used to describe the type or category of the objects contained within the bounding box.

[0025] Step S103: Generate a background region that matches the size of the sensitive region based on the pixel information of the neighboring region and the pixel information of the sensitive region.

[0026] Background regions refer to the image portions used to replace sensitive regions. The purpose is to fill in the area after removing or blurring sensitive information, making the entire image look natural and not abrupt. Based on pixel information of neighboring regions and sensitive regions, including features such as color, texture, and brightness, background regions that match the size of sensitive regions are generated. The size matching result can be determined from aspects such as shape and size, texture and features, visual consistency, and width and height at the pixel level.

[0027] Step S104: Identify sensitive text information in the sensitive area, and call a preset text generation model to generate pseudo-sensitive content that matches the font style of the sensitive text information.

[0028] In this embodiment, the size of the sensitive region is analyzed based on the image bounding box and category label extracted from the sensitive region. If the length / height ratio of the sensitive region is greater than a threshold, it is considered to contain multiple text information. For example, the threshold can be set to 2.5.

[0029] Next, a preset text generation model is invoked to preprocess the text and extract font style features to generate pseudo-sensitive content that matches the font style of the sensitive text information. Pseudo-sensitive content refers to alternative text or data generated to protect the original sensitive information when processing sensitive information. This content is consistent with the original sensitive information in terms of theme, semantics or function, and format, but does not contain real sensitive information. It can help prevent the leakage of sensitive information when sharing, storing or displaying data, while maintaining the availability and readability of information.

[0030] When generating pseudo-sensitive content, ensure that its font style matches the original sensitive text. This is mainly reflected in aspects such as font type, font size, character spacing and line spacing, color and style, and text alignment.

[0031] Step S105: The pseudo-sensitive content, the background area, and the image to be processed are fused together to form a desensitized image.

[0032] In this embodiment, Poisson image editing is used to fuse pseudo-sensitive content, the background region, and the image to be processed, forming a desensitized image. Poisson image editing is a seamless image fusion technique based on solving the Poisson equation; its core mathematical principle is to perform image operations in the gradient domain (rather than the pixel domain). In the desensitized image, sensitive information is replaced with pseudo-sensitive information that matches the pseudo-visual style, and this pseudo-sensitive information is perfectly integrated with a completed background image.

[0033] The image desensitization method containing sensitive text information in this application identifies neighboring regions between sensitive and non-sensitive regions in the image to be processed, and generates a background region that matches the size of the sensitive region, ensuring that the generated background visually matches the original. Figure 1 This method involves several steps: first, removing or blurring sensitive information to create a natural and seamless image; then, generating pseudo-sensitive content with a matching font style for sensitive text in sensitive areas to prevent the leakage of real sensitive information, protecting the original information while maintaining its usability and readability; finally, fusing the pseudo-sensitive content, background area, and the image to be processed to obtain the desensitized image, avoiding the hard edge cutting and color difference problems of traditional masking methods. The resulting desensitized image appears natural and without obvious processing traces, improving the overall visual appeal and usability. Therefore, this application proposes an image desensitization method for images containing sensitive text information. This method achieves image desensitization by partitioning the image to be processed, improving the accuracy of sensitive area identification, reducing the risk of information leakage and false masking, achieving high-quality and natural image completion, and improving the overall visual effect and user experience. This solution is applicable to various image scenarios containing sensitive information, significantly enhancing the security and practicality of image desensitization.

[0034] In one implementation, such as Figure 2 As shown, in step S104, the sensitive text information includes a style vector reflecting the font style of the sensitive text; identifying the sensitive text information in the sensitive area includes: Step S201: The sensitive region is segmented into characters to obtain several character sub-images.

[0035] In this embodiment, after identifying the image bounding box, category label, and text information of the sensitive area, the text information is segmented into characters, and the words in the text information are split into several character sub-images.

[0036] For example, suppose a bounding box containing a person's name is identified in a sensitive region. For a sensitive word such as "Zhang Wei", the bounding box output by the recognition model is... ,in, It is the coordinate of the top left corner. It is the coordinate of the bottom right corner. If the image to be processed is Then the text in the sensitive area is cropped as follows: Record it as This represents the cropped image portion, i.e., the area containing sensitive text. Assuming the sensitive text is printed (i.e., has clear black-and-white contrast), an adaptive thresholding method can be used to binarize the text. Adaptive thresholding is an image processing technique primarily used to convert grayscale images into binary images. By dynamically adjusting the threshold based on local image features, it effectively separates the foreground (usually text or other objects of interest) from the background under different lighting conditions and backgrounds. The cropped portion is then processed using the adaptive thresholding method. Converting to a binary image is achieved using the following formula:

[0037] in It is the cropped image. Pixel values ​​in In position The adaptive threshold calculated at that point, It is the binarized mask image, where This indicates that the position is foreground (text). 0 indicates that the position is the background.

[0038] After obtaining the text content based on the above steps, character segmentation is performed using the projection segmentation method. Projection segmentation identifies character boundaries by calculating the horizontal and vertical projections of the image. Specifically, the projection value reflects the number of foreground pixels (usually characters) in a given row or column. For a given binary image... Calculate its horizontal and vertical projections to determine the spacing between characters using the following formula:

[0039] in, Indicates position A binary mask where a value of 1 represents the foreground (text) and a value of 0 represents the background; The height of the image; The width of the image; Indicates being listed The projection value is calculated as the sum of the foreground pixels of all rows in that column.

[0040] By analyzing projection values By identifying recessed areas (regions with lower projection values), which typically correspond to the intervals between characters, a threshold is set to identify columns with projection values ​​below that threshold. This determines the start and end positions of the characters. Based on the identified boundaries, the original image is segmented into multiple character sub-images. Each character subgraph It is an RGB image containing a single recognized character.

[0041] Step S202: Binarize several character sub-images to obtain a binary mask for each character sub-image.

[0042] In this embodiment, each character sub-image Generate the corresponding binary mask Specifically, by using character subgraphs Convert to grayscale The optimal threshold is determined using an adaptive thresholding method. For each The corresponding binary mask is obtained by determining the value using the following formula. :

[0043] Step S203: Based on the pre-trained style encoder, style encoding is performed on the at least one character image and its corresponding binary mask to obtain a style vector that represents the font style of the text.

[0044] In this embodiment, style encoding is performed on at least one character image and its corresponding binary mask. Style encoding refers to extracting the feature vector of the character image through a model to capture information such as font, stroke style, and shape. The purpose of style encoding is to make the feature vectors of different characters as close as possible under the same font and style, while the feature vectors of different fonts or styles are as far apart as possible.

[0045] The style encoder is pre-trained primarily based on the Triplet Loss function of contrastive learning to train the CNN encoder. Triplet Loss is a loss function used to learn similarity measures, which aims to train the model by minimizing the distance between samples of the same class and maximizing the distance between samples of different classes. Specifically, the goal of Triplet Loss is to ensure that samples of the same class are close to each other in the feature space, while samples of different classes are relatively far apart.

[0046] By segmenting and binarizing sensitive regions, and then performing style encoding based on a pre-trained style encoder, the accuracy of character recognition can be effectively improved, background noise can be suppressed, style features can be extracted, a unified feature representation can be generated, and the generalization ability of the model can be enhanced.

[0047] In one implementation, such as Figure 3 As shown, in step S203, the training process of the style encoder includes: Step S301: Prepare a training dataset. The training dataset contains various font samples. Each font sample includes a text image of a specific font, a binary mask corresponding to the text image, and a character label.

[0048] In this embodiment, a font database is constructed, which contains... There are several fonts, each with a number of character samples. Each sample consists of a character image, a corresponding binary mask, and a character label. The mask is used to highlight the character region. The dataset is represented as follows: .

[0049] in, Indicates the total number of font categories; Indicates the first The first type of font A character image; Indicates the first The first Chinese font The binary mask corresponding to each character image; Representation and font The relevant sample size, i.e., the number of character samples under that font category, in practical applications, The value may vary depending on the font category. For example, if a font has 100 samples, then... =100; If another font only has 50 samples, then for that font =50.

[0050] A character label is an identifier or information associated with a character image. It is typically used to describe the character content in an image and may include the character itself (e.g., letters, numbers, or symbols), font information (e.g., indicating the type of character, such as letters, numbers, punctuation marks, etc.), and other related attributes (such as the names and types of different fonts).

[0051] Step S302: Construct a contrastive learning task based on the training dataset, and train the pre-trained encoder using a preset loss function to maximize the similarity of different samples under the same font style in the feature space and minimize the similarity of samples with different font styles in the feature space.

[0052] In this embodiment, a CNN convolutional neural network encoder is constructed. The input consists of character sub-images and corresponding masks from a font database. Each image is assigned a label indicating its font category. Images are then standardized, such as resizing, normalizing, and data augmentation (rotation, translation, flipping, etc.). A suitable CNN architecture for feature extraction is designed, typically including the following layers: Input layer: The size of the input image can be set to... , usually 32 32 3 or 64 64 1 (Grayscale image). H and G represent the number of pixels in the length and width directions of the image, respectively, and C represents the number of channels.

[0053] Convolutional layers: using multiple filters, such as 32-fold or 3D filters. 3 convolution kernels, applying max pooling, such as 2 2. Reduce the size of the feature map and increase the number of filters, such as 64. Three convolutional kernels are used, and max pooling is applied again.

[0054] Fully connected layer: Flatten the multidimensional feature map into a one-dimensional vector, add one or more fully connected layers, and the output dimension can be set to the desired feature vector dimension (such as 128 or 256).

[0055] Output layer: The dimension of the output layer is the same as the dimension of the feature vector.

[0056] Model compilation: Select an optimizer (such as Adam or SGD) and a loss function (using TripletLoss during training).

[0057] Next, a contrastive learning task is constructed, and Triplet Loss is calculated to complete model training, ensuring that vectors of samples with the same font are close in distance, while vectors of samples with different fonts are far apart. Triplet samples (anchor sample, positive sample, negative sample) prepared from the font database are processed by an encoder. Output the corresponding vector: Anchor Sample Positive samples negative samples .

[0058] Calculate the Triplet Loss using the following formula:

[0059] in, This represents the distance between the anchor sample and the positive sample, indicating the similarity between the two samples in the feature space; This represents the distance between the anchor sample and the negative sample, indicating the difference between the two samples in the feature space; This is a hyperparameter used to control the distance difference between anchor samples and positive and negative samples; empirically, a value of 0.2 is acceptable. By aiming to maximize the similarity between different samples of the same font style in the feature space and minimize the similarity between samples of different font styles in the feature space, the similarity between samples of the same class and the difference between samples of different classes are enhanced, thus enabling the training of the pre-trained encoder.

[0060] Step S303: After training is completed, a style encoder that can output style vectors is obtained. The style vectors can capture the font style information of the text, such as the shape of the characters and the thickness of the strokes.

[0061] In this embodiment, after training is complete, an arbitrary character image and mask are input into the encoder. Style vectors can be obtained. , This allows any input character to be mapped to a vector space that represents the font style. This vector can capture font style information such as the shape and stroke thickness of the text, and can be used to complete tasks such as font style analysis, font retrieval, or font generation.

[0062] In one implementation, such as Figure 4 As shown, in step S302, constructing a contrastive learning task based on the training dataset includes: Step S401: Select any text image and its corresponding binary mask from the training dataset as anchor samples, select text images with the same font as the anchor samples and their corresponding binary masks as positive samples, and select text images with different fonts than the anchor samples and their corresponding binary masks as negative samples, thus forming a sample triplet.

[0063] In this embodiment, the anchor sample, positive sample, and negative sample are triplet samples in Triplet Loss. The anchor sample is a baseline sample whose features are used to compare similarity with other samples. The positive sample is a sample belonging to the same category as the anchor sample and should be as close as possible to the anchor sample so that the model can learn the similarity between them. The negative sample is a sample belonging to a different category from the anchor sample and should be as far away as possible from the anchor sample so that the model can learn the difference between them. During training, the model is optimized through the triplet loss function so that the distance between the anchor sample and the positive sample is smaller than the distance between the anchor sample and the negative sample.

[0064] Furthermore, any text image and its corresponding binary mask are selected from the training dataset as anchor samples, text images with the same font as the anchor samples and their corresponding binary masks are selected as positive samples, and text images with different fonts than the anchor samples and their corresponding binary masks are selected as negative samples, thus forming a sample triplet.

[0065] Step S402: Input the training dataset into the pre-trained encoder to obtain the encoding vectors corresponding to the anchor samples, positive samples, and negative samples respectively, and construct the loss function based on the encoding vectors and preset hyperparameters.

[0066] Based on the selection of triplet samples and pre-trained encoder processing, features can be effectively extracted, optimized loss functions can be constructed, hyperparameters can be flexibly adjusted, the robustness of the model can be enhanced, and the training process can be accelerated.

[0067] In one implementation, such as Figure 5 As shown, in step S104, the text generation model is a GAN-based font generation network; the step of calling the preset text generation model to generate pseudo-sensitive content that matches the font style of the sensitive text information includes: Step S501: Determine the corresponding pseudo-sensitive text based on the sensitive text information.

[0068] In this embodiment, the text generation model is a GAN-based font generation network. A GAN (Generative Adversarial Network) is a deep learning model that uses a generative adversarial network structure to generate font styles. A generative adversarial network consists of two main parts: a generator and a discriminator. The generator is responsible for generating fake samples (in this case, font styles), while the discriminator is responsible for determining whether the input sample is real or fake. During training, the generator and discriminator continuously compete against each other. The generator attempts to generate increasingly realistic fonts, while the discriminator strives to improve its ability to identify fake fonts. The training goal is to make the font images generated by the generator visually deceive the discriminator. The two networks compete with each other through adversarial training, thereby improving their respective performance.

[0069] Pseudo-sensitive text refers to text that, after processing, resembles real sensitive content in form but does not actually contain sensitive information. This can be achieved by creating a database or thesaurus containing sensitive words, which can be specific words, phrases, or expressions, usually related to a specific theme or content; analyzing the input sensitive text to identify the sensitive words; iterating through the sensitive text, replacing each sensitive word to generate new pseudo-sensitive text; and then outputting or returning the generated pseudo-sensitive text.

[0070] Step S502: Obtain the character label sequence of the pseudo-sensitive text, and use the character label sequence of the pseudo-sensitive text and the style vector of the sensitive text as input to the font generation network.

[0071] In this embodiment, the character tag sequence typically refers to a sequence that associates each character in the text with a specific tag or identifier. The character tag sequence of pseudo-sensitive text is represented as follows: ,in It is the index of the character, indicating the position of each character in the sequence.

[0072] For example, the pseudo-sensitive text to be processed is "Zhang San". The text is segmented by character to obtain individual characters, that is, "Zhang San" can be segmented into "Zhang" and "San". A corresponding label is generated for each character. For example, "Zhang" can correspond to the label. The number "three" can correspond to a label. The final character label sequence corresponding to "Zhang San" is .

[0073] Step S503: The character label sequence of pseudo-sensitive text is converted into a one-hot vector through the font generation network, and the text sequence feature vector is obtained through the embedding layer and RNN network. The text sequence feature vector and style feature vector are fused to generate pseudo-sensitive content.

[0074] In this embodiment, a one-hot vector is a vector form used to represent discrete categories. Its characteristic is that for a set containing D possible categories, the size of the one-hot vector is D, and only one element is 1, while the rest are 0. For example, given three categories: A, B, and C, their one-hot vector representation is as follows: A:

[0075] B:

[0076] C:

[0077] By converting the character label sequence of pseudo-sensitive text into one-hot vectors, discrete categorical data can be effectively transformed into a numerical format suitable for neural network processing. This transformation not only improves the input quality of the model but also avoids misunderstandings between categories, thereby enhancing the model's performance. Subsequently, these one-hot vectors can be used to generate text sequence feature vectors through embedding layers and RNN networks, and then fused with style feature vectors to ultimately generate pseudo-sensitive content.

[0078] The above-mentioned pseudo-sensitive text character tag sequence Converting to a one-hot vector is problematic because one-hot encoding is high-dimensional and sparse, leading to significant computational and storage overhead. Mapping it to a low-dimensional embedding vector compresses character information into a dense vector, thus reducing dimensionality. Assume... If the dictionary size (number of characters) after conversion to one-hot vectors is U, then the label sequence for each character... one-hot vector Let U be a vector of length U, and then define an embedding matrix. Map it to a low-dimensional embedding vector, where It is the embedding dimension, which uses the embedding matrix to embed one-hot vectors. Convert to low-dimensional embedding vector The vector is then input into an RNN network to obtain the text sequence feature vector. RNNs can capture the temporal dependencies in a sequence and generate a fixed-dimensional sequence feature vector.

[0079] Based on the style vector extracted in step S303 and text sequence feature vector After forward propagation, reshaping, and upsampling convolutional layers, and finally processed by the sigmoid activation function, the model can generate outputs in the range [0, 1]. The specific implementation process is as follows:

[0080]

[0081]

[0082]

[0083] in, The text sequence feature vector is obtained by processing the character sequence with an RNN, representing the semantic / sequence information of the input text; The style vector representing the target font is extracted from real font samples by the style encoder.

[0084] The weight matrix, a trainable linear transformation parameter, is used to map the concatenated vector z to a new dimension; The bias term is a trainable scalar / vector used for the offset of a linear transformation. It is an intermediate vector after linear transformation, which is used to prepare for subsequent reshaping and upsampling.

[0085] The reshape operation reshapes a one-dimensional vector. Reconfigured into a four-dimensional tensor; These are the initial height, width, and number of channels of the reshaped feature map; It is the initial feature map, which serves as the input for subsequent upsampling convolutions.

[0086] It is the number of upsampling and convolutional layers; It is an upsampling operation, which will take the first... Layer feature map Enlarge the spatial dimensions (height, width); Two-dimensional convolutional layers convolve the upsampled feature maps to extract more complex texture and structural features, while adjusting the number of channels; It is the first The feature map of the layer is finally processed. After the layer, the spatial size of the feature map is close to that of the target image.

[0087] The sigmoid activation is mapped to [0, 1] to generate a pseudo-sensitive image. The sigmoid function is defined as follows: The function's output range is (0, 1), making it well-suited for generating probability values ​​or normalized image data. With sigmoid activation, any input feature is transformed into a standardized value that represents the pixel intensity of the image.

[0088] By combining the sequence feature vector with the style vector and processing it through a multi-layer network, the high-dimensional features are mapped to the image space. Finally, through the sigmoid activation function, the features output by the network are restricted to the range of [0, 1], ensuring that the generated image is visually reasonable (i.e., the pixel values ​​are within the effective range) and can effectively reflect the characteristics of the input features.

[0089] Simultaneously, to ensure the quality and stylistic consistency of the generated images, the pseudo-sensitive content generated during the above process is trained using a loss function. This includes a discriminator loss and a generator loss weighted by a perceptual loss. The discriminator loss aims to distinguish between real font samples and generated pseudo-sensitive images. By learning, it determines whether the input image comes from the real data distribution (real font samples) or the generative model (generated pseudo-sensitive images), aiming to improve the discriminator's ability to distinguish between real and generated samples. The discriminator loss... The binary cross-entropy loss is typically used and can be expressed as:

[0090] Among them, the discriminator Used to determine whether the generated image conforms to being generated using the same font; Represents a real font sample and its corresponding style code; This represents the generated pseudo-sensitive image.

[0091] Generator loss The goal is to generate images that match the style of the target pseudo-text and pass the discriminator's judgment. This aims to improve the generator's ability to generate high-quality pseudo-text images. The generator loss typically consists of two parts: adversarial loss and perceptual loss. The adversarial loss measures the ability of the generated pseudo-sensitive image to be recognized as a real image by the discriminator. The perceptual loss is calculated through a pre-trained visual network to ensure that the generated pseudo-sensitive image is closer to the real image in structure and detail. Specifically, it can be expressed as:

[0092] Among them, generator take over Output pseudo-text images; This represents the feature map of the first layer of a pre-trained convolutional network; Represents a true image of the sensitive area; It is the part that combats losses; This is the perceived loss part; It is a weighted hyperparameter used to balance the importance of adversarial loss and perceptual loss. By minimizing the generator loss, the generator can generate images that are more consistent with the distribution of real samples and are stylistically consistent with the target pseudotext.

[0093] In this embodiment, a perceptual loss is added to the traditional GAN ​​generator loss. The aim is to improve the quality of the generated pseudo-sensitive images by focusing on the high-level features of the image. In the font generation task, the perceptual loss can effectively preserve the details and structural information of the strokes, avoid blurring and loss of details caused by pixel-level loss, and be closer to the real sample image. In the end, the generated pseudo-sensitive images are more realistic and visually attractive.

[0094] In one implementation, generating a background region matching the size of the sensitive region based on the pixel information of the neighboring region and the pixel information of the sensitive region includes: The sensitive area is masked, and a preset image processing model is invoked to complete the content of the sensitive area based on the neighboring areas, thereby forming the background area.

[0095] In this embodiment, the model is trained according to the deep learning model such as YOLO, Faster R-CNN or SSD mentioned in step S102 to identify sensitive regions in the image, extract the bounding boxes and category labels of the image, and after identifying the bounding boxes of the sensitive regions, adjust the pixel values ​​of these regions to preset values ​​to achieve sensitive region occlusion.

[0096] The prepared input image is fed into the selected image processing model for inference. The model will generate a background region that matches the size of the sensitive region (with consistent width and height) based on the features of the neighboring regions.

[0097] In one implementation, such as Figure 6 As shown, the process of masking the sensitive area and using a preset image processing model to complete the sensitive area based on neighboring regions to form the background area includes: Step S1: Replace the sensitive area with preset pixels to eliminate sensitive information in the sensitive area.

[0098] In this embodiment, based on the bounding box of the sensitive area extracted by the above process, the pixel value of the area is adjusted to white to eliminate sensitive information in the sensitive area.

[0099] Step S2: Use a preset image processing model to perform forward noise diffusion on the adjacent region to obtain a first image that matches the size of the sensitive region.

[0100] In this embodiment, the preset image processing model is the improved Diffusion Model (DDPM) to achieve image completion. DDPM is a probability-based generative model that mainly generates data by gradually adding noise and denoising. Its core idea is to gradually transform the data from a simple distribution (such as Gaussian distribution) into a complex data distribution. First, a forward diffusion model is applied to the pixel information of neighboring regions (i.e., known unoccluded regions) in the image, progressively adding Gaussian noise to align with the generated content in subsequent steps at the noise level. Next, a reverse diffusion model process (i.e., noise reduction, denoising, and generation) is performed on the pixel information of sensitive regions (i.e., unknown occluded regions). Using the knowledge learned from the pre-trained diffusion model, new image content matching the context is "conceptualized" from the noise. Then, the known regions with added Gaussian noise and the denoised occluded regions are combined to form a complete temporary image at the current time step. Finally, the above three operations are iteratively executed until the noise is completely removed, resulting in a clear, completed image. This enhances the consistency of image completion, prevents the generated content from becoming detached from the known background, and thus achieves higher quality and more natural completion results.

[0101] Forward noise diffusion simulates various noise types encountered in real-world image processing by adding noise to known sharp images (such as neighboring regions). This generates noise samples that match the size of the sensitive region, providing a foundation for subsequent reverse denoising. Forward noise diffusion is achieved using the following formula:

[0102] in, This refers to an image sampled from the known unoccluded portion of the image to be processed. These are the default parameters for the DDPM model. Let I be the pixel values ​​of the original clear image in the known unoccluded area, where I is the identity matrix, and let I be the mechanism of cyclic iteration.

[0103] Based on the above calculations, a first image matching the size of the sensitive region is obtained. .

[0104] Step S3: Perform reverse noise reduction on the sensitive areas where sensitive information has been removed to obtain a second image that matches the size of the sensitive areas.

[0105] The reverse denoising process aims to recover sharp details from a noisy image, ensuring that the generated image content is consistent with the image information of the surrounding known areas. Reverse denoising is achieved through the following formula:

[0106] in, To obtain images of unknown occluded regions of the image to be processed by the DDPM model. The image sample obtained in the previous step (time t+1) The image sample obtained at the current time (t) is used to obtain a second image that matches the size of the sensitive region.

[0107] Step S4: Merge the first image and the second image to form a merged image.

[0108] Based on images of known unoccluded regions and images of unknown occluded regions, the two are fused to fill in missing areas and generate a complete image without obvious missing or discontinuous parts. The fusion process is implemented using the following formula:

[0109] Where m represents the mask. This represents element-wise multiplication. The above formula is executed repeatedly until the noise disappears at time t=0.

[0110] Step S5: Using the newly formed fused image as the input for the next time step, repeat steps S2 to S4 multiple times to obtain the final fused image as the background region.

[0111] In step S2 above From The calculations were performed without considering the influence of unknown occlusion areas; the data generated in step S3 is as follows. The image is obtained based on the known occluded region image from the previous step (time t+1). This lack of information interaction between the known and unknown region images leads to a significant mismatch between the generated image and the existing image, resulting in poor completion quality. To address this issue, the following resampling process is introduced to improve the DDPM model.

[0112] In the DDPM model, the forward process is defined as a Markov chain, represented as follows:

[0113] definition Using formulas 1-3 to generate a new completed image Then, noise is re-added to the completed image using the noise diffusion process, followed by a resampling process. The specific formula is as follows:

[0114] in, The noise figure at step t+1 increases slowly with t. This represents the conditional probability distribution of the forward diffusion process, i.e., the graph at a known time step t. Under the condition of time step t+1, the image The probability distribution, Represents a multivariate Gaussian distribution, specifically as follows: Follow the mean The covariance matrix is The Gaussian distribution.

[0115] Based on the above improvements, each execution Steps S2 to S4 are followed by a resampling process, which can improve the matching degree between the completed image and the existing image and improve the quality of the completed image in sensitive areas. Based on experience, after performing steps S2 to S4 10 times, performing the resampling process 5 times can achieve better image information fusion. The specific number of times can be determined based on the final image completion effect, and this disclosure does not make a specific limit on this.

[0116] In one implementation, such as Figure 7 As shown, the step of fusing the pseudo-sensitive content, the background area, and the image to be processed to form a desensitized image includes: Step S701 involves replacing the sensitive area using preset pixels to eliminate sensitive information in the sensitive area.

[0117] Sensitive areas are replaced using preset pixels (which can be a single color or a texture extracted from the surrounding area) to eliminate sensitive information.

[0118] Step S702: Embed the pseudo-sensitive content into the background area to form an intermediate image.

[0119] Pseudo-sensitive content is content used to replace sensitive information. It can be randomly generated patterns, blurred images, or elements extracted from other images. The purpose is to make it visually non-revealing of real information while coordinating with the background area and the overall image style.

[0120] Intermediate images refer to the images formed after embedding pseudo-sensitive content into the background area. They typically include the replaced background area (i.e., the result after the sensitive area in the original image to be processed has been replaced) and the area where the pseudo-sensitive content is embedded, ensuring that the pseudo-sensitive content is synthesized with the background area so that it looks natural and not abrupt.

[0121] Step S703: The intermediate image and the image to be processed after pixel replacement are fused together to form a desensitized image.

[0122] The generated intermediate image is then fused with the pixel-replaced image to be processed using Poisson image editing.

[0123] In one embodiment, such as Figure 8 The image shows the process of Poisson image editing and fusion. The sensitive text "Zhang Weijie" in the sensitive area is identified in the image. Its pixels are set to white. Then, the DDPM model is used to complete the sensitive area. The generated intermediate image including pseudo-sensitive content and the image to be processed after pixel replacement are fused using Poisson image editing to obtain the desensitized image "Zhang Moumou".

[0124] The Poisson image editing fusion process is implemented as follows: First, prepare a background image of the image to be processed and a source image patch to be merged. Determine the region to be merged and create a mask. The mask is a binary image that identifies the region to be merged. Second, construct an optimization problem using the gradient and boundary conditions of Poisson image editing. The gradient condition calculates the change in intensity of adjacent pixels within the source image patch, and the boundary condition ensures that the pixel values ​​at the patch boundary are consistent with the adjacent pixel values ​​in the background image. Solve the optimization problem using the least squares method to obtain the merged pixel values.

[0125] For example, with The background image, where For pixel metrics, For the height of the image, Define the width of the image. The pixel region to be merged into the background image. It is the optimized version The new value of each pixel within the region is calculated using the following formula. , This allows for a seamless visual integration between the pasted area and the background image.

[0126] in, The pixel values ​​(or vectors) to be optimized will eventually be copied to the background image. area (i.e.) The pixel values ​​within the area are determined by Decide); This represents the pixel value at the corresponding location in the source image; These are the pixel values ​​in the target image (background image). For pixels The set of neighbors (usually 4 or 8 neighbors). for The complement of the region; the first summation represents the neighbors. exist Within the area, at this moment, a new image The difference in ( Get as close as possible to the source image. The difference in ( This achieves the goal of preserving the gradient structure within the source image; the second summation represents the neighbor... Within the background area, at this time, (new image) The value of i in the middle - Background image The value of j in the pasted area is made as close as possible to (the value of i in the source image - the value of j in the source image) to ensure that the gradient of the pasted area edge is consistent with the gradient of the background image edge.

[0127] in The four adjacent positions of position i (which cannot exceed the image boundary) are represented by the following formula:

[0128] The desensitized image generated according to the above formula will no longer contain any sensitive information and will look natural and harmonious.

[0129] In one implementation method Figure 9 This is a schematic diagram of an image desensitization processing apparatus containing sensitive text information according to an embodiment of this application. Figure 9 As shown, the device includes the following units: Image acquisition unit 901 is used to identify sensitive regions in the image to be processed and neighboring regions in non-sensitive regions adjacent to the sensitive regions.

[0130] The sensitive image recognition unit 902 is used to identify sensitive regions in the image to be processed and adjacent regions in non-sensitive regions adjacent to the sensitive regions.

[0131] The image generation unit 903 is used to generate a background region that matches the size of the sensitive region based on the pixel information of the neighboring region and the pixel information of the sensitive region.

[0132] The text generation unit 904 is used to identify sensitive text information in the sensitive area and call a preset text generation model to generate pseudo-sensitive content that matches the font style of the sensitive text information.

[0133] The image fusion unit 905 is used to fuse the pseudo-sensitive content, the background area and the image to be processed to form a desensitized image.

[0134] In one embodiment, the image generation unit 903 is further configured to mask the sensitive area and call a preset image processing model to complete the content of the sensitive area based on the neighboring area, thereby forming the background area.

[0135] In one embodiment, the text generation unit 904 is further configured to segment the sensitive region into characters to obtain several character sub-images; binarize the several character sub-images to obtain a binary mask for each character sub-image; and perform style encoding on at least one character image and its corresponding binary mask based on a pre-trained style encoder to obtain a style vector that represents the font style of the text.

[0136] In one embodiment, the text generation unit 904 is further configured to prepare a training dataset containing multiple font samples, each font sample including a text image of a specific font, a binary mask corresponding to the text image, and character labels; construct a contrastive learning task based on the training dataset, and train a pre-trained encoder using a preset loss function, with the goal of maximizing the similarity of different samples under the same font style in the feature space and minimizing the similarity of samples with different font styles in the feature space; after training, a style encoder that can output style vectors is obtained, the style vectors being able to capture font style information such as the shape and stroke thickness of the text.

[0137] In one embodiment, the text generation unit 904 is further configured to select any text image and its corresponding binary mask from the training dataset as anchor samples, select text images with the same font as the anchor samples and their corresponding binary masks as positive samples, and select text images with different fonts than the anchor samples and their corresponding binary masks as negative samples, thus forming a sample triplet; input the training dataset into the pre-trained encoder to obtain the encoding vectors corresponding to the anchor samples, positive samples, and negative samples respectively, and construct a loss function based on the encoding vectors and preset hyperparameters.

[0138] In one embodiment, the text generation unit 904 is further configured to determine the corresponding pseudo-sensitive text based on the sensitive text information; obtain the character label sequence of the pseudo-sensitive text; use the character label sequence of the pseudo-sensitive text and the style vector of the sensitive text as input to the font generation network; convert the character label sequence of the pseudo-sensitive text into a one-hot vector through the font generation network, and obtain a text sequence feature vector through an embedding layer and an RNN network; and fuse the text sequence feature vector and the style feature vector to generate pseudo-sensitive content.

[0139] In one embodiment, the image fusion unit 905 is further configured to replace the sensitive region with preset pixels to eliminate sensitive information in the sensitive region; embed the pseudo-sensitive content into the background region to form an intermediate image; and fuse the intermediate image and the image to be processed after pixel replacement to form a desensitized image.

[0140] The image desensitization processing apparatus containing sensitive text information in this application identifies adjacent regions between sensitive and non-sensitive regions in the image to be processed, and generates a background region that matches the size of the sensitive region, ensuring that the generated background visually matches the original. Figure 1 This process involves several steps: first, removing or blurring sensitive information to create a natural and seamless image; then, generating pseudo-sensitive content with a matching font style for sensitive text information in sensitive areas to prevent the leakage of real sensitive information, protecting the original information while maintaining its usability and readability; finally, fusing the pseudo-sensitive content, background area, and the image to be processed to obtain the desensitized image, avoiding the hard edge cutting and color difference problems of traditional masking methods. The resulting desensitized image appears visually natural with no obvious processing traces, improving the overall visual appeal and usability. Therefore, this application proposes an image desensitization processing device for images containing sensitive text information. This device achieves image desensitization by partitioning the image to be processed, improving the accuracy of sensitive area identification, reducing the risk of information leakage and false masking, achieving high-quality, natural image completion, and improving the overall visual effect and user experience. This solution is applicable to various image scenarios containing sensitive information, significantly enhancing the security and practicality of image desensitization.

[0141] In one embodiment, an electronic device is provided, in conjunction with Figure 10 As shown, the electronic device includes: one or more processors; and a memory for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to perform the method described in any one of the embodiments of this application.

[0142] In one embodiment, a computer-readable storage medium is provided that stores executable instructions that, when executed by a processor, cause the processor to perform any of the methods described in this application.

[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

[0144] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of this application and form different embodiments. For example, all the embodiments above can be used in any combination. The information disclosed in this background section is intended only to enhance the understanding of the general background of this application and should not be construed as an admission or in any way implying that such information constitutes prior art known to those skilled in the art.

Claims

1. A method for desensitizing images containing sensitive text information, characterized in that, The method includes: Obtain the image to be processed; Identify sensitive regions in the image to be processed and neighboring regions among non-sensitive regions adjacent to the sensitive regions; The process involves generating a background region that matches the size of the sensitive region based on the pixel information of the neighboring region and the pixel information of the sensitive region. The steps include: S1, replacing the sensitive region with preset pixels to eliminate sensitive information; S2, performing forward noise diffusion on the neighboring region using a preset image processing model to obtain a first image that matches the size of the sensitive region; S3, performing reverse noise reduction on the sensitive region after the sensitive information has been eliminated to obtain a second image that matches the size of the sensitive region; and S4, fusing the first and second images to form a fused image. The newly formed fused image is then used as the input for the next time step. Steps S2 to S4 are repeated multiple times to obtain the final fused image as the background region. Sensitive text information in the sensitive region is identified, and the sensitive region is segmented into characters to obtain several character sub-images. The several character sub-images are binarized to obtain a binary mask for each character sub-image. Based on a pre-trained style encoder, at least one character image and its corresponding binary mask are style-encoded to obtain a style vector that represents the font style of the text. Here, style encoding refers to extracting the feature vector of the character image through the model to capture font, stroke style, and shape information. A preset text generation model is called to generate pseudo-sensitive content that matches the font style of the sensitive text information. The pseudo-sensitive content, the background area, and the image to be processed are fused together to form a desensitized image.

2. The method according to claim 1, characterized in that, The training process of the style encoder includes: Prepare a training dataset containing various font samples. Each font sample includes a text image of a specific font, a binary mask corresponding to the text image, and character labels. Based on the training dataset, a contrastive learning task is constructed. A pre-trained encoder is trained using a preset loss function to maximize the similarity of different samples under the same font style in the feature space and minimize the similarity of samples with different font styles in the feature space. After training, a style encoder that can output style vectors is obtained, which can capture font style information such as the shape and stroke thickness of the text.

3. The method according to claim 2, characterized in that, The construction of the contrastive learning task based on the training dataset includes: Select any text image and its corresponding binary mask from the training dataset as anchor samples, select text images with the same font as the anchor samples and their corresponding binary masks as positive samples, and select text images with different fonts than the anchor samples and their corresponding binary masks as negative samples to form sample triples. The training dataset is input into the pre-trained encoder to obtain the encoding vectors corresponding to anchor samples, positive samples, and negative samples, respectively. A loss function is constructed based on the encoding vectors and preset hyperparameters.

4. The method according to claim 1, characterized in that, The text generation model is a GAN-based font generation network; The step of calling a preset text generation model to generate pseudo-sensitive content that matches the font style of the sensitive text information includes: Based on the sensitive text information, the corresponding pseudo-sensitive text is determined; Obtain the character label sequence of the pseudo-sensitive text, and use the character label sequence of the pseudo-sensitive text and the style vector of the sensitive text as input to the font generation network; The font generation network converts the character label sequence of pseudo-sensitive text into a one-hot vector, and then passes it through an embedding layer and an RNN network to obtain a text sequence feature vector. The text sequence feature vector is then fused with the style feature vector to generate pseudo-sensitive content.

5. The method according to claim 1, characterized in that, The step of generating a background region that matches the size of the sensitive region based on the pixel information of the neighboring region and the pixel information of the sensitive region includes: The sensitive area is masked, and a preset image processing model is invoked to complete the content of the sensitive area based on the neighboring areas, thereby forming the background area.

6. The method according to any one of claims 1 to 5, characterized in that, The step of fusing the pseudo-sensitive content, the background area, and the image to be processed to form a desensitized image includes: The sensitive areas will be replaced using preset pixels to eliminate sensitive information in the sensitive areas; The pseudo-sensitive content is embedded into the background area to form an intermediate image; The intermediate image and the image to be processed after pixel replacement are fused together to form a desensitized image.

7. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method as described in any one of claims 1 to 6.

8. A computer storage medium, characterized in that, The storage medium stores executable instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Screen information leakage prevention method and system based on UWB positioning

    CN121145188A