Text recognition method and device, storage medium, program product and electronic equipment

By constructing a Voronoi diagram to select training samples and using a large language model to train the text recognition model, the problem of poor training results caused by random sample selection in existing technologies is solved, and the accuracy of text recognition is improved.

CN120808359APending Publication Date: 2025-10-17INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510854263.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-24
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The existing technology randomly selects samples when training a text recognition model, resulting in poor model training effect and low accuracy of the trained text recognition model.

Method used

By constructing a Voronoi diagram, selecting samples based on the semantic vectors of training samples, using a large language model for training, and selecting semantically similar but different samples for model training, the accuracy of sample selection is improved.

Benefits of technology

The training effect of the text recognition model is improved, thereby improving the accuracy of text recognition and solving the problem of low accuracy caused by poor training effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120808359A_ABST
    Figure CN120808359A_ABST
Patent Text Reader

Abstract

The invention discloses a text recognition method and device, a storage medium, a program product and electronic equipment. The method relates to the field of artificial intelligence and comprises the steps that a target file is obtained, and the target file comprises text content to be subjected to text recognition; the target file is subjected to text recognition through a target recognition model, a text recognition result is obtained, the target recognition model is a large language model, and the target recognition model is trained based on the sample recognition results of the N training samples and the real labels in single-round iteration to obtain a text recognition result; n training samples in the single round of iteration are selected from M training samples based on a Voronoi diagram, point locations in the Voronoi diagram are used for representing the training samples, coordinates of the point locations are determined based on semantic vectors of sample recognition results of the training samples, and N is smaller than M. Through the text recognition method and device, the problem that the text recognition accuracy of the trained text recognition model is low due to the fact that the training effect of the text recognition model is poor 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 in particular, to a text recognition method and device, a storage medium, a program product and an electronic device. BACKGROUND

[0002] With the continuous development of digital information processing and analysis, text recognition technology has become one of the key technologies in the automatic document processing process. Text recognition technology can extract text information from various types of documents, providing strong support for big data analysis, document management, information retrieval and other fields.

[0003] Currently, in the process of training a text recognition model, the related technology randomly selects samples to train the model, resulting in poor training effect of the text recognition model, thereby causing low text recognition accuracy when text recognition is performed by the trained text recognition model.

[0004] In view of the above problems in the related technology, no effective solution has been proposed so far. SUMMARY

[0005] The main purpose of the present application is to provide a text recognition method, device, storage medium, program product and electronic device to solve the problem of low text recognition accuracy of the trained text recognition model caused by poor training effect of the text recognition model in the related technology.

[0006] In order to achieve the above purpose, according to one aspect of the present application, a text recognition method is provided. The method comprises: obtaining a target file, wherein the target file includes text content to be recognized; performing text recognition on the target file by a target recognition model to obtain a text recognition result, wherein the target recognition model is a large language model, the target recognition model is trained based on sample recognition results and real labels of N training samples in a single round of iteration, the N training samples in the single round of iteration are selected from M training samples based on a Venn diagram, a point in the Venn diagram is used to represent a training sample, the coordinates of the point are determined based on the semantic vector of the sample recognition result of the training sample, and N is less than M.

[0007] Further, the text recognition method further comprises: in each iteration round, performing text recognition on the M training samples by the initial recognition model in the iteration round to obtain M sample recognition results; performing vector conversion on the M sample recognition results to obtain M semantic vectors, and taking part of the target training samples in the M training samples as generation elements, constructing a Venn diagram based on the target training samples and the M semantic vectors, wherein the target training sample is a training sample with an accurate sample recognition result; determining a plurality of center lines from the Venn diagram, and performing sample selection in the Venn diagram based on the center lines to obtain N training samples, wherein each center line corresponds to two generation elements, and the center line represents the positions of points with the same semantic distance between the two generation elements; training the initial recognition model based on the sample recognition results and sample correction results of the N training samples, and determining the initial recognition model trained in the last iteration round as the target recognition model, wherein the sample correction result at least includes the true labels of the N training samples.

[0008] Further, the text recognition method further comprises: in the case that the current iteration round is the first round, obtaining a first correction result of the target object for the M sample recognition results, and taking the target training samples in the first correction result as the generation elements, wherein the first correction result includes part of the target training samples in the M training samples; in the case that the current iteration round is the Pth round, taking the target training samples in the last round as the generation elements and the target training samples in the N training samples in the last round as the generation elements, wherein P is a positive integer greater than 1.

[0009] Further, the text recognition method further comprises: before training the initial recognition model based on the sample recognition results and sample correction results of the N training samples, obtaining a second correction result of the target object for the sample recognition results of the N training samples, wherein the second correction result includes the true labels of the N training samples and the error types of the sample recognition results in the N training samples; determining the true labels and error types in the second correction result as the sample correction results.

[0010] Further, the text recognition method further comprises: determining a starting point and an ending point from the Venn diagram based on the semantic vectors of the two business types; determining a plurality of polygons and a plurality of intersection points in the Venn diagram based on the center lines, wherein the edges of the polygon are composed of the center lines, and the intersection point refers to a common intersection point between three center lines; determining a first point from the Venn diagram in a manner of selecting the ending point according to a first probability, selecting a point based on the polygon according to a second probability, selecting a point based on the intersection point according to a third probability, and selecting a point randomly according to a fourth probability, wherein the sum of the first probability, the second probability, the third probability and the fourth probability is 1; determining a plurality of second points based on the first point, and determining the N training samples based on the plurality of second points.

[0011] Further, the text recognition method further includes: determining a point closest to the first point from the tree structure to obtain a third point, wherein an initial node in the tree structure includes a starting point; moving a preset step length from the third point to the first point in the Venn diagram to obtain a fourth point, and determining a point closest to the fourth point in the Venn diagram as a fifth point; adding the third point and the fifth point as nodes to the tree structure, and determining the nodes in the tree structure as a plurality of second points.

[0012] Further, the text recognition method further includes: determining a point closest to the first point from the tree structure to obtain a third point, wherein an initial node in the tree structure includes a starting point; moving a preset step length from the third point to the first point in the Venn diagram to obtain a fourth point, and determining a point closest to the fourth point in the Venn diagram as a fifth point; adding the third point and the fifth point as nodes to the tree structure, and determining the nodes in the tree structure as a plurality of second points.

[0013] To achieve the above object, according to another aspect of the present application, a text recognition device is provided. The device comprises: a first acquisition module configured to acquire a target file, wherein the target file includes text content to be subjected to text recognition; and a first recognition module configured to perform text recognition on the target file by using a target recognition model to obtain a text recognition result, wherein the target recognition model is a large language model, the target recognition model is trained based on sample recognition results of N training samples and true labels in a single round of iteration, the N training samples in the single round of iteration are selected from M training samples based on a Venn diagram, points in the Venn diagram are used to represent the training samples, coordinates of the points are determined based on semantic vectors of the sample recognition results of the training samples, and N is less than M.

