Image processing method and device, nonvolatile storage medium and electronic equipment

By processing the OCR recognition results through intent understanding models and deep learning technology, the problem of string segmentation in penetration test reports is solved, and the accuracy and efficiency of penetration test reports are improved.

CN120612704APending Publication Date: 2025-09-09CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510742102.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

When processing complex images containing multiple lines of text information, especially in penetration test reports, existing OCR technology cannot correctly reassemble the segmented character strings into a whole, resulting in the recognition results being unable to extract real information, affecting the accuracy and efficiency of penetration test reports.

Method used

The intent understanding model is used to process the OCR recognition results, converting multi-line character strings into single-line representations. The accuracy of the recognition results is ensured through feature extraction and similarity verification, and the deep learning model is used to extract and optimize the features of the image.

Benefits of technology

It significantly improves the accuracy and efficiency of OCR recognition in penetration test reports, ensures the information consistency and integrity of penetration test reports, and supports the accurate execution of subsequent security analysis and vulnerability management processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120612704A_ABST
    Figure CN120612704A_ABST
Patent Text Reader

Abstract

The invention discloses an image processing method and device, a nonvolatile storage medium and electronic equipment. The method comprises the following steps: receiving a to-be-recognized image; performing optical character recognition on the to-be-recognized image to obtain a first text; converting a first character string in the first text into a second character string represented by a single line to obtain a second text; performing feature extraction on the to-be-recognized image to obtain a first feature vector, and performing feature extraction on the target image to obtain a second feature vector; and determining the similarity between the first feature vector and the second feature vector, and displaying the second text when the similarity is greater than a preset threshold. According to the method and the device, the technical problem that real information cannot be extracted from the identification result due to the fact that the identification result is also the character string represented by multiple lines if the image to be identified comprises the character string represented by multiple lines and having complete semantics in the process of performing optical character identification on the image to be identified in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and specifically, to an image processing method and device, a non-volatile storage medium, and an electronic device. Background Art

[0002] With the acceleration of digital transformation, enterprises are facing increasingly severe cybersecurity challenges. Penetration testing, as a key means of detecting and assessing system security, is becoming increasingly important. Optical character recognition (OCR) technology is widely used in the analysis and processing of penetration test reports to convert text within images into editable and searchable text. However, the application of OCR technology is not without its challenges, particularly when processing complex images containing multiple lines of text. Its accuracy and reliability can be affected by various factors.

[0003] On the one hand, the quality of the image directly affects the recognition effect of OCR. For example, low pixel resolution, poor lighting conditions, blurred text edges, etc. will all lead to recognition errors. On the other hand, the layout design of the text, such as text wrapping, font diversity, font size changes, and background complexity, will also increase the difficulty of OCR recognition. Especially in penetration test reports, long character strings are often separated into multiple lines. For example, a complete URL or IP address is split into multiple segments and appears on different lines due to line width limitations. In this case, traditional OCR technology often cannot correctly reassemble these segmented character strings into a whole, resulting in the inability to accurately extract key information from the penetration test report, which in turn affects subsequent security analysis and vulnerability management processes, such as Figure 1a shown.

[0004] Specifically, if Figure 1b As shown in the figure, when the IP address "192.168.0.2 / 32" in the penetration test report is identified by OCR as "192.\r\n168.0.2 / 32" because it is too long (where "\r\n" is a line break identifier, indicating that a line or paragraph has ended and the Enter key is pressed to break the line), although each part is identified correctly, the coherence and integrity of the overall information are destroyed, making it difficult for automated tools to directly process this information, thereby affecting the efficiency and accuracy of vulnerability management.

[0005] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0006] The present application provides an image processing method and apparatus, a non-volatile storage medium, and an electronic device to at least solve the technical problem that, in the process of optical character recognition of an image to be recognized, if the image to be recognized includes a string with complete semantics represented by multiple lines, the recognition result is also a string represented by multiple lines, resulting in the inability to extract real information from the recognition result.

[0007] According to one aspect of the present application, an image processing method is provided, comprising: receiving an image to be recognized, wherein the image to be recognized includes at least: a first character string represented by multiple lines; performing optical character recognition on the image to be recognized to obtain a first text, wherein the first text includes at least: a first character string; using an intent understanding model to convert the first character string in the first text into a second character string represented by a single line to obtain a second text, and converting the second text into a target image; performing feature extraction on the image to be recognized to obtain a first feature vector, performing feature extraction on the target image to obtain a second feature vector; determining the similarity between the first feature vector and the second feature vector, and displaying the second text when the similarity is greater than a preset threshold.

[0008] Optionally, the intent understanding model is trained by the following method: extracting a target paragraph from a target text, wherein the target text includes: a request for comment document question and answer text, an Internet Protocol address format question and answer text, a Uniform Resource Locator standard format question and answer, and a security professional question and answer text; the target paragraph includes a first target string represented by multiple lines, and the first target string is divided into multiple lines after optical character recognition; determining a second target string represented by a single line corresponding to the first target string; marking the first target string as a negative sample and the second target string as a positive sample, and training the initial intent understanding model through the positive and negative sample pairs, and obtaining the intent understanding model when the preset training stop conditions are met.

