Image recognition method, device, electronic equipment and medium

By using the mapping relationship between hash values ​​and probability values ​​in image text recognition, the calculation amount of storing intermediate strings is reduced, the problem of low storage efficiency in the existing technology is solved, and the recognition efficiency of the OCR model is improved.

CN114612916BActive Publication Date: 2024-10-29BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011409602.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-04
Publication Date
2024-10-29
Estimated Expiration
2040-12-04

AI Technical Summary

Technical Problem

In the process of image text recognition in the existing technology, the amount of calculation required to store the intermediate string is large, resulting in low efficiency. Especially when multiple fields need to be compared, the complexity is O(n^2), which affects the recognition efficiency.

Method used

Obtain the recognized current string and its hash value through the optical character recognition model, store it in a preset tree structure, predict new probability values ​​based on the hash value, expand the string set, and use the relationship between probability values ​​and hash values. Mapping relationship, reducing the calculation amount of storing strings and improving efficiency.

Benefits of technology

It effectively reduces the calculation amount of storing intermediate strings, improves the efficiency of text recognition, reduces the number of field comparisons, and improves the overall recognition efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612916B_ABST
    Figure CN114612916B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method for image recognition. In the process of performing text recognition on the collected image through an optical character recognition model, the recognized current string and its hash value are obtained, and the current string and its hash value are stored in a first preset tree structure and a second preset tree structure, and a new probability value of the current string at the next moment is predicted, and an extended string set is obtained. According to the hash value stored in the second preset tree structure, the N strings with the highest probability values ​​are obtained and retained, and the N strings are used as the current string, and the above steps are repeated until the recognition of all collected images is completed, and a string with the highest probability value is obtained as the final recognition result. The image recognition method, device, electronic device and medium provided by the embodiment of the present invention can effectively reduce the amount of calculation required to store intermediate strings in the process of performing text recognition on images, and can effectively improve the efficiency of storing intermediate strings.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to a method, device, electronic device and medium for image recognition. Background Art

[0002] With the rapid development of Internet technology, users can use image recognition devices such as dictionary pens or reading pens to translate or annotate texts in non-native languages, thereby improving users' learning efficiency.

[0003] However, in the prior art, when performing text recognition on images, it is necessary to store intermediate character strings and their corresponding probability values, for example, it is necessary to store character strings such as a, ab, abc and probability values. If the fields are the same, they need to be added up; if the fields are different, they need to be stored together with other fields. The usual practice is to first compare the lengths of the two fields. If the lengths are different, the two fields must be different. If the lengths are the same, then the characters are compared one by one. If they are different, it means that the two fields are different. At this time, if the set stores n fields, the comparison of each field requires O(n) complexity, and the comparison complexity of the entire set is O(n^2). This makes the amount of calculation required to store intermediate character strings in the process of text recognition on images extremely large, making the efficiency of intermediate character string storage low. Summary of the invention

[0004] The embodiments of the present invention provide a method, device, electronic device and medium for image recognition, which can effectively reduce the amount of calculation required for storing intermediate character strings in the process of text recognition for images, and can effectively improve the efficiency of storing intermediate character strings.

[0005] A first aspect of an embodiment of the present invention provides an image recognition method, comprising:

[0006] In the process of performing text recognition on the collected image through the optical character recognition model, obtaining the recognized current character string and its hash value, and storing the current character string and its hash value in a first preset tree structure;

[0007] Predicting a new probability value of the current string at the next moment, and storing the hash value of the current string in a second preset tree structure;

[0008] Expanding the current character string by using the target character set identified at the next moment to obtain an expanded character string set, storing the probability value and the hash value of each expanded character string in the expanded character string set into the first preset tree structure, and storing the hash value of each expanded character string into the second preset tree structure;

[0009] According to the hash value stored in the second preset tree structure, obtain and retain the N character strings with the highest probability values ​​from the first preset tree structure, where N is an integer not less than 1; and use the N character strings as the current character strings, repeat the above steps until the recognition of all collected images is completed, and obtain the character string with the highest probability value as the final recognition result.