[0014] Furthermore, the text recognition device also includes: a second recognition module, which is used to perform text recognition on M training samples in each round of iteration through the initial recognition model in the round of iteration to obtain M sample recognition results; a construction module, which is used to perform vector conversion on the M sample recognition results to obtain M semantic vectors, and use some target training samples in the M training samples as generators, and construct a Voronoi diagram based on the target training samples and the M semantic vectors, wherein the target training samples are training samples with accurate sample recognition results; a selection module, which is used to determine multiple center lines from the Voronoi diagram, and select samples in the Voronoi diagram based on the center lines to obtain N training samples, wherein each center line corresponds to two generators, and the center line represents the position of a point with the same semantic distance with the two generators; a training module, which is used to train the initial recognition model based on the sample recognition results and sample proofreading results of the N training samples, and determine the initial recognition model trained in the last round of iteration as the target recognition model, wherein the sample proofreading results at least include the true labels of the N training samples.

[0015] Furthermore, the construction module also includes: a first acquisition submodule, which is used to obtain the first proofreading result of the target object for M sample recognition results when the current iteration round is the first round, and use the target training sample in the first proofreading result as a generator, wherein the first proofreading result includes part of the target training samples in the M training samples; a processing submodule, which is used to use the target training sample used as a generator in the previous round and the target training sample among the N training samples in the previous round as generators when the current iteration round is the P round, wherein P is a positive integer greater than 1.

[0016] Furthermore, the text recognition device also includes: an acquisition module, used to obtain a second proofreading result of the sample recognition result of the target object for N training samples, wherein the second proofreading result includes the true labels of the N training samples and the error type of the sample recognition result error in the N training samples; a determination module, used to determine the true label and error type in the second proofreading result as the sample proofreading result.

[0017] Further, the selecting module further comprises: a first determining submodule, configured to determine a starting point and an ending point in the Venn diagram based on the semantic vectors of the two service types; a second determining submodule, configured to determine a plurality of polygons and a plurality of intersection points in the Venn diagram based on the center lines, wherein the edges of the polygons are composed of the center lines, and the intersection points refer to common intersection points among three center lines; a third determining submodule, configured to determine a first point in the Venn diagram in a manner that the ending point is selected according to a first probability, a point is selected based on the polygons according to a second probability, a point is selected based on the intersection points according to a third probability, and a point is selected randomly according to a fourth probability, wherein the sum of the first probability, the second probability, the third probability and the fourth probability is 1; and a fourth determining submodule, configured to determine a plurality of second points based on the first point, and determine the N training samples based on the plurality of second points.

[0018] Further, the fourth determining submodule further comprises: a first determining unit, configured to determine a third point that is closest to the first point in the tree structure, wherein an initial node in the tree structure comprises the starting point; a second determining unit, configured to move a preset step length from the third point towards the first point in the Venn diagram to obtain a fourth point, and determine a fifth point that is closest to the fourth point in the Venn diagram; and a third determining unit, configured to add the third point and the fifth point as nodes to the tree structure, and determine the nodes in the tree structure as the plurality of second points.

[0019] Further, the fourth determining submodule further comprises: a judging unit, configured to judge whether there is a target point in the plurality of second points, wherein the target point refers to a point whose distance to the ending point is less than a preset distance; and a fourth determining unit, configured to, in a case where there is no target point in the plurality of second points, repeatedly execute the steps of reselecting the first point, determining a new plurality of second points based on the new first point, until there is a target point in the new plurality of second points, and determine the training samples corresponding to the determined second points as the N training samples.

[0020] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a computer readable storage medium is provided, which comprises a stored executable program, wherein the computer readable storage medium controls the device where the computer readable storage medium is located to execute the text recognition method described above when the executable program is running.

[0021] In order to achieve the above-mentioned purpose, according to another aspect of the present application, an electronic device is provided, which comprises a memory storing an executable program, and a processor configured to run the program, wherein the program executes the text recognition method described above when running.

[0022] In order to achieve the above object, according to another aspect of the present application, a computer program product is provided, comprising computer instructions which, when executed by a processor, implement the steps of the text recognition method described above.

[0023] In the embodiment of the present application, the Venn diagram is constructed based on the semantic vectors of the sample recognition results of the training samples, and the sample selection is performed based on the Venn diagram, so that the sample selection is performed based on the semantic information of the sample recognition results of the training samples, thereby avoiding the bias and limitation caused by the traditional random sampling, and improving the accuracy of sample selection. By training the target recognition model based on the selected N training samples, the training effect of the target recognition model can be improved, thereby improving the text recognition accuracy.

[0024] It can be seen that the method provided in the present application achieves the purpose of training the model by using the sample selection based on the Venn diagram, and performing text recognition based on the trained model, realizes the technical effect of improving the text recognition accuracy, and solves the technical problem of poor training effect of the text recognition model in the related art, which leads to low text recognition accuracy of the trained text recognition model. BRIEF DESCRIPTION OF DRAWINGS

[0025] The accompanying drawings, which form a part of the present application, are intended to provide further understanding of the present application, and the illustrative embodiments of the present application and their description serve the purpose of explaining the present application. The accompanying drawings should not be construed as an inappropriate limitation of the present application. In the drawings:

[0026] Figure 1 is a hardware structure block diagram of a computer terminal provided according to an embodiment of the present application;

[0027] Figure 2 is a flow of a text recognition method provided according to an embodiment of the present application Figure 1 ;

[0028] Figure 3 is a flow of a text recognition method provided according to an embodiment of the present application Figure 2 ;

[0029] Figure 4 is a schematic diagram of a Venn diagram provided according to an embodiment of the present application;

[0030] Figure 5 is a schematic diagram of a text recognition device provided according to an embodiment of the present application;

[0031] Figure 6 is a structure block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0032] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.

[0033] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0034] First, some of the nouns or terms that appear in the description of the embodiments of the present application are applicable to the following explanations:

[0035] Blockchain digital safe: also known as blockchain electronic file cabinet, blockchain electronic evidence storage cabinet, is a safe storage and management platform for digital files based on blockchain technology. It provides safe, reliable digital file storage and management services for users through the tamper-proof, traceable, decentralized and other characteristics of blockchain technology.

[0036] Smart contract: an automatically executed contract that contains computer code of contract terms and is stored on the blockchain. Once the preset conditions are met, the smart contract will automatically execute without the intervention of a third party. Smart contract ensures transparency, tamper resistance and automatic execution.

[0037] Voronoi diagram: also called Voronoi diagram or Dirichlet diagram, composed of continuous polygons formed by the perpendicular bisector of the line connecting two adjacent points. The Voronoi diagram has the following characteristics: (1) each V polygon has a generator; (2) the distance from each point in the V polygon to the generator is shorter than the distance to other generators; (3) the points on the boundary of the polygon have equal distance to the generators that generate the boundary; (4) the boundary of the Voronoi polygon of the adjacent figure is a subset of the original adjacent boundary.

[0038] It should be noted that the information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present application are information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards, necessary security measures are taken, do not violate public order and good customs, and provide corresponding operation portal for user to choose authorization or refusal. For example, the system and the interface between the related users or institutions are provided with the corresponding operation portal for the user to choose to agree or refuse the automatic decision result; if the user chooses to refuse, the expert decision process is entered.