[0009] Optionally, using an intention understanding model to convert a first character string in a first text into a second character string represented by a single line to obtain a second text, including: using an intention understanding model to convert the first character string in the first text into a second character string represented by a single line, identifying and replacing abnormal characters in the second character string, wherein the abnormal characters are variant characters corresponding to preset characters; and re-editing the second character string according to a preset template to obtain a second text.

[0010] Optionally, the image to be identified is a penetration test report for testing the target network system, and the penetration test report includes at least one of the following character strings: Internet Protocol address, domain name, uniform resource locator; after displaying the second text, the method also includes: sending the second text to the target platform, wherein the target platform includes at least one of the following: security scanning platform, security penetration platform, work order management platform; receiving a response message to the second text sent by the target platform, wherein the response message is used to indicate the correctness of the second text; based on the response message, adding a tag to the second text to obtain the target text, and optimizing the model parameters of the intent understanding model through the target text.

[0011] Optionally, the method further includes: when the number of received target response messages is greater than a first preset threshold, increasing the preset threshold according to a preset ratio, wherein the target response message is used to indicate that there is an error in the second text.

[0012] Optionally, feature extraction is performed on the image to be identified to obtain a first feature vector, and feature extraction is performed on the target image to obtain a second feature vector, including: using a pre-trained deep learning model to perform feature extraction on the image to be identified to obtain a first text feature in the image to be identified; performing one-dimensional processing on the first text feature to obtain a first initial feature sequence; using a first normalization factor to normalize the first initial feature sequence to obtain a first feature vector; using a pre-trained deep learning model to perform feature extraction on the target image to obtain a second text feature in the target image; performing one-dimensional processing on the second text feature to obtain a second initial feature sequence; and using a second normalization factor to normalize the second initial feature sequence to obtain a second feature vector.

[0013] Optionally, when the similarity is not greater than a preset threshold, optical character recognition is performed again on the image to be recognized to obtain a first text, the intention understanding model is reused to convert the first character string in the first text into a second character string represented by a single line to obtain a second text, and the second text is converted into a target image; feature extraction is performed again on the image to be recognized to obtain a first feature vector, feature extraction is performed on the target image to obtain a second feature vector; the similarity between the first feature vector and the second feature vector is re-determined until the similarity is greater than the preset threshold.

[0014] According to another aspect of the present application, an image processing device is also provided, including: a receiving module for receiving an image to be identified, wherein the image to be identified includes at least: a first character string represented by multiple lines; a recognition module for performing optical character recognition on the image to be identified to obtain a first text, wherein the first text includes at least: a first character string; a conversion module for using an intention understanding model to convert the first character string in the first text into a second character string represented by a single line to obtain a second text, and convert the second text into a target image; an extraction module for performing feature extraction on the image to be identified to obtain a first feature vector, and performing feature extraction on the target image to obtain a second feature vector; a display module for determining the similarity between the first feature vector and the second feature vector, and displaying the second text when the similarity is greater than a preset threshold.

[0015] According to another aspect of the present application, a non-volatile storage medium is provided. The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the above image processing method.

[0016] According to another aspect of the present application, an electronic device is provided, including: a memory and a processor, wherein the processor is configured to run a program stored in the memory, wherein the above image processing method is executed when the program is run.

[0017] According to yet another aspect of the present application, a computer program is provided, wherein when the computer program is executed by a processor, the above image processing method is implemented.

[0018] According to another aspect of the present application, a computer program product is provided, which includes a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above image processing method is implemented.

[0019] In the present application, an image to be recognized is received, wherein the image to be recognized includes at least: a first string represented by multiple lines; optical character recognition is performed on the image to be recognized to obtain a first text, wherein the first text includes at least: a first string; the first string in the first text is converted into a second string represented by a single line using an intent understanding model to obtain a second text, and the second text is converted into a target image; feature extraction is performed on the image to be recognized to obtain a first feature vector, and feature extraction is performed on the target image to obtain a second feature vector; the similarity between the first feature vector and the second feature vector is determined, and when the similarity is greater than a preset threshold, the second text is displayed. This method achieves the purpose of optimizing the recognition result by using a pre-trained intent understanding model after optical character recognition is performed on the image to be recognized, thereby achieving the technical effect of extracting real information from the recognition result of optical character recognition of the image to be recognized, and further solves the technical problem that in the process of optical character recognition of the image to be recognized in the related technology, if the image to be recognized includes a string with complete semantics represented by multiple lines, the recognition result is also a string represented by multiple lines, resulting in the inability to extract real information from the recognition result. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0021] Figure 1a A schematic diagram of a vulnerability scanning process is shown;

[0022] Figure 1b A schematic diagram of OCR recognition data is shown;

[0023] Figure 2 is a flowchart of an image processing method according to an embodiment of the present application;

[0024] Figure 3 This is a schematic diagram of a vulnerability scanning process according to an embodiment of the present application;

[0025] Figure 4 1 is a schematic diagram of a processing flow of an AI review module according to an embodiment of the present application;

[0026] Figure 5 is a schematic diagram of training an intent understanding model according to an embodiment of the present application;

[0027] Figure 6 is a schematic diagram of a model fine-tuning test according to an embodiment of the present application;

