A feature extraction method and device based on a recognition model, equipment and medium
By performing text recognition and classification on case file images and generating feature maps using a recognition model, the problem of low efficiency and accuracy in case file feature extraction in existing technologies is solved, achieving efficient and accurate feature extraction and visualization.
Patent Information
- Application Number
- CN202511560831.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-10-29
AI Technical Summary
Existing methods for extracting features from case files suffer from low extraction efficiency and accuracy.
By performing text recognition on images of target case files, title keywords and text categories are determined. Then, by combining similarity calculation and recognition models, feature maps are generated.
It improves the accuracy and reliability of case file text segment classification, reduces false positives and false negatives, and achieves efficient feature extraction and visualization.
Smart Images

Figure CN121053665B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of case file data processing technology, and in particular to a feature extraction method, apparatus, device and medium based on a recognition model. Background Technology
[0002] Case files are complete collections of all documents and materials in a judicial case, including transcripts, photos, reports, documents, and other information from the entire process. These case file materials are usually in unstructured forms such as scanned images, and the amount of information is too large, resulting in slow case file processing efficiency. By extracting features from unstructured case file data, key feature data of the case file can be quickly identified, thereby improving processing efficiency and highlighting core information.
[0003] Existing methods for feature extraction from case files generally involve natural annotation, or the use of natural language processing (NLP) and large language modeling (LLM) techniques to extract textual information from case files, thereby processing the text content after OCR detection.
[0004] However, existing methods for feature extraction from case files suffer from low extraction efficiency and accuracy. Summary of the Invention
[0005] This application provides a feature extraction method, apparatus, device, and medium based on a recognition model to solve the problems of low extraction efficiency and accuracy in existing feature extraction methods for case files.
[0006] Firstly, this application provides a feature extraction method based on a recognition model, the method comprising:
[0007] Text recognition is performed on the images of the target case file to obtain multiple target case file text segments, and semantic segmentation is performed on the text titles of each target case file text segment to obtain multiple title keywords;
[0008] Based on the title keywords and the category keywords corresponding to each text category, determine the first text category corresponding to the target case file text segment and its corresponding first category value, and calculate the similarity between the target case file text segment and each text category to obtain the second text category corresponding to the target case file text segment and its corresponding second category value;
[0009] Based on the first text category, the first category value, the second text category, and the second category value, determine the target text category corresponding to the target file text segment, and determine the corresponding target prompt words based on the target text category;
[0010] Based on the recognition model and target prompts, feature extraction is performed on the image of the target file to obtain target features. Then, based on the execution logic between each target feature, the corresponding feature map is generated.
[0011] In some embodiments of this application, text recognition is performed on the image of the target file to obtain multiple target file text segments, including:
[0012] The original file image is resized according to the preset size, and then the resized original file image is denoised and contrast enhanced to obtain the image of the target file.
[0013] Text recognition is performed on the image of the target file to obtain multiple initial file text segments. Based on the text format corresponding to each initial file text segment, the initial file text segments with the same text format are merged to obtain the target file text segment.
[0014] In some embodiments of this application, determining the first text category corresponding to the target file text segment and its corresponding first category value based on the title keywords and the category keywords corresponding to each text category includes:
[0015] Based on the category keywords corresponding to each text category, keyword matching is performed on the title keywords to obtain the target keywords in the title keywords that match the category keywords, and the target number of target keywords and the number of keywords in the title keywords are determined.
[0016] The category value for each text category is determined based on the ratio of the target quantity to the keyword quantity.
[0017] By comparing the values of each category, the target category value with the largest value is obtained, and the target category value is determined to be the first category value, and the text category corresponding to the first category value is determined to be the first text category.
[0018] In some embodiments of this application, similarity calculations are performed on the target file text segment and each text category to obtain the second text category corresponding to the target file text segment and its corresponding second category value, including:
[0019] Determine the preset case file text segments corresponding to each text category, and calculate the similarity based on the text vectors corresponding to each preset case file text segment and the text vectors corresponding to the target case file text segment to obtain the similarity value between the target case file text segment and each text category.
[0020] By comparing each similarity value, the target similarity value with the largest value is obtained, and the target similarity value is determined to be the second category value, and the text category corresponding to the second category value is determined to be the second text category.
[0021] In some embodiments of this application, determining the target text category corresponding to the target file text segment based on a first text category, a first category value, a second text category, and a second category value includes:
[0022] Determine whether the first text category and the second text category are the same;
[0023] If so, then the target text category is determined to be the text category corresponding to the first text category and the second text category;
[0024] If not, then the first category value and the second category value are weighted according to the preset weights corresponding to the first category value and the second category value, respectively, to obtain the first target category value corresponding to the first category value and the second target category value corresponding to the second category value;
[0025] The text category corresponding to the largest value among the first and second target category values is determined as the target text category.
[0026] In some embodiments of this application, before determining the corresponding target prompt word based on the target text category, the method further includes:
[0027] Determine the preset case file image and at least one preset prompt word corresponding to each text category, and determine the target features corresponding to the preset case file image based on the recognition model and the preset prompt word;
[0028] Based on the feature characters corresponding to the target features and the preset character rules, determine whether the feature characters satisfy the preset character rules;
[0029] If so, the preset prompt words are determined to be the standard prompt words corresponding to the text category, and similar words are generated from the standard prompt words to obtain multiple target prompt words;
[0030] If not, then the preset prompt word is not a standard prompt word.
[0031] In some embodiments of this application, a corresponding feature map is generated based on the execution logic between various target features, including:
[0032] Each target feature is identified as a corresponding feature node, and the feature nodes are connected according to the execution logic to obtain the initial map.
[0033] Based on the recognition model, the image coordinates corresponding to the target features in the image of the target file are determined, and the image coordinates and the corresponding feature nodes are connected to obtain the feature map.
[0034] Secondly, this application provides a feature extraction device based on a recognition model, the device comprising:
[0035] The recognition module is used to perform text recognition on the images of the target case file, obtain multiple target case file text segments, and perform semantic segmentation on the text titles of each target case file text segment to obtain multiple title keywords;
[0036] The calculation module is used to determine the first text category and its corresponding first category value of the target case file text segment based on the title keywords and the category keywords corresponding to each text category, and to calculate the similarity between the target case file text segment and each text category to obtain the second text category and its corresponding second category value of the target case file text segment.
[0037] The determination module is used to determine the target text category corresponding to the target file text segment based on the first text category, the first category value, the second text category, and the second category value, and to determine the corresponding target prompt words based on the target text category;
[0038] The extraction module is used to extract features from the image of the target file based on the recognition model and target prompt words, obtain target features, and generate corresponding feature maps according to the execution logic between each target feature.
[0039] Thirdly, this application provides an apparatus, including: a processor, and a memory communicatively connected to the processor;
[0040] The memory stores the instructions that the computer executes;
[0041] The processor executes computer execution instructions stored in memory to implement the method of this application.
[0042] Fourthly, this application provides a computer-readable storage medium storing program code, which, when executed by a processor, is used to implement the method of this application.
[0043] This application provides a feature extraction method, apparatus, device, and medium based on a recognition model. The method involves performing text recognition on an image of a target case file to obtain multiple target case file text segments, and semantically segmenting the text titles of each target case file text segment to obtain multiple title keywords. Based on the title keywords and category keywords corresponding to each text category, a first text category and its corresponding first category value are determined for each target case file text segment. Similarity calculations are then performed between the target case file text segment and each text category to obtain a second text category and its corresponding second category value. Based on the first text category, first category value, second text category, and second category value, a target text category is determined for each target case file text segment. Based on the target text category, corresponding target prompt words are determined. Based on the recognition model and target prompt words, feature extraction is performed on the image of the target case file to obtain target features. Finally, based on the execution logic between each target feature, a corresponding feature map is generated.
[0044] Thus, in application scenarios involving the processing of case file data, target case file text segments and text categories can be matched using title keywords. The first text category and its value are obtained based on the proportion of category keywords in the title keywords. The second text category and its value are determined through case file text segment similarity calculation. By combining keyword-based rule matching and vector-based semantic similarity analysis, the accuracy of text classification is ensured, effectively avoiding classification errors caused by title ambiguity or model misjudgment. This improves the reliability and accuracy of case file text segment classification and effectively reduces misjudgments and omissions. Simultaneously, target prompt words obtained from accurate target text category matching improve the accuracy of the recognition model when extracting features from target case file images, avoiding model extraction errors caused by mismatches between prompt words and text categories. Furthermore, the feature map generated based on the execution logic between target features transforms scattered target features into a logically related structured map, intuitively presenting the inherent connections between features. This facilitates subsequent feature tracing and clarifies the logical chain between case file feature elements, thus providing efficient data support and visualization tools. Attached Figure Description
[0045] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0046] Figure 1 A flowchart illustrating a feature extraction method based on a recognition model provided in an embodiment of this application;
[0047] Figure 2 A flowchart illustrating another feature extraction method based on a recognition model provided in this application embodiment;
[0048] Figure 3 A flowchart illustrating another feature extraction method based on a recognition model provided in this application embodiment;
[0049] Figure 4 A schematic diagram of a feature extraction device based on a recognition model provided in an embodiment of this application;
[0050] Figure 5 This is a structural block diagram of an apparatus for performing a feature extraction method based on a recognition model according to an embodiment of this application. Detailed Implementation
[0051] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0052] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0053] Figure 1 This is a flowchart illustrating a feature extraction method based on a recognition model, provided as an embodiment of this application. Figure 1 As shown, this feature extraction method based on a recognition model may include the following steps:
[0054] S110. Perform text recognition on the image of the target file to obtain multiple target file text segments, and perform semantic segmentation on the text title of each target file text segment to obtain multiple title keywords.
[0055] Among them, the target case file image refers to the case file image data that meets the image specifications after preprocessing the acquired original case file images, and is used for case file feature extraction; the case file image data is the original scanned image of the electronic case file, used for text recognition and feature extraction, and is mostly in JPG or PNG format, covering scanned copies of various types of evidence such as interrogation records, expert opinions, and on-site inspection photos.
[0056] Text recognition refers to converting text information (including printed and handwritten text) in images of target documents into corresponding text data for further analysis and processing. For example, it can be OCR detection. OCR (Optical Character Recognition) can convert text images on media such as pictures and scanned documents into text data that can be edited, searched, and processed by computers, thereby realizing the digitization, automated recognition, and information utilization of paper document content.
[0057] The target file text segment refers to the text segment obtained after identifying and extracting the text content from the image of the target file through text recognition. Each target file text segment satisfies the relative independence of semantics, that is, each target file text segment is a paragraph or content block with a single theme, logic and semantic completeness, so as to process complete text with the same semantics, thereby improving the accuracy of file text processing.
[0058] Semantic segmentation refers to breaking down a text title into its smallest lexical units that carry the core meaning based on sentence components and semantic expression, and extracting the keywords that best represent its meaning. For example, semantic segmentation of the text title "Zhang San's First Interrogation Record" can yield three keywords that constitute the text title: Zhang San, first time, and interrogation record. Semantic segmentation can be accomplished through a natural language processing model.
[0059] Based on this, text recognition is performed on images of target files that meet the image specifications to identify and extract text data from the images of the target files, resulting in multiple corresponding target file text segments. In order to further divide the text titles of each file text segment into keywords according to the sentence components and semantic meaning, the corresponding title keywords are obtained. The title keywords can represent the core meaning of the text title, and the text title carries the most core key content of a file text segment. Therefore, by determining the title keywords, the text category corresponding to the file text segment can be further determined based on the title keywords.
[0060] S120. Based on the title keywords and the category keywords corresponding to each text category, determine the first text category corresponding to the target case file text segment and its corresponding first category value, and calculate the similarity between the target case file text segment and each text category to obtain the second text category corresponding to the target case file text segment and its corresponding second category value.
[0061] The text category refers to the text type corresponding to the case file text segment, such as transcripts, expert reports, and seizure lists. Different categories of text have different semantic expressions, and therefore require different processing methods. Therefore, by determining the specific text category corresponding to each case file text segment, we can further perform targeted text processing on different categories of case file text segments, thereby improving accuracy.
[0062] Category keywords refer to the keywords corresponding to each text type. They are core keywords that are preset for each text category and can uniquely identify the category. For example, the category keywords for the interrogation record category are interrogation record, interrogated person, and interrogator; the category keywords for the expert opinion report category are expert opinion report, evidence identification, and conclusion expert.
[0063] The first text category refers to the text category corresponding to the target case file text segment, determined based on the title keywords and category keywords. For example, if the title keyword of the target case file text segment is "Zhang San's interrogation record," and the interrogation record completely matches the category keyword of the interrogation record category, then the first text category is "interrogation record." The first category value is a quantitative indicator that measures the degree of matching between the title keywords and the category keywords, and can be calculated based on the number of matched keywords.
[0064] The second text category refers to the text category corresponding to the target case file text segment, which is determined based on the text similarity calculation. The second category value is an index value that measures the degree of similarity between the target case file text segment and each text category, and the similarity calculation can be performed based on text vectors.
[0065] Similarity calculation refers to calculating the semantic association between the target dossier text segment and the preset dossier text segments corresponding to each text category.
[0066] Based on this, in order to determine the text category corresponding to each target file text segment, a dual determination can be made using both the title and the text content. By performing keyword matching on the title keywords and the category keywords corresponding to the text category, the first text category corresponding to the target file text segment and the first category value measuring the degree of matching are obtained. By calculating the similarity of the text content, the second text category and the second category value are obtained. In this way, title keyword matching and text similarity calculation determine the text category of the target file text segment from two dimensions. Keyword matching can improve the recognition speed, while text content can further improve the recognition accuracy. The combination of dual matching improves the processing efficiency and accuracy of file text.
[0067] S130. Based on the first text category, the first category value, the second text category, and the second category value, determine the target text category corresponding to the target file text segment, and determine the corresponding target prompt word based on the target text category.
[0068] The target text category is the text category corresponding to the target file text segment.
[0069] Target prompts are the prompts corresponding to the target text category. These prompts are the instruction text that guides the model when it receives input data. For example, "Please extract the following from the interrogation record: interrogation time, location, name of the person being questioned, name of the interrogator, recorder, and output in the format..." is a prompt text used by the model to identify and extract data. In practical applications, the output quality of the model is affected by the prompts. Without prompts or with poor-quality prompts, the model's output is random and unpredictable. By identifying the target prompts corresponding to the target text category, the prompts clearly define the instruction boundaries, allowing the model to avoid processing irrelevant information, shortening inference time, and providing targeted guidance to the model. This improves the quality of the model's output and enhances the accuracy of recognizing case file texts.
[0070] Based on this, the first text category and the first category value are determined by the title keywords and category keywords, while the second text category and the second category value are determined by text similarity calculation. By combining the first text category, the first category value, the second text category, and the second category value, the target text category corresponding to the target case file text segment can be determined from multiple dimensions, so as to achieve accurate classification of the case file text segment. Furthermore, the target prompt words corresponding to the target text category can be determined so that the model's recognition and output capabilities can be optimized based on the target prompt words, thereby improving the recognition accuracy of the case file text.
[0071] S140. Based on the recognition model and target prompt words, extract features from the image of the target file to obtain target features, and generate corresponding feature maps according to the execution logic between each target feature.
[0072] The recognition model refers to the model used to process case file image information, thereby realizing the data recognition and extraction of case file images. It can be a large visual multimodal model, such as Qwen-VL, InternVL, Qwen2.5-VL-72B and other models.
[0073] Target features refer to the case file features that meet actual needs, extracted from the image of the target case file by the recognition model. For example, if the actual requirement is "Please extract the following from the interrogation record: interrogation time, location, name of the person being questioned, name of the interrogator, and recorder, and output them in the format of...", then the corresponding target features are the specific data such as interrogation time, location, name of the person being questioned, name of the interrogator, and recorder extracted by the model from the image of the target case file.
[0074] Execution logic refers to the logical association rules between target features, thereby representing the relationship between various target features. For example, if person P participates in behavior A, then there is an execution logic of "participation" between P and A, and the two are logically related.
[0075] Feature mapping refers to a feature map of case file evidence constructed based on the target features extracted from the images of the target case file and according to the evidence correlation. By constructing a network of map relationships, the features of the case file can be visualized.
[0076] Based on this, a recognition model is determined, and target prompt words and images of target case files are input into the recognition model. The recognition model can then identify and extract the images of target case files based on the target prompt words, thereby obtaining the target features corresponding to the case file images. Furthermore, based on the execution logic relationship between each target feature, the corresponding feature map is determined to meet the actual requirements of users, realize the data recognition and extraction of case file images, and visualize the data.
[0077] Based on the feasible implementation of S110 described above, this application further provides text recognition of images of target files to obtain multiple target file text segments, including:
[0078] The original file image is resized according to the preset size, and then the resized original file image is denoised and contrast enhanced to obtain the image of the target file.
[0079] Text recognition is performed on the image of the target file to obtain multiple initial file text segments. Based on the text format corresponding to each initial file text segment, the initial file text segments with the same text format are merged to obtain the target file text segment.
[0080] The preset size refers to the pre-defined image size standard. In practical applications, the length and width of each image can be scaled to the size that best matches the model input (an integer multiple of 28), maintaining the original proportions and filling the edges to avoid deformation, and unifying the image resolution to 300 DPI, thereby ensuring clear image details.
[0081] Original case file images refer to scanned files of case files that have not undergone preprocessing. These images can be collected from electronic case file management systems. If the source file is in a non-image format such as PDF, it needs to be converted to an image using a format conversion tool. The content of original case file images includes original scanned copies of various types of judicial evidence such as interrogation records, expert opinions, and on-site inspection photos. However, they may have quality problems such as inconsistent sizes, scanning noise, and low contrast, so image preprocessing is required.
[0082] The initial case file text segment refers to the text unit that is directly output after OCR text recognition of the target case file image, without any merging processing.
[0083] Text format refers to the layout style characteristics of the initial case file text segments. In practical applications, initial case file text segments with the same semantic unit usually have the same text format. By matching the formats, scattered initial case file text segments can be merged into a logically complete target case file text segment. For example, initial case file text segments with the same format, such as "Interrogation time: May 10, 2024" and "Interrogation location: XX district", can be merged into the target case file text segment "Interrogation basic information". This avoids the mixing of texts with different semantics, ensures the semantic independence of the target case file text segment, and provides a structured text foundation for subsequent title recognition and keyword extraction.
[0084] Based on this, image preprocessing such as resizing, denoising, and contrast enhancement is performed on the original case file images to obtain target case file images that meet image specifications. Furthermore, the content of each initial case file text segment after text recognition is merged to obtain target case file text segments with the same semantics.
[0085] Based on the feasible implementation of S120 described above, this application further provides a method for determining the first text category corresponding to the target file text segment and its corresponding first category value based on the title keywords and the category keywords corresponding to each text category, including:
[0086] Based on the category keywords corresponding to each text category, keyword matching is performed on the title keywords to obtain the target keywords in the title keywords that match the category keywords, and the target number of target keywords and the number of keywords in the title keywords are determined.
[0087] The category value for each text category is determined based on the ratio of the target quantity to the keyword quantity.
[0088] By comparing the values of each category, the target category value with the largest value is obtained, and the target category value is determined to be the first category value, and the text category corresponding to the first category value is determined to be the first text category.
[0089] The target keyword refers to the keyword that is contained in both the title keyword and the category keyword of the text. For example, if the title keyword and the category keyword both contain the keyword A, then A is the target keyword.
[0090] The target quantity is the number of target keywords. For example, if the title keywords and category keywords all contain keywords A, B, and C, then the target quantity is 3.
[0091] The target category value refers to the category value with the largest numerical value among the category values corresponding to each text category.
[0092] Based on this, by determining the overlap between the category keywords and title keywords corresponding to each text category, that is, the number of keywords contained in both, the category value is obtained by the ratio of the target number of target keywords to the number of keywords in the text title. Furthermore, the target category value with the largest value is determined, thereby determining the first category value and the first text category.
[0093] Based on the feasible implementation of S120 described above, this application further provides a method for calculating the similarity between the target file text segment and each text category to obtain the second text category corresponding to the target file text segment and its corresponding second category value, including:
[0094] Determine the preset case file text segments corresponding to each text category, and calculate the similarity based on the text vectors corresponding to each preset case file text segment and the text vectors corresponding to the target case file text segment to obtain the similarity value between the target case file text segment and each text category.
[0095] By comparing each similarity value, the target similarity value with the largest value is obtained, and the target similarity value is determined to be the second category value, and the text category corresponding to the second category value is determined to be the second text category.
[0096] Among them, the preset dossier text segment refers to the representative standard text sample with the semantic features of each preset text category, which is constructed in advance.
[0097] Similarity value refers to a quantitative indicator obtained by calculating the degree of correlation between the text vector of a target case file text segment and the text vector of a preset case file text segment corresponding to a certain text category.
[0098] Based on this, the dossier text segments corresponding to each text category are determined. Then, the similarity between the dossier text segments that can represent the semantic features of the text category and the target dossier text segments is calculated to obtain the corresponding similarity values. In order to determine the value with the largest similarity value as the second category value, the corresponding second text category is determined.
[0099] Based on the feasible implementation of S130 described above, this application further provides a method for determining the target text category corresponding to a target file text segment based on a first text category, a first category value, a second text category, and a second category value, including:
[0100] Determine whether the first text category and the second text category are the same;
[0101] If so, then the target text category is determined to be the text category corresponding to the first text category and the second text category;
[0102] If not, then the first category value and the second category value are weighted according to the preset weights corresponding to the first category value and the second category value, respectively, to obtain the first target category value corresponding to the first category value and the second target category value corresponding to the second category value;
[0103] The text category corresponding to the largest value among the first and second target category values is determined as the target text category.
[0104] The preset weight refers to the weight coefficients set in advance for the first category value and the second category value. Through weighted calculation, the first category value and the second category value are brought to the same metric for numerical comparison. That is, the first target category value and the second target category value obtained after weighted calculation correspond to the same calculation scale, so they can be used for numerical comparison to determine the category value with the larger value, so as to determine the target category value and the corresponding target text category, thereby realizing the text classification of the target file text segment.
[0105] Based on this, after determining the first text category and the second text category, it is determined whether the two are consistent. If they are inconsistent, that is, the text categories calculated by the title keywords and text similarity are different, then the first category value and the second category value can be compared with the same metric by setting a weight, so as to determine the category value with the larger value, so as to determine the target category value and the corresponding target text category.
[0106] Based on the feasible implementation of S130 described above, this application further provides a method that includes, before determining the corresponding target prompt word according to the target text category:
[0107] Determine the preset case file image and at least one preset prompt word corresponding to each text category, and determine the target features corresponding to the preset case file image based on the recognition model and the preset prompt word;
[0108] Based on the feature characters corresponding to the target features and the preset character rules, determine whether the feature characters satisfy the preset character rules;
[0109] If so, the preset prompt words are determined to be the standard prompt words corresponding to the text category, and similar words are generated from the standard prompt words to obtain multiple target prompt words;
[0110] If not, then the preset prompt word is not a standard prompt word.
[0111] Among them, the preset case file images refer to the representative image samples with the visual features and text structure of each text category that are determined in advance. These images are used for model training, and the prompt words are optimized based on the extraction results of the model in order to obtain target prompt words that can be used in practice.
[0112] A preset prompt is a structured instruction text initially designed for each text category to guide the recognition model to extract the core elements of that category. It can include "elements to be extracted, element format requirements", but has not been verified for effectiveness and needs to be further optimized to obtain a target prompt that meets actual requirements.
[0113] The preset character rule refers to the preset character format and content constraint rules corresponding to the target features of each text category, which are used to judge whether the feature characters are compliant. For example, the preset character rule for the interrogation time element is that the character format should be 'YYYY-MM-DD HH:MM-HH:MM', the year should be 2000-2099, the month should be 1-12, the date should be 1-31, and the time range should meet the start time < end time. By judging whether the target feature characters extracted from the preset case file image by the preset prompt comply with the preset character rule, it is determined whether the instruction of the preset prompt is accurate.
[0114] Based on this, before feature extraction according to the target prompt, it is possible to first determine the preset case file image and preset prompt corresponding to each text category, and then determine whether the character format of the target feature output after the model extracts features from the preset case file image according to the preset prompt meets the format requirements corresponding to this text category, so as to determine whether the target feature meets the requirements. If it meets, it indicates that the preset prompt meets the model output requirements and can be used as a standard prompt, and further similar language generation can be performed to obtain multiple target prompts; if it does not meet, it is determined that the preset prompt is not a standard prompt.
[0115] On the basis of the feasible implementation manner of S140 above, the present application further provides a method for generating a corresponding feature map according to the execution logic between each target feature, including:
[0116] Determine each target feature as a corresponding feature node, and connect the feature nodes according to the execution logic to obtain an initial map;
[0117] According to the recognition model, determine the image coordinates corresponding to the target feature in the image of the target case file, and connect the image coordinates and the corresponding feature nodes to obtain a feature map.
[0118] Among them, a feature node refers to a node obtained by node processing of a target feature, which is used for subsequent map generation to realize the visual presentation of the target feature.
[0119] The image coordinate refers to the position corresponding to each target feature in the case file image. For example, determine the bounding box coordinates (x, y, w, h) of the readable text in the image.
[0120] Based on this, by performing node-based processing on the target features, corresponding feature nodes are obtained. Furthermore, based on the execution logic between nodes and the image coordinates corresponding to each node, the final feature graph is determined. In practical applications, an evidence knowledge graph can be constructed by defining an evidence element ontology model, that is, defining entity types (such as "personnel", "time", "location", "behavior", "evidence materials") and relationship types (such as "participation", "occurrence", "proof"). The extracted elements are transformed into "subject-relationship-object" triples, such as (interrogation record - involved personnel - Zhang San) and (physical evidence 1 - extraction location - entrance of a certain community). Furthermore, based on all triples in the case, an evidence element knowledge graph is constructed using a graph database (such as Neo4j). At the same time, a graphical interface is provided to display the spatiotemporal, personnel, and behavioral relationships between evidence, and supports clicking to trace back to the original case file image, assisting users in reviewing the evidence chain and deducing the case.
[0121] Please refer to Figure 2 , Figure 2 A flowchart illustrating another feature extraction method based on a recognition model provided in this application embodiment; as shown Figure 2 As shown, the process first reads and preprocesses the image of each page of the case file; then, it uses a visual multimodal large model to identify the title and page structure; it uses a rule base to make a preliminary judgment on the evidence category; it determines whether a page is an independent evidence page based on a valid title, and if there is no title, it is determined to be a continuation page of the previous page's evidence; then, it determines the evidence type of the current page based on regular expression matching and semantic analysis; finally, it detects the continuity of page numbers and the first and last features, merges multiple pages into a complete evidence unit, and outputs a structured classification and component list. This process realizes intelligent classification and integration from images to logical evidence entities.
[0122] Please refer to Figure 3 , Figure 3 A flowchart illustrating another feature extraction method based on a recognition model provided in this application embodiment; as shown Figure 3 As shown, by loading evidence types and extraction strategy configurations, structured prompts containing element items, contextual information, and output formats are constructed. Images and prompts are input into a visual multimodal large model for joint image-text reasoning, outputting structured element results. Error samples are manually verified and marked to analyze their causes (such as semantic ambiguity, missing context, or format deviation), and prompts are optimized accordingly, including enhancing context, adjusting instruction structure, or introducing examples, thus forming a closed-loop iterative mechanism to continuously verify accuracy until a preset threshold (such as ≥95%) is reached, at which point the optimal prompt template is solidified, achieving high-precision and maintainable automated evidence element extraction, significantly improving the intelligence level and business adaptability of document processing.
[0123] In some embodiments of this application, by determining the image of the target file obtained after preprocessing, OCR text recognition technology is used to convert the text in the image into corresponding text data, and then splitting it into multiple target file text segments according to semantic independence; the text title of each target file text segment is semantically segmented, redundant information such as headers and page numbers is removed, and title keywords that reflect the core attributes of the text are extracted, thereby matching the extracted title keywords with the category keywords corresponding to each text category. By calculating the ratio of the number of matched target keywords to the total number of title keywords, the first text category and the first category value corresponding to the target file text segment are determined; simultaneously, a visual multimodal large model is used to convert the target file text segment and the preset file text segments corresponding to each text category into text vectors, so as to obtain the result through cosine similarity calculation. The similarity values of the target case file text segments with each text category are calculated, and the largest similarity value is selected as the second category value, which is the corresponding text category. The first and second text categories are then compared to determine if they match. If they match, the first and second category values are directly identified as the target text category. If they do not match, the first and second category values are weighted according to preset weights, and the target text category is determined based on the category value with the largest weighted value. The target prompt word corresponding to the target text category is then matched from the prompt word template library. A visual multimodal large model is invoked to perform image-text joint reasoning on the images in the target case file in conjunction with the target prompt word, extracting target features such as text category features and image category features. Then, according to the execution logic, the scattered target features are concatenated through a triple structure to generate a feature map that can intuitively show the logical relationship between evidence.
[0124] Thus, in application scenarios involving the processing of case file data, target case file text segments and text categories can be matched using title keywords. The first text category and its value are obtained based on the proportion of category keywords in the title keywords. The second text category and its value are determined through case file text segment similarity calculation. By combining keyword-based rule matching and vector-based semantic similarity analysis, the accuracy of text classification is ensured, effectively avoiding classification errors caused by title ambiguity or model misjudgment. This improves the reliability and accuracy of case file text segment classification and effectively reduces misjudgments and omissions. Simultaneously, target prompt words obtained from accurate target text category matching improve the accuracy of the recognition model when extracting features from target case file images, avoiding model extraction errors caused by mismatches between prompt words and text categories. Furthermore, the feature map generated based on the execution logic between target features transforms scattered target features into a logically related structured map, intuitively presenting the inherent connections between features. This facilitates subsequent feature tracing and clarifies the logical chain between case file feature elements, thus providing efficient data support and visualization tools.
[0125] Figure 4 This is a schematic diagram of the structure of a feature extraction device 400 based on a recognition model provided in an embodiment of this application. Figure 4 As shown, the feature extraction device 400 based on a recognition model includes: a recognition module 410, a calculation module 420, a determination module 430, and an extraction module 440; wherein:
[0126] The recognition module 410 is used to perform text recognition on the image of the target file, obtain multiple target file text segments, and perform semantic segmentation on the text title of each target file text segment to obtain multiple title keywords.
[0127] The calculation module 420 is used to determine the first text category corresponding to the target file text segment and its corresponding first category value based on the title keywords and the category keywords corresponding to each text category, and to calculate the similarity between the target file text segment and each text category to obtain the second text category corresponding to the target file text segment and its corresponding second category value.
[0128] The determination module 430 is used to determine the target text category corresponding to the target file text segment based on the first text category, the first category value, the second text category, and the second category value, and to determine the corresponding target prompt words based on the target text category;
[0129] The extraction module 440 is used to extract features from the image of the target file based on the recognition model and target prompt words, obtain target features, and generate corresponding feature maps according to the execution logic between each target feature.
[0130] In this embodiment of the application, the identification module 410 can also be specifically used for:
[0131] The original file image is resized according to the preset size, and then the resized original file image is denoised and contrast enhanced to obtain the image of the target file.
[0132] Text recognition is performed on the image of the target file to obtain multiple initial file text segments. Based on the text format corresponding to each initial file text segment, the initial file text segments with the same text format are merged to obtain the target file text segment.
[0133] In this embodiment of the application, the calculation module 420 may also be specifically used for:
[0134] Based on the category keywords corresponding to each text category, keyword matching is performed on the title keywords to obtain the target keywords in the title keywords that match the category keywords, and the target number of target keywords and the number of keywords in the title keywords are determined.
[0135] The category value for each text category is determined based on the ratio of the target quantity to the keyword quantity.
[0136] By comparing the values of each category, the target category value with the largest value is obtained, and the target category value is determined to be the first category value, and the text category corresponding to the first category value is determined to be the first text category.
[0137] In this embodiment of the application, the calculation module 420 may also be specifically used for:
[0138] Determine the preset case file text segments corresponding to each text category, and calculate the similarity based on the text vectors corresponding to each preset case file text segment and the text vectors corresponding to the target case file text segment to obtain the similarity value between the target case file text segment and each text category.
[0139] By comparing each similarity value, the target similarity value with the largest value is obtained, and the target similarity value is determined to be the second category value, and the text category corresponding to the second category value is determined to be the second text category.
[0140] In this embodiment of the application, the determining module 430 can also be specifically used for:
[0141] Determine whether the first text category and the second text category are the same;
[0142] If so, then the target text category is determined to be the text category corresponding to the first text category and the second text category;
[0143] If not, then the first category value and the second category value are weighted according to the preset weights corresponding to the first category value and the second category value, respectively, to obtain the first target category value corresponding to the first category value and the second target category value corresponding to the second category value;
[0144] The text category corresponding to the largest value among the first and second target category values is determined as the target text category.
[0145] In this embodiment of the application, the determining module 430 can also be specifically used for:
[0146] Determine the preset case file image and at least one preset prompt word corresponding to each text category, and determine the target features corresponding to the preset case file image based on the recognition model and the preset prompt word;
[0147] Based on the feature characters corresponding to the target features and the preset character rules, determine whether the feature characters satisfy the preset character rules;
[0148] If so, the preset prompt words are determined to be the standard prompt words corresponding to the text category, and similar words are generated from the standard prompt words to obtain multiple target prompt words;
[0149] If not, then the preset prompt word is not a standard prompt word.
[0150] In this embodiment of the application, the extraction module 440 can also be specifically used for:
[0151] Each target feature is identified as a corresponding feature node, and the feature nodes are connected according to the execution logic to obtain the initial map.
[0152] Based on the recognition model, the image coordinates corresponding to the target features in the image of the target file are determined, and the image coordinates and the corresponding feature nodes are connected to obtain the feature map.
[0153] Figure 5 This is a schematic diagram of the structure of an apparatus for performing a feature extraction method based on a recognition model according to an embodiment of this application. Figure 5 As shown, the device 500 includes:
[0154] The device 500 may include a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a communication component 503, and other components. The processor 501, memory 502, and communication component 503 are connected via a bus 504.
[0155] In the specific implementation process, at least one processor 501 executes computer execution instructions stored in memory 502, causing at least one processor 501 to execute the feature extraction method based on the recognition model as described above.
[0156] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0157] Furthermore, the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0158] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0159] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0160] In some embodiments, a computer program product is also provided, including a computer program or instructions that, when executed by a processor, implement the steps in any of the above-described feature extraction methods based on recognition models.
[0161] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0162] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0163] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple lines of program code that can be loaded by a processor to execute steps in any of the feature extraction methods based on recognition models provided in embodiments of this application.
[0164] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0165] According to one aspect of this application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium.
[0166] Since the instructions stored in the storage medium can execute the steps of any of the feature extraction methods based on the recognition model provided in the embodiments of this application, the beneficial effects that any of the feature extraction methods based on the recognition model provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0167] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the appended claims.
[0168] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A feature extraction method based on a recognition model, characterized in that, The method includes: Text recognition is performed on the images of the target case file to obtain multiple target case file text segments, and semantic segmentation is performed on the text titles of each target case file text segment to obtain multiple title keywords; Based on the title keywords and category keywords corresponding to each text category, the first text category corresponding to the target case file text segment and its corresponding first category value are determined. Then, similarity calculations are performed between the target case file text segment and each of the text categories to obtain the second text category corresponding to the target case file text segment and its corresponding second category value. The step of determining the first text category corresponding to the target case file text segment and its corresponding first category value based on the title keywords and category keywords corresponding to each text category includes: Based on the category keywords corresponding to each of the text categories, keyword matching is performed on the title keywords to obtain target keywords that match the category keywords in the title keywords, and the target number of the target keywords and the number of keywords in the title keywords are determined; Based on the ratio of the target quantity to the keyword quantity, determine the category value corresponding to each text category; By comparing each category value, the target category value with the largest value is obtained, and the target category value is determined to be the first category value, and the text category corresponding to the first category value is determined to be the first text category; The step of calculating the similarity between the target file text segment and each of the text categories to obtain the second text category corresponding to the target file text segment and its corresponding second category value includes: Determine the preset case file text segments corresponding to each text category, and perform similarity calculation based on the text vectors corresponding to each preset case file text segment and the text vectors corresponding to the target case file text segment to obtain the similarity value between the target case file text segment and each text category; By comparing each of the similarity values, the target similarity value with the largest value is obtained, and the target similarity value is determined to be the second category value, and the text category corresponding to the second category value is the second text category; Based on the first text category, the first category value, the second text category, and the second category value, determine the target text category corresponding to the target file text segment, and determine the corresponding target prompt word based on the target text category; Based on the recognition model and the target prompt words, feature extraction is performed on the image of the target file to obtain target features, and a corresponding feature map is generated according to the execution logic between each target feature.
2. The method according to claim 1, characterized in that, The text recognition of the target file image yields multiple target file text segments, including: According to the preset size, the image of the original case file is resized, and the resized image of the original case file is denoised and contrast enhanced to obtain the image of the target case file; Text recognition is performed on the image of the target file to obtain multiple initial file text segments. Based on the text format corresponding to each initial file text segment, the initial file text segments with the same text format are merged to obtain the target file text segment.
3. The method according to claim 1, characterized in that, The step of determining the target text category corresponding to the target file text segment based on the first text category, the first category value, the second text category, and the second category value includes: Determine whether the first text category and the second text category are consistent; If so, the target text category is determined to be the text category corresponding to the first text category and the second text category; If not, then according to the preset weights corresponding to the first category value and the second category value respectively, the first category value and the second category value are weighted to obtain the first target category value corresponding to the first category value and the second target category value corresponding to the second category value; The text category corresponding to the largest value among the first target category value and the second target category value is determined as the target text category.
4. The method according to claim 1, characterized in that, Before determining the corresponding target prompt word based on the target text category, the method further includes: Determine the preset case file image and at least one preset prompt word corresponding to each of the text categories, and determine the target features corresponding to the preset case file image based on the recognition model and the preset prompt word; Based on the feature character corresponding to the target feature and the preset character rule, determine whether the feature character satisfies the preset character rule; If so, the preset prompt word is determined to be the standard prompt word corresponding to the text category, and similar words are generated from the standard prompt word to obtain multiple target prompt words; If not, then it is determined that the preset prompt word is not the standard prompt word.
5. The method according to claim 1, characterized in that, The step of generating corresponding feature maps based on the execution logic between each of the target features includes: Each of the target features is identified as a corresponding feature node, and the feature nodes are connected according to the execution logic to obtain an initial map; Based on the recognition model, the image coordinates corresponding to the target feature in the image of the target file are determined, and the image coordinates and the corresponding feature nodes are connected to obtain the feature map.
6. A feature extraction device based on a recognition model, characterized in that, The device includes: The recognition module is used to perform text recognition on the image of the target file, obtain multiple target file text segments, and perform semantic segmentation on the text title of each target file text segment to obtain multiple title keywords; The calculation module is used to determine the first text category and its corresponding first category value corresponding to the target case file text segment based on the title keywords and the category keywords corresponding to each text category, and to perform similarity calculation on the target case file text segment and each of the text categories to obtain the second text category and its corresponding second category value corresponding to the target case file text segment; wherein, determining the first text category and its corresponding first category value corresponding to the target case file text segment based on the title keywords and the category keywords corresponding to each text category includes: Based on the category keywords corresponding to each of the text categories, keyword matching is performed on the title keywords to obtain target keywords that match the category keywords in the title keywords, and the target number of the target keywords and the number of keywords in the title keywords are determined; Based on the ratio of the target quantity to the keyword quantity, determine the category value corresponding to each text category; By comparing each category value, the target category value with the largest value is obtained, and the target category value is determined to be the first category value, and the text category corresponding to the first category value is determined to be the first text category; The step of calculating the similarity between the target file text segment and each of the text categories to obtain the second text category corresponding to the target file text segment and its corresponding second category value includes: Determine the preset case file text segments corresponding to each text category, and perform similarity calculation based on the text vectors corresponding to each preset case file text segment and the text vectors corresponding to the target case file text segment to obtain the similarity value between the target case file text segment and each text category; By comparing each of the similarity values, the target similarity value with the largest value is obtained, and the target similarity value is determined to be the second category value, and the text category corresponding to the second category value is the second text category; The determination module is used to determine the target text category corresponding to the target file text segment based on the first text category, the first category value, the second text category, and the second category value, and to determine the corresponding target prompt word based on the target text category; The extraction module is used to extract features from the image of the target file based on the recognition model and the target prompt words to obtain target features, and generate corresponding feature maps according to the execution logic between the target features.
7. A computer device, characterized in that, include: One or more processors; Memory; One or more programs, wherein the programs are stored in memory and configured to be executed by one or more processors, the programs being configured to perform the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code that can be called by a processor to perform the method as described in any one of claims 1 to 5.