Method, apparatus, device, medium and product for identifying image text

By segmenting the test question file into sub-files and utilizing multi-process concurrent processing and a distributed message queue system, the problem of low efficiency in OCR recognition of test question images was solved, achieving efficient image text recognition and sensitive word detection.

CN115331089BActive Publication Date: 2025-11-18BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211008302.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-22
Publication Date
2025-11-18
Estimated Expiration
2042-08-22

AI Technical Summary

Technical Problem

Existing technologies for OCR are inefficient at recognizing sensitive words in test questions and cannot efficiently process a large number of test question images.

Method used

By dividing the test question identification file into multiple sub-files and utilizing multi-process concurrent processing and a distributed message queue system, image filtering and text recognition of the test question content are performed on the production queue server and the consumer queue server respectively, thereby improving recognition efficiency.

Benefits of technology

It achieves efficient recognition of test question images and detection of sensitive words, improving OCR recognition efficiency and processing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115331089B_ABST
    Figure CN115331089B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, equipment, medium and product for identifying image text, relating to the technical field of artificial intelligence, in particular to the technical field of computer vision. The specific implementation scheme is: dividing a test question identification file into multiple test question identification sub-files; transmitting the multiple test question identification sub-files to a first message queue; cyclically reading the test question identification sub-files from the first message queue; based on multiple processes, concurrently processing the test question identification sub-files to obtain a test question identification set matched with each test question identification sub-file; for each test question identification, in response to determining that the test question content corresponding to the test question identification contains an image, sending the test question content to a second message queue to enable the second message queue to perform optical character recognition on the image. The present implementation mode can improve the OCR recognition efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, specifically the field of computer vision technology. Background Technology

[0002] Currently, Optical Character Recognition (OCR) can recognize text in images and has been widely used.

[0003] When identifying sensitive words in test questions, it is necessary to perform OCR recognition on the images contained in the questions to obtain the corresponding text. Based on this text processing, it is determined whether sensitive words are contained. In this process, the efficiency of OCR recognition is low due to the large number of test questions requiring OCR recognition. Summary of the Invention

[0004] This disclosure provides a method, apparatus, device, medium, and product for recognizing text in images.

[0005] According to one aspect of this disclosure, a method for recognizing text in an image is provided, comprising: dividing a test question identifier file into multiple test question identifier sub-files; transmitting the multiple test question identifier sub-files to a first message queue; cyclically reading the test question identifier sub-files from the first message queue; concurrently processing the test question identifier sub-files based on multiple processes to obtain a set of test question identifiers matching each test question identifier sub-file; wherein the number of processes is the same as the number of test question identifier sub-files in the first message queue, and the set of test question identifiers is a set of a preset number of test question identifiers determined from each test question identifier contained in the test question identifier sub-files; for each test question identifier, in response to determining that the test question content corresponding to the test question identifier contains an image, sending the test question content to a second message queue so that the second message queue performs optical character recognition on the image; wherein one test question identifier corresponds to one test question content.

[0006] According to another aspect of this disclosure, an apparatus for recognizing image text is provided, comprising: a file segmentation unit configured to segment a test question identifier file into multiple test question identifier sub-files; a file transmission unit configured to transmit the multiple test question identifier sub-files to a first message queue; a file reading unit configured to cyclically read the test question identifier sub-files from the first message queue; an identifier determination unit configured to concurrently process the test question identifier sub-files based on multiple processes to obtain a set of test question identifiers matching each test question identifier sub-file; wherein the number of processes is the same as the number of test question identifier sub-files in the first message queue, and the set of test question identifiers is a set of a preset number of test question identifiers determined from each test question identifier contained in the test question identifier sub-files; and an image recognition unit configured to, for each test question identifier, in response to determining that the test question content corresponding to the test question identifier contains an image, send the test question content to a second message queue so that the second message queue performs optical character recognition on the image; wherein one test question identifier corresponds to one test question content.