[0028] Figure 7A structural diagram of an image processing device according to an embodiment of the present application;

[0029] Figure 8 A hardware structure block diagram of a computer terminal according to an image processing method in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] According to an embodiment of the present application, a method embodiment of an image processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0033] Figure 2 is a flow chart of an image processing method according to an embodiment of the present application, such as Figure 2 As shown, the method includes the following steps:

[0034] Step S201: receiving an image to be recognized, wherein the image to be recognized at least includes: a first character string represented by multiple lines.

[0035] The image to be identified is, for example, a penetration test report document. This document contains various security-related data, such as the URL address of the vulnerability, the IP address, the timestamp, the vulnerability level, and other information. It is worth noting that the image to be identified contains at least one first string, which is so long that it is represented across multiple lines in the original document. For example, this string is a complete URL or an IP address including a subnet mask.

[0036] Step S202 : performing optical character recognition on the image to be recognized to obtain a first text, wherein the first text at least includes a first character string.

[0037] The first character string includes but is not limited to: IP address, domain name, URL.

[0038] In step S202, the image to be recognized is processed using OCR technology to convert the text information in the image into a text format. The resulting first text contains a first string that was originally represented by multiple lines. However, because OCR recognition follows the line breaks in the image, the first string is incorrectly recognized as being in a multi-line format. For example, "https: / / example.com / a\rlong-url" is recognized as two lines: "https: / / example.com / a" and "long-url."

[0039] Step S203 : Using the intention understanding model, the first character string in the first text is converted into a second character string represented by a single line to obtain a second text, and the second text is converted into a target image.

[0040] In step S203, after obtaining the first text, the pre-trained intent understanding model is used to perform secondary processing on the first text. The intent understanding model can understand the specific context and semantics in the penetration test report. For example, the model recognizes that "https: / / example.com / a" and the "long-url" on the next line are actually two parts of the same URL. Therefore, the intent understanding model will merge these two parts into a complete string, namely the second string "https: / / example.com / along-url", and correct similar characters (such as the number "0" and the letter "O") to ensure the accuracy of the text. The second text obtained will contain complete information that has been optimized and edited, and the second text will then be converted into a target image to facilitate feature comparison in the next step.

[0041] Among them, the above-mentioned intent understanding model includes but is not limited to a large language model.

[0042] Step S204 , performing feature extraction on the image to be identified to obtain a first feature vector, and performing feature extraction on the target image to obtain a second feature vector.

[0043] As some optional embodiments of the present application, step S204 can be implemented by the following method: using a pre-trained deep learning model to perform feature extraction on the image to be identified, and obtain the first text feature in the image to be identified; performing one-dimensional processing on the first text feature to obtain a first initial feature sequence; using a first normalization factor to normalize the first initial feature sequence to obtain a first feature vector; using a pre-trained deep learning model to perform feature extraction on the target image, and obtain the second text feature in the target image; performing one-dimensional processing on the second text feature to obtain a second initial feature sequence; using a second normalization factor to normalize the second initial feature sequence to obtain a second feature vector.

[0044] In step S204, the sizes and number of color channels of the image to be identified and the target image are first determined. For example, assume the image to be identified has a height of H1, a width of W1, and a number of channels of C1; while the target image has a height of H2, a width of W2, and a number of channels of C2. It should be noted that the different sizes and number of channels of the image to be identified and the target image do not affect the vectorization operation.

[0045] For the image to be recognized, its dimension d1 = H1 × W1 × C1 is calculated. For the target image, its dimension d2 = H2 × W2 × C2 is calculated.

[0046] Apply the vectorization operation vec to convert the image data from R^(H×W×C) to R^(HWC). For the image to be recognized: apply vec(I) to expand the image I into a vector, where I∈R^(H1×W1×C1). For the target image: apply vec(J) to expand the image J into a vector, where J∈R^(H2×W2×C2).

[0047] For the image to be recognized, multiply the vectorized image data by the normalization factor α, resulting in V1 = α * vec(I). For the target image, perform the same operation, resulting in V2 = α * vec(J). The normalization factor α = 1 / 255 is used to control the range of the image data, ensuring that all pixel values ​​are between 0 and 1.

[0048] After the above steps, the image to be identified and the target image are respectively converted into one-dimensional feature vectors, the first feature vector V1 and the second feature vector V2, where V1∈R^(d1) and V2∈R^(d2).

[0049] Step S205 : determining the similarity between the first feature vector and the second feature vector, and displaying the second text when the similarity is greater than a preset threshold.

[0050] In step S205, the similarity between the first eigenvector and the second eigenvector is calculated. If the calculated similarity is greater than a preset threshold (e.g., 60%), the second text is deemed to be highly consistent with the text in the original image, and the second text, i.e., the optimized penetration test report information, is displayed.