[0039] Embodiment 1

[0040] According to the embodiments of the present application, an embodiment of a text recognition method is also 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 group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.

[0041] The method embodiment provided by the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing the text recognition method is shown. As shown in Figure 1 The computer terminal 10 (or mobile device) can include one or more processors 102 (the processor 102 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art can understand that Figure 1 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can also include more or fewer components than those shown in Figure 1 , or have a different configuration than Figure 1 .

[0042] It should be noted that the one or more processors 102 and / or other data processing circuitry described above can be generally referred to herein as "data processing circuitry". The data processing circuitry can be embodied in whole or in part as software, hardware, firmware, or any combination thereof. In addition, the data processing circuitry can be a single standalone processing module, or incorporated in whole or in part within any of the other elements of the computer terminal 10 (or mobile device). As referred to in embodiments of the present application, the data processing circuitry functions as a processor to control, for example, selection of the variable resistance terminal path connected to the interface.

[0043] The memory 104 can be used to store software programs of application software and modules, such as program instructions / data storage means corresponding to the text recognition method in embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, i.e. implements the text recognition method described above. The memory 104 can include a high-speed random access memory, and can 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 examples, the memory 104 can further include a memory disposed remotely with respect to the processor 102, which can be connected to the computer terminal 10 through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0044] The transmission device 106 is used to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.

[0045] The display can be, for example, a touch screen type liquid crystal display (LCD), which can enable a user to interact with the user interface of the computer terminal 10 (or mobile device).

[0046] When performing OCR (Optical Character Recognition) on sample files in the data vault, a large model is first called, and then manual correction and feedback are performed on the recognized results for fine-tuning training of the vertical large model. The work content of manual correction and feedback includes:

[0047] 1. Compare the original document and the recognition result: Compare the recognition result generated by the OCR system with the original document one by one to find out the parts that have been recognized incorrectly.

[0048] 2. Mark errors: Mark incorrect characters or words in the recognition results and provide the correct text.

[0049] 3. Record feedback: Record the error type (such as recognition error, missed detection error, multiple detection error, etc.) and the correct text to form structured feedback data.

[0050] 4. Data organization: Organize the proofread results into a unified format for subsequent data processing and model training.

[0051] Due to the large number of sample files, manually proofreading all of them would incur significant labor costs. Therefore, manual proofreading requires sampling a subset of the massive sample files as a control group for the original files and recognition results for model training. However, there is a selectivity bias in which control group to sample. Specifically, if the selected proofreading data is unrepresentative, this can lead to biased model training and affect the model's generalization capabilities. Consequently, related technologies suffer from poor training results for text recognition models, resulting in low text recognition accuracy even after the trained models have been trained.

[0052] In the above technical background, the present application provides Figure 2 The present application provides a method for handling the fault as shown. Figure 2 The text recognition method shown. Figure 2 This is the process of the text recognition method provided by the embodiment of the present application Figure 1 .

[0053] Step S201: Acquire a target file, wherein the target file includes text content to be subjected to text recognition.

[0054] Optionally, electronic devices, application systems, servers and other devices may be used as the execution subject of the present application. In this embodiment, the target processing system is used as the execution subject to execute the above-mentioned text recognition method.

[0055] Optionally, the target file includes text content to be recognized, that is, the target file includes text content for the text recognition model to extract the text content.

[0056] For example, the target file may be a product file, document, etc. uploaded to a relevant platform in a financial institution. Figure 3 This is the process of the text recognition method provided by the embodiment of the present application Figure 2 ,like Figure 3As shown, these files can be stored in the data locker, and a smart contract related to the digital locker is set in the blockchain platform, which mainly has three functions: a batch trigger for calling the OCR recognition; receiving the semantic vector to construct the Venn diagram; and selecting samples according to the Venn diagram and the timing type configuration information.

[0057] In step S202, the target file is subjected to text recognition by a target recognition model to obtain a text recognition result, wherein the target recognition model is a large language model, and the target recognition model is trained based on sample recognition results and real labels of N training samples in a single round of iteration, the N training samples in the single round of iteration are selected from M training samples based on a Venn diagram, a point in the Venn diagram is used to represent a training sample, and coordinates of the point are determined based on a semantic vector of the sample recognition result of the training sample, and N is less than M.

[0058] Optionally, the target recognition model is a large language model, the target file can be input to the target recognition model, the target file is subjected to text recognition by the target recognition model, and thus a text recognition result is obtained. The text recognition result represents the text content recognized from the target file.

[0059] For example, as shown in Figure 3 As shown, when the number of newly uploaded target files in the data locker reaches a preset threshold, the batch trigger of the smart contract packs and uploads the newly uploaded target files to the OCR recognizer to call the target recognition model in the OCR platform through the OCR recognizer.

[0060] Optionally, the target recognition model in the OCR platform can be multiple, one target recognition model can be used to process one or more target files of a business type, and different target recognition models correspond to different business types. Before calling the target recognition model, the OCR recognizer can determine the target recognition model to be called according to the business type of the target file.

[0061] Optionally, the target recognition model is trained based on the sample recognition result and the real label of the N training samples in a single round of iteration. The N training samples in the single round of iteration are selected from the M training samples based on the Venn diagram. For example, in the training process, the sample recognition result of the initial recognition model (equivalent to the untrained target recognition model) on the M training samples is obtained first, and then the coordinates of the M training samples in the Venn diagram to be generated are determined based on the semantic vectors of the sample recognition result of the M training samples, so as to obtain the Venn diagram. After obtaining the Venn diagram, in a single round of iteration, N training samples can be selected from the M training samples based on the coordinates of the training samples in the Venn diagram. For example, N training samples are randomly selected in the Venn diagram. For example, the Venn diagram is divided into multiple regions, and a part of each region is randomly selected. For example, a starting point is randomly selected, and then a next starting point is randomly selected outside the preset range of the starting point, and the process is repeated to obtain multiple points. For example, a plurality of center lines are determined in the Venn diagram, and the N training samples are selected based on the center lines in the Venn diagram.

[0062] Optionally, the number of training samples N selected in each round of iteration can be the same or different.

[0063] Optionally, after the N training samples in a single round of iteration are determined, the initial recognition model is trained based on the sample recognition result and the sample proofreading result of the N training samples, and the initial recognition model trained in this round is used as the initial model for the next round of training. The sample proofreading result at least includes the real label of the N training samples, and the real label represents the real text content in the training sample.

[0064] In the embodiments of the present application, the Venn diagram is constructed based on the semantic vector of the sample recognition result of the training sample, and the sample selection is performed based on the Venn diagram, so as to realize the sample selection based on the semantic information of the sample recognition result of the training sample, thereby avoiding the deviation and limitation caused by the traditional random sampling, and improving the accuracy of sample selection. By training the target recognition model based on the selected N training samples, the training effect of the target recognition model can be improved, thereby improving the text recognition accuracy.

