Artificial intelligence-based data desensitization method and device, computer device and medium
By using character recognition and classification models in multimodal data desensitization processing, and combining multimodal information from images and text, the problem of conflicting recognition results in multimodal data desensitization processing is solved, achieving higher accuracy and data security.
Patent Information
- Application Number
- CN202310445560.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-19
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2043-04-19
AI Technical Summary
Existing technologies for desensitizing multimodal data suffer from conflicting identification results, leading to sensitive data leakage and low accuracy.
By inputting the image and text to be desensitized into a pre-trained character recognition and classification model, sensitive characters are identified and processed by using associated character sets and weighted summation methods, combined with multimodal information from the image and text.
It improves the accuracy of multimodal data desensitization processing, accurately identifies sensitive characters, and ensures data security.
Smart Images

Figure CN116563860B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a data desensitization method and device based on artificial intelligence, a computer device and a medium. BACKGROUND
[0002] With the development of artificial intelligence technology, the object of data desensitization processing gradually changes from structured data to unstructured data. Structured data needs to know the location of the part to be desensitized in the data, so as to perform desensitization processing. The application scenarios are limited, therefore, the existing method usually uses a deep learning model to identify whether each character in the unstructured data belongs to a sensitive part, and then determines the part to be desensitized according to the identification result.
[0003] Due to the wide application scenarios of data desensitization processing, there are cases that require desensitization processing of multi-modal data. At this time, only relying on a deep learning model to identify sensitivity for multi-modal data respectively may cause conflicts in the identification results of data under different modalities, and further cause different desensitization processing methods for part of the sensitive data under different modalities, resulting in leakage of sensitive data. Therefore, how to improve the accuracy of desensitization processing of multi-modal data has become a problem to be solved. SUMMARY
[0004] Therefore, the embodiments of the present application provide a data desensitization method and device based on artificial intelligence, a computer device and a medium to solve the problem of low accuracy of desensitization processing of multi-modal data.
[0005] In a first aspect, the embodiments of the present application provide a data desensitization method based on artificial intelligence, which comprises:
[0006] inputting the obtained image to be desensitized into a trained character recognition model to obtain at least two recognized characters and image positions corresponding to the recognized characters;
[0007] For any recognized character, according to the image position corresponding to the recognized character, from other recognized characters except the recognized character, determine the first N recognized characters closest to the recognized character to form an associated character set of the recognized character, N is an integer greater than zero;
[0008] inputting the recognized character and the associated character set into a trained first classification model to obtain a first probability vector of the recognized character;
[0009] inputting the obtained text to be desensitized into a trained second classification model to obtain a second probability vector corresponding to each text character in the text to be desensitized, the text to be desensitized comprising at least two text characters;
[0010] when a text character is detected to be consistent with the recognized character, weighting and adding the first probability vector and a second probability vector of the text character to update the second probability vector of the text character with a result of the adding;
[0011] when a maximum value in the second probability vector of the text character is detected to be greater than a preset judgment threshold, determining the text character as a sensitive character, performing desensitization processing on the text to be desensitized, and performing desensitization processing on an image region corresponding to the sensitive character in the image to be desensitized to obtain desensitized data.
[0012] In a second aspect, an embodiment of the present application provides a data desensitization device based on artificial intelligence, the data desensitization device comprising:
[0013] a character recognition module configured to input an obtained image to be desensitized into a trained character recognition model to obtain at least two recognized characters and image positions corresponding to the recognized characters;
[0014] a character association module configured to, for any recognized character, determine, from other recognized characters except the recognized character, a set of associated characters of the recognized character closest to the recognized character according to image positions corresponding to the recognized character, N being an integer greater than zero;
[0015] a first classification module configured to input the recognized character and the set of associated characters into a trained first classification model to obtain a first probability vector of the recognized character;
[0016] a second classification module configured to input an obtained text to be desensitized into a trained second classification model to obtain a second probability vector corresponding to each text character in the text to be desensitized, the text to be desensitized comprising at least two text characters;
[0017] a weighting update module configured to, when a text character is detected to be consistent with the recognized character, weight and add the first probability vector and the second probability vector of the text character to update the second probability vector of the text character with a result of the adding;
[0018] a desensitization processing module configured to, when a maximum value in the second probability vector of the text character is detected to be greater than a preset judgment threshold, determine the text character as a sensitive character, perform desensitization processing on the text to be desensitized, and perform desensitization processing on an image region corresponding to the sensitive character in the image to be desensitized to obtain desensitized data.
[0019] In a third aspect, an embodiment of the present application provides a computer device, which comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the data desensitization method according to the first aspect when executing the computer program.
[0020] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the data desensitization method according to the first aspect.
[0021] Compared with the prior art, the embodiment of the present application has the following beneficial effects:
[0022] The obtained to-be-desensitized image is input into the trained character recognition model to obtain at least two recognized characters and image positions of the corresponding recognized characters, for any recognized character, according to the image position corresponding to the recognized character, the first N recognized characters closest to the recognized character are determined from other recognized characters except the recognized character to form a set of associated characters of the recognized character, the recognized character and the set of associated characters are input into the trained first classification model to obtain a first probability vector of the recognized character, the obtained to-be-desensitized text is input into the trained second classification model to obtain a second probability vector corresponding to each text character in the to-be-desensitized text, when a text character is detected to be consistent with a recognized character, the first probability vector and the second probability vector of the text character are weighted and added, and the second probability vector of the text character is updated according to the addition result, when the maximum value in the second probability vector of the text character is detected to be greater than a preset judgment threshold, the text character is determined to be a sensitive character, the to-be-desensitized text is desensitized, and the image region corresponding to the sensitive character in the to-be-desensitized image is desensitized to obtain desensitized data, the recognized character in the image and the corresponding associated character are combined as the input of the classification model, which can retain the spatial features of the image and improve the accuracy of the classification of the recognized character, the first probability vector of the recognized character and the second probability vector of the text character are weighted and added, the classification result of the text character is corrected in combination with the multi-modal information, and the accuracy of the classification of the text character is improved, so that the sensitive character is more accurately recognized, and the accuracy of the desensitization of the multi-modal data is improved. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0024] Figure 1is an application environment schematic diagram of the data desensitization method based on artificial intelligence provided by the embodiment one of the present application;
[0025] Figure 2 is a flow schematic diagram of the data desensitization method based on artificial intelligence provided by the embodiment one of the present application;
[0026] Figure 3 is a flow schematic diagram of the data desensitization method based on artificial intelligence provided by the embodiment two of the present application;
[0027] Figure 4 is a structure schematic diagram of the data desensitization device based on artificial intelligence provided by the embodiment three of the present application;
[0028] Figure 5 is a structure schematic diagram of the computer device provided by the embodiment four of the present application. DETAILED DESCRIPTION
[0029] In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular sequences of steps, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, and circuits are omitted so as not to obscure the description of the present application with unnecessary detail.
[0030] It is to be understood that the terminology "includes", "has", "holds", "contains" and / or "comprising", when used in this specification and in the following claims, indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0031] It is also to be understood that the terminology "and / or" when used in this specification and in the following claims, refers to at least one of the items, or any combination of one or more of the items, and includes any possible combination of the items.
[0032] As used in this specification and in the claims, the terms "if" and "when" can be interpreted to mean "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining" or "in response to determining" or "upon detecting [a described condition or event]" or "in response to detecting [a described condition or event]", depending on the context.
[0033] In addition, in the description of the specification and the appended claims of the present application, the terms "first", "second", "third", etc. are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.
[0034] In the present application, the description of "one embodiment" or "some embodiments" means that the specific features, structures or characteristics described in connection with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in further some embodiments" and the like appearing in different places in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "include", "contain", "have" and their variants mean "include but not limited to", unless otherwise specifically emphasized.
[0035] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Among them, artificial intelligence (AI) is to use digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Theory, method, technology and application system.
[0036] The basic technology of artificial intelligence generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The software technology of artificial intelligence mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. Several major directions.
[0037] It should be understood that the size of the serial number of each step in the following embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0038] In order to illustrate the technical solutions of the present application, the following will be described by specific embodiments.
[0039] The data desensitization method based on artificial intelligence provided by the first embodiment of the present application can be applied to, for example Figure 1The application environment is shown in FIG. 1, in which a client communicates with a server. The client includes, but is not limited to, a palmtop computer, a desktop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud terminal device, a personal digital assistant (PDA), and the like. The server can be a standalone server or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0040] Referring to Figure 2 FIG. 2 is a flowchart of a data desensitization method based on artificial intelligence according to an embodiment of the present application. The data desensitization method can be applied to a client in Figure 1 The client corresponds to a computer device connected to a server to obtain a desensitization image and a desensitization text received by the server. The computer device corresponding to the client is deployed with a trained character recognition model, a trained first classification model, and a trained second classification model. The trained character recognition model can be used for character recognition on the desensitization image to obtain recognized characters. The trained first classification model can be used for sensitive category classification on the recognized characters. The trained second classification model can be used for sensitive category classification on text characters in the desensitization text, and the like. As shown in FIG. 2, the data desensitization method can include the following steps. Figure 2
[0041] Step S201, input the obtained desensitization image into the trained character recognition model to obtain at least two recognized characters and image positions of the corresponding recognized characters.
[0042] The desensitization image can refer to image data that needs to be desensitized. The trained character recognition model can refer to an optical character recognition model (OCR). The recognized character can refer to character information recognized from the desensitization image. The image position can refer to the coordinates of the position of the recognized character in the desensitization image.
[0043] Specifically, the trained character recognition model outputs a classification result of a recognized character and a bounding box of the recognized character, the bounding box of the recognized character is represented as a coordinate pair, the coordinate pair includes a coordinate of a top-left corner of the bounding box and a coordinate of a bottom-right corner of the bounding box, and a coordinate of a center point of the bounding box can be calculated according to the coordinate of the top-left corner of the bounding box and the coordinate of the bottom-right corner of the bounding box, and the coordinate of the center point of the bounding box is taken as an image position of the recognized character.
[0044] Optionally, after obtaining the at least two recognized characters and the image positions of the corresponding recognized characters, the method further includes:
[0045] inputting each recognized character into the trained first classification model respectively to obtain an initial probability vector of the corresponding recognized character;
[0046] For any initial probability vector, when it is detected that a maximum probability in the initial probability vector is greater than a preset probability threshold, the recognized character corresponding to the initial probability vector is determined as a reference type;
[0047] Correspondingly, for any recognized character, according to distances between the image positions, N recognized characters closest to the recognized character are determined from other recognized characters except the recognized character to form an associated character set of the recognized character.
[0048] For any recognized character of a non-reference type, according to distances between the image positions, N recognized characters closest to the recognized character are determined from recognized characters of the reference type to form an associated character set of the recognized character.
[0049] The trained first classification model can be a neural network model used for sensitive category classification of the recognized character, the initial probability vector can be a vector obtained by directly inputting the recognized character into the trained first classification model, the preset probability threshold can be used to judge the credibility of the sensitive category classification result, and the reference type can be a credible type of the sensitive category.
[0050] Specifically, when it is detected that the maximum probability in the initial probability vector is greater than the preset probability threshold, it indicates that there is only one sensitive category with a greater possibility for the classification result of the recognized character, and at this time, the recognized character can be taken as a character for determining the sensitive category to provide spatial information for other recognized characters, and the preset probability threshold is set to 0.8 in this embodiment.
[0051] In this embodiment, the recognized character with higher credibility is taken as a reference character, which facilitates providing more accurate spatial information when associating characters subsequently, and thus improves the accuracy of sensitive category recognition of all recognized characters.
[0052] The step of inputting the obtained to-be-desensitized image into the trained character recognition model to obtain at least two recognized characters and image positions of the corresponding recognized characters identifies and positions the character information in the to-be-desensitized image, facilitates subsequent determination of an associated character set based on the positioning information, and can better extract the spatial association of characters in the to-be-desensitized image.
[0053] In step S202, for any recognized character, the first N recognized characters closest to the recognized character are determined from other recognized characters except the recognized character as an associated character set of the recognized character according to the image position corresponding to the recognized character.
[0054] The N is an integer greater than zero, the associated character set includes N associated characters, the image distance between the calculated image position of the recognized character and the image position of each of the other recognized characters is calculated, the calculation method can be the Euclidean distance, and the first N recognized characters with the smallest calculated distance form the associated character set.
[0055] The step of determining, for any recognized character, the first N recognized characters closest to the recognized character from other recognized characters except the recognized character as an associated character set of the recognized character according to the image position corresponding to the recognized character determines the associated characters close in space, and subsequently inputs the associated characters into the classification model to increase the input information and improve the classification accuracy of the sensitive category of the recognized character.
[0056] In step S203, the recognized character and the associated character set are input into the trained first classification model to obtain a first probability vector of the recognized character.
[0057] The associated character set includes N associated characters, and the first probability vector can be a vector obtained by inputting the recognized character and the N associated characters into the trained first classification model. The recognized character and the N associated characters can be spliced in a joint manner, and then the spliced result is input into the trained first classification model.
[0058] In an embodiment, the trained first classification model can include an encoder and a fully connected layer. The recognized character and the N associated characters are input into the encoder to extract features, and then the features corresponding to the recognized character and the features corresponding to the N associated characters are connected, and the connected features are input into the fully connected layer.
[0059] Optionally, inputting the recognized character and the associated character set into the trained first classification model includes:
[0060] The recognized character and the image position of the recognized character are spliced into a recognized character vector, and any associated character in the associated character set and the image position of the corresponding associated character are spliced into an associated character vector of the associated character.
[0061] input the associated character vector into the trained first classification model to obtain an associated probability vector of the associated character vector, and determine a preset sensitive category corresponding to a maximum element value in the associated probability vector as a reference category;
[0062] concatenate the reference category to the end of the associated character vector to obtain an updated associated character vector;
[0063] input the recognized character vector and the updated associated character vector corresponding to each associated character into the trained first classification model.
[0064] The recognized character vector can represent information of the recognized character, the associated character vector can represent information of the associated character, and the updated associated character vector further includes reference information, which can be classification result information of the associated character.
[0065] The embodiment represents the recognized character information and the associated character information in the form of vectors, and updates the reference category to the associated character vector, which is beneficial to reasoning and calculation of the model and learning of spatial domain associated information, thereby improving the efficiency and accuracy of data desensitization.
[0066] The above step of inputting the recognized character and the associated character set into the trained first classification model to obtain the first probability vector of the recognized character fuses the associated character and the recognized character and inputs them into the classification model, thereby improving the effectiveness of the input information from the spatial domain information and further improving the classification accuracy of the sensitive category of the recognized character.
[0067] In step S204, the obtained to-be-desensitized text is input into the trained second classification model to obtain a second probability vector corresponding to each text character in the to-be-desensitized text.
[0068] The to-be-desensitized text includes at least two text characters, and the second probability vector can be a vector composed of probabilities of the text character belonging to each preset sensitive category.
[0069] Optionally, inputting the obtained to-be-desensitized text into the trained second classification model to obtain a second probability vector corresponding to each text character in the to-be-desensitized text includes:
[0070] For any text character, the left adjacent character and the right adjacent character of the text character are determined according to the character order in the text;
[0071] The left adjacent character is input into the trained second classification model to obtain a left character probability vector, and the left character probability vector and the text character are input into the trained second classification model to obtain a forward probability vector;
[0072] inputting the right adjacent character into the trained second classification model to obtain a right character probability vector, inputting the right character probability vector and the text character into the trained second classification model to obtain a reverse probability vector;
[0073] adding the forward probability vector and the reverse probability vector and normalizing to determine a second probability vector.
[0074] wherein the text characters are usually arranged in a fixed text order, for example, in the embodiment, the order is from left to right, and the left adjacent character and the right adjacent character of the text character can be determined according to the character order in the text.
[0075] The trained second classification model can be a long short-term memory network model, the forward probability vector can be a classification result of the text character combined with the left adjacent character classification information, and the reverse probability vector can be a classification result of the text character combined with the right adjacent character classification information.
[0076] The embodiment can fuse more effective features through bidirectional classification prediction by the bidirectional long short-term memory network model, and thus improve the accuracy of sensitive category classification of the text character.
[0077] The step of inputting the obtained text to be desensitized into the trained second classification model to obtain the second probability vector corresponding to each text character in the text to be desensitized can obtain the classification result of the text character, which is convenient for subsequent fusion with the classification result of the recognized character to improve the accuracy of sensitive category recognition.
[0078] In step S205, when it is detected that a text character is consistent with a recognized character, the first probability vector and the second probability vector of the text character are weighted and added to update the second probability vector of the text character.
[0079] wherein the text character being consistent with the recognized character can mean that the text character and the recognized character are the same character, the number of elements of the first probability vector and the second probability vector of the text character is consistent, and corresponding elements are weighted and added when weighted and added.
[0080] The step of, when it is detected that a text character is consistent with a recognized character, weighted and adding the first probability vector and the second probability vector of the text character to update the second probability vector of the text character, fuses the classification results of the image character and the text character, and thus obtains multi-modal information, which is convenient for subsequent sensitive character judgment.
[0081] In step S206, when it is detected that the maximum value in the second probability vector of the text character is greater than a preset judgment threshold, the text character is determined to be a sensitive character, desensitization processing is performed on the text to be desensitized, and desensitization processing is performed on the image region corresponding to the sensitive character in the image to be desensitized to obtain desensitized data.
[0082] The cotton-sensitive character can refer to a character related to sensitive information, and the desensitization processing mode in the text to be desensitized can be flexibly set, such as deletion, replacement, and disordering, and the desensitization processing mode of the image region corresponding to the sensitive character in the image to be desensitized can also be flexibly set, for example, blurring, rotating, and image hashing.
[0083] Optionally, when the maximum value in the second probability vector of the text character is greater than the judgment threshold, the text character is determined to be a sensitive character, the sensitive character is desensitized in the text to be desensitized, and the sensitive character is desensitized in the image region corresponding to the sensitive character in the image to be desensitized, to obtain desensitized data, which comprises:
[0084] When the text character corresponding to the second probability vector is determined to be a sensitive character, the preset category corresponding to the maximum value in the second probability vector is determined to be a sensitive category.
[0085] According to the mapping table, the desensitization processing mode of the sensitive category is determined, the sensitive character is desensitized in the text to be desensitized according to the desensitization processing mode, and the sensitive character is desensitized in the image region corresponding to the sensitive character in the image to be desensitized according to the preset image blurring mode, to obtain desensitized data.
[0086] The mapping table can include the correspondence between the sensitive category and the desensitization processing mode, and there is a corresponding desensitization processing mode for different sensitive categories, for example, when the sensitive category is a number category, the desensitization processing mode can be disordering, and when the sensitive category is an address category, the desensitization processing mode can be replacement. The image blurring can be convolution of the Gaussian kernel on the image region. It should be noted that the size of the Gaussian kernel is consistent with that of the image region.
[0087] Optionally, after obtaining the desensitized data, it further comprises:
[0088] The desensitized text in the desensitized data is input into the trained second classification model, to obtain a desensitized probability vector corresponding to each text character in the desensitized text.
[0089] According to the maximum probability in the desensitized probability vector, the preset category of the corresponding text character is determined, and when the preset category of any text character is detected to be a sensitive category, the judgment threshold is adjusted according to a preset step, and the step of detecting that the maximum value in the second probability vector of the text character is greater than the judgment threshold is returned to determine that the text character corresponding to the second probability vector is a sensitive character.
[0090] The preset step can be 0.05, the adjustment of the judgment threshold can be addition, and the desensitized text is identified again to ensure that there is no sensitive information that has not been desensitized.
[0091] The embodiment re-identifies the desensitized data in an iterative manner, ensures the effectiveness of the desensitization processing, updates the judgment threshold when the condition is not met, and re-performs sensitive character identification and desensitization processing, thereby further improving the accuracy of the desensitization processing.
[0092] The step of determining the text character as a sensitive character when the maximum value in the second probability vector of the detected text character is greater than the preset judgment threshold, desensitizing the text, and desensitizing the image region corresponding to the sensitive character in the image to obtain desensitized data, combines the multi-modal information to correct the classification result of the text character, and improves the accuracy of the text character classification.
[0093] The embodiment combines the recognized character in the image and the corresponding associated character as the input of the classification model, can retain the spatial domain features of the image, improve the accuracy of the recognized character classification, and further combines the multi-modal information to correct the classification result of the text character by weighting and adding the first probability vector of the recognized character and the second probability vector of the text character, thereby improving the accuracy of the text character classification, more accurately identifying the sensitive character, and improving the accuracy of the desensitization processing of the multi-modal data.
[0094] Referring to Figure 3 The flowchart of the data desensitization method based on artificial intelligence provided in Embodiment Two, when weighting and adding the first probability vector and the second probability vector of the text character, the preset weight can be used for weighting and adding, or the weight can be determined according to the first probability vector and then weighting and adding.
[0095] The steps of weighting and adding by using the preset weight are described in Embodiment One and will not be repeated here.
[0096] When the weight is determined according to the first probability vector and then weighting and adding, the process includes:
[0097] In step S301, a preset mapping function is used to map the maximum probability in the first probability vector to a first weight.
[0098] In step S302, a preset value is subtracted from the first weight, and the result of the subtraction is determined as a second weight.
[0099] In step S303, the product of the first weight and the first probability vector is added to the product of the second weight and the second probability vector, and the second probability vector of the text character is updated with the addition result.
[0100] The mapping function is used to represent the mapping relationship between the maximum probability in the first probability vector and the first weight, the first weight can be the weight when the first probability vector is weighted and added, and the second weight can be the weight when the second probability vector is weighted and added.
[0101] Specifically, the mapping function f(p) can be represented as where p can be the maximum probability in the first probability vector, f(p) is the mapping result, that is, the first weight, since the first probability vector has been processed by the normalization exponential function, the value range of p is [0, 1], when p is close to 0, it means that the prediction values corresponding to the preset sensitive categories are relatively close, at this time, the accuracy rate of determining the sensitive category according to the classification result of the recognized character is low, therefore, the maximum probability in the first probability vector is mapped to a first weight close to 0 through the mapping function, and when p is close to 1, it means that only one prediction value corresponding to the preset sensitive category is large, at this time, the accuracy rate of determining the sensitive category according to the classification result of the recognized character is high, therefore, the maximum probability in the first probability vector is mapped to a first weight close to 1 through the mapping function.
[0102] It should be noted that the above mapping function is used to smooth the weight, and the implementer can also select other positive correlation functions as the mapping function, for example, f(p) =.
[0103] The preset value is set to 1 in this embodiment, that is, the sum of the first weight and the second weight is 1, correspondingly, when the first weight is large, the second weight is small, when the first weight is small, the second weight is large, and then the influence degree of the classification result of the recognized character on the classification result of the text character is adjusted according to the credibility of the classification result of the recognized character.
[0104] For example, assuming that the number of preset sensitive categories is C, for a character, the character corresponds to C output prediction values when it is a recognized character, the output prediction value corresponds to one preset sensitive category, and the normalization exponential function can be represented as where o i may be the i-th output prediction value, as can be seen from the normalization exponential function, the closer the C output prediction values are, the smaller the maximum probability processed by the normalization exponential function is, and the closer to 1 / C it is, and the greater the difference between the C output prediction values is, the greater the maximum probability processed by the normalization exponential function is, and the closer to 1 it is.
[0105] In this embodiment, the maximum probability in the first probability vector is mapped by the mapping function to obtain the weight of the first probability vector in the weighting, and the influence degree of the classification result of the recognized character on the classification result of the text character is dynamically adjusted according to the credibility of the classification result of the recognized character, thereby avoiding a large error in the weighted classification result caused by the classification error of the recognized character, and further improving the accuracy rate of the desensitization processing of the multi-modal data.
[0106] The data desensitization method based on artificial intelligence corresponding to the above embodiment, Figure 4A structural block diagram of the data desensitization device based on artificial intelligence provided by the third embodiment of the present application is shown. The data desensitization device is applied to a client. A computer device corresponding to the client is connected to a server to obtain a to-be-desensitized image and a to-be-desensitized text received by the server. The computer device corresponding to the client is deployed with a trained character recognition model, a trained first classification model, and a trained second classification model. The trained character recognition model can be used for character recognition on the to-be-desensitized image to obtain recognized characters. The trained first classification model can be used for sensitive category classification on the recognized characters. The trained second classification model can be used for sensitive category classification on text characters in the to-be-desensitized text. For the convenience of description, only parts related to the embodiments of the present application are shown.
[0107] For the convenience of description, only parts related to the embodiments of the present application are shown. Figure 4 The data desensitization device comprises:
[0108] The character recognition module 41 is configured to input the obtained to-be-desensitized image into the trained character recognition model to obtain at least two recognized characters and image positions of the corresponding recognized characters.
[0109] The character association module 42 is configured to, for any recognized character, determine, according to the image position corresponding to the recognized character, a set of associated characters of the recognized character from other recognized characters except the recognized character, the set of associated characters comprising the first N recognized characters closest to the recognized character, N being an integer greater than zero.
[0110] The first classification module 43 is configured to input the recognized character and the set of associated characters into the trained first classification model to obtain a first probability vector of the recognized character.
[0111] The second classification module 44 is configured to input the obtained to-be-desensitized text into the trained second classification model to obtain a second probability vector corresponding to each text character in the to-be-desensitized text, the to-be-desensitized text comprising at least two text characters.
[0112] The weighted update module 45 is configured to, when a text character is detected to be consistent with a recognized character, add the first probability vector and the second probability vector of the text character by weighting, and update the second probability vector of the text character with the addition result.
[0113] The desensitization processing module 46 is configured to, when a maximum value in the second probability vector of the text character is detected to be greater than a preset judgment threshold, determine that the text character is a sensitive character, perform desensitization processing on the to-be-desensitized text, and perform desensitization processing on an image region corresponding to the sensitive character in the to-be-desensitized image to obtain desensitized data.
[0114] Optionally, the data desensitization device further comprises:
[0115] The initial classification module is configured to input each identified character into a trained first classification model respectively to obtain an initial probability vector corresponding to the identified character;
[0116] The type determination module is configured to, for any initial probability vector, determine that the identified character corresponding to the initial probability vector is a reference type when it is detected that a maximum probability in the initial probability vector is greater than a preset probability threshold.
[0117] Correspondingly, the character association module 42 includes:
[0118] The character screening unit is configured to, for any identified character of a non-reference type, determine, from the identified characters of the reference type, a set of associated characters of the identified character according to distances between the image positions.
[0119] Optionally, the first classification module 43 includes:
[0120] The vector concatenation unit is configured to concatenate the identified character and the image position of the identified character into an identified character vector, and concatenate any associated character in the set of associated characters and the image position of the corresponding associated character into an associated character vector of the associated character.
[0121] The category reference unit is configured to input the associated character vector into the trained first classification model to obtain an associated probability vector of the associated character vector, and determine a preset sensitive category corresponding to a maximum element value in the associated probability vector as a reference category.
[0122] The vector updating unit is configured to concatenate the reference category to the end of the associated character vector to obtain an updated associated character vector.
[0123] The joint input unit is configured to input the identified character vector and the updated associated character vector corresponding to each associated character into the trained first classification model.
[0124] Optionally, the second classification module 44 includes:
[0125] The adjacent character determination unit is configured to, for any text character, determine a left adjacent character and a right adjacent character of the text character according to an order of characters in the text.
[0126] The forward probability acquisition unit is configured to input the left adjacent character into the trained second classification model to obtain a left character probability vector, and input the left character probability vector and the text character into the trained second classification model to obtain a forward probability vector.
[0127] The reverse probability acquisition unit is configured to input the right adjacent character into the trained second classification model to obtain a right character probability vector, and input the right character probability vector and the text character into the trained second classification model to obtain a reverse probability vector.
[0128] A vector fusion unit is configured to add the forward probability vector and the reverse probability vector and normalize the result to obtain a second probability vector.
[0129] Optionally, the weighting update module 45 includes:
[0130] A weight mapping unit is configured to map the maximum probability in the first probability vector to a first weight using a preset mapping function, the mapping function being configured to represent a mapping relationship between the maximum probability in the first probability vector and the first weight.
[0131] A weight determination unit is configured to subtract the first weight from a preset value to obtain a second weight.
[0132] A weighted addition unit is configured to add a product of the first weight and the first probability vector and a product of the second weight and the second probability vector to update the second probability vector of the text character.
[0133] Optionally, the desensitization processing module 46 includes:
[0134] A sensitive category determination unit is configured to, when the text character corresponding to the second probability vector is determined to be a sensitive character, determine that a preset category corresponding to the maximum value in the second probability vector of the text character is a sensitive category.
[0135] A data desensitization unit is configured to determine a desensitization processing manner of the sensitive category according to a preset mapping table, perform desensitization processing on the sensitive character in the text to be desensitized according to the desensitization processing manner, and perform desensitization processing on an image region corresponding to the sensitive character in the image to be desensitized according to a preset image blurring manner to obtain desensitization data.
[0136] Optionally, the desensitization processing module 46 further includes:
[0137] An iterative recognition unit is configured to input the desensitization data into the trained second classification model to obtain a desensitization probability vector corresponding to each text character in the desensitization text.
[0138] A threshold adjustment unit is configured to determine a preset category of a corresponding text character according to a maximum probability in the desensitization probability vector, adjust a judgment threshold according to a preset step size when detecting that the preset category of any text character is a sensitive category, and return to the step of determining that the text character corresponding to the second probability vector is a sensitive character when detecting that the maximum value in the second probability vector of the text character is greater than the judgment threshold.
[0139] It should be noted that the information interaction and execution process between the above modules and units are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0140] Figure 5 This is a schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. Figure 5 As shown, the computer device of this embodiment includes: at least one processor ( Figure 5 Only one is shown in the diagram), a memory, and a computer program stored in the memory and capable of running on at least one processor, which, when executing the computer program, implements the steps in any of the above embodiments of the AI-based data desensitization methods.
[0141] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 5 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.
[0142] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0143] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory can be a memory of the computer device, and the internal memory provides an environment for running of the operating system and the computer-readable instructions in the readable storage medium. The readable storage medium can be a hard disk of the computer device, and in other embodiments, can also be an external storage device of the computer device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory can include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a BootLoader, data, and other programs, such as program codes of computer programs, etc. The memory can also be used to temporarily store data that has been output or will be output.
[0144] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or software. In addition, the specific name of each functional unit and module is only for easy distinction, and does not limit the protection scope of the present application. The specific working process of the unit and module in the above device can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here. If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the present application realizes all or part of the processes in the above-mentioned embodiment methods, which can be completed by a computer program instructing related hardware. The computer program can be stored in a computer readable storage medium, and when the processor executes the computer program, the steps of the above-mentioned method embodiment can be realized. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium at least includes any entity or device capable of carrying the computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium cannot be an electrical carrier signal and a telecommunication signal.
[0145] The present application realizes all or part of the processes in the above-mentioned embodiment methods, which can also be completed by a computer program product. When the computer program product runs on the computer device, it makes the computer device execute the steps that can realize the above-mentioned method embodiments.
[0146] In the above-mentioned embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0147] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0148] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / computer device and method can be implemented in other manners. For example, the described apparatus / computer device embodiments are merely schematic. For example, the division of the modules or units can be different, and each can include a plurality of sub-units. Some or all of the modules or units can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0149] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e. can be located in one place or distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.
[0150] The above embodiments are merely used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. An artificial intelligence-based data desensitization method, characterized in that, The data desensitization method comprises: inputting the obtained to-be-desensitized image into the trained character recognition model to obtain at least two recognized characters and image positions corresponding to the recognized characters; for any recognized character, determining, from other recognized characters except the recognized character, N recognized characters closest to the recognized character according to the image positions corresponding to the recognized characters, to form a set of associated characters of the recognized character, N being an integer greater than zero; inputting the recognized character and the set of associated characters into the trained first classification model to obtain a first probability vector of the recognized character; inputting the obtained to-be-desensitized text into the trained second classification model to obtain a second probability vector corresponding to each text character in the to-be-desensitized text, the to-be-desensitized text comprising at least two text characters; when it is detected that a text character is consistent with the recognized character, weighting and adding the first probability vector and the second probability vector of the text character to update the second probability vector of the text character with the addition result; when it is detected that a maximum value in the second probability vector of the text character is greater than a preset judgment threshold, determining that the text character is a sensitive character, performing desensitization processing on the to-be-desensitized text, and performing desensitization processing on an image region corresponding to the sensitive character in the to-be-desensitized image to obtain desensitized data.
2. The data de-identification method of claim 1, wherein, After the at least two recognized characters and the image positions corresponding to the recognized characters are obtained, the method further comprises: inputting each recognized character into the trained first classification model to obtain an initial probability vector corresponding to the recognized character; for any initial probability vector, when it is detected that a maximum probability in the initial probability vector is greater than a preset probability threshold, determining that a recognized character corresponding to the initial probability vector is of a reference type; correspondingly, the step of determining, for any recognized character, N recognized characters closest to the recognized character from other recognized characters except the recognized character according to distances between the image positions to form a set of associated characters of the recognized character comprises: for any recognized character of a non-reference type, determining N recognized characters closest to the recognized character from the recognized characters of the reference type according to distances between the image positions to form a set of associated characters of the recognized character.
3. The data de-identification method of claim 1, wherein, The step of inputting the recognized character and the set of associated characters into the trained first classification model comprises: concatenating the recognized character and the image position of the recognized character into a recognized character vector, and concatenating any associated character in the set of associated characters and the image position of the corresponding associated character into an associated character vector of the associated character; inputting the associated character vector into the trained first classification model to obtain an associated probability vector of the associated character vector, determining that a preset sensitive category corresponding to a maximum element value in the associated probability vector is a reference category; concatenating the reference category to the end of the associated character vector to obtain an updated associated character vector; inputting the recognized character vector and the updated associated character vector corresponding to each associated character into the trained first classification model.
4. The data de-identification method of claim 1, wherein, The inputting the obtained to-be-desensitization text into the trained second classification model to obtain a second probability vector corresponding to each text character in the to-be-desensitization text comprises: For any text character, the left adjacent character and the right adjacent character of the text character are determined according to the character sequence in the text; The left adjacent character is input into the trained second classification model to obtain a left character probability vector, and the left character probability vector and the text character are input into the trained second classification model to obtain a forward probability vector; The right adjacent character is input into the trained second classification model to obtain a right character probability vector, and the right character probability vector and the text character are input into the trained second classification model to obtain a reverse probability vector; The forward probability vector and the reverse probability vector are added and normalized, and the normalized result is determined as the second probability vector.
5. The data de-identification method of claim 1, wherein, The weighted addition of the first probability vector and the second probability vector of the text character, and the updating of the second probability vector of the text character with the addition result comprise: A preset mapping function is used to map the maximum probability in the first probability vector to a first weight, and the mapping function is used to represent the mapping relationship between the maximum probability in the first probability vector and the first weight; A preset value is subtracted from the first weight, and the subtraction result is determined as a second weight; The product of the first weight and the first probability vector and the product of the second weight and the second probability vector are added, and the second probability vector of the text character is updated with the addition result.
6. The data de-identification method of any one of claims 1 to 5, characterized in that, The determination of the text character as a sensitive character when the maximum value in the second probability vector of the text character is greater than the judgment threshold, the desensitization processing of the sensitive character in the to-be-desensitization text, and the desensitization processing of the image region corresponding to the sensitive character in the to-be-desensitization image to obtain desensitization data comprise: When it is determined that the text character corresponding to the second probability vector is a sensitive character, it is determined that the maximum value in the second probability vector corresponds to a sensitive category; According to a preset mapping table, a desensitization processing mode of the sensitive category is determined, the sensitive character in the to-be-desensitization text is desensitized according to the desensitization processing mode, and the image region corresponding to the sensitive character in the to-be-desensitization image is desensitized according to a preset image blurring mode to obtain desensitization data.
7. The data de-identification method of claim 6, wherein, After the desensitization data is obtained, the following steps are further included: The desensitized text in the desensitization data is input into the trained second classification model to obtain a desensitization probability vector corresponding to each text character in the desensitized text; According to the maximum probability in the desensitization probability vector, the preset category of the corresponding text character is determined, and when it is detected that the preset category of any text character is the sensitive category, the judgment threshold is adjusted according to a preset step size, and the step of determining that the text character corresponding to the second probability vector is a sensitive character when the maximum value in the second probability vector of the text character is greater than the judgment threshold is returned.
8. An artificial intelligence-based data desensitization device, characterized by, The data desensitization device comprises: The character recognition module is configured to input the obtained to-be-de- sensitized image into a trained character recognition model to obtain at least two recognized characters and image positions of the corresponding recognized characters. The character association module is configured to, for any recognized character, determine, according to the image position corresponding to the recognized character, a set of associated characters of the recognized character from other recognized characters except the recognized character, the set of associated characters including the first N recognized characters closest to the recognized character, N being an integer greater than zero. The first classification module is configured to input the recognized character and the set of associated characters into a trained first classification model to obtain a first probability vector of the recognized character. The second classification module is configured to input the obtained to-be-de- sensitized text into a trained second classification model to obtain a second probability vector corresponding to each text character in the to-be-de-sensitized text, the to-be-de-sensitized text including at least two text characters. The weighting update module is configured to, when detecting that a text character is consistent with the recognized character, add the first probability vector and the second probability vector of the text character by weighting, and update the second probability vector of the text character based on the addition result. The de-sensitization processing module is configured to, when detecting that a maximum value in the second probability vector of the text character is greater than a preset judgment threshold, determine that the text character is a sensitive character, perform de-sensitization processing on the to-be-de-sensitized text, and perform de-sensitization processing on an image region corresponding to the sensitive character in the to-be-de-sensitized image to obtain de-sensitization data.
9. A computer device, comprising: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the data de-sensitization method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the data de-sensitization method of any one of claims 1 to 7.
Citation Information
Patent Citations
Text data desensitization method and device, medium and electronic equipment
CN111159770A
Text data multi-label classification method and device
CN113297379A