[0007] According to another aspect of this disclosure, an electronic device is provided, comprising: one or more processors; a memory for storing one or more programs; and, when the one or more programs are executed by the one or more processors, causing the one or more processors to implement any of the above methods for recognizing image text.

[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform any of the above methods for recognizing image text.

[0009] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements any of the above methods for recognizing image text.

[0010] According to the technology disclosed herein, a method for recognizing text in images is provided, which can improve OCR recognition efficiency.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0013] Figure 1 This is an exemplary system architecture diagram to which one embodiment of this disclosure can be applied;

[0014] Figure 2This is a flowchart of an embodiment of a method for recognizing image text according to the present disclosure;

[0015] Figure 3 This is a schematic diagram of an application scenario of the method for recognizing text in an image according to the present disclosure;

[0016] Figure 4 This is a flowchart of another embodiment of the method for recognizing image text according to the present disclosure;

[0017] Figure 5 This is a schematic diagram of one embodiment of the apparatus for recognizing image text according to the present disclosure;

[0018] Figure 6 This is a block diagram of an electronic device used to implement the method for recognizing image text according to embodiments of the present disclosure. Detailed Implementation

[0019] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0020] It should be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other. This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.

[0021] like Figure 1 As shown, system architecture 100 may include a production queue server 101, a network 102, and multiple consumer queue servers 103. Network 102 serves as the medium for providing communication links between the production queue server 101 and the consumer queue servers 103. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0022] The production queue server 101 may deploy a first message queue. During the image text recognition process, the production queue server 101 can cyclically read question identifier sub-files from the first message queue. These question identifier sub-files can be several smaller files obtained by segmenting the question identifier files corresponding to all questions. The production queue server 101 can also concurrently process the question identifier sub-files based on multiple processes to obtain a set of question identifiers matching each question identifier sub-file. The number of processes is the same as the number of question identifier sub-files in the first message queue. The set of question identifiers is a set of a preset number of question identifiers determined from each question identifier contained in the question identifier sub-files. For each question identifier in the set, the corresponding question content is determined. For each question content, it is determined whether the question content contains an image. If it does, the question content is sent to the consumer queue server 103 via network 102, so that the second message queue in the consumer queue server 103 can perform optical character recognition on the image. The second message queue can be deployed across multiple consumer queue servers 103. Preferably, the production queue server 101 can employ multiple processes to concurrently acquire test question content and determine whether the test question content contains images. Preferably, both the production queue server 101 and the consumer queue server 103 deploy daemon processes to prevent program interruptions.

[0023] Furthermore, the question identifier sub-file can be stored in the production queue server 101. During the process of the production queue server 101 determining whether the question content contains an image, a corresponding log file can be generated and stored uniformly in the production queue server 101. Based on the analysis of the log files stored in the production queue server 101, the progress and breakpoints in determining whether the question content contains an image can be obtained.

[0024] Furthermore, the consumer queue server 103 can start a process to retrieve test question content from the second message queue, identify the text corresponding to the images contained in the test question content, and write the text into a database for reading text from the database for sensitive word recognition. Preferably, the recognition speed of image text recognition by the consumer queue server 103 can be controlled by increasing or decreasing the number of consumer queue servers 103. Preferably, the production queue server 101 and the consumer queue server 103 can start multiple processes to process data concurrently, wherein the number of processes of the production queue server 101 is determined based on the consumption demand information of the consumer queue server 103.

[0025] It should be noted that the production queue server 101 and the consumer queue server 103 can be either hardware or software. When the production queue server 101 and the consumer queue server 103 are hardware, they can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the production queue server 101 and the consumer queue server 103 are software, they can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module. No specific limitations are imposed here.

[0026] It should be noted that the method for recognizing image text provided in this embodiment can be executed by the production queue server 101, and the device for recognizing image text can be set in the production queue server 101. This embodiment does not limit this.

[0027] It should be understood that Figure 1 The number of production queue servers, network servers, and consumer queue servers shown is merely illustrative. Depending on implementation needs, any number of production queue servers, network servers, and consumer queue servers can be used.

[0028] Continue to refer to Figure 2 The diagram illustrates a flow 200 of an embodiment of a method for recognizing image text according to the present disclosure. The method for recognizing image text of this embodiment includes the following steps:

[0029] Step 201: Divide the question identifier file into multiple question identifier sub-files.

[0030] In this embodiment, the execution subject (such as...) Figure 1 The production queue server 101 can obtain the question identifier file from local storage or a pre-connected electronic device. This question identifier file contains a large number of question identifiers. The executing entity can then divide the question identifier file into multiple question identifier sub-files. Each sub-file can include multiple question identifiers. Furthermore, the file size of each sub-file can be set to be less than a preset threshold, thereby splitting the large file into smaller files, facilitating subsequent data processing, improving data processing efficiency, and simplifying data management.

[0031] Step 202: Transmit multiple question identifier sub-files to the first message queue.

[0032] In this embodiment, the executing entity can transmit multiple question identifier sub-files to a first message queue to read and process the question identifier sub-files from the first message queue. Preferably, the first message queue is in the form of a file pipe, which serves as a channel for inter-process data exchange; one process can write information to the file pipe, and other processes can read information from the file pipe.

[0033] It is understood that the number of the aforementioned question identifier sub-files is quite large, while the number of files that the first message queue can hold at one time is usually much smaller than the total number of question identifier sub-files. Therefore, it is necessary to transmit the aforementioned question identifier sub-files to the first message queue in batches. After reading and processing one question identifier sub-file from the first message queue, an unprocessed question identifier sub-file can be added to the first message queue, until all the aforementioned question identifier sub-files have been processed.

[0034] Step 203: Read the question identifier sub-file from the first message queue in a loop.

[0035] In this embodiment, the executing entity can cyclically read a sub-file containing multiple question identifiers from the first message queue. The question identifiers are used to associate and store question content, and the corresponding question content can be determined based on the question identifiers. Using the method of reading the question identifier sub-files, compared to directly reading the question content, can significantly reduce the file size, thereby improving file reading speed and consequently improving the image and text recognition speed. Both the first message queue and the question identifier sub-files can be deployed on a production queue server.

[0036] In some optional implementations of this embodiment, reading the question identifier sub-files cyclically from the first message queue may include: using a preset sliding window, obtaining an initial question identifier sub-file from multiple question identifier sub-files contained in the first message queue. In response to the initial question identifier sub-file having completed image determination, a new question identifier sub-file is selected from the first message queue, and an image determination operation is performed on the newly selected question identifier sub-file until all question identifier sub-files in the first message queue have completed image determination. The image determination operation involves determining whether the question content corresponding to all question identifiers in the question identifier sub-files contains an image. If the question content corresponding to all question identifiers has been determined to contain an image, then the image determination operation is considered complete. Preferably, the preset sliding window can be a first-in, first-out (FIFO) sliding window. Preferably, in the process of obtaining the question identifier sub-files from multiple question identifier sub-files contained in the first message queue using the preset sliding window, multi-process concurrent reading of the question identifier sub-files can be employed.

[0037] Step 204: Based on multiple processes, concurrently process the question identifier sub-files to obtain a set of question identifiers that match each question identifier sub-file; wherein, the number of processes is the same as the number of question identifier sub-files in the first message queue, and the set of question identifiers is a set of a preset number of question identifiers determined from each question identifier contained in the question identifier sub-file.

[0038] In this embodiment, after obtaining the question identifier sub-file, the executing entity can scan the question identifier sub-file to obtain multiple question identifiers within it, and then use these multiple question identifiers as the aforementioned question identifier set. Optionally, the executing entity can iteratively read the question identifiers in the question identifier sub-file, obtaining a preset number of question identifiers each time to obtain a question identifier set. Afterwards, once the question content corresponding to each question identifier in the question identifier set has been determined to contain an image, a new batch of question identifier sets is obtained from the question identifier sub-file, and this process is repeated until the question content corresponding to all question identifiers in the question identifier sub-file has been determined to contain an image.

[0039] Step 205: For each question identifier, in response to determining that the question content corresponding to the question identifier contains an image, the question content is sent to the second message queue so that the second message queue performs optical character recognition on the image; wherein, one question identifier corresponds to one question content.

[0040] In this embodiment, the executing entity can determine the question content corresponding to each question identifier in the question identifier set from a preset database. The preset database can be stored in the executing entity or in other electronic devices connected to the executing entity; this embodiment does not limit this. The second message queue is preferably a Redis list queue (a list queue in a remote dictionary service). Compared to other types of queues, this queue allows for timely marking of question content containing images as read after it is read, and the next question content to be added to the queue, thereby further improving OCR recognition efficiency.

[0041] In some optional implementations of this embodiment, determining the question content corresponding to each question identifier in the question identifier set may include: sending a batch question retrieval request to a preset database, and receiving the question content corresponding to each question identifier in the question identifier set returned by the preset database based on the batch question retrieval request. By implementing this optional implementation, question content can be retrieved in batches from the preset database. Compared to retrieving question content corresponding to question identifiers one by one, this batch retrieval method can further improve question processing efficiency.

[0042] In this embodiment, the executing entity can determine whether the question content corresponding to each question identifier contains an image. If it does, the question content is sent to a second message queue so that the second message queue can identify the text in the image and perform sensitive word identification based on the text in the image to determine whether the image in the question content contains sensitive words. Optionally, if the executing entity determines that the question content contains an image, it can also extract the image from the question content and send the image and the question identifier to the second message queue so that the second message queue can obtain the image and perform image recognition more quickly. Furthermore, after the second message queue obtains the image recognition result, it can associate and store the image recognition result with the question identifier for easy management of the image-text recognition results.

[0043] The second message queue and the first message queue can be deployed on different servers. This allows the production queue server to focus solely on determining whether the question content contains images, thus filtering question content that does. Conversely, the consumer queue server can focus solely on acquiring images from the question content and recognizing the text within those images. By deploying the image filtering and image recognition steps to different servers, the efficiency of image-to-text recognition can be improved.

[0044] In some optional implementations of this embodiment, the following steps may also be performed: receiving text information from the image contained in each test question returned by the second message queue; and determining the sensitive word recognition result corresponding to each test question based on text recognition of the text information.

[0045] See also Figure 3 This illustration shows a schematic diagram of an application scenario of the method for recognizing text in an image according to the present disclosure. Figure 3 In the application scenario, the executing entity can obtain the question identifier sub-file 302 from the first message queue 301, and obtain the question identifier set 303 based on the question identifier sub-file 302. For each question identifier in the question identifier set 303, the corresponding question content 304 can be determined. An image determination operation 305 is performed on the question content 304, that is, it is determined whether the question content 304 contains an image. If the question content 304 does not contain an image, the current question content 304 is skipped, and the question content 304 is re-obtained and the image determination operation 305 is performed again. If the question content 304 contains an image, the question content 304 is sent to the second message queue 306. Afterwards, the consumer queue server deployed with the second message queue 306 can obtain the question content 304 from the second message queue 306 and identify the image text 307 contained in the image within the question content 304.

[0046] The method for recognizing text in images provided in the above embodiments of this disclosure can utilize a first message queue and a second message queue deployed on different servers to filter test questions containing images and perform OCR recognition on the images. Since different message queues can execute asynchronously, recognizing text in images based on different message queues can improve OCR recognition efficiency. Furthermore, by segmenting the test question identifier file to obtain multiple test question identifier sub-files and using multiple processes to concurrently read these sub-files, OCR recognition efficiency can be further improved.

[0047] See also Figure 4 This illustrates a flow 400 of another embodiment of a method for recognizing image text according to the present disclosure. For example... Figure 4 As shown, the method for recognizing image text in this embodiment may include the following steps:

[0048] Step 401: Divide the question identifier file into multiple question identifier sub-files.

[0049] In this embodiment, for a detailed description of step 401, please refer to the detailed description of step 201, which will not be repeated here.

[0050] Step 402: Transmit multiple question identifier sub-files to the first message queue.

[0051] In this embodiment, for a detailed description of step 402, please refer to the detailed description of step 202, which will not be repeated here.

[0052] Step 403: Read the question identifier sub-file from the first message queue in a loop.

[0053] In this embodiment, for a detailed description of step 403, please refer to the detailed description of step 203, and it will not be repeated here.

[0054] Step 404: For each question identifier sub-file, use the process corresponding to the question identifier sub-file to obtain a preset number of question identifiers from the question identifier sub-file according to the order of the question identifiers in the question identifier sub-file; wherein, the process corresponding to each question identifier sub-file is executed concurrently.

[0055] In this embodiment, the executing entity can obtain a preset number of question identifiers from the question identifier sub-file according to the order in which each question identifier appears in the question identifier sub-file. The order of the question identifiers can be the order in which they appear in the question identifier sub-file. For example, the question identifier sub-file may include many rows, each row corresponding to one question identifier. The executing entity can select the question identifiers from the first preset number of rows according to their order of appearance in the file to obtain the preset number of question identifiers.

[0056] Step 405: Based on a preset number of question identifiers, generate a set of question identifiers that match the question identifier sub-file.

[0057] In this embodiment, the executing entity can form a set of test question identifiers from the aforementioned preset number of test question identifiers.

[0058] The number of processes mentioned above is the same as the number of question identifier sub-files in the first message queue. The question identifier set is a set of a preset number of question identifiers determined from each question identifier contained in the question identifier sub-file.

[0059] Step 406: For each question content corresponding to a question identifier in the question identifier set, determine the image discrimination result corresponding to the question content; wherein, the image discrimination result is either containing an image or not containing an image.

[0060] In this embodiment, the executing entity can determine whether the question content corresponding to each question identifier in the question identifier set contains an image, thereby obtaining the image discrimination result corresponding to the question content. Then, based on the image discrimination result, the executing entity can filter out question content containing images from a massive amount of question content, facilitating subsequent OCR recognition and sensitive word recognition of the question content containing images.

[0061] Step 407: In response to the fact that the image discrimination results of the question content corresponding to each question identifier in the question identifier set have been determined, a preset number of question identifiers are re-acquired from the question identifier sub-file that matches the question identifier set, and the question identifier set is updated based on the re-acquired preset number of question identifiers.

[0062] In this embodiment, if the image discrimination result is determined for all the question content corresponding to all the question identifiers in the question identifier set, a preset number of question identifiers can be re-obtained from the question identifier sub-file. The newly obtained preset number of question identifiers are used as a new question identifier set. For each question identifier in the new question identifier set, it is determined whether the question content corresponding to the question identifier contains an image. This process continues until the image discrimination result is determined for all the question identifiers corresponding to all the question identifiers in the question identifier sub-file. Then, the question identifier sub-file is updated, and this process is repeated to traverse all the question identifier sub-files.

[0063] In some optional implementations of this embodiment, the following steps may also be performed: For the question content corresponding to each question identifier in the question identifier set, in response to the question content having a determined image discrimination result, the question identifier is stored in the log file corresponding to the question identifier sub-file that matches the question identifier set.

[0064] In this implementation, the executing entity can generate a log file for each question identifier sub-file when acquiring each question identifier sub-file and performing image discrimination on the question content corresponding to the question identifier in that sub-file. Preferably, the log file is stored in the executing entity (production queue server). Specifically, for each question content corresponding to a question identifier in the question identifier set, if the question content has been determined to have an image discrimination result, the question identifier corresponding to that question content can be stored in the log file corresponding to the question identifier sub-file to record that the image discrimination operation for that question identifier has been completed.

[0065] In some optional implementations of this embodiment, the following steps may also be performed: in response to the fact that each question identifier in the question identifier sub-file has been stored in the log file, the log file is moved to a specified file directory for storage; based on the files in the specified file directory, the question identifier sub-file is updated.

[0066] In this implementation, if all question identifiers in the current question identifier sub-file have been stored in their corresponding log files, it indicates that the image discrimination operation for that question identifier sub-file has been completed, and the log file corresponding to that question identifier sub-file can be moved to a designated directory for storage. Optionally, the executing entity can also move the question identifier sub-file from the first message queue to a designated directory for storage. The designated directory for storing the question identifier sub-file and the designated directory for storing the corresponding log file can be different or the same; this embodiment does not impose any limitations on this. The designated directory is the directory corresponding to the processed files. Unprocessed files (log files and / or question identifier sub-files) can be stored in directories different from the designated directory, allowing for quick identification of the file processing status based on the file directory. Furthermore, since the size of the question identifier sub-file is less than a threshold, in breakpoint resume applications, smaller files can be read quickly without repeatedly reading larger file contents, thereby further improving file processing speed.

[0067] Furthermore, the executing entity can also update the question identifier sub-file based on files in a specified file directory. Specifically, if image discrimination is interrupted, the executing entity can determine the question identifier sub-file that has completed image discrimination from the files in the specified file directory, obtain the question identifier sub-file that currently needs image discrimination, and update the question identifier sub-file based on the question identifier sub-file that currently needs image discrimination.

[0068] In some optional implementations of this embodiment, the following steps may also be performed: determining recognition progress information based on files in a specified file directory.

[0069] In this implementation, since the files in the specified file directory contain test item identifier sub-files that have completed image discrimination, and / or log files corresponding to the test item identifier sub-files, the test item identifier information and test item identifier sub-file information that have completed image discrimination can be obtained based on the files in the specified file directory. Then, the executing entity can perform file analysis on the files in the specified file directory to obtain recognition progress information. This recognition progress information is used to indicate the progress of image discrimination of the test item identifiers.

[0070] Step 408: For each question identifier, in response to determining that the question content corresponding to the question identifier contains an image, the question content is sent to the second message queue so that the second message queue performs optical character recognition on the image; wherein, one question identifier corresponds to one question content.

[0071] In this embodiment, the detailed description of step 408 is the same as the detailed description of step 205, and will not be repeated here.

[0072] The method for recognizing image text provided in the above embodiments of this disclosure can further obtain a preset number of question identifiers from a question identifier sub-file according to the question identifier order, thus obtaining a question identifier set. Based on multiple question identifiers in the question identifier set, question content can be obtained in batches, improving the efficiency of question content acquisition. Furthermore, question identifiers can be read cyclically from the question identifier sub-file to obtain a question identifier set, enabling image discrimination of the question content of each question identifier in the question identifier sub-file. During the image discrimination operation of reading question identifiers, a corresponding log file is generated, allowing the question identifier sub-file to be updated based on the log file, solving the problem of resuming interrupted downloads. Finally, by statistically analyzing the question identifiers in the log file, recognition progress information can be obtained, enabling overall progress statistics of the image discrimination operation based on the recognition progress information, facilitating the management of the image text recognition progress.

[0073] Further reference Figure 5 As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of a device for recognizing image text, which is similar to... Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to electronic devices such as production queue servers.

[0074] like Figure 5 As shown, the device 500 for recognizing image text in this embodiment includes: a file segmentation unit 501, a file transfer unit 502, a file reading unit 503, an identifier determination unit 504, and an image recognition unit 505.

[0075] The file segmentation unit 501 is configured to segment the test question identifier file into multiple test question identifier sub-files.

[0076] The file transfer unit 502 is configured to transfer multiple question identifier sub-files to the first message queue.

[0077] The file reading unit 503 reads the question identifier sub-file from the first message queue in a loop.

[0078] The identifier determination unit 504 is configured to concurrently process the question identifier sub-files based on multiple processes to obtain a set of question identifiers that match each question identifier sub-file; wherein, the number of processes is the same as the number of question identifier sub-files in the first message queue, and the set of question identifiers is a set of a preset number of question identifiers determined from each question identifier contained in the question identifier sub-file.

[0079] The image recognition unit 505 is configured to, for each question identifier, in response to determining that the question content corresponding to the question identifier contains an image, send the question content to a second message queue so that the second message queue performs optical character recognition on the image; wherein, one question identifier corresponds to one question content.

[0080] In some optional implementations of this embodiment, the identifier determination unit 504 is further configured to: for each question identifier sub-file, using the process corresponding to the question identifier sub-file, obtain a preset number of question identifiers from the question identifier sub-file according to the order of the question identifiers in the question identifier sub-file; wherein, the process corresponding to each question identifier sub-file is executed concurrently; and based on the preset number of question identifiers, generate a set of question identifiers that match the question identifier sub-file.

[0081] In some optional implementations of this embodiment, the identifier determination unit 504 is further configured to: determine the image discrimination result corresponding to the question content corresponding to each question identifier in the question identifier set; wherein the image discrimination result is either containing an image or not containing an image; in response to the fact that the image discrimination result has been determined for the question content corresponding to each question identifier in the question identifier set, re-acquire a preset number of question identifiers from the matching question identifier sub-file of the question identifier set, and update the question identifier set based on the re-acquired preset number of question identifiers.

[0082] In some optional implementations of this embodiment, a file processing unit is further included, configured to, for each question content corresponding to a question identifier in the question identifier set, store the question identifier in a log file corresponding to the question identifier file that matches the question identifier file in the question identifier set, in response to the question content having a determined image discrimination result.

[0083] In some optional implementations of this embodiment, the file processing unit is further configured to: in response to the fact that each question identifier in the question identifier sub-file has been stored in the log file, move the log file to a specified file directory for storage; and update the question identifier sub-file based on the files in the specified file directory.

[0084] In some optional implementations of this embodiment, the file processing unit is further configured to determine recognition progress information based on files in a specified file directory.

[0085] It should be understood that units 501 to 504 described in the device 500 for recognizing image text are respectively related to the reference. Figure 2 The steps in the method described above correspond to those in the previous section. Therefore, the operations and features described above for the method of recognizing image text also apply to the device 500 and the units contained therein, and will not be repeated here.

[0086] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0087] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0088] like Figure 6 As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0089] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0090] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as methods for recognizing image text. For example, in some embodiments, the methods for recognizing image text may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the methods for recognizing image text described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform methods for recognizing image text by any other suitable means (e.g., by means of firmware).

[0091] The collection, storage, use, processing, transmission, provision, and disclosure of test information involved in this technical solution comply with relevant laws and regulations and do not violate public order and good morals.

[0092] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0093] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0094] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0095] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0096] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0097] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0098] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0099] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for recognizing text in an image, comprising: The test item identifier file is divided into multiple test item identifier sub-files; Transmit multiple test question identifier sub-files to the first message queue; Read the question identifier sub-file in a loop from the first message queue; Based on multiple processes, the test question identifier sub-files are processed concurrently to obtain a set of test question identifiers that match each test question identifier sub-file; wherein, the number of processes is the same as the number of test question identifier sub-files in the first message queue, and the set of test question identifiers is a set of a preset number of test question identifiers determined from each test question identifier contained in the test question identifier sub-file; For each question identifier, in response to determining that the question content corresponding to the question identifier contains an image, the question content is sent to a second message queue so that the second message queue performs optical character recognition on the image; wherein, one question identifier corresponds to one question content.

2. The method according to claim 1, wherein, The method of concurrently processing the question identifier sub-files based on multiple processes to obtain a set of question identifiers matching each question identifier sub-file includes: For each of the test question identifier sub-files, the process corresponding to the test question identifier sub-file retrieves the preset number of test question identifiers from the test question identifier sub-file according to the order of the test question identifiers in the test question identifier sub-file; wherein, the process corresponding to each test question identifier sub-file is executed concurrently; Based on the preset number of question identifiers, a set of question identifiers matching the question identifier sub-file is generated.

3. The method according to claim 2, further comprising: For each question content corresponding to a question identifier in the question identifier set, determine the image discrimination result corresponding to that question content; wherein, the image discrimination result is either containing an image or not containing an image; In response to the fact that the image discrimination result has been determined for the question content corresponding to each question identifier in the question identifier set, the preset number of question identifiers are re-acquired from the question identifier sub-file that matches the question identifier set, and the question identifier set is updated based on the re-acquired preset number of question identifiers.

4. The method according to claim 3, further comprising: For each question content corresponding to a question identifier in the question identifier set, in response to the determination of the image discrimination result for the question content, the question identifier is stored in the log file corresponding to the question identifier sub-file that matches the question identifier set.

5. The method according to claim 4, further comprising: In response to the fact that all question identifiers in the question identifier sub-file have been stored in the log file, the log file is moved to a specified file directory for storage; Update the question identifier subfile based on the files in the specified file directory.

6. The method according to claim 5, further comprising: Based on the files in the specified file directory, the recognition progress information is determined.

7. An apparatus for recognizing image text, comprising: The file segmentation unit is configured to segment the question identifier file into multiple question identifier sub-files; The file transfer unit is configured to transfer multiple test question identifier sub-files to a first message queue; The file reading unit reads the question identifier sub-file from the first message queue in a loop; The identifier determination unit is configured to concurrently process the question identifier sub-files based on multiple processes to obtain a set of question identifiers that match each question identifier sub-file; wherein, the number of processes is the same as the number of question identifier sub-files in the first message queue, and the set of question identifiers is a set of a preset number of question identifiers determined from each question identifier contained in the question identifier sub-file; An image recognition unit is configured to, for each question identifier, in response to determining that the question content corresponding to the question identifier contains an image, send the question content to a second message queue so that the second message queue performs optical character recognition on the image; wherein, one question identifier corresponds to one question content.

8. The apparatus according to claim 7, wherein, The identifier determination unit is further configured to: For each of the test question identifier sub-files, the process corresponding to the test question identifier sub-file retrieves the preset number of test question identifiers from the test question identifier sub-file according to the order of the test question identifiers in the test question identifier sub-file; wherein, the process corresponding to each test question identifier sub-file is executed concurrently; Based on the preset number of question identifiers, a set of question identifiers matching the question identifier sub-file is generated.

9. The apparatus of claim 8, wherein the identifier determining unit is further configured to: For each question content corresponding to a question identifier in the question identifier set, determine the image discrimination result corresponding to that question content; wherein... The image discrimination result is either that the image is contained or that the image is not contained. In response to the fact that the image discrimination result has been determined for the question content corresponding to each question identifier in the question identifier set, the preset number of question identifiers are re-acquired from the question identifier sub-file that matches the question identifier set, and the question identifier set is updated based on the re-acquired preset number of question identifiers.

10. The apparatus according to claim 9, further comprising: The file processing unit is configured to, for each question content corresponding to a question identifier in the question identifier set, in response to the determination of the image discrimination result for the question content, store the question identifier in the log file corresponding to the question identifier sub-file that matches the question identifier set.

11. The apparatus according to claim 10, wherein, The file processing unit is further configured to: In response to the fact that all question identifiers in the question identifier sub-file have been stored in the log file, the log file is moved to a specified file directory for storage; Update the question identifier subfile based on the files in the specified file directory.

12. The apparatus according to claim 11, wherein, The file processing unit is further configured to: Based on the files in the specified file directory, the recognition progress information is determined.

13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.

14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.

15. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Paper marking method and device, computer equipment and storage medium

    CN110569401A

  • Question book identification method, system and device and medium

    CN113205046A