[0065] Therefore, the method provided in the present application achieves the purpose of training the model by using the sample selection based on the Venn diagram, and performing text recognition based on the trained model, realizes the technical effect of improving the text recognition accuracy, and solves the technical problem of poor training effect of the text recognition model in the related art, which leads to low text recognition accuracy of the trained text recognition model.

[0066] Optionally, in the text recognition method provided in the embodiments of the present application, the target recognition model can be obtained by the following steps:

[0067] Step 301, in each round of iteration, text recognition is performed on M training samples by the initial recognition model in the round of iteration to obtain M sample recognition results.

[0068] Optionally, the initial recognition model is a large language model. In the first round of iteration, the initial recognition model in the round of iteration is the original initial recognition model, and in the Pth round of iteration, the initial recognition model in the round of iteration is the initial recognition model trained in the (P-1)th round of iteration.

[0069] Optionally, the training sample is a sample file, and the sample file includes text content.

[0070] Optionally, in each round of iteration, the M training samples are input to the initial recognition model in the round of iteration to obtain M sample recognition results. The sample recognition result corresponds to the training sample one by one.

[0071] Step 302, vector conversion is performed on the M sample recognition results to obtain M semantic vectors, and part of the target training samples in the M training samples are taken as the generating element, and a Venn diagram is constructed based on the target training sample and the M semantic vectors, wherein the target training sample is a training sample with accurate sample recognition result.

[0072] Optionally, as shown in Figure 3 , the sample recognition result can be mapped to a high-dimensional space through a semantic vector constructor, and then reduced to a low-dimensional space through multidimensional scaling analysis to obtain a semantic vector for Venn diagram construction. For example, after obtaining the sample recognition result, the sample recognition result can be mapped to a high-dimensional space through a word embedding model, for example, including the following steps: text preprocessing, word embedding (word vector) generation, and sentence or document vector generation. Multidimensional scaling (MDS) is a statistical technique used to visualize the similarity or distance relationships between high-dimensional data points in a low-dimensional space. The main purpose of MDS is to preserve the relative distances or similarities between the original high-dimensional data points in a low-dimensional space. MDS has wide applications in data visualization, cluster analysis, network analysis, etc. Basic principle: the core idea of MDS is to project the data points in a high-dimensional space into a low-dimensional space, so that the distances between the points in the low-dimensional space are as close as possible to the distances between the points in the high-dimensional space.

[0073] In an optional embodiment, the low-dimensional space is set to 2 dimensions, i.e., the semantic vector is two-dimensional, and the vector value of the semantic vector of the sample recognition result of the training sample can be regarded as the coordinate value of the point position corresponding to the training sample in the Venn diagram.

[0074] Optionally, after the M semantic vectors are determined, part of the target training samples in the M training samples are taken as generating elements, and a Venn diagram is constructed based on the target training samples and the M semantic vectors. For example, M points are constructed in the Venn diagram based on the vector values of the M semantic vectors, and part of the target training samples in the M training samples are taken as generating elements, so that the Venn diagram is constituted by a continuous polygon composed of vertical bisectors of lines connecting two adjacent generating elements.

[0075] For example, Figure 4 is a schematic diagram of a Venn diagram provided by an embodiment of the present application, as Figure 4 shown, Figure 4 1-5 numbered in the Venn diagram are edges of a V-polygon of the Venn diagram, ABCD are generating elements of the Venn diagram, and the intersection points of 1-2-3 and 3-4-5 are A and B, respectively. The polygon edges 1-5 of the Venn diagram represent center lines of the sample recognition results in the semantic space, and these center lines represent points having the same semantic distance from two generating elements; and the intersection points A and B represent points having the same semantic distance from three generating elements.

[0076] Step 303, a plurality of center lines are determined from the Venn diagram, and sample selection is performed in the Venn diagram based on the center lines, to obtain N training samples. Each center line corresponds to two generating elements, and the center line represents the positions of points having the same semantic distance from the two generating elements.

[0077] Optionally, after the Venn diagram is determined, a plurality of center lines are determined from the Venn diagram. The center line is also a vertical bisector of a line connecting two adjacent generating elements.

[0078] Optionally, the training samples located near the center lines or around the intersection points of the center lines can be determined as belonging to the N training samples. These samples are similar to at least two generating elements in semantics but have differences, and thus are optimal choices for model training. Optionally, N can be a preset value, which can be determined based on a selection rule.

[0079] Step 304, an initial recognition model is trained based on the sample recognition results of the N training samples and sample proofreading results, and the initial recognition model trained in the last iteration is determined as a target recognition model. The sample proofreading results at least include true labels of the N training samples.

[0080] Optionally, the sample proofreading results at least include true labels of the N training samples. The target processing system can input the sample recognition results of the N training samples, the N training samples, and the sample proofreading results to the initial recognition model, so that the initial recognition model performs learning and training. Then, it is determined that the current iteration round is ended, and the next iteration round is entered.

[0081] Optionally, in the next iteration round, the initial recognition model trained in the last round is taken as the basis for the training in the current round, and then the steps of determining the sample recognition result, constructing the Venn diagram, and selecting the sample for model training are continued to be executed, thereby continuously iterating until the preset iteration condition (such as reaching the iteration number threshold) is met, and then the initial recognition model trained in the last iteration is determined as the target recognition model.

[0082] It should be noted that the construction and use of the Venn diagram enable the system to accurately identify the semantic differences and difficulty distribution among the training samples, thereby facilitating more targeted selection of samples that can improve the performance of the model for training, thereby improving the model training effect.

[0083] Optionally, in the text recognition method provided in the embodiments of the present application, part of the target training samples in the M training samples are taken as the generation, including: in the case that the current iteration round is the first round, obtaining the first proofreading result of the target object for the M sample recognition results, and taking the target training sample in the first proofreading result as the generation, wherein the first proofreading result includes part of the target training samples in the M training samples; in the case that the current iteration round is the Pth round, taking the target training sample in the last round as the generation and the target training sample in the N training samples in the last round as the generation, wherein P is a positive integer greater than 1.

[0084] Optionally, in the first iteration round, after obtaining the M sample recognition results, the M sample recognition results are sent to the target object. The target object can be a worker for proofreading the training samples and the sample recognition results. The target object determines whether the result output by the model is the same as the real text content in the training sample according to the sample recognition result, and if so, determines that the training sample is the target training sample.

[0085] Optionally, the target object does not need to proofread all the M sample recognition results, but only needs to proofread a part to obtain a part of the target training samples, for example, multiplying a preset proportion by M to obtain a target value K, K is less than M, so that only K sample recognition results are proofread to find the target training sample. After the target object determines the target training sample, the target training sample is sent to the target processing system as the first proofreading result, so that the target processing system takes the target training sample in the first proofreading result as the generation.

[0086] Optionally, in a case where the current iteration round is the Pth round, the target training sample in the last round as the generating element and the target training sample in the N training samples in the last round are taken as the generating element. The target processing system can send the sample recognition results of the N training samples to the target object after determining the sample recognition results of the N training samples, so that the target object determines the target training sample from the sample recognition results and feeds back the target training sample to the target processing system.