[0051] To implement the above steps, assume the image to be recognized is a penetration test report containing a URL split due to line breaks: "https: / / www.example.com / long\rlong-test-url." After OCR recognition, the URL is incorrectly recognized as two lines: "https: / / www.example.com / long" and "long-test-url." Next, the intent understanding model kicks in. By analyzing the context, it understands that this is a complete URL and should be recognized as a single line. It also checks for any character recognition errors. The model merges the two lines of text into a single line and correctly outputs: "https: / / www.example.com / longlong-test-url." The optimized text is then converted into a target image. Feature vectors are extracted from the target and the image to be recognized, and similarity is calculated using a pre-trained deep learning model. If the similarity exceeds a preset threshold, the optimized second text, representing the complete and correct URL, is displayed, ensuring that subsequent security analysis and vulnerability management processes are based on accurate data.

[0052] Based on the above steps, we can see that this application significantly improves the accuracy of OCR recognition in the process of generating penetration test reports by combining AI technology with OCR recognition technology. The specific technical effects are mainly reflected in the following aspects:

[0053] Improve penetration testing efficiency: Through automated and intelligent image preprocessing, feature extraction, model training and selection, post-processing, and model evaluation and optimization, manual intervention can be greatly reduced, improving the overall efficiency of penetration testing.

[0054] Enhanced test report accuracy: By improving the accuracy of OCR recognition, the text information in the penetration test report can be ensured to be accurate, providing a reliable data foundation for subsequent automated vulnerability remediation and security reinforcement.

[0055] Strong adaptability: Leveraging the adaptive capabilities of AI technology, it can process images of different qualities, layouts, and fonts, making it suitable for various complex penetration testing scenarios.

[0056] The following Figure 2 The steps shown are exemplified and explained.

[0057] According to some optional embodiments of the present application, the steps performed from step S202 to step S205 can be integrated into the AI ​​review module and deployed in actual business scenarios, such as Figure 3 As shown in the figure, after OCR recognition, an AI review module is introduced to perform in-depth processing and verification of the recognition results. The AI ​​review module leverages deep learning technology, specifically intent understanding models, to perform semantic and contextual analysis of the text, identifying and correcting OCR errors, such as reassembling fragmented URLs or IP addresses and correcting misidentification of similar characters. By integrating the AI ​​review module into the vulnerability scanning process, intelligent review and correction of OCR results are achieved. This improvement significantly improves the accuracy and usability of penetration testing reports, as the AI ​​review module not only corrects punctuation and character errors in OCR recognition but also performs logical verification through contextual understanding to ensure the coherence and semantic correctness of the information. For example, the IP addresses "192." and "168.0.2 / 32," originally incorrectly recognized as two lines by OCR, are then recognized and reassembled into the correct single-line format "192.168.0.2 / 32" by the AI ​​review module. This correction is critical to subsequent vulnerability management, security analysis, and automated remediation processes, ensuring that these platforms can operate based on accurate information and avoid analytical bias or ineffective responses due to data errors.

[0058] Figure 4 This is a schematic diagram of the processing flow of an AI review module according to an embodiment of the present application. Figure 4 As shown, the AI ​​review module is used to perform the following steps:

[0059] 1. Upload an image file of the penetration test report. This document contains key network security information, such as IP addresses, URLs, domain names, etc. It is presented in image format and needs to be converted to text using OCR technology.

[0060] 2.1. Recognize and convert text in images into text format. However, due to factors such as image quality, text layout, and font, OCR recognition results may have problems such as sentence segmentation errors and character recognition errors.

[0061] 2.2. Although the text information generated after OCR recognition has been converted from an image to an editable text format, it may contain errors and formatting issues and requires further processing to improve its accuracy and usability.

[0062] 2.3. The AI ​​review module receives text generated by OCR and automatically detects and corrects text areas using a deep learning model to ensure the integrity of the text structure. Subsequently, it uses natural language processing (NLP) technology to edit and optimize the text, including but not limited to fixing line break errors, correcting character recognition errors (such as misidentifying an "O" as a "0"), and making necessary additions and adjustments based on contextual logic to improve the text's coherence and accuracy.

[0063] 2.4. Get the optimized text.

[0064] 2.5. Regenerate the optimized text into an image and generate an image feature vector.

[0065] 3.1. Extract features from input images.

[0066] 3.2. Generate image features.

[0067] 4. The optimized text is converted into a feature vector. Simultaneously, the original image is also processed through the AI ​​review module to generate a feature vector. The two sets of feature vectors are compared for similarity. If the similarity exceeds a preset threshold (e.g., 60%), the AI ​​processing result is considered highly consistent with the original image content, and the optimized text can be output.

[0068] 5. After the AI ​​review module completes the processing and verifies the accuracy of the results through feature vector comparison, it will output the final optimized text. This text has higher accuracy and better formatting than the initial OCR recognition results.

[0069] According to other optional embodiments of the present application, the intent understanding model is trained by the following method: extracting a target paragraph from a target text, wherein the target text includes: a request for comment document question and answer text, an Internet Protocol address format question and answer text, a Uniform Resource Locator standard format question and answer, and a security professional question and answer text; the target paragraph includes a first target string represented by multiple lines, and the first target string is divided into multiple lines after optical character recognition; determining a second target string represented by a single line corresponding to the first target string; marking the first target string as a negative sample and the second target string as a positive sample, and training the initial intent understanding model through the positive and negative sample pairs, and obtaining the intent understanding model when the preset training stop conditions are met.