[0010] Optionally, in the process of performing text recognition on the collected image through the optical character recognition model, obtaining the recognized current character string and its hash value includes:

[0011] In the process of performing text recognition on the collected image through the optical character recognition model, the current character string composed of characters with a recognition probability greater than a preset probability is obtained, and a hash value of the current character string is obtained.

[0012] Optionally, predicting a new probability of the current string at a next moment and storing the hash value of the current string in a second preset tree structure includes:

[0013] Predicting the predicted characters of the current character string at the next moment;

[0014] The combined probability of the current character string and the predicted character is obtained as the new probability value, and the hash value of the current character string is stored in the second preset tree structure, wherein the second preset tree structure is a set structure.

[0015] Optionally, the method of expanding the current character string by using the target character set identified at the next moment to obtain an expanded character string set includes:

[0016] Acquire characters whose recognition probability is greater than the preset probability and recognized at the next moment to form the target character set;

[0017] The current character string is combined with each character in the target character set, and all the combined character strings are obtained as the extended character string set.

[0018] Optionally, obtaining and retaining N character strings with the highest probability values ​​from the first preset tree structure according to the hash values ​​stored in the second preset tree structure includes:

[0019] Determining N hash values ​​with the highest probability values ​​from the second preset tree structure according to the new probability value of the current character string and the probability value of each extended character string;

[0020] According to the N hash values, the N character strings corresponding to the N hash values ​​are determined from the first preset tree structure.

[0021] Optionally, the first preset tree structure is a set structure.

[0022] A second aspect of an embodiment of the present invention provides an image recognition device, including:

[0023] A character recognition unit, configured to obtain a recognized current character string and a hash value thereof during character recognition of the collected image by using an optical character recognition model, and store the current character string and the hash value thereof in a first preset tree structure;

[0024] A prediction unit, used to predict a new probability value of the current string at a next moment, and store the hash value of the current string in a second preset tree structure;

[0025] an expansion unit, configured to expand the current character string by using a target character set identified at a next moment, obtain an expanded character string set, store a probability value and a hash value of each expanded character string in the expanded character string set into the first preset tree structure, and store the hash value of each expanded character string into the second preset tree structure;

[0026] A loop execution unit is used to obtain and retain N character strings with the highest probability values ​​from the first preset tree structure according to the hash value stored in the second preset tree structure, where N is an integer not less than 1; and use the N character strings as current character strings, repeat the above steps until the recognition of all collected images is completed, and obtain a character string with the highest probability value as the final recognition result.

[0027] Optionally, the character recognition unit is used to obtain the current character string composed of characters with a recognition probability greater than a preset probability and obtain a hash value of the current character string during text recognition on the captured image through an optical character recognition model.

[0028] Optionally, the prediction unit is used to predict the predicted character of the current string at the next moment; obtain the combined probability of the current string and the predicted character as the new probability value, and store the hash value of the current string in the second preset tree structure, wherein the second preset tree structure is a set structure.

[0029] Optionally, the expansion unit is used to obtain characters whose recognition probability is greater than the preset probability and which are recognized at the next moment to form the target character set; combine the current character string with each character in the target character set to obtain all combined character strings as the expanded character string set.

[0030] Optionally, the loop execution unit is used to determine N hash values ​​with the highest probability values ​​from the second preset tree structure based on the new probability value of the current string and the probability value of each extended string; and determine the N strings corresponding to the N hash values ​​from the first preset tree structure based on the N hash values.

[0031] Optionally, the first preset tree structure is a set structure.

[0032] A third aspect of an embodiment of the present invention provides a device for data processing, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include steps for the above-mentioned image recognition method.

[0033] A fourth aspect of an embodiment of the present invention provides a machine-readable medium having instructions stored thereon, which, when executed by one or more processors, enables a device to perform the steps of the above-mentioned image recognition method.

[0034] The beneficial effects of the embodiments of the present invention are as follows:

[0035] According to the above technical solution, in the process of performing text recognition on an image through an OCR model, when it is determined that a certain string needs to be stored, the hash values ​​of the N characters that need to be stored are determined first through the mapping relationship between the probability value and the hash value, and then the N characters that need to be stored are determined according to the mapping relationship between the hash value and the string and the hash values ​​of the N characters; compared with the prior art, not only is it not necessary to compare the lengths between the stored fields, but it is also not necessary to compare each character one by one before storing when the field lengths are the same. The present invention adopts the mapping relationship between the probability value, the hash value and the string, and can determine which string to store only by storing the hash value, which can greatly reduce the amount of calculation required for storing the string, and can effectively improve the efficiency of storing the string; and on the basis of improving the efficiency of storing the string, since the stored string is used for text recognition, the efficiency of the OCR model in recognizing text is also improved accordingly. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A method flow chart of a picture recognition method in an embodiment of the present invention;

[0037] Figure 2 It is a structural schematic diagram of a picture recognition device in an embodiment of the present invention;

[0038] Figure 3 It is a structural block diagram of a picture recognition device used as a device in an embodiment of the present invention;

[0039] Figure 4This is a structural block diagram of the server in some embodiments of the present invention. DETAILED DESCRIPTION

[0040] In order to better understand the above technical scheme, the technical scheme of the embodiment of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiment of the present invention and the specific features in the embodiments are detailed descriptions of the technical scheme of the embodiment of the present invention, rather than limitations on the technical scheme of the present invention. In the absence of conflict, the embodiment of the present invention and the technical features in the embodiments can be combined with each other.

[0041] In view of the technical problem of low efficiency in storing intermediate character strings during text recognition on images, an embodiment of the present invention provides an image recognition solution, which is used to obtain a recognized current character string and its hash value during text recognition on a captured image through an optical character recognition model, and store the current character string and its hash value in a first preset tree structure; predict a new probability value of the current character string at the next moment, and store the hash value of the current character string in a second preset tree structure; expand the current character string through a target character set recognized at the next moment to obtain an expanded character string set, and store the probability value and hash value of each expanded character string in the expanded character string set in the first preset tree structure, and store the hash value of each expanded character string in the second preset tree structure; obtain N character strings with the highest probability values ​​from the first preset tree structure according to the hash values ​​stored in the second preset tree structure and retain them, wherein N is an integer not less than 1; and use the N character strings as the current character string, repeat the above steps until the recognition of all captured images is completed, and obtain a character string with the highest probability value as the final recognition result.

[0042] In this way, in the process of performing text recognition on an image through an OCR model, when determining that a certain string needs to be stored, the hash values ​​of the N characters that need to be stored are determined first through the mapping relationship between the probability value and the hash value, and then the N characters that need to be stored are determined according to the mapping relationship between the hash value and the string and the hash values ​​of the N characters; compared with the prior art, not only is there no need to compare the lengths between the stored fields, but there is also no need to compare each character one by one before storing when the field lengths are the same. The present invention adopts the mapping relationship between the probability value, the hash value and the string, and can determine which string to store only by storing the hash value, which can greatly reduce the amount of calculation required for storing the string, and can effectively improve the efficiency of storing the string; and on the basis of improving the efficiency of storing the string, since the stored string is used for text recognition, the efficiency of the OCR model in recognizing text is also improved accordingly.

[0043] In the embodiments of this specification, in the field of image and text recognition, an optical character recognition (OCR) model is usually used to recognize text in an image. When using the OCR model to recognize text in an image, it is necessary to use the OCR model to predict the probability of each word for beam search decoding. In this way, the text in the image can be predicted by the OCR model.

[0044] In the embodiments of this specification, characters may be words, punctuation marks, symbols, etc., and this specification does not impose any specific limitation.

[0045] like Figure 1 As shown, an embodiment of the present invention provides a method for image recognition, comprising the following steps:

[0046] S101, in a process of performing text recognition on a captured image through an optical character recognition model, obtaining a recognized current character string and a hash value thereof, and storing the current character string and the hash value thereof in a first preset tree structure;

[0047] S102, predicting a new probability value of the current string at the next moment, and storing the hash value of the current string in a second preset tree structure;

[0048] S103, expanding the current character string by using the target character set identified at the next moment to obtain an expanded character string set, and storing the probability value and hash value of each expanded character string in the expanded character string set into the first preset tree structure, and storing the hash value of each expanded character string into the second preset tree structure;

[0049] S104. According to the hash value stored in the second preset tree structure, obtain and retain N character strings with the highest probability values ​​from the first preset tree structure, where N is an integer not less than 1; and use the N character strings as current character strings, repeat the above steps until the recognition of all collected images is completed, and obtain a character string with the highest probability value as the final recognition result.

[0050] Specifically, the OCR model is usually deployed on an image recognition device, which can be served by a server. The image recognition device can be, for example, a dictionary pen and a reading pen, and the server can be, for example, a laptop computer, a desktop computer, and an all-in-one computer.

[0051] In step S101, in the process of performing text recognition on the collected image through the OCR model, the current string is predicted by the OCR model, and the predicted current string is hashed using a hash algorithm to obtain a hash value of the current string. The hash algorithm may be, for example, MD5, SHA-1, and SHA-2, etc., and this specification does not impose any specific restrictions.

[0052] Specifically, during text recognition of the captured image using an optical character recognition model, a current string consisting of characters with a recognition probability greater than a preset probability can be obtained, and a hash value of the current string can be obtained, and then the current string and its hash value can be stored in a first preset tree structure.

[0053] Specifically, when the current character string is predicted by the OCR model, a preset probability can be set in advance, and then each character in the image predicted by the OCR model at the current moment is filtered according to the preset probability. In this way, the current character string is obtained by filtering with the preset probability, wherein the probability of each character in the current character string is greater than the preset probability; and then the current character string obtained by filtering is hashed using a hash algorithm to obtain a hash value of the current character string, and the current character string and its hash value are stored in a first preset tree structure, wherein the first preset tree structure can be a set structure in the C language or a binary tree structure, and this manual does not make any specific restrictions.

[0054] For example, taking text as an example, in the process of continuously scanning text through an image scanning device, a continuous set of pictures is obtained; then the OCR model is used to recognize the picture set. During the recognition process, if the probability that the word in the picture recognized at the current moment is A1 is 15%, the probability of A2 is 35%, the probability of A3 is 65%, the probability of A4 is 85%, the probability of A5 is 45%, and the preset probability is 50%, then A1, A2 and A5 are filtered out, and A3 and A4 are retained, and the current string is determined to be A3 and A4; if the preset probability is 70%, the current string is determined to be A4; and after obtaining the current string as A4, A4 is hashed through SHA-2, and the obtained hash value H1 is used as the hash value of A4, and then A4 and H1 are stored in the first set structure.

[0055] After the current string and the hash value are stored in the first preset tree structure, step S102 is executed, in which a new probability value of the current string at the next moment is predicted, and the hash value of the current string is stored in the second preset tree structure.

[0056] Specifically, predict the predicted character of the current string at the next moment; obtain the combined probability of the current string and the predicted character as a new probability value, and store the hash value of the current string in a second preset tree structure, wherein the second preset tree structure can be a set structure and a binary tree structure.

[0057] Specifically, when predicting the predicted character of the current string at the next moment, the last character in the current string can be used as the predicted character, and the space can also be used as the predicted character, so that the predicted character can include any one or more of the last character and the space in the current string. When there are multiple predicted characters, obtaining the combined probability of the current string and the predicted character is to obtain the sum of the combined probabilities of the current character and each predicted character as a new probability value, or the sum of the weights of the combined probabilities can be the new probability value, or the product of the combined probabilities can be the new probability value, and this specification does not make specific restrictions.

[0058] Specifically, after obtaining the sum of the new probability values, the current character string is stored in a second preset tree structure, wherein there are no repeated numbers in the second preset tree structure, and correspondingly, there are no repeated numbers in the first preset tree structure.

[0059] For example, assuming that the current string at time T-1 is abc, it is predicted that the current string at time T is abc+space and abc+c. The OCR model predicts that the probability value of abc+space is H2, and the probability value of abc+c is H3. The new probability value of abc is determined to be H2+H3, and the hash value X of abc is stored in the second set structure.

[0060] Next, step S103 is executed, in which the current character string is expanded by the target character set identified at the next moment to obtain an expanded character string set, and the probability value and hash value of each expanded character string in the expanded character string set are stored in the first preset tree structure, and the hash value of each expanded character string is stored in the second preset tree structure.

[0061] Specifically, characters recognized at the next moment with a recognition probability greater than a preset probability are obtained to form a target character set; the current character string is combined with each character in the target character set, and all the combined character strings are obtained as an extended character string set.

[0062] Specifically, the OCR model is used to perform text recognition on the image collected at the next moment. According to the preset probability, each character in the image predicted by the OCR model at the next moment is filtered to obtain the target character set of all words with a recognition probability greater than the preset probability. Then, the current character string is combined with each character in the target character set, and all the combined character strings are obtained as the expanded character string set.

[0063] For example, taking the current character string as abc as an example, if the image collected at time T+1 is recognized by the OCR model, and the characters with recognition probabilities greater than the preset probabilities are identified as d, e and f respectively, then abcd, abce and abcf are obtained as the extended character string set, and then the OCR model is used to predict that the probability values ​​of abcd, abce and abcf are D1, D2 and D3 respectively, and abcd, abce and abcf are hashed by the hash algorithm, and the obtained hash values ​​are X1, X2 and X3 respectively; in this way, abcd and X1, abce and X2 and abcf and X3 are stored in the first set structure, and X1, X2 and X3 are stored in the second set structure.

[0064] After the probability value and the hash value of each extended character string in the extended character string set are stored in the first preset tree structure, and the hash value of each extended character string is stored in the second preset tree structure, step S104 is executed.

[0065] In step S104, N hash values ​​with the highest probability values ​​can be determined from the second preset tree structure according to the new probability value of the current string and the probability value of each extended string; N strings corresponding to the N hash values ​​can be determined from the first preset tree structure according to the N hash values; the N strings are retained, and N is an integer not less than 1; and the N strings are used as the current strings, and the above steps are repeated until the recognition of all collected images is completed, and a string with the highest probability value is obtained from the first preset tree structure as the final recognition result.

[0066] In the embodiments of this specification, the value of N may be the maximum set number in the beam search in the OCR model, or may be set manually or by the device itself, for example, it may be 1, 2, 3, 5, etc., and this specification does not impose any specific limitation.

[0067] For example, taking the current string abc as an example, the expanded string set obtained at time T+1 is abcd, abce and abcf and the corresponding probability values ​​are D1, D2 and D3, and the new probability value of abc is H2+H3; if D2>D3>D1>(H2+H3), and N=2; at this time, according to the mapping relationship between probability values ​​and hash values, the hash values ​​of N strings can be obtained from the second set structure as X2 and X3; and according to X2 and X3, the string corresponding to X2 is obtained from the first set structure as abce, and the string corresponding to X3 is abcf, then the N strings are determined to be abce and abcf; at this time, abce and abcf in the first set structure are used as the current strings and retained, and only the hash values ​​X2 and X3 corresponding to abce and abcf can be retained in the second set structure; then the next step is performed.

[0068] Specifically, first, it is necessary to predict the new probabilities of N strings at time T+2. Specifically, the new probability of abce at time T+2 is predicted to be the sum of the probabilities of abce+space and abce+e; and the new probability of abcf at time T+2 is predicted to be the sum of the probabilities of abcf+space and abcf+f; if at time T+2 as the current time, the collected real-time image is recognized through the OCR mode, and the characters p and k with recognition probabilities greater than the preset probability are recognized, then abcep, abcek, abcfp and abcfk are obtained as expansion The character string set is filled, and then the probability values ​​of abcep, abcek, abcfp and abcfk are predicted by the OCR model as D4, D5, D6 and D7 respectively, and abcep, abcek, abcfp and abcfk are hashed by the hash algorithm, and the obtained hash values ​​are X4, X5, X6 and X7 respectively; in this way, abcep and X4, abcek and X5, abcfp and X6 and abcfk and X7 are stored in the first set structure, and X4, X5, X6 and X7 are stored in the second set structure.

[0069] Among them, if D5>D4>D7>D6>the new probability of abce>the new probability of abcf, then according to the mapping relationship between the probability value, the hash value and the string, the N strings are determined to be abcek and abcep. At this time, abce and abcf in the first set structure are taken as the current strings and retained, and only the hash values ​​X2 and X3 corresponding to abce and abcf can be retained in the second set structure; then the next step of processing is carried out in the same way until the recognition of all collected images is completed, and the string with the highest probability value is obtained as the final recognition result.

[0070] In this way, when recognizing the current character string, the embodiment of the present specification only retains the character strings whose recognition probability is greater than the preset probability, and discards the character strings whose recognition probability is not greater than the preset probability, thereby improving the overall efficiency of OCR model recognition.

[0071] And when it is determined that a certain character string needs to be stored, the mapping relationship between the probability value and the hash value is first used to determine the hash values ​​of the N characters that need to be stored, and then the N characters that need to be stored are determined according to the mapping relationship between the hash value and the character string and the hash values ​​of the N characters; compared with the prior art, not only is it not necessary to compare the lengths between the stored fields, but it is also not necessary to compare each character one by one before storing when the field lengths are the same. The present invention adopts the mapping relationship between the probability value, the hash value and the character string, and can determine which character string to store only by storing the hash value, which can greatly reduce the amount of calculation required for storing the character string and can effectively improve the efficiency of storing the character string; and on the basis of improving the efficiency of storing the character string, since the stored character string is used for text recognition, the efficiency of the OCR model in recognizing text is also improved accordingly.

[0072] like Figure 2 As shown, the embodiment of the present invention further provides a picture recognition device, comprising:

[0073] The character recognition unit 201 is used to obtain the recognized current character string and its hash value during the character recognition process of the collected image through the optical character recognition model, and store the current character string and its hash value in a first preset tree structure;

[0074] A prediction unit 202, configured to predict a new probability value of the current string at a next moment, and store the hash value of the current string in a second preset tree structure;

[0075] An expansion unit 203 is used to expand the current character string by using the target character set recognized at the next moment, obtain an expanded character string set, store the probability value and the hash value of each expanded character string in the expanded character string set into the first preset tree structure, and store the hash value of each expanded character string into the second preset tree structure;

[0076] The loop execution unit 204 is used to obtain and retain N character strings with the highest probability values ​​from the first preset tree structure according to the hash values ​​stored in the second preset tree structure, where N is an integer not less than 1; and use the N character strings as current character strings, repeat the above steps until the recognition of all collected images is completed, and obtain a character string with the highest probability value as the final recognition result.

[0077] In an optional implementation, the character recognition unit 201 is used to obtain the current character string composed of characters with a recognition probability greater than a preset probability and obtain a hash value of the current character string during text recognition of the captured image through an optical character recognition model.

[0078] In an optional implementation, the prediction unit 202 is used to predict the predicted character of the current string at the next moment; obtain the combined probability of the current string and the predicted character as the new probability value, and store the hash value of the current string in the second preset tree structure, wherein the second preset tree structure is a set structure.

[0079] In an optional implementation, the expansion unit 203 is used to obtain characters whose recognition probability is greater than the preset probability and which are recognized at the next moment to form the target character set; and combine the current character string with each character in the target character set to obtain all the combined character strings as the expanded character string set.

[0080] In an optional implementation, the loop execution unit 204 is used to determine the N hash values ​​with the highest probability values ​​from the second preset tree structure based on the new probability value of the current string and the probability value of each extended string; and determine the N strings corresponding to the N hash values ​​from the first preset tree structure based on the N hash values.

[0081] Optionally, the first preset tree structure is a set structure.

[0082] Figure 3 9 is a structural block diagram of an image recognition device as a device according to an exemplary embodiment. For example, the device 900 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0083] Reference Figure 3 , the device 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 906 , a multimedia component 908 , an audio component 910 , an input / output (I / O) interface 912 , a sensor component 914 , and a communication component 916 .

[0084] The processing component 902 generally controls the overall operation of the device 900, such as operations associated with display, incoming calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 908 and the processing component 902.

[0085] The memory 904 is configured to store various types of data to support operations on the device 900. Examples of such data include instructions for any application or method operating on the device 900, contact data, caller book data, messages, pictures, videos, etc. The memory 904 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0086] The power supply component 906 provides power to the various components of the device 900. The power supply component 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 900.

[0087] The multimedia component 908 includes a screen that provides an output interface between the device 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide motion action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 908 includes a front camera and / or a rear camera. When the device 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0088] The audio component 910 is configured to output and / or input audio signals. For example, the audio component 910 includes a microphone (MIC), and when the device 900 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 904 or sent via the communication component 916. In some embodiments, the audio component 910 also includes a speaker for outputting audio signals.

[0089] I / O interface 912 provides an interface between processing component 902 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0090] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the device 900. For example, the sensor assembly 914 can detect the open / closed state of the device 900, the relative positioning of components, such as the display and keypad of the device 900, and the sensor assembly 914 can also detect the position change of the device 900 or a component of the device 900, the presence or absence of user contact with the device 900, the orientation or acceleration / deceleration of the device 900, and the temperature change of the device 900. The sensor assembly 914 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0091] The communication component 916 is configured to facilitate wired or wireless communication between the device 900 and other devices. The device 900 can access a wireless network according to a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 916 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 916 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0092] In an exemplary embodiment, the apparatus 900 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above method.

[0093] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 904 including instructions, and the instructions can be executed by the processor 920 of the device 900 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0094] Figure 41 is a block diagram of the structure of the server in some embodiments of the present invention. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.

[0095] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0096] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (equipment or server), enables the device to execute an image recognition method, the method comprising: in the process of performing text recognition on a collected image through an optical character recognition model, obtaining a recognized current string and its hash value, and storing the current string and its hash value in a first preset tree structure; predicting a new probability value of the current string at the next moment, and storing the hash value of the current string in a second preset tree structure; expanding the current string through a target character set recognized at the next moment, obtaining an expanded string set, and storing the probability value and hash value of each expanded string in the expanded string set in the first preset tree structure, and storing the hash value of each expanded string in the second preset tree structure; according to the hash value stored in the second preset tree structure, obtaining N strings with the highest probability values ​​from the first preset tree structure and retaining them, wherein N is an integer not less than 1; and taking the N strings as the current string, repeating the above steps until the recognition of all collected images is completed, and obtaining a string with the highest probability value as the final recognition result.

[0097] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that has the functions specified in one or more boxes.

[0098] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0099] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0100] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0101] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for image recognition, characterized in that: include: In the process of performing text recognition on the collected image through the optical character recognition model, obtaining the recognized current character string and its hash value, and storing the current character string and its hash value in a first preset tree structure; Predicting a new probability value of the current string at the next moment, and storing the hash value of the current string in a second preset tree structure; Expanding the current character string by using the target character set identified at the next moment to obtain an expanded character string set, storing the probability value and the hash value of each expanded character string in the expanded character string set into the first preset tree structure, and storing the hash value of each expanded character string into the second preset tree structure; According to the hash value stored in the second preset tree structure, N character strings with the highest probability values ​​are obtained from the first preset tree structure and retained, wherein N is an integer not less than 1; and the N character strings are used as current character strings, and the above steps are repeated until the recognition of all collected images is completed, and a character string with the highest probability value is obtained as the final recognition result; The predicting of the new probability value of the current string at the next moment specifically includes: predicting the predicted character of the current string at the next moment; obtaining the combined probability of the current string and the predicted character as the new probability value, and when predicting the predicted character of the current string at the next moment, the last character in the current string can be used as the predicted character, or the space can be used as the predicted character, so that the predicted character can include any one or more of the last character and the space in the current string.

2. The method according to claim 1, characterized in that In the process of performing text recognition on the collected image through the optical character recognition model, obtaining the recognized current character string and its hash value includes: In the process of performing text recognition on the collected image through the optical character recognition model, the current character string composed of characters with a recognition probability greater than a preset probability is obtained, and a hash value of the current character string is obtained.

3. The method according to claim 2, characterized in that The step of storing the hash value of the current character string in a second preset tree structure includes: The second preset tree structure is a set structure.

4. The method according to claim 2, characterized in that The method of expanding the current character string by using the target character set identified at the next moment to obtain an expanded character string set includes: Acquire characters whose recognition probability is greater than the preset probability and recognized at the next moment to form the target character set; The current character string is combined with each character in the target character set, and all the combined character strings are obtained as the extended character string set.

5. The method according to claim 4, characterized in that The obtaining and retaining N character strings with the highest probability values ​​from the first preset tree structure according to the hash values ​​stored in the second preset tree structure includes: Determining N hash values ​​with the highest probability values ​​from the second preset tree structure according to the new probability value of the current character string and the probability value of each extended character string; According to the N hash values, the N character strings corresponding to the N hash values ​​are determined from the first preset tree structure.

6. The method according to any one of claims 1 to 5, characterized in that: The first preset tree structure is a set structure.

7. A picture recognition device, characterized in that: include: A character recognition unit, configured to obtain a recognized current character string and a hash value thereof during character recognition of the collected image by using an optical character recognition model, and store the current character string and the hash value thereof in a first preset tree structure; A prediction unit, used to predict a new probability value of the current string at a next moment, and store the hash value of the current string in a second preset tree structure; The prediction unit is specifically used to predict the predicted character of the current character string at the next moment; obtain the combined probability of the current character string and the predicted character as the new probability value, and when predicting the predicted character of the current character string at the next moment, the last character in the current character string can be used as the predicted character, or the space can be used as the predicted character, so that the predicted character can include any one or more of the last character and the space in the current character string; an expansion unit, configured to expand the current character string by using a target character set identified at a next moment, obtain an expanded character string set, store a probability value and a hash value of each expanded character string in the expanded character string set into the first preset tree structure, and store the hash value of each expanded character string into the second preset tree structure; A loop execution unit is used to obtain and retain N character strings with the highest probability values ​​from the first preset tree structure according to the hash value stored in the second preset tree structure, where N is an integer not less than 1; and use the N character strings as current character strings, repeat the above steps until the recognition of all collected images is completed, and obtain a character string with the highest probability value as the final recognition result.

8. The device according to claim 7, characterized in that The character recognition unit is used to obtain the current character string composed of characters with a recognition probability greater than a preset probability and obtain a hash value of the current character string during text recognition of the collected image through an optical character recognition model.

9. A device for data processing, characterized in that: The device comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include the method steps according to any one of claims 1 to 6.

10. A machine-readable medium having instructions stored thereon which, when executed by one or more processors, cause an apparatus to perform the method of one or more of claims 1 to 6.

Citation Information

Patent Citations

  • Identification method and device

    CN111753802A

  • Character recognizing device, character recognizing method, and character recognizing program

    JP2006163830A