[0087] Optionally, in each iteration round, a new Venn diagram can be generated based on the generating element of the iteration round and the sample recognition results of the M training samples in the iteration round, for sample selection in the iteration round.

[0088] It should be noted that, by the above method, the generating element is accurately determined, and as the iteration deepens, the set of generating elements becomes richer and richer, and can cover various typical and edge cases in model recognition, thereby not only accelerating the learning process of the model, but also improving the generalization ability and recognition accuracy of the model.

[0089] Optionally, in the text recognition method provided in the embodiments of the present application, before training the initial recognition model based on the sample recognition results and the sample proofreading results of the N training samples, the method further includes: obtaining a second proofreading result of the target object for the sample recognition results of the N training samples, wherein the second proofreading result includes the true labels of the N training samples and the error types of the sample recognition results of the N training samples; and determining the true labels and the error types in the second proofreading result as the sample proofreading results.

[0090] Optionally, as shown in Figure 3 After determining the sample recognition results of the N training samples, the sample recognition results of the N training samples are sent to the target object. The target object judges whether the result output by the model is the same as the true text content in the training sample according to the sample recognition result. If they are the same, the training sample is determined as the target training sample. If they are not the same, the sample recognition result is compared with the original text content in the training sample one by one, the part of the recognition error is found out, the error type (such as recognition error, omission error, multiple detection error, etc.) is determined, and the true text content (i.e. true label) of the training sample is provided. Then, the second proofreading result is generated based on the error type of the sample recognition result error and the true labels of the N training samples, and the second proofreading result is sent to the target processing system, so that the target processing system determines the true labels and the error types in the second proofreading result as the sample proofreading results.

[0091] Optionally, as shown in Figure 3 The target object can also send the third proofreading result to the target processing system, and the third proofreading result includes the target training sample in the N training samples.

[0092] It should be noted that, by the above manner, the model can effectively learn the related error types of the error recognition samples in the training process, thereby improving the training effect of the model.

[0093] Optionally, in the text recognition method provided in the embodiments of the present application, in the case that the M training samples are divided into two business types, sample selection is performed in the Venn diagram based on the center line to obtain N training samples, including: determining a starting point and an ending point in the Venn diagram based on semantic vectors of the two business types; determining a plurality of polygons and a plurality of intersection points in the Venn diagram based on the center line, wherein the edges of the polygon are composed of the center line, and the intersection point refers to a common intersection point between three center lines; determining a first point in the Venn diagram in a manner of selecting the ending point according to a first probability, selecting a point based on the polygon according to a second probability, selecting a point based on the intersection point according to a third probability, and selecting a point randomly according to a fourth probability, wherein the sum of the first probability, the second probability, the third probability, and the fourth probability is 1; determining a plurality of second points based on the first point, and determining the N training samples based on the plurality of second points.

[0094] In some embodiments, the M training samples are divided into one business type.

[0095] In some embodiments, the M training samples are divided into two business types. The division rule of the training samples is determined according to the text content thereof, for example, the business types can be “ABC fund”, “CD bond”, etc.

[0096] Optionally, in the case that the M training samples are divided into two business types, the starting point Q start and the ending point Q goal may be determined in the Venn diagram based on semantic vectors of the two business types. For example, the starting point is determined based on the semantic vector of one of the business types, and the ending point is determined based on the semantic vector of the other business type.

[0097] For example, in the process of determining the starting point, the semantic vector of the name of the business type is first determined to obtain a business semantic vector, and then the vector value of the business semantic vector is taken as a coordinate value to determine its position in the Venn diagram, and then the point closest to the position in the Venn diagram is determined as the starting point. The way of determining the ending point is the same as that of determining the starting point, and therefore will not be described here.

[0098] Optionally, the semantic vector corresponding to the business type can be determined according to the inverse document frequency corresponding to the segmented “AB”, “C”, and “fund”. The corresponding semantic vector can also be determined through a word embedding model, and can also be determined through other manners.

[0099] In an optional embodiment, the service type of the training sample can be preconfigured in the timing type configuration, and the generation time range of the training sample corresponding to the service type.

[0100] Optionally, the Venn diagram is composed of a continuous polygon formed by the perpendicular bisectors of the lines connecting two adjacent points. Therefore, a plurality of polygons and a plurality of intersection points are determined in the Venn diagram based on the center lines. Each polygon in the Venn diagram has a generator, the distance from each point in the polygon to the generator is shorter than the distance to other generators, the distance from a point on the boundary of the polygon to the generator generating the boundary is equal, and the polygon boundary of the adjacent graph takes the original adjacent boundary as a subset. And the aforementioned intersection point refers to the common intersection point between three center lines, such as Figure 4 the intersection points A and B in

[0101] Optionally, as shown in Figure 3 , the sample selector can select a random sample point (i.e., the first point) Q start from the starting point Q rand of the Venn diagram step by step according to the following rules. rand Q goal is directly selected with a fixed probability (i.e., the first probability), adjacent samples on the polygon edge are selected with a higher probability (i.e., the second probability), adjacent samples on the intersection vertex (i.e., the intersection point) are selected with a higher probability (i.e., the third probability), and the remaining probability (i.e., the fourth probability) is randomly selected in the entire semantic space (i.e., the Venn diagram). The distance threshold corresponding to the aforementioned adjacent sample can be pre-set, that is, if the distance between the target region (i.e., the polygon edge, the intersection vertex) and the sample is greater than the distance threshold, it is not considered adjacent, otherwise, it is considered adjacent.

[0102] Optionally, the sum of the first probability, the second probability, the third probability, and the fourth probability is 1.

[0103] Optionally, the first probability, the second probability, the third probability, and the fourth probability can be artificially pre-set, and the amount of probability determines the bias of sample selection. For example: if you want to speed up the convergence of the sample selector, increase the size of the "fixed probability"; if you want to highlight the characteristics of error rate sampling, increase the size of the "higher probability" and the "higher probability"; if you want more diversity, reduce the size of the "higher probability" to prevent the selected points from being concentrated around "A" and "B". Figure 4

[0104] ​Optionally, after determining the first point, multiple second points can be determined based on the first point, and N training samples can be determined based on the multiple second points. For example, multiple points near the first point can be determined as second points, and then the training samples corresponding to the multiple second points can be determined as N training samples. For another example, other methods can be used to determine the second points and N training samples.

[0105] Several sampling methods in related technologies have different shortcomings: random sampling may miss certain specific types of errors, especially when the data is unevenly distributed; sampling based on error rate requires a preliminary error rate assessment, which will have a certain lag; sampling based on diversity requires data classification and screening, which increases the workload of preliminary preparation; sampling based on importance requires an assessment of the importance and impact of the data, which increases complexity.