[0070] In the above embodiment, relevant paragraphs are first selected and extracted from a large amount of target text. The target text includes but is not limited to request comment document question and answer text, IP address format question and answer text, URL standard format question and answer, and security professional question and answer text. The information in these texts has certain formats and rules. Especially in the field of network security, such as penetration test reports, the target text can provide the diverse scenarios and contexts required for model training. The target paragraph contains at least one first target string. Because this string is too long, it may be designed to be represented by multiple lines in the original document to adapt to the page layout. For example, an IP address "192.168.0.2 / 32" may be divided into two lines: "192." and "168.0.2 / 32".

[0071] Next, we determine the second target string corresponding to the first target string. This string is a complete single-line representation of the information. For example, we combine the two lines of information described above into a single, correct, and uniquely formatted string: "192.168.0.2 / 32." We label the first target string (the segmented, multi-line string) as a negative sample, and the second target string (the unsegmented, single-line string, i.e., the correct format) as a positive sample. This labeling of positive and negative samples helps the model learn the correct information integration and format restoration rules during training.

[0072] These positive and negative examples are used to train the initial intent understanding model. This training process includes iterative model optimization, parameter adjustment, and dynamic learning rate adjustment. This ensures the model can identify errors from negative examples and learn strategies for recovering a single, complete string from multiple lines of information, thereby improving its ability to process documents like penetration test reports.

[0073] on the other hand, Figure 5 is a training diagram of an intent understanding model according to an embodiment of the present application, such as Figure 5 As shown, the above intention understanding model can also be trained by the following method.

[0074] First, we acquired a dataset consisting of questions and answers about RFC documents, IP address formats, URL standard formats, and security professional Q&A text. Each type of data provided the model with knowledge and rules about common elements in penetration test reports, covering a wide range of possible text formats and security terminology.

[0075] Secondly, we chose the distilled DeepSeek-R1-7B model as our foundation. This model is a large pre-trained language model that demonstrates outstanding performance on a variety of natural language processing tasks. Through the distillation process, we extract smaller yet equally efficient models from the larger model, maintaining high accuracy while reducing resource consumption.

[0076] Third, the initial model needs to be fine-tuned to optimize it for the characteristics of penetration test reports. Fine-tuning training is a task-specific training process based on pre-training. By learning from a large amount of labeled training data, the model parameters are adjusted to make it more suitable for the target task, namely, identifying and repairing the specific formats in penetration test reports. Specifically, the model first performs self-supervised learning, learning document structure, language patterns, and common error patterns by predicting the obscured portions of the input data. The model is then further trained using manually labeled data, which contains examples of various formatting errors and common misleading information, such as incorrectly segmented URLs and IP addresses. During the supervised learning phase, the model updates its weight parameters through a backpropagation algorithm, learning how to correctly identify and correct these errors.

[0077] Finally, after fine-tuning training is complete, model performance is evaluated through testing. The test data should differ from the training data to verify the model's generalization capabilities. The testing process examines metrics such as the model's accuracy in recognizing format errors, its ability to correct errors, and its adaptability to emerging errors. Once the model passes testing and meets pre-set performance standards, it is output as the final intent understanding model. At this point, the model can effectively identify and correct common formatting errors found in penetration test reports, such as line break segmentation in URLs and confusion between letters and numbers in IP addresses.

[0078] Figure 6 is a schematic diagram of a model fine-tuning test according to an embodiment of the present application, such as Figure 6 As shown, after fine-tuning, test the model and input the following document:

[0079] The IP address is 192.168.\r\n / / The first line, where \r\n is a line break character;

[0080] O.1 / 32\r\n / / The second line, where O is the capital letter o;

[0081] Through model inference, the two-line document is adjusted to one-line document to output the following content:

[0082] The IP address is 192.168.0.1 / 32.

[0083] According to some optional embodiments of the present application, using an intention understanding model to convert a first character string in a first text into a second character string represented by a single line to obtain a second text can be achieved by the following method: using an intention understanding model to convert the first character string in the first text into a second character string represented by a single line, identifying and replacing abnormal characters in the second character string, wherein the abnormal characters are variant characters corresponding to preset characters; and re-editing the second character string according to a preset template to obtain a second text.

[0084] For example, the intent understanding model receives the first text recognized by OCR. The text contains multiple lines of information. In particular, when processing long URLs, IP addresses, or other continuous strings, the information that should be on one line is separated by line breaks. The intent understanding model uses semantic understanding of the text content to identify which strings should be merged into a single line, thereby converting the first string into the second string. For example, it can recognize that the two lines "IP address is 192." and "168.0.2 / 32" are actually the same complete IP address, so it merges them into a single line "IP address is 192.168.0.2 / 32".

[0085] Next, the model identifies unusual characters in the second string. These are variant characters that are easily confused with the intended characters, such as the uppercase letter 'O' and the numeral '0'. By learning patterns from the training data, the model can distinguish reasonable character configurations within the context. When encountering a suspected unusual character, it determines the most likely correct form based on the context and pre-set rules and replaces it. For example, the letter 'O' in the incorrect "IP address is 192.0168.0.2 / 32" is automatically replaced with the numeral '0', correcting it to "IP address is 192.0168.0.2 / 32."

[0086] Finally, the second string is re-edited according to a pre-set text format template to ensure that the output second text follows a unified standard and format, facilitating processing by subsequent modules. For example, all IP addresses and URLs are arranged according to a standard format, ensuring that each piece of information has a clear title and category. Furthermore, the model checks the text structure for completeness, such as missing key fields or grammatical errors, and makes necessary additions or corrections to ensure the integrity and standardization of the output information.

[0087] In some optional embodiments of the present application, the image to be identified is a penetration test report of a target network system, and the penetration test report includes at least one of the following character strings: Internet Protocol address, domain name, uniform resource locator; after displaying the second text, the following steps can also be performed: sending the second text to the target platform, wherein the target platform includes at least one of the following: security scanning platform, security penetration platform, work order management platform; receiving a response message to the second text sent by the target platform, wherein the response message is used to indicate the correctness of the second text; based on the response message, adding a tag to the second text to obtain the target text, and optimizing the model parameters of the intent understanding model through the target text.

[0088] Furthermore, when the number of received target response messages is greater than a first preset threshold, the preset threshold is increased according to a preset ratio, wherein the target response message is used to indicate that an error exists in the second text.

[0089] In the above embodiment, the optimized second text is sent to a security-related platform of the target network system, such as a security scanning platform, a security penetration platform, or a work order management platform. These platforms are responsible for receiving key information from the penetration test report and taking corresponding actions, such as further analyzing vulnerabilities, planning remediation strategies, or recording work order status. The target platform analyzes the second text and, based on its own verification mechanisms and rules, determines the accuracy and completeness of the information. If there are errors or omissions in the second text, the platform will send a response message indicating the specific location and nature of the error so that it can be corrected in a timely manner.

[0090] After receiving the response message from the target platform, tags are added to the corresponding locations in the second text to mark the information that has been confirmed as erroneous. These tags not only facilitate manual review but also serve as feedback signals to optimize the parameters of the intent understanding model. By analyzing the labeled second text, the intent understanding model can identify its own misjudgments or shortcomings and adjust the model parameters to improve its recognition of specific error types.

[0091] It is worth noting that once it is found that the number of response messages is too large, the first threshold is automatically increased according to the preset ratio, which serves as a trigger condition to prompt the model to perform more detailed self-inspection and parameter adjustment.

[0092] Specifically, when the cumulative number of received target response messages exceeds a first preset threshold, this is considered a warning signal, indicating that the model's generated second text contains numerous errors or deficiencies, impacting the platform's subsequent normal workflow. In this case, the first preset threshold is automatically increased by a preset percentage. For example, if the threshold is set at 10%, then each time the trigger condition is met, the threshold will increase by 10% of its current value. This mechanism ensures that sensitivity to receiving error feedback gradually increases over time, prompting the model to prioritize the quality of generated text. By dynamically adjusting the threshold, the intent understanding model can prioritize the quality and accuracy of generated text after receiving a certain number of error feedbacks, avoiding the continuous consumption of feedback resources due to frequent minor errors. Over time, as feedback accumulates, the increase in the preset threshold forces the model to achieve higher accuracy standards when handling the same type of task to avoid triggering the threshold adjustment mechanism. This in turn forces the model to continuously learn and optimize until the generated text reduces the number of error feedbacks and reaches or approaches higher quality standards.

[0093] In some optional embodiments of the present application, the above-mentioned image processing method also includes the following steps: when the similarity is not greater than a preset threshold, re-performing optical character recognition on the image to be recognized to obtain a first text, re-using the intention understanding model to convert the first character string in the first text into a second character string represented by a single line to obtain a second text, and converting the second text into a target image; re-performing feature extraction on the image to be recognized to obtain a first feature vector, performing feature extraction on the target image to obtain a second feature vector; and re-determining the similarity between the first feature vector and the second feature vector until the similarity is greater than the preset threshold.

[0094] Figure 7 is a structural diagram of an image processing device according to an embodiment of the present application, such as Figure 7 As shown, the device includes:

[0095] The receiving module 71 is configured to receive an image to be recognized, wherein the image to be recognized at least includes a first character string represented by multiple lines.

[0096] The recognition module 72 is configured to perform optical character recognition on the image to be recognized to obtain a first text, wherein the first text at least includes a first character string.

[0097] The conversion module 73 is configured to convert a first character string in the first text into a second character string represented by a single line using an intention understanding model to obtain a second text, and convert the second text into a target image.

[0098] The extraction module 74 is used to perform feature extraction on the image to be identified to obtain a first feature vector, and to perform feature extraction on the target image to obtain a second feature vector.

[0099] The display module 75 is configured to determine the similarity between the first feature vector and the second feature vector, and display the second text when the similarity is greater than a preset threshold.

[0100] Optionally, the intent understanding model is trained by the following method: extracting a target paragraph from a target text, wherein the target text includes: a request for comment document question and answer text, an Internet Protocol address format question and answer text, a Uniform Resource Locator standard format question and answer, and a security professional question and answer text; the target paragraph includes a first target string represented by multiple lines, and the first target string is divided into multiple lines after optical character recognition; determining a second target string represented by a single line corresponding to the first target string; marking the first target string as a negative sample and the second target string as a positive sample, and training the initial intent understanding model through the positive and negative sample pairs, and obtaining the intent understanding model when the preset training stop conditions are met.

[0101] Optionally, the conversion module 73 is also used to perform the following steps: using the intention understanding model to convert the first string in the first text into a second string represented by a single line, identifying and replacing abnormal characters in the second string, wherein the abnormal characters are variant characters corresponding to preset characters; and re-editing the second string according to the preset template to obtain a second text.

[0102] Optionally, the image to be identified is a penetration test report of a target network system, and the penetration test report includes at least one of the following character strings: an Internet Protocol address, a domain name, and a uniform resource locator.

[0103] The image processing device is also used to perform the following steps after displaying the second text: sending the second text to a target platform, wherein the target platform includes at least one of the following: a security scanning platform, a security penetration platform, and a work order management platform; receiving a response message to the second text sent by the target platform, wherein the response message is used to indicate the correctness of the second text; based on the response message, adding a tag to the second text to obtain a target text, and optimizing the model parameters of the intent understanding model through the target text.

[0104] Optionally, the image processing device is further configured to perform the following steps: when the number of received target response messages is greater than a first preset threshold, increase the preset threshold according to a preset ratio, wherein the target response message is used to indicate that there is an error in the second text.

[0105] Optionally, the extraction module 74 is also used to perform the following steps: use a pre-trained deep learning model to perform feature extraction on the image to be identified, and obtain a first text feature in the image to be identified; perform one-dimensional processing on the first text feature to obtain a first initial feature sequence; use a first normalization factor to normalize the first initial feature sequence to obtain a first feature vector; use a pre-trained deep learning model to perform feature extraction on the target image, and obtain a second text feature in the target image; perform one-dimensional processing on the second text feature to obtain a second initial feature sequence; use a second normalization factor to normalize the second initial feature sequence to obtain a second feature vector.

[0106] Optionally, the image processing device is also used to perform the following steps: when the similarity is not greater than a preset threshold, re-performing optical character recognition on the image to be recognized to obtain a first text, re-using the intention understanding model to convert a first character string in the first text into a second character string represented by a single line to obtain a second text, and converting the second text into a target image; re-performing feature extraction on the image to be recognized to obtain a first feature vector, performing feature extraction on the target image to obtain a second feature vector; and re-determining the similarity between the first feature vector and the second feature vector until the similarity is greater than the preset threshold.

[0107] It should be noted that the above Figure 7 Each module in the embodiment can be a program module (for example, a set of program instructions that implement a specific function) or a hardware module. For the latter, it can be expressed in the following forms, but is not limited to this: each of the above modules is expressed in the form of a processor, or the functions of each of the above modules are implemented by a processor.

[0108] It should be noted that Figure 7 The preferred implementation of the embodiment shown can be found in Figure 2 The relevant description of the illustrated embodiment will not be repeated here.

[0109] Figure 8 FIG1 shows a hardware structure block diagram of a computer terminal for implementing an image processing method. Figure 8 As shown, the computer terminal 80 may include one or more (802a, 802b, ..., 802n are used to illustrate) processors 802 (the processor 802 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 804 for storing data, and a transmission module 806 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 8 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 8 More or fewer components than shown, or with Figure 8 Different configurations shown.

[0110] It should be noted that the one or more processors 802 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 80. As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0111] The memory 804 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image processing method in the embodiment of the present application. The processor 802 executes various functional applications and data processing by running the software programs and modules stored in the memory 804, that is, implementing the above-mentioned image processing method. The memory 804 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 804 may further include a memory remotely located relative to the processor 802, and these remote memories may be connected to the computer terminal 80 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0112] The transmission module 806 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 80. In one embodiment, the transmission module 806 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission module 806 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0113] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 80 .

[0114] It should be noted that, in some optional embodiments, the above Figure 8The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. Figure 8 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0115] It should be noted that Figure 8 The computer terminal shown is used to execute Figure 2 The image processing method shown in the figure, therefore the relevant explanations in the execution method of the above command are also applicable to the electronic device and will not be repeated here.

[0116] An embodiment of the present application further provides a non-volatile storage medium, which includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the above image processing method.

[0117] A program for a non-volatile storage medium to perform the following functions: receiving an image to be recognized, wherein the image to be recognized includes at least: a first character string represented by multiple lines; performing optical character recognition on the image to be recognized to obtain a first text, wherein the first text includes at least: a first character string; using an intent understanding model to convert the first character string in the first text into a second character string represented by a single line to obtain a second text, and converting the second text into a target image; performing feature extraction on the image to be recognized to obtain a first feature vector, performing feature extraction on the target image to obtain a second feature vector; determining the similarity between the first feature vector and the second feature vector, and displaying the second text when the similarity is greater than a preset threshold.

[0118] An embodiment of the present application further provides an electronic device, comprising: a memory and a processor, wherein the processor is configured to run a program stored in the memory, wherein the above image processing method is executed when the program is run.

[0119] The processor is used to run a program that performs the following functions: receiving an image to be recognized, wherein the image to be recognized includes at least: a first character string represented by multiple lines; performing optical character recognition on the image to be recognized to obtain a first text, wherein the first text includes at least: a first character string; using an intention understanding model to convert the first character string in the first text into a second character string represented by a single line to obtain a second text, and converting the second text into a target image; performing feature extraction on the image to be recognized to obtain a first feature vector, performing feature extraction on the target image to obtain a second feature vector; determining the similarity between the first feature vector and the second feature vector, and displaying the second text when the similarity is greater than a preset threshold.

[0120] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0121] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0122] In the above-mentioned embodiments of the present application, the collected information is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary protection measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0123] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0124] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0125] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0126] If the integrated unit is implemented 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 technical solution of the present application is essentially or the part that contributes to the relevant technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0127] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. An image processing method, characterized in that: include: receiving an image to be recognized, wherein the image to be recognized at least includes: a first character string represented by multiple lines; Performing optical character recognition on the image to be recognized to obtain a first text, wherein the first text at least includes: the first character string; Using an intent understanding model, converting the first character string in the first text into a second character string represented by a single line to obtain a second text, and converting the second text into a target image; Performing feature extraction on the image to be identified to obtain a first feature vector, and performing feature extraction on the target image to obtain a second feature vector; The similarity between the first feature vector and the second feature vector is determined, and when the similarity is greater than a preset threshold, the second text is displayed.

2. The method according to claim 1, characterized in that The intent understanding model is trained using the following method: Extracting a target paragraph from a target text, wherein the target text includes: a question-and-answer text of a request for comment document, a question-and-answer text in an Internet Protocol address format, a question-and-answer text in a Uniform Resource Locator standard format, or a security professional question-and-answer text; the target paragraph includes a first target character string represented by multiple lines, and the first target character string is segmented into the multiple lines after optical character recognition; determining a second target character string represented by a single line corresponding to the first target character string; The first target character string is labeled as a negative sample, and the second target character string is labeled as a positive sample. The initial intent understanding model is trained using the positive and negative sample pairs, and the intent understanding model is obtained when a preset training stop condition is met.

3. The method according to claim 1, characterized in that The first character string in the first text is converted into a second character string represented by a single line using an intent understanding model to obtain a second text, including: The first character string in the first text is converted into the second character string represented by a single line using the intention understanding model, abnormal characters in the second character string are identified and replaced, wherein the abnormal characters are variant characters corresponding to preset characters; and the second character string is re-edited according to a preset template to obtain the second text.

4. The method according to claim 1, wherein include: The image to be identified is a penetration test report of a target network system, wherein the penetration test report includes at least one of the following character strings: an Internet Protocol address, a domain name, and a uniform resource locator; After displaying the second text, the method further includes: Sending the second text to a target platform, wherein the target platform includes at least one of the following: a security scanning platform, a security penetration platform, and a work order management platform; receiving a response message to the second text sent by the target platform, wherein the response message is used to indicate the correctness of the second text; Based on the response message, a tag is added to the second text to obtain a target text, and the model parameters of the intent understanding model are optimized using the target text.

5. The method according to claim 4, characterized in that The method further includes: when the number of received target response messages is greater than a first preset threshold, increasing the preset threshold according to a preset ratio, wherein the target response message is used to indicate that an error exists in the second text.

6. The method according to claim 1, characterized in that Performing feature extraction on the image to be identified to obtain a first feature vector, and performing feature extraction on the target image to obtain a second feature vector, including: Extracting features from the image to be identified using a pre-trained deep learning model to obtain a first text feature in the image to be identified; performing one-dimensional processing on the first text feature to obtain a first initial feature sequence; and normalizing the first initial feature sequence using a first normalization factor to obtain a first feature vector. A pre-trained deep learning model is used to extract features of the target image to obtain a second text feature in the target image; the second text feature is one-dimensionalized to obtain a second initial feature sequence; and the second initial feature sequence is normalized using a second normalization factor to obtain a second feature vector.

7. The method according to claim 1, characterized in that The method further comprises: If the similarity is not greater than the preset threshold, re-performing optical character recognition on the image to be recognized to obtain a first text, re-using the intent understanding model to convert the first character string in the first text into a second character string represented by a single line to obtain a second text, and converting the second text into a target image; re-performing feature extraction on the image to be recognized to obtain a first feature vector, and re-performing feature extraction on the target image to obtain a second feature vector; The similarity between the first feature vector and the second feature vector is re-determined until the similarity is greater than the preset threshold.

8. An image processing device, characterized in that: include: A receiving module is configured to receive an image to be identified, wherein the image to be identified at least includes: a first character string represented by multiple lines; a recognition module, configured to perform optical character recognition on the image to be recognized to obtain a first text, wherein the first text at least includes: the first character string; a conversion module, configured to convert the first character string in the first text into a second character string represented by a single line using an intent understanding model to obtain a second text, and convert the second text into a target image; An extraction module, configured to perform feature extraction on the image to be identified to obtain a first feature vector, and perform feature extraction on the target image to obtain a second feature vector; The display module is configured to determine the similarity between the first feature vector and the second feature vector, and display the second text when the similarity is greater than a preset threshold.

9. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute the image processing method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: A memory and a processor, wherein the processor is configured to run a program stored in the memory, wherein the image processing method according to any one of claims 1 to 7 is executed when the program is run.

11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 7 is implemented.