US2025173510A1PendingUtilityA1

Text detection

Assignee: BEIJING YOUZHUJU NETWORK TECH CO LTDPriority: May 15, 2024Filed: Jan 30, 2025Published: May 29, 2025
Est. expiryMay 15, 2044(~17.8 yrs left)· nominal 20-yr term from priority
G06F 18/2155G06F 18/217G06N 3/0455G06N 3/044G06N 3/0464G06N 3/094G06F 21/57G06F 40/30G06F 40/279G06F 16/35
49
PatentIndex Score
0
Cited by
0
References
0
Claims

Abstract

Embodiments of the disclosure provide a text detection method and apparatus, a device, and a storage medium. The method includes: determining a text feature of a target text; performing, by using a trained text reconstruction model, noise addition on the text feature to obtain a text feature after noise addition, where the noise addition includes performing noise addition on a text feature corresponding to a text element in the target text; and determining, by using a trained text detection model and based on the text feature after noise addition, a detection result of the target text, where the detection result indicates whether the target text is generated by a machine learning model. In this manner, the capability of coping with adversarial attacks is increased by actively adding noise.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
         1 . A text detection method, comprising:
 determining a text feature of a target text;   performing, by using a trained text reconstruction model, noise addition on the text feature to obtain a text feature after noise addition, wherein the noise addition comprises performing noise addition on a text feature corresponding to a text element in the target text; and   determining, by using a trained text detection model and based on the text feature after noise addition, a detection result of the target text, wherein the detection result indicates whether the target text is generated by a machine learning model.   
     
     
         2 . The method according to  claim 1 , wherein performing the noise addition on the text feature corresponding to the text element in the target text comprises:
 determining, based on the text feature of the text element, semantic terms of the text element, wherein the semantic terms indicate a semantic feature of the text element, and the semantic terms at least comprise a first semantic term and a second semantic term;   performing the noise addition on the second semantic term to obtain a noise term; and   determining, based on the first semantic term and the noise term, a noise addition result of the text element.   
     
     
         3 . The method according to  claim 2 , wherein determining, based on the text feature of the text element, the semantic terms of the text element comprises:
 performing, by using a semantic mapper in the text reconstruction model, semantic feature mapping on the text feature of the text element to obtain a semantic mapping result; and   determining, by using a biaser in the text reconstruction model, a bias of the semantic mapping result to obtain the semantic terms of the text element.   
     
     
         4 . The method according to  claim 1 , wherein the text reconstruction model and the text detection model are jointly trained. 
     
     
         5 . The method according to  claim 1 , wherein the text reconstruction model to be trained comprises a first sub-model and a second sub-model with a same architecture, and the text reconstruction model is trained by:
 performing, by using the text reconstruction model to be trained, noise addition on a sample text feature of sample text to obtain a sample text feature after noise addition, wherein the sample text feature after noise addition comprises a first sample feature obtained by performing, by the first sub-model, noise addition on the sample text feature, and a second sample feature obtained by performing, by the second sub-model, noise addition on the sample text feature;   determining, by using the text detection model and based on the sample text feature after noise addition, a sample detection result, wherein the sample detection result comprises a first detection result determined based on the first sample feature, and a second detection result determined based on the second sample feature;   training the text reconstruction model to be trained based on a difference to obtain the trained text reconstruction model, wherein the difference at least indicates a noise loss function between the sample text feature after noise addition and the sample text feature, and the noise loss function comprises a first noise loss function between the first sample feature and the sample text feature, and a second noise loss function between the second sample feature and the sample text feature; and   retaining one of the first sub-model or the second sub-model in the trained text reconstruction model.   
     
     
         6 . The method according to  claim 5 , wherein the noise loss function between the sample text feature after noise addition and the sample text feature is determined by a similarity loss function and a penalty noise loss function, the similarity loss function indicates a similarity between the sample text feature after noise addition and the sample text feature, and the penalty noise loss function indicates a penalty rule for an amplitude of noise addition. 
     
     
         7 . The method according to  claim 6 , wherein the determination of the penalty noise loss function comprises:
 for a sample text element in the sample text, obtaining a noise term in a text feature of the sample text element, wherein the text feature of the sample text element comprises a first semantic term of the sample text element and a second semantic term of the sample text element, and the noise term is obtained by performing noise addition on the second semantic term of the sample text element;   determining a vector length of the noise term, wherein the vector length indicates semantic richness of the sample text element;   determining a penalty term for the vector length, wherein the penalty term is configured to be inversely proportional to a value of the vector length; and   determining the penalty noise loss function based on the vector length and the penalty term.   
     
     
         8 . The method according to  claim 6 , wherein the determination of the similarity loss function comprises:
 obtaining a similarity result based on a similarity, wherein the similarity indicates a similarity between a text feature of each sample text element in the sample text feature after the noise addition and a text feature of each corresponding sample text element in the sample text feature; and   determining the similarity loss function based on the similarity result.   
     
     
         9 . The method according to  claim 5 , wherein the difference further indicates at least one of:
 a detection result loss function between the first detection result and the second detection result,   a first detection loss function between the first detection result and a labeling result of the text sample, and   a second detection loss function between the second detection result and the labeling result of the text sample.   
     
     
         10 . The method according to  claim 9 , wherein the detection result loss function between the first detection result and the second detection result is determined according to a symmetric divergence between the first detection result and the second detection result. 
     
     
         11 . An electronic device, comprising:
 at least one processor; and   at least one memory coupled to the at least one processor and storing instructions for execution by the at least one processor, wherein the instructions, when executed by the at least one processor, cause the electronic device to perform acts comprising:   determining a text feature of a target text;   performing, by using a trained text reconstruction model, noise addition on the text feature to obtain a text feature after noise addition, wherein the noise addition comprises performing noise addition on a text feature corresponding to a text element in the target text; and   determining, by using a trained text detection model and based on the text feature after noise addition, a detection result of the target text, wherein the detection result indicates whether the target text is generated by a machine learning model.   
     
     
         12 . The electronic device according to  claim 11 , wherein performing the noise addition on the text feature corresponding to the text element in the target text comprises:
 determining, based on the text feature of the text element, semantic terms of the text element, wherein the semantic terms indicate a semantic feature of the text element, and the semantic terms at least comprise a first semantic term and a second semantic term;   performing the noise addition on the second semantic term to obtain a noise term; and   determining, based on the first semantic term and the noise term, a noise addition result of the text element.   
     
     
         13 . The electronic device according to  claim 12 , wherein determining, based on the text feature of the text element, the semantic terms of the text element comprises:
 performing, by using a semantic mapper in the text reconstruction model, semantic feature mapping on the text feature of the text element to obtain a semantic mapping result; and   determining, by using a biaser in the text reconstruction model, a bias of the semantic mapping result to obtain the semantic terms of the text element.   
     
     
         14 . The electronic device according to  claim 11 , wherein the text reconstruction model and the text detection model are jointly trained. 
     
     
         15 . The electronic device according to  claim 11 , wherein the text reconstruction model to be trained comprises a first sub-model and a second sub-model with a same architecture, and the text reconstruction model is trained by:
 performing, by using the text reconstruction model to be trained, noise addition on a sample text feature of sample text to obtain a sample text feature after noise addition, wherein the sample text feature after noise addition comprises a first sample feature obtained by performing, by the first sub-model, noise addition on the sample text feature, and a second sample feature obtained by performing, by the second sub-model, noise addition on the sample text feature;   determining, by using the text detection model and based on the sample text feature after noise addition, a sample detection result, wherein the sample detection result comprises a first detection result determined based on the first sample feature, and a second detection result determined based on the second sample feature;   training the text reconstruction model to be trained based on a difference to obtain the trained text reconstruction model, wherein the difference at least indicates a noise loss function between the sample text feature after noise addition and the sample text feature, and the noise loss function comprises a first noise loss function between the first sample feature and the sample text feature, and a second noise loss function between the second sample feature and the sample text feature; and   retaining one of the first sub-model or the second sub-model in the trained text reconstruction model.   
     
     
         16 . The electronic device according to  claim 15 , wherein the noise loss function between the sample text feature after noise addition and the sample text feature is determined by a similarity loss function and a penalty noise loss function, the similarity loss function indicates a similarity between the sample text feature after noise addition and the sample text feature, and the penalty noise loss function indicates a penalty rule for an amplitude of noise addition. 
     
     
         17 . The electronic device according to  claim 16 , wherein the determination of the penalty noise loss function comprises:
 for a sample text element in the sample text, obtaining a noise term in a text feature of the sample text element, wherein the text feature of the sample text element comprises a first semantic term of the sample text element and a second semantic term of the sample text element, and the noise term is obtained by performing noise addition on the second semantic term of the sample text element;   determining a vector length of the noise term, wherein the vector length indicates semantic richness of the sample text element;   determining a penalty term for the vector length, wherein the penalty term is configured to be inversely proportional to a value of the vector length; and   determining the penalty noise loss function based on the vector length and the penalty term.   
     
     
         18 . The electronic device according to  claim 16 , wherein the determination of the similarity loss function comprises:
 obtaining a similarity result based on a similarity, wherein the similarity indicates a similarity between a text feature of each sample text element in the sample text feature after the noise addition and a text feature of each corresponding sample text element in the sample text feature; and   determining the similarity loss function based on the similarity result.   
     
     
         19 . The electronic device according to  claim 15 , wherein the difference further indicates at least one of:
 a detection result loss function between the first detection result and the second detection result,   a first detection loss function between the first detection result and a labeling result of the text sample, and   a second detection loss function between the second detection result and the labeling result of the text sample.   
     
     
         20 . A non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable by a processor to implement acts comprising:
 determining a text feature of a target text;   performing, by using a trained text reconstruction model, noise addition on the text feature to obtain a text feature after noise addition, wherein the noise addition comprises performing noise addition on a text feature corresponding to a text element in the target text; and   determining, by using a trained text detection model and based on the text feature after noise addition, a detection result of the target text, wherein the detection result indicates whether the target text is generated by a machine learning model.

Join the waitlist — get patent alerts

Track US2025173510A1 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.