[0106] Since large model recognition generally has the following characteristics, if the semantic features between samples are similar, the recognition error rates are close for "error rate sampling"; and for "diversity sampling", the types are also similar. And from the definitions of generators, edges, and vertices of the Voronoi diagram, it can be seen that there is a long distance between the two perfected samples near the polygon edge of the Voronoi diagram, which is the part with a high probability of recognition error; and the distance near the intersecting vertices is the farthest for each adjacent perfected sample, belonging to the spatial domain (based on Figure 4 For example, the spatial domain of A is the ACD, representing the portion with the highest probability of recognition error. Therefore, if a point can be found in this reduced semantic space (i.e., the Voronoi diagram) that is relatively far from each completed sample (i.e., the target training sample), both of the above sampling requirements will be met. Furthermore, by applying a certain random probability, the requirement for "random sampling" can be met. Based on the timing type configuration, the requirement for "importance sampling" for specific business types can be met. This approach combines the advantages of "diversity sampling," "error rate sampling," "random rate sampling," and "importance sampling," improving model training effectiveness.

[0107] It should be noted that the above method improves the comprehensiveness and pertinence of sample selection, thereby promoting the balanced development and in-depth learning of the model and improving the model training effect.

[0108] Optionally, in the text recognition method provided in an embodiment of the present application, multiple second points are determined based on the first point, including: determining the point closest to the first point from a tree structure to obtain a third point, wherein the initial node in the tree structure includes the starting point; taking the third point as the starting point in the Voronoi diagram, moving a preset step length toward the first point to obtain a fourth point, and determining the point closest to the fourth point in the Voronoi diagram as the fifth point; adding the third point and the fifth point as nodes to the tree structure, and determining the nodes in the tree structure as multiple second points.

[0109] For example, establish a tree structure T, the initial node in the tree structure T is only Q start When the first point Q is determined rand After that, find the distance Q from the tree structure T rand The nearest node Q near Node (in the first iteration, Q near That is Q start ), that is, find the third point. Then from Q near Towards Q rand Move a preset step size Δq to reach the fourth point, and then obtain the nearest new node Q with the moved position (i.e. the fourth point) as the center new , that is, get the fifth point. Then, Q new Add it to the tree T and set its parent node in the tree structure to the third point Q mentioned above near , which means the tree structure also includes the third point. Therefore, the nodes in the current tree structure (i.e., the starting point, the third point, and the fifth point) are determined as multiple second points. Since the storage order of each vector in the vector space follows a certain pattern, the "nearest new node" can be quickly determined without traversal.

[0110] It should be noted that by introducing the tree structure and the path approximation strategy, not only can the sample selection cover a wide range of semantic dimensions, but also priority can be given to samples that are close to the first point (i.e., high-difficulty and high-representative samples), thereby accelerating the model's learning and optimization process and improving the model training effect.

[0111] Optionally, in the text recognition method provided in the embodiment of the present application, N training samples are determined based on multiple second points, including: judging whether there is a target point among the multiple second points, wherein the target point refers to a point whose distance from the cutoff point is less than a preset distance; if there is no target point among the multiple second points, repeatedly performing the steps of reselecting the first point and determining multiple new second points based on the new first point, until there is a target point among the new multiple second points, and determining the training samples corresponding to the determined second points as N training samples.

[0112] Optionally, after the plurality of second point positions are determined, it is judged whether there is a target point position in the plurality of second point positions, that is, it is judged whether there is a point position close enough to Q goal .

[0113] If not, the steps of reselecting the first point position, determining a new plurality of second point positions based on the new first point position are repeatedly performed to continuously expand the tree structure, and until there is a target point position in the new plurality of second point positions, the training samples corresponding to the determined second point positions are determined as the N training samples. That is, until there is a target point position in the new plurality of second point positions, the training samples corresponding to all nodes in the tree structure are determined as the N training samples.

[0114] Optionally, in the case where the M training samples are divided into 1 service type, the adjacent samples of the polygon edges in the Venn diagram can be directly determined as the second point positions, so as to realize the determination of the plurality of second point positions.

[0115] It should be noted that, by the above method, it is ensured that the N training samples can cover the semantic space represented by the cutoff point position, thereby improving the accuracy and comprehensiveness of sample selection.

[0116] As can be seen, the method provided in the present application achieves the purpose of training a model by using a sample selection method based on a Venn diagram, and performs text recognition based on the trained model, thereby achieving the technical effect of improving the accuracy of text recognition, and solving the technical problem of poor training effect of a text recognition model in the related art, which leads to low text recognition accuracy of the trained text recognition model.

[0117] 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 the 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.

[0118] Embodiment 2

[0119] The embodiment of the present application also provides a text recognition device. It should be noted that the text recognition device of the embodiment of the present application can be used to execute the text recognition method provided by the embodiment of the present application. The text recognition device provided by the embodiment of the present application is introduced as follows.

[0120] According to the embodiment of the present application, a device for implementing the above-mentioned text recognition method is also provided, as shown in Figure 5 , the device comprises:

[0121] A first acquisition module 501 is configured to acquire a target file, wherein the target file includes text content to be recognized.

[0122] The first identification module 502 is configured to perform text identification on the target file by using a target identification model to obtain a text identification result, wherein the target identification model is a large language model, the target identification model is trained based on sample identification results and real labels of N training samples in a single iteration, the N training samples in the single iteration are selected from M training samples based on a Venn diagram, a point in the Venn diagram is used to represent a training sample, coordinates of the point are determined based on a semantic vector of the sample identification result of the training sample, and N is less than M.

[0123] In the embodiments of the present application, the Venn diagram is constructed based on the semantic vector of the sample identification result of the training sample, and sample selection is performed based on the Venn diagram, so that sample selection is performed based on the semantic information of the sample identification result of the training sample, thereby avoiding the bias and limitations caused by traditional random sampling, and improving the accuracy of sample selection. By training the target identification model based on the selected N training samples, the training effect of the target identification model can be improved, thereby improving the text identification accuracy.

[0124] Therefore, the method provided in the present application achieves the purpose of training the model by using the sample selection based on the Venn diagram and performing text identification based on the trained model, realizes the technical effect of improving the text identification accuracy, and solves the technical problem of poor training effect of the text identification model in the related art, which leads to low text identification accuracy of the trained text identification model.

[0125] Optionally, in the text identification device provided in the embodiments of the present application, the text identification device further includes: a second identification module, configured to perform text identification on the M training samples by using an initial identification model in each iteration to obtain M sample identification results; a construction module, configured to perform vector conversion on the M sample identification results to obtain M semantic vectors, and construct a Venn diagram based on target training samples and the M semantic vectors, wherein the target training samples are training samples with accurate sample identification results; a selection module, configured to determine a plurality of center lines from the Venn diagram, and perform sample selection in the Venn diagram based on the center lines to obtain N training samples, wherein each center line corresponds to two generating elements, and the center line represents the positions of points with the same semantic distance between the two generating elements; and a training module, configured to train the initial identification model based on sample identification results and sample proofreading results of the N training samples, and determine the initial identification model trained in the last iteration as the target identification model, wherein the sample proofreading results at least include real labels of the N training samples.

[0126] Optionally, in the text recognition device provided in the embodiments of the present application, the construction module further comprises: a first obtaining sub-module, configured to, in a case where the current iteration round is the first round, obtain a first proofreading result of the target object for the M sample recognition results, and take a target training sample in the first proofreading result as a generation element, wherein the first proofreading result comprises the target training sample of part of the M training samples; and a processing sub-module, configured to, in a case where the current iteration round is the Pth round, take the target training sample in the last round as the generation element and a target training sample in the N training samples in the last round as the generation element, wherein P is a positive integer greater than 1.

[0127] Optionally, in the text recognition device provided in the embodiments of the present application, the text recognition device further comprises: an obtaining module, configured to obtain a second proofreading result of a sample recognition result of the target object for the N training samples, wherein the second proofreading result comprises real labels of the N training samples and error types of the sample recognition result errors in the N training samples; and a determining module, configured to determine the real labels and the error types in the second proofreading result as the sample proofreading result.

[0128] Optionally, in the text recognition device provided in the embodiments of the present application, the selection module further comprises: a first determining sub-module, configured to determine a starting point and an ending point in the Venn diagram based on the semantic vectors of the two business types; a second determining sub-module, configured to determine a plurality of polygons and a plurality of intersection points in the Venn diagram based on the center lines, wherein the edges of the polygons are composed of the center lines, and the intersection points refer to common intersection points among three center lines; a third determining sub-module, configured to determine the first point in the Venn diagram in a manner that the ending point is selected according to a first probability, a point is selected based on the polygons according to a second probability, a point is selected based on the intersection points according to a third probability, and a point is selected randomly according to a fourth probability, wherein the sum of the first probability, the second probability, the third probability and the fourth probability is 1; and a fourth determining sub-module, configured to determine a plurality of second points based on the first point, and determine the N training samples based on the plurality of second points.

[0129] Optionally, in the text recognition device provided in the embodiments of the present application, the fourth determining sub-module further comprises: a first determining unit, configured to determine a point closest to the first point in the tree structure to obtain a third point, wherein the initial node in the tree structure comprises the starting point; a second determining unit, configured to move a preset step length from the third point to the first point in the Venn diagram to obtain a fourth point, and determine a point closest to the fourth point in the Venn diagram as a fifth point; and a third determining unit, configured to add the third point and the fifth point as nodes to the tree structure, and determine the nodes in the tree structure as the plurality of second points.

[0130] Optionally, in the text recognition device provided in the embodiment of the present application, the fourth determination submodule also includes: a judgment unit, used to judge whether there is a target point among the multiple second points, wherein the target point refers to a point whose distance from the cutoff point is less than a preset distance; a fourth determination unit, used to repeatedly execute the steps of reselecting the first point and determining multiple new second points based on the new first point when there is no target point among the multiple second points, until there is a target point among the new multiple second points, and the training samples corresponding to the determined second points are determined to be N training samples.

[0131] It should be noted that the first acquisition module 501 and the first identification module 502 correspond to steps S201 to S202 in Example 1. The examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above-mentioned modules can also be run as part of the device in the computer terminal 10 provided in Example 1.

[0132] Example 3

[0133] An embodiment of the present application may provide an electronic device, Figure 6 This is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 6 As shown, the electronic device may include: one or more ( Figure 6 Only one is shown) processor 1002, memory 1004, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0134] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the above-mentioned method. The memory 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 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal 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 a combination thereof.

[0135] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining a target file, wherein the target file includes text content to be subjected to text recognition; performing text recognition on the target file through a target recognition model to obtain a text recognition result, wherein the target recognition model is a large language model, the target recognition model is trained based on sample recognition results and true labels of N training samples in a single round of iteration, the N training samples in the single round of iteration are selected from M training samples based on a Venn diagram, a point in the Venn diagram is used to represent a training sample, coordinates of the point are determined based on a semantic vector of the sample recognition result of the training sample, and N is less than M.

[0136] The processor can also call information and application programs stored in the memory through the transmission device to perform the following steps: in each round of iteration, performing text recognition on the M training samples through an initial recognition model in the round of iteration to obtain M sample recognition results; performing vector conversion on the M sample recognition results to obtain M semantic vectors, and taking part of the target training samples in the M training samples as generating elements, constructing a Venn diagram based on the target training samples and the M semantic vectors, wherein the target training samples are training samples with accurate sample recognition results; determining a plurality of center lines from the Venn diagram, and performing sample selection in the Venn diagram based on the center lines to obtain N training samples, wherein each center line corresponds to two generating elements, and the center line represents the positions of points with the same semantic distance between the two generating elements; training the initial recognition model based on sample recognition results and sample correction results of the N training samples, and determining the initial recognition model trained in the last round of iteration as the target recognition model, wherein the sample correction results at least include true labels of the N training samples.

[0137] The processor can also call information and application programs stored in the memory through the transmission device to perform the following steps: in the case that the current iteration round is the first round, obtaining a first correction result of the target object for the M sample recognition results, and taking the target training samples in the first correction result as generating elements, wherein the first correction result includes part of the target training samples in the M training samples; in the case that the current iteration round is the Pth round, taking the target training samples in the last round as generating elements and the target training samples in the N training samples in the last round as generating elements, wherein P is a positive integer greater than 1.

[0138] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining a second correction result of the sample recognition result of the target object for the N training samples before training the initial recognition model based on the sample recognition result and the sample correction result of the N training samples, wherein the second correction result includes the true label of the N training samples and the error type of the sample recognition result error in the N training samples; and determining the true label and the error type in the second correction result as the sample correction result.

[0139] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: determining a starting point and an ending point in the Venn diagram based on the semantic vectors of the two business types; determining a plurality of polygons and a plurality of intersection points in the Venn diagram based on the center lines, wherein the edges of the polygons are composed of the center lines, and the intersection points refer to common intersection points between three center lines; determining a first point in the Venn diagram in a manner that the ending point is selected according to a first probability, a point is selected based on the polygons according to a second probability, a point is selected based on the intersection points according to a third probability, and a point is randomly selected according to a fourth probability, wherein the sum of the first probability, the second probability, the third probability and the fourth probability is 1; determining a plurality of second points based on the first point, and determining the N training samples based on the plurality of second points.

[0140] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: determining a point closest to the first point in the tree structure to obtain a third point, wherein the initial node in the tree structure includes the starting point; moving a fourth point from the third point in the Venn diagram towards the first point by a preset step length, and determining a fifth point closest to the fourth point in the Venn diagram; adding the third point and the fifth point as nodes to the tree structure, and determining the nodes in the tree structure as the plurality of second points.

[0141] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: determining whether there is a target point in the plurality of second points, wherein the target point refers to a point with a distance less than a preset distance from the ending point; in the case that there is no target point in the plurality of second points, repeating the steps of reselecting the first point, determining a new plurality of second points based on the new first point, until there is a target point in the new plurality of second points; and in the case that there is a target point in the new plurality of second points, determining the training samples corresponding to the determined second points as the N training samples.

[0142] In the embodiment of the present application, the Venn diagram is constructed based on the semantic vector of the sample recognition result of the training sample, and the sample selection is performed based on the Venn diagram, so that the sample selection is performed based on the semantic information of the sample recognition result of the training sample, thereby avoiding the deviation and limitation caused by the traditional random sampling, and improving the accuracy of sample selection. By training the target recognition model based on the selected N training samples, the training effect of the target recognition model can be improved, thereby improving the text recognition accuracy.

[0143] Therefore, the method provided in the present application achieves the purpose of training the model by using the sample selection based on the Venn diagram, and performing the text recognition based on the trained model, and achieves the technical effect of improving the text recognition accuracy, and solves the technical problem of poor training effect of the text recognition model in the related art, which leads to low text recognition accuracy of the trained text recognition model.

[0144] Those skilled in the art can understand that Figure 6 The structure shown is only schematic, and the electronic device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Figure 6 It does not limit the structure of the electronic device. For example, the electronic device can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figure, or have a different configuration from that shown in the figure. Figure 6 For example, the electronic device can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figure, or have a different configuration from that shown in the figure. Figure 6 For example, the electronic device can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figure, or have a different configuration from that shown in the figure.

[0145] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by programs instructing the related hardware of the terminal device, and the programs can be stored in a computer readable storage medium, which can include a flash disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, etc.

[0146] Embodiment 4

[0147] The embodiment of the present application also provides a storage medium. Optionally, in the embodiment, the above storage medium can be used to save the program code executed by the text recognition method provided in the embodiment one.

[0148] Optionally, in the embodiment, the above storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.

[0149] The application also provides a computer program product adapted to perform the steps of the text recognition method when executed on a data processing device.

[0150] The above-mentioned embodiment numbers of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0151] In the above-mentioned embodiments of the application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0152] In the several embodiments provided by the present application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the above-described device embodiments are only illustrative, and the division of units is only a logical function division. There can be another division way in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, unit or module, and can be electrical or other forms.

[0153] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.

[0154] In addition, each functional unit in each embodiment of the application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or in the form of software functional unit.

[0155] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing 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 the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0156] The above is only the preferred embodiment of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should be considered as the protection scope of the present application.

Claims

1. A text recognition method, characterized in that: include: Acquire a target file, wherein the target file includes text content to be subjected to text recognition; Performing text recognition on the target file through a target recognition model to obtain a text recognition result, wherein the target recognition model is a large language model, and the target recognition model is trained based on sample recognition results and true labels of N training samples in a single round of iteration, and the N training samples in a single round of iteration are selected from M training samples based on a Voronoi diagram, and the points in the Voronoi diagram are used to represent the training samples, and the coordinates of the points are determined based on the semantic vectors of the sample recognition results of the training samples, and N is less than M.

2. The method according to claim 1, characterized in that The target recognition model is obtained by: In each round of iteration, the M training samples are subjected to text recognition using the initial recognition model in the iteration to obtain M sample recognition results; Performing vector conversion on the M sample recognition results to obtain M semantic vectors, and using some target training samples among the M training samples as generators, constructing the Voronoi diagram based on the target training samples and the M semantic vectors, wherein the target training samples are training samples with accurate sample recognition results; Determining a plurality of center lines from the Voronoi diagram, and performing sample selection in the Voronoi diagram based on the center lines to obtain the N training samples, wherein each center line corresponds to two generators, and the center line represents the position of a point having the same semantic distance as the two generators; An initial recognition model is trained based on the sample recognition results and sample proofreading results of the N training samples, and the initial recognition model trained in the last round of iteration is determined as the target recognition model, wherein the sample proofreading results at least include the true labels of the N training samples.

3. The method according to claim 2, characterized in that Using some target training samples among the M training samples as generators includes: When the current iteration round is the first round, obtaining a first proofreading result of the target object recognition results for the M samples, and using the target training sample in the first proofreading result as a generator, wherein the first proofreading result includes a portion of the target training samples in the M training samples; When the current iteration round is the Pth round, the target training sample used as the generator in the previous round and the target training sample among the N training samples in the previous round are used as generators, where P is a positive integer greater than 1.

4. The method according to claim 2, characterized in that Before training the initial recognition model based on the sample recognition results and sample proofreading results of the N training samples, the method further includes: Obtaining a second proofreading result of the sample recognition result of the target object for the N training samples, wherein the second proofreading result includes the true labels of the N training samples and the error types of the sample recognition results errors in the N training samples; The true label and error type in the second proofreading result are determined as the sample proofreading result.

5. The method according to claim 2, characterized in that In a case where the M training samples are divided into two service types, sample selection is performed in the Voronoi diagram based on the center line to obtain the N training samples, including: Determining a starting point and an ending point from the Voronoi diagram based on the semantic vectors of the two service types; Determining a plurality of polygons and a plurality of intersection points in the Voronoi diagram based on the center lines, wherein the sides of the polygons are formed by the center lines, and the intersection points are common intersection points between three center lines; Determining a first point from the Voronoi diagram by selecting a cutoff point according to a first probability, selecting a point based on the polygon according to a second probability, selecting a point based on the intersection according to a third probability, and randomly selecting a point according to a fourth probability, wherein the sum of the first probability, the second probability, the third probability, and the fourth probability is 1; A plurality of second points are determined based on the first point, and the N training samples are determined based on the plurality of second points.

6. The method according to claim 5, characterized in that Determining a plurality of second points based on the first point includes: Determine a point closest to the first point from a tree structure to obtain a third point, wherein an initial node in the tree structure includes the starting point; In the Voronoi diagram, starting from the third point, moving a preset step length toward the first point to obtain a fourth point, and determining the point in the Voronoi diagram closest to the fourth point as the fifth point; The third point and the fifth point are added as nodes to the tree structure, and the nodes in the tree structure are determined to be the plurality of second points.

7. The method according to claim 5, characterized in that Determining the N training samples based on the multiple second points includes: Determining whether there is a target point among the plurality of second points, wherein the target point refers to a point whose distance from the cutoff point is less than a preset distance; When there is no target point among the multiple second points, the steps of reselecting the first point and determining multiple new second points based on the new first point are repeated until there is a target point among the multiple new second points, and the training samples corresponding to the determined second points are determined as the N training samples.

8. A text recognition device, characterized in that: include: A first acquisition module is used to acquire a target file, wherein the target file includes text content to be subjected to text recognition; The first recognition module is used to perform text recognition on the target file through a target recognition model to obtain a text recognition result, wherein the target recognition model is a large language model, and the target recognition model is trained based on the sample recognition results and true labels of N training samples in a single round of iteration. The N training samples in a single round of iteration are selected from M training samples based on a Voronoi diagram. The points in the Voronoi diagram are used to represent the training samples. The coordinates of the points are determined based on the semantic vectors of the sample recognition results of the training samples, and N is less than M.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored executable program, wherein when the executable program is run, the device where the computer-readable storage medium is located is controlled to execute the text recognition method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: a memory storing an executable program; A processor is configured to run the program, wherein the program, when running, executes the text recognition method according to any one of claims 1 to 7.

11. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the text recognition method according to any one of claims 1 to 7 are implemented.