Methods and devices for identifying container numbers
By using a text recognition model to extract and assign features from container number images, and combining adjacent feature elements and probability distribution, the problem of inaccurate container number recognition in complex environments is solved, achieving higher recognition accuracy and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING JINGWEI HIRAIN TECH CO INC
- Filing Date
- 2026-01-21
- Publication Date
- 2026-05-26
AI Technical Summary
In the complex environment of ports, the identification of container numbers is often inaccurate due to distortion caused by outdoor operations, uneven lighting, and surface stains.
A text recognition model is used to extract features from images of container numbers. Feature elements are assigned through feature sequences, and character prediction is performed by combining adjacent feature elements. Combining character position and probability distribution, checksums and check codes are used to ensure recognition accuracy.
It improves the accuracy of container number identification, enhances the robustness of identification in complex environments, and ensures the reliability of identification results.
Smart Images

Figure CN122090468A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer vision technology, and in particular relates to a method and apparatus for identifying container numbers. Background Technology
[0002] In the port and logistics sector, efficient management and precise monitoring of containers are core elements for ensuring smooth operations. With the development of computer vision technology, Optical Character Recognition (OCR) can identify container numbers from images containing containers captured by cameras, enabling efficient container management based on these container numbers.
[0003] However, in the complex environment of ports, long-term outdoor operations can lead to distortion of container numbers, uneven outdoor lighting, stains on the container surface, and peeling paint, all of which can result in inaccurate OCR recognition results. Summary of the Invention
[0004] This application provides a method and apparatus for identifying container numbers, which can improve the accuracy of container number identification.
[0005] In a first aspect, embodiments of this application provide a method for identifying container numbers, including: The image containing the container number is subjected to feature extraction using a text recognition model to obtain a feature sequence, which includes multiple feature elements. The text recognition model assigns multiple feature elements according to the character position of the container number and the order of feature elements in the feature sequence, thereby obtaining the feature element corresponding to each character position in the container number. For each character position corresponding to a feature element, the character recognition model obtains a preset number of adjacent feature elements in the feature sequence. The text recognition model uses the feature elements and the preset number of feature elements as the target feature elements corresponding to the character position. For each character position, the target character corresponding to the character position is predicted by the character recognition model using the target feature elements corresponding to the character position.
[0006] In one possible implementation, the step of assigning the plurality of feature elements according to the character position of the container number and the order of feature elements in the feature sequence to obtain the feature element corresponding to each character position in the container number includes: Calculate the ratio of the number of feature elements in the feature sequence to the number of characters in the container number to obtain the number of basic elements corresponding to each character position; According to the character position of the container number and the order of the feature elements in the feature sequence, the number of feature elements of the basic element is assigned to each character position.
[0007] In one possible implementation, after assigning the number of basic elements to each character position according to the character position of the container number and the order of the feature elements in the feature sequence, the method further includes: Zero-padding is performed on the feature elements corresponding to the first and last characters of the container number to obtain the feature elements corresponding to the first and last characters.
[0008] In one possible implementation, predicting the target character corresponding to the character position using the feature elements corresponding to the character position includes: For each feature element, the probability distribution corresponding to the feature element is predicted based on the feature element. For each character position, the probability distribution corresponding to each feature element is summed to obtain the character probability distribution corresponding to the character position. Calculate the ratio of the character probability distribution to the number of feature elements corresponding to the character position; The character corresponding to the largest ratio is taken as the target character at the character position.
[0009] In one possible implementation, after predicting the character corresponding to each character position using the feature elements corresponding to that character position, the method further includes: Construct a predicted number based on the character corresponding to the character position; If the number of characters in the predicted number is equal to a preset threshold, the predicted number is verified. If the predicted number passes the verification, the predicted number is output.
[0010] In one possible implementation, verifying the predicted number includes: Based on the correspondence between characters and their corresponding values, obtain the target corresponding values for all characters in the predicted number except for the last character; The checksum value is calculated based on the target corresponding value of the other characters; The checksum value is moduloed to obtain the check code; If the predicted number passes verification, the predicted number is output, including: If the checksum and the last character are the same, output the predicted number.
[0011] One possible implementation also includes: If the number of characters in the predicted number is equal to a preset threshold minus one, the predicted number is filled to generate multiple first candidate numbers; Verify each first candidate number; Output the first candidate number that passes the verification.
[0012] One possible implementation also includes: If the predicted number fails the verification, obtain the confidence level of the target character corresponding to each character position; For each target character, if the confidence level of the target character is less than a preset confidence threshold, obtain the potential candidate character corresponding to the target character, wherein the confidence level of the potential candidate character is less than the confidence level corresponding to the target character; Based on the preset correspondence between characters and easily confused characters, determine the target easily confused character corresponding to the target character; The target character is replaced with the potential candidate character and the target easily confused character to generate multiple second candidate numbers; Verify each second candidate number; Output the second candidate number that passes the verification.
[0013] In one possible implementation, the container number consists of alphanumeric characters; before performing feature extraction on the image of the text region to be identified to obtain a feature sequence, the method further includes: Obtain text recognition sample data; The text recognition sample data is input into the neural network model to obtain the output result of the neural network model; Based on the output results, calculate the letter constraint loss function corresponding to the letter character, the number constraint loss function corresponding to the number character, and the connectionist temporal classification CTC loss function; The loss function corresponding to the neural network model is obtained by weighted summing of the letter constraint loss function, the number constraint loss function, and the CTC loss function. The model parameters of the neural network model are adjusted based on the loss function to obtain the character recognition model.
[0014] Secondly, embodiments of this application provide a container number identification device, comprising: The feature extraction module is used to extract features from an image containing container numbers using a text recognition model to obtain a feature sequence, wherein the feature sequence includes multiple feature elements. The allocation module is used to allocate the multiple feature elements according to the character position of the container number and the order of feature elements in the feature sequence through the text recognition model, so as to obtain the feature element corresponding to each character position in the container number; The acquisition module is used to acquire a preset number of adjacent feature elements in the feature sequence for each character position through the character recognition model. The determination module is used to use the text recognition model to identify the feature elements and the preset number of feature elements as the target feature elements corresponding to the character position; The prediction module is used to predict the target character corresponding to each character position using the target feature elements corresponding to the character position through the character recognition model.
[0015] Thirdly, embodiments of this application provide an electronic device, the device comprising: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the method as described in the first aspect.
[0016] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions that, when executed by a processor, implement the method described in the first aspect.
[0017] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the method described in the first aspect.
[0018] This application discloses a method, apparatus, device, storage medium, and program product for container number recognition. It utilizes a character recognition model to extract features from an image containing container numbers, obtaining a feature sequence. Based on the order of feature elements in the feature sequence and the character position of the container number, feature elements are assigned to each character position, thus determining the feature elements corresponding to each character position. To ensure the accuracy of container number prediction, a preset number of feature elements are obtained for each character position's corresponding feature element in the feature sequence. The assigned feature elements and the preset number of feature elements are used as the feature elements for that character position. This expands the range of feature elements corresponding to each character position. When the features corresponding to a character position are unclear, the character at that position can be predicted by combining adjacent preset number of feature elements, thereby ensuring the accuracy of the container number prediction result. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is an exemplary schematic diagram of a system architecture employing a container number identification method provided in an embodiment of this application; Figure 2 This is a flowchart illustrating a method for identifying container numbers provided in an embodiment of this application; Figure 3 This is a flowchart illustrating a feature element allocation method provided in an embodiment of this application; Figure 4 This is a flowchart illustrating a character recognition method provided in an embodiment of this application; Figure 5 This is a flowchart illustrating a text verification method provided in an embodiment of this application; Figure 6 This is a flowchart illustrating a verification code calculation method provided in an embodiment of this application; Figure 7 This is a flowchart illustrating a method for correcting predicted numbers provided in an embodiment of this application; Figure 8 This is a flowchart illustrating a text recognition model training method provided in an embodiment of this application; Figure 9 This is an exemplary schematic diagram of a model training method provided in an embodiment of this application; Figure 10 This is an exemplary schematic diagram of a container number identification method provided in an embodiment of this application; Figure 11 This is an exemplary schematic diagram of a predicted number verification method provided in an embodiment of this application; Figure 12 This is a schematic diagram of the structure of a container number identification device provided in an embodiment of this application; Figure 13 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0021] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0022] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0023] With the development of port logistics, efficient management and precise monitoring of containers are the foundation for stable port operation. Currently, in order to improve the identification efficiency of containers, two-stage optical character recognition (OCR) technology is used to identify container numbers.
[0024] Specifically, the first stage of OCR technology involves locating and extracting regions containing text information from complex images, while the second stage involves recognizing the specific text content from these regions. However, the port environment is complex, and due to prolonged outdoor operations, the text on container surfaces is severely distorted. Furthermore, strong natural light or shadows during image acquisition can distort the text areas in the acquired images. In addition, stains, rust, or paint peeling on the container surface can also lead to incomplete or illegible text, further hindering the accurate identification of container numbers using OCR technology.
[0025] To address the problems in the prior art, this application provides a method and apparatus for identifying container numbers. Figure 1 This application illustrates a system architecture diagram of a container number identification method provided in an embodiment, as shown below. Figure 1 As shown, the system includes a text detection model and a text recognition model. The text detection model is used to detect regions containing text information in images captured by a camera, and the text recognition model is used to recognize the text in the regions containing text information.
[0026] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a method for identifying container numbers provided in an embodiment of this application. This method for identifying container numbers can be applied to electronic devices, such as... Figure 2 As shown, the method includes: S201. Use a text recognition model to extract features from images containing container numbers to obtain a feature sequence.
[0027] The feature sequence includes multiple feature elements.
[0028] After acquiring images of containers in the port from cameras, the electronic equipment inputs the container images into a text detection model to obtain images containing container numbers.
[0029] To ensure the clarity of the images to be identified, multiple cameras of 8M or higher can be used. Depending on the port environment, the cameras should be waterproof and shockproof. Furthermore, the electronic equipment's processor can be a Central Processing Unit (CPU) with at least 128 cores, and the storage can be a high-speed memory of 10TB or more, depending on actual business storage needs. During camera installation, ensure that the cameras can capture images of the sides and top of the containers, and that the angle between the camera's incident angle and the normal vector of the plane containing the container number does not exceed 45 degrees.
[0030] The text detection model employs a Differential Binarization Network (DBNET) model.
[0031] The text detection model is used to detect text regions in container images and outputs the coordinates of the quadrilateral bounding boxes of the text regions. Electronic devices can then crop the container image based on the quadrilateral bounding box coordinates to obtain an image containing the container number.
[0032] The training process of the text detection model is as follows: Images captured by the camera are filtered, removing blurry images and those with obscured container numbers to obtain prepared images. The container number regions in these prepared images are manually labeled, resulting in quadrilateral bounding boxes. These prepared images and their corresponding bounding boxes are used as training data for the text detection model. The training data is then input into the DBNET model to obtain its output. Based on the output and the bounding boxes, the model's loss function is calculated. The model parameters are adjusted using this loss function until it falls below a preset value, resulting in a trained text detection model.
[0033] S202. Using a text recognition model, multiple feature elements are assigned based on the character position of the container number and the order of feature elements in the feature sequence to obtain the feature element corresponding to each character position in the container number.
[0034] In this process, the electronic device can evenly distribute the feature elements and the number of character positions to obtain the feature elements corresponding to each character position.
[0035] S203. For each character position corresponding to a feature element, obtain a preset number of adjacent feature elements in the feature sequence through a character recognition model.
[0036] The preset quantity is set in advance based on experience.
[0037] Understandably, after determining the feature elements corresponding to each character position, in order to ensure the accuracy of subsequent text recognition, the adjacent feature elements of the feature elements corresponding to that character position can be combined for text recognition.
[0038] In one example, the feature sequence includes 110 feature elements, and the container number includes 11 characters. The feature elements are evenly distributed, with each character position corresponding to 10 feature elements. Taking the second character position corresponding to feature elements 10 to 19 as an example, in order to ensure the accuracy of text recognition, the feature elements adjacent to feature elements 10 to 19 in the feature sequence are obtained. Assuming the preset number is 3, the electronic device can obtain the preset number of adjacent feature elements as feature elements 7 to 9 and feature elements 20 to 22.
[0039] S204. The character recognition model uses the feature elements and a preset number of feature elements as the target feature elements corresponding to the character positions.
[0040] Continuing with the example above, for the second character position, feature elements 7 to 22 are taken as the feature elements corresponding to that character position.
[0041] S205. For each character position, the target character corresponding to the character position is predicted by the character recognition model using the target feature elements corresponding to the character position.
[0042] After determining the feature elements corresponding to each character position, prediction is performed according to each feature element to obtain the probability distribution of the character corresponding to that feature element. For example, taking the second character position as an example, the feature elements corresponding to the second character position are feature elements 7 to feature elements 22. The probability distribution of the character corresponding to feature element 7 is as follows: the probability of the digit 1 is 0.1; the probability of the digit 2 is 0.15; the probability of the digit 3 is 0.2, and so on. After obtaining the probability distribution of the character corresponding to that character position, the probability of the same character is obtained from the probability distribution corresponding to each feature element, and the sum is calculated to obtain the probability distribution of the character corresponding to that character position. Therefore, the target character corresponding to that character position can be determined based on the probability distribution of the character corresponding to that character position.
[0043] Specifically, the character with the highest probability can be used as the target character corresponding to that character position.
[0044] Using the above method, a character recognition model is employed to extract features from images containing container numbers, resulting in a feature sequence. Based on the order of feature elements in the feature sequence and the character positions of the container numbers, feature elements are assigned to each character position. This determines the corresponding feature element for each character position. To ensure the accuracy of container number prediction, a preset number of feature elements are obtained for each character position within the feature sequence. The assigned feature elements and the preset number of feature elements are then used as the feature elements for that character position. This expands the range of feature elements corresponding to each character position. When the features corresponding to a character position are unclear, the adjacent preset number of feature elements can be used to predict the character at that position, thus ensuring the accuracy of the container number prediction results.
[0045] In some embodiments of this application, regarding S202 above, a character recognition model is used to assign multiple feature elements according to the character position of the container number and the order of feature elements in the feature sequence, thereby obtaining the feature element corresponding to each character position in the container number. Specific implementation methods include S2021-S2022, such as... Figure 3 As shown: S2021. Calculate the ratio of the number of feature elements in the feature sequence to the number of characters in the container number to obtain the number of basic elements corresponding to each character position.
[0046] Specifically, the method for calculating the number of basic elements is shown in Formula 1:
[0047] in, Indicates the number of basic elements. This indicates the number of feature elements in the feature sequence. This indicates rounding down to the nearest integer.
[0048] S2022. Assign a number of basic elements to each character position according to the character position of the container number and the order of the feature elements in the feature sequence.
[0049] Using the method provided in this application embodiment, based on the order of feature elements in the feature sequence and the character position order of the container number, a number of basic elements are evenly distributed to each character position. In this way, the feature element corresponding to each character position can be determined, which facilitates the subsequent prediction of the corresponding character according to the feature element corresponding to each position.
[0050] In some embodiments of this application, in step S2022 above, according to the character position of the container number and the order of feature elements in the feature sequence, a number of basic element feature elements are allocated to each character position. The method further includes: Zero-padding is performed on the feature elements corresponding to the first and last characters of the container number to obtain the feature elements corresponding to the first and last characters.
[0051] Specifically, after allocating a basic number of feature elements for each character position, zeros are padded before the feature element corresponding to the first character and after the feature element corresponding to the last character. The number of zeros padded can be preset according to actual business needs.
[0052] Understandably, for the character positions in the container number other than the first and last characters, the feature elements corresponding to these other character positions have adjacent feature elements on both sides. To ensure the accuracy of text recognition, the feature elements corresponding to the first and last characters are padded with zeros so that the structure of the feature elements corresponding to the first and last characters is the same as the structure of the feature elements corresponding to other character positions, and that they all have adjacent feature elements.
[0053] In one example, based on the number of basic elements calculated above, an additional feature point is added to the feature elements corresponding to the first and last characters. The number of feature elements corresponding to the first and last characters is shown in Formula 2:
[0054] By employing the method provided in this application embodiment, zero-padding is performed on the feature elements corresponding to the first and last characters to ensure that the feature elements corresponding to the first and last characters include the feature elements at adjacent positions of the first and last characters, thereby ensuring the accuracy of subsequent prediction results.
[0055] Accordingly, after determining the number of feature elements corresponding to the first and last characters, based on this, a preset number of feature elements adjacent to the feature element corresponding to each character position are obtained to determine the feature element corresponding to each character position, as shown in Formula 3. The range of feature elements corresponding to each character position is:
[0056] in, For the preset quantity, This represents the number of characters preceding the middle character in the container number.
[0057] After assigning feature elements to each character position as described above, character recognition is performed using the feature elements corresponding to each character position. Specifically, in S205 above, for each character position, the target character corresponding to the character position is predicted using the target feature elements corresponding to the character position through the character recognition model. This can be implemented as S2051-S2054, as follows: Figure 4 As shown: S2051. For each feature element, predict the probability distribution corresponding to the feature element based on the feature element.
[0058] In one example, the probability distribution of the character corresponding to feature element 7 in the feature sequence is as follows: the probability of the number 1 is 0.1; the probability of the number 2 is 0.15; the probability of the number 3 is 0.2, and so on, with the sum of the probabilities of each character being 1.
[0059] S2052. For each character position, sum the probability distributions corresponding to each feature element to obtain the character probability distribution corresponding to the character position.
[0060] Specifically, for each character position, the probability of the same character is obtained from each feature element, and the probabilities of the same character are summed to obtain the character probability distribution corresponding to that character position.
[0061] In one example, suppose character position 1 corresponds to feature elements 7-9. The probability distribution for feature element 7 is as follows: the probability of digit 1 is 0.3; the probability of digit 2 is 0.4; the probability of digit 3 is 0.3. The probability distribution for feature element 8 is as follows: the probability of digit 1 is 0.1; the probability of digit 2 is 0.5; the probability of digit 3 is 0.4. The probability distribution for feature element 9 is as follows: the probability of digit 1 is 0.1; the probability of digit 2 is 0.6; the probability of digit 3 is 0.3. Therefore, the probability of digit 1 at character position 1 is 0.3 + 0.1 + 0.1 = 0.5; the probability of digit 2 at character position 1 is 0.4 + 0.5 + 0.6 = 1.5; and the probability of digit 3 at character position 1 is 0.3 + 0.4 + 0.3 = 1.
[0062] S2053. Calculate the ratio of the character probability distribution to the number of feature elements corresponding to the character position.
[0063] The probability calculated using the method in S2052 above may be greater than 1. Therefore, by calculating the ratio of the character probability distribution to the number of feature elements, the probability of the character is made less than 1. Continuing the example above, the actual probability of the digit 1 at character position 1 is (0.3+0.1+0.1) / 3=0.167; the actual probability of the digit 2 is (0.4+0.5+0.6) / 3=0.5; and the actual probability of the digit 3 is (0.3+0.4+0.3) / 3=0.333.
[0064] S2054. Take the character corresponding to the maximum ratio as the target character corresponding to the character position.
[0065] The maximum ratio is the maximum confidence level. The confidence level is used to represent the probability of different characters at a given character position.
[0066] Specifically, the formula for calculating the probability distribution corresponding to each character position is shown in Figure 4:
[0067] in, Let b represent the probability distribution of character category c at position p, and b be the batch number. This represents the length of the feature sequence range corresponding to character position p, i.e., the number of feature elements. This represents the character category corresponding to the t-th feature element in the feature sequence.
[0068] The method provided in this application predicts the corresponding probability distribution based on feature elements. The probability distribution of the feature elements represents the probability of each character at a given character position. Thus, by summing the probability distributions of multiple feature elements corresponding to each character position, the character probability distribution for that position can be obtained. Then, the ratio of the character probability distribution to the number of feature elements corresponding to that character position is calculated, and the character with the largest ratio is taken as the target character for that position. In this way, for each character position, multiple feature elements corresponding to that position are combined for text recognition, improving the accuracy of text recognition.
[0069] In some embodiments of this application, to further improve the accuracy of character recognition, the recognized characters are verified. Based on this, in step S205 above, after predicting the target character corresponding to each character position using the target feature elements corresponding to the character position through the character recognition model, as follows... Figure 5 As shown, the method also includes: S501. Construct a predicted number based on the character corresponding to the character position.
[0070] Based on the characters corresponding to each character position output by the text recognition model, a predicted number can be constructed according to the order of the character positions. This predicted number is the container number determined based on the text recognition model.
[0071] S502. If the number of characters in the predicted number is equal to the preset number threshold, the predicted number is verified.
[0072] The preset quantity threshold is equal to the number of characters in the container number. In this embodiment, the preset quantity threshold is 11.
[0073] S503. If the predicted number passes the verification, output the predicted number.
[0074] Using the method provided in this application, the predicted number corresponding to the text region to be recognized is obtained according to the characters corresponding to each character position and the order of the character positions. Then, if the number of characters in the predicted number is equal to a preset threshold, it means that the number of characters in the predicted number is the same as the number of characters in the container number, and the number of digits in the predicted number is correct. Therefore, the predicted number can be directly verified, and if the verification passes, the predicted number can be output.
[0075] Regarding S502 above, when the number of characters in the predicted number equals a preset threshold, the predicted number is verified. This can be implemented as S5021-S5023, as follows: Figure 6 As shown: S5021. Based on the correspondence between characters and corresponding values, obtain the target corresponding values for all characters in the predicted number except for the last character.
[0076] When the character is a number, the corresponding value of the character is equal to the character itself. For example, the corresponding value of the number 0 is 0, and the corresponding value of the number 1 is 1.
[0077] When the characters are letters, the corresponding values for letters A to Z are 10-38. However, 11, 22, and 33 cannot be modulo 11, so they are removed. The modulo 11 is determined based on the number of characters in the container number; the modulo equals the number of characters in the container number.
[0078] S5022. Calculate the checksum value based on the target corresponding value of other characters.
[0079] After determining the corresponding value of each character in the predicted number, the sum of the corresponding values is calculated. The product of these values yields the checksum corresponding to the character, where... This indicates the position of the character. If the character is the second character in the predicted number, then N=2. Then, the checksum value corresponding to each character is summed to obtain the checksum value.
[0080] S5023. Perform modulo calculation on the checksum value to obtain the check code.
[0081] Specifically, the checksum value is used to perform a modulo operation on 11. The modulo is equal to the number of characters in the container number.
[0082] It should be noted that if the modulo result is 10 after the modulo calculation, then 0 is used as the check digit.
[0083] In one example, assuming the predicted number is ABCD123456, and the value corresponding to A is 10, then the check value corresponding to A is 10× =10×1=10; the corresponding value of B is 12, so the check value corresponding to B is 12× =12×2=24, and so on, summing the check values corresponding to each character to get a check sum of 5334. Then, performing a modulo operation on 5334, the result is 10. 0 is used as the check code for the predicted number.
[0084] If the predicted number passes the verification, output the predicted number, including: If the check digit and the last character are the same, output the predicted number.
[0085] If the verification fails, the electronic device outputs a default value, which can be "error".
[0086] Using the method provided in this application, the corresponding values of all characters in the predicted number except the last character are obtained. A checksum value is calculated based on the target corresponding values of the other characters. Then, the checksum value is moduloed to obtain a check code. The check code and the last character are then compared. If they are the same, the predicted number passes the verification and is output. In practical applications, the last character of the container number is used to generate a check code based on predetermined rules. Therefore, by calculating the predicted number according to these rules and generating the check code, the predicted number can be verified using the last character and the generated check code.
[0087] In some embodiments of this application, if the number of characters in the predicted number is not equal to a preset threshold, it indicates that the number of characters in the predicted number is different from the number of characters in the container number. The electronic device can automatically perform a padding operation to ensure that the number of characters in the predicted number meets the preset threshold. Based on this, the above-mentioned method for verifying the predicted number further includes: If the number of characters in the predicted number is equal to the preset threshold minus one, the predicted number is padded to generate multiple first candidate numbers; each first candidate number is verified; and the first candidate number that passes the verification is output.
[0088] The preset quantity threshold is equal to the number of characters in the container number, i.e., the preset quantity threshold is 11. Therefore, if the number of characters in the predicted number is 10, the electronic device will pad the end of the predicted number. Specifically, it can pad with 0-9 to generate multiple first candidate numbers.
[0089] If multiple first-choice numbers fail the verification, the electronic device outputs a predicted number.
[0090] Understandably, the first four characters of a container number are alphanumeric characters, and the last six characters are numeric characters. Therefore, when electronic devices perform padding at the end, they fill in numeric characters.
[0091] Using the method provided in this application, when the number of characters in the predicted number is equal to a preset threshold minus one, the electronic device can automatically pad the end of the predicted number with one digit to generate multiple first candidate numbers. Then, the multiple first candidate numbers are verified, and the verified first candidate number is used as the final output predicted number. In this way, the electronic device can automatically correct the predicted number, thereby improving the robustness of text recognition.
[0092] In some embodiments of this application, since different characters correspond to different easily confused characters, such as 'I' and '1', when the predicted number verification fails, characters with lower confidence in the predicted number are replaced according to the potential candidate character and easily confused character table to generate multiple second candidate numbers, thereby verifying the second candidate numbers. Figure 7 As shown, this method can be specifically implemented as follows: S701. If the predicted number fails the verification, obtain the confidence level of the target character corresponding to each character position.
[0093] Here, confidence level is the probability corresponding to the target character.
[0094] Specifically, for each character position, the character recognition model outputs the probability of different characters at that position. The target character is the character with the highest probability at that position.
[0095] S702. For each target character, if the confidence level of the target character is less than the preset confidence threshold, obtain the potential candidate character corresponding to the target character.
[0096] The confidence level of potential candidate characters is lower than that of the target character. The pre-set confidence threshold can be set empirically.
[0097] Specifically, for the character position corresponding to the target character, the probability of each character at that position is obtained from the output of the text recognition model. The electronic device then determines the character with the highest probability among all characters other than the target character, thus obtaining potential candidate characters.
[0098] S703. Based on the preset correspondence between characters and easily confused characters, determine the target easily confused character corresponding to the target character.
[0099] The preset correspondence between characters and easily confused characters is set in advance based on experience.
[0100] Specifically, users can import a list of easily confused characters into their electronic devices. This list includes multiple combinations of easily confused characters. For example, easily confused character combinations could be I and 1, Z and 2, S and 5, 0 and O, 6 and G, 8 and B, etc. Users can dynamically update the easily confused character combinations in the list.
[0101] S704. Replace the target character with potential candidate characters and target easily confused characters to generate multiple second candidate numbers.
[0102] S705. Verify each second candidate number.
[0103] S706, Output the second candidate number that passes the verification.
[0104] If multiple second candidate numbers fail the verification, the electronic device outputs a default value, which can be "error".
[0105] In one example, suppose the predicted number that fails validation is ZHLU20099I0, where the confidence level of character 'I' is less than a preset confidence threshold. The second most probable potential candidate character 'J' corresponding to this character position is obtained, and the easily confused character 'I' is determined to be '1' according to the easily confused character table. The electronic device generates two second candidate numbers, ZHLU20099J0 and ZHLU2009910, based on the potential candidate character J and the easily confused character '1'. The electronic device validates both second candidate numbers; ZHLU2009910 passes the validation and is output.
[0106] Using the method provided in this application, when the predicted number fails verification, a target character with a confidence level lower than the predicted confidence level threshold is identified. The character recognition model outputs different characters corresponding to each character position, along with the confidence level of each character. Therefore, the confidence levels of the characters corresponding to each character position are sorted, and the character with the highest confidence level is used as the target character. When the confidence level of the target character is lower than a preset confidence threshold, a second confidence level is used as a potential candidate character corresponding to that character position. Furthermore, target easily confused characters corresponding to the target character are obtained, and the target character is replaced with potential candidate characters and target easily confused characters respectively, resulting in multiple second candidate numbers. Each second candidate number is then verified, and the second candidate number that passes verification is output. In this way, by using different characters corresponding to each character position, the confidence level of each character, and easily confused characters, the target character in the predicted number can be modified, achieving correction of the predicted number and improving the accuracy of character recognition.
[0107] The following combination Figure 8 Introducing the training process of a text recognition model, such as... Figure 8 As shown, the method includes: S801. Obtain text recognition sample data.
[0108] In this embodiment, based on the training sample data of the text detection model, the prepared image is cropped according to the quadrilateral annotation box to obtain the text region image, and the container numbers contained in the text region image are manually annotated. The text region image and the corresponding container numbers are used as text recognition sample data.
[0109] S802. Input the character recognition sample data into the neural network model and obtain the output result of the neural network model.
[0110] Among them, the neural network model can be a convolutional recurrent neural network (CRNN).
[0111] S803. Based on the output results, calculate the letter constraint loss function corresponding to letter characters, the number constraint loss function corresponding to number characters, and the connectionist time classification CTC loss function.
[0112] The letter-constrained loss function can be expressed as:
[0113] in, Represents the letter-constrained loss function. Indicates batch size. This represents a set of letter categories.
[0114] The numerical constraint loss function can be expressed as:
[0115] in, Represents the numerical constraint loss function. Represents a set of number categories.
[0116] S804. The loss function corresponding to the neural network model is obtained by weighted summation of the letter constraint loss function, the number constraint loss function, and the CTC loss function.
[0117] The weights corresponding to the letter constraint loss function and the number constraint loss function are preset based on experience.
[0118] Specifically, the loss function corresponding to the neural network model is calculated according to Formula 7:
[0119] in, This represents the loss function corresponding to the neural network model. The weights of the letter-constrained loss function, These are the weights of the numerical constraint loss function. and It is usually 0.3.
[0120] S805. Adjust the model parameters of the neural network model based on the loss function to obtain the character recognition model.
[0121] Using the method provided in this application, text recognition sample data is input into a neural network model to obtain the output result. Since container numbers consist of both letters and numbers, the letter constraint loss function and the number constraint loss function are calculated separately for each letter character. Finally, the letter constraint loss function, the number constraint loss function, and the CTC loss function are weighted and summed to obtain the loss function corresponding to the neural network model. Thus, by calculating the letter constraint loss function and the number constraint loss function separately, the model parameters of the neural network model can be adjusted comprehensively considering both letter and number characters, thereby improving the accuracy of the model's prediction results.
[0122] The following combination Figure 9 This application describes the model training process provided in its embodiments. For example... Figure 9 As shown, the method includes: S901, Acquire images captured by the camera.
[0123] S902, Generate training sample dataset.
[0124] In this process, after acquiring images from the camera, the regions containing container numbers are manually labeled. The electronic device then generates bounding boxes and corresponding container numbers based on the labeling information. The bounding boxes and the camera-captured images are used as training samples for the text detection model, while the region images and their corresponding container numbers are used as training samples for the text recognition model.
[0125] S903. Train the model using the training sample dataset.
[0126] In the above model training process, the loss function of the model is calculated based on alphanumeric characters and numeric characters respectively, thereby forcing the model to learn the feature representation of the container number structure and improving the accuracy of the model prediction results.
[0127] S904. Test the model.
[0128] The training dataset for the model is split into a training dataset and a test dataset. After training the model using the training dataset, the performance of the trained model is tested using the test dataset.
[0129] exist Figure 9 Based on the illustrated embodiment, a text detection model and a text recognition model are trained, and these models are then used to perform text recognition on the image to be recognized. Specifically, as shown... Figure 10 As shown, the text recognition process is as follows: S1001. Obtain the image to be recognized.
[0130] The images to be identified are container images captured by devices such as cameras.
[0131] S1002. Input the image to be recognized into the model and perform model inference.
[0132] The process involves inputting the image to be recognized into a text detection model, which outputs bounding boxes for the regions of the image containing the container numbers. The electronic device then crops the image according to these bounding boxes to obtain an image containing the container numbers. This image is then input into the text recognition model to obtain the predicted numbers output by the model.
[0133] S1003. Verify the predicted number.
[0134] The method for verifying the predicted number is as follows: Figure 11 The process shown is as follows: Figure 11 As shown, the verification method specifically includes: S1101, Obtain the predicted number.
[0135] S1102. Was the verification successful?
[0136] Specifically, the check digit of the predicted number is calculated. If the last character of the check digit matches the last character of the predicted number, the verification is successful.
[0137] If yes, then execute S1109; otherwise, execute S1103.
[0138] S1103, Predict whether the number is 11 digits.
[0139] If yes, then execute S1105; otherwise, execute S1104.
[0140] S1104. Perform padding at the end character position.
[0141] Specifically, fill in 0-9 after the predicted number to generate multiple first candidate numbers.
[0142] S1105, Filter characters with low confidence.
[0143] Specifically, each character in the predicted number is iterated through, and characters with a confidence level lower than the preset confidence threshold are designated as low-confidence characters.
[0144] S1106. Determine candidate characters.
[0145] The candidate characters include potential candidate characters and easily confused characters. The methods for determining potential candidate characters and easily confused characters are described in the relevant embodiments above, and will not be repeated here.
[0146] S1107. Generate candidate numbers.
[0147] The candidate number mentioned above is the second candidate number in the above embodiment. Specifically, low-confidence characters are replaced with candidate characters to generate candidate numbers.
[0148] S1108, Was the verification successful?
[0149] Specifically, the first candidate number and the second candidate number are verified separately.
[0150] If yes, then execute S1109; otherwise, execute S1110.
[0151] S1109, Output container number.
[0152] The first or second candidate number that passes the verification will be used as the output container number.
[0153] S1110, Output default value.
[0154] Using the method provided in this application embodiment, the predicted number is verified based on the model output. If the verification fails, it indicates that there is an error in the predicted number. Therefore, candidate numbers for the predicted number are determined based on the number of digits in the predicted number and the confidence level of each character position in the predicted number. In this way, the error information in the predicted number can be corrected, and the robustness of the model prediction results is improved.
[0155] Based on the same concept, embodiments of this application provide a device for identifying container numbers, such as... Figure 12 As shown, the device includes: Feature extraction module 1201 is used to extract features from an image containing container numbers using a text recognition model to obtain a feature sequence, wherein the feature sequence includes multiple feature elements; The allocation module 1202 is used to allocate the multiple feature elements according to the character position of the container number and the order of feature elements in the feature sequence through the text recognition model, so as to obtain the feature element corresponding to each character position in the container number; The acquisition module 1203 is used to acquire a preset number of adjacent feature elements in the feature sequence for each character position through the character recognition model. The determining module 1204 is used to use the character recognition model to determine the feature elements and the preset number of feature elements as the target feature elements corresponding to the character position; The prediction module 1205 is used to predict the target character corresponding to each character position using the target feature elements corresponding to the character position through the character recognition model.
[0156] In one possible implementation, the allocation module 1202 is specifically used for: Calculate the ratio of the number of feature elements in the feature sequence to the number of characters in the container number to obtain the number of basic elements corresponding to each character position; According to the character position of the container number and the order of the feature elements in the feature sequence, the number of feature elements of the basic element is assigned to each character position.
[0157] In one possible implementation, the device further includes: The zero-padding module is used to pad the feature elements corresponding to the first and last characters of the container number with zeros, so as to obtain the feature elements corresponding to the first character and the feature elements corresponding to the last character.
[0158] In one possible implementation, the prediction module 1205 is specifically used for: For each feature element, the probability distribution corresponding to the feature element is predicted based on the feature element. For each character position, the probability distribution corresponding to each feature element is summed to obtain the character probability distribution corresponding to the character position. Calculate the ratio of the character probability distribution to the number of feature elements corresponding to the character position; The character corresponding to the largest ratio is taken as the target character at the character position.
[0159] In one possible implementation, the device further includes: The construction module is used to construct a predicted number based on the character corresponding to the character position; The verification module is used to verify the predicted number when the number of characters in the predicted number is equal to a preset number threshold. The output module is used to output the predicted number if the predicted number passes the verification.
[0160] In one possible implementation, the verification module is specifically used for: Based on the correspondence between characters and their corresponding values, obtain the target corresponding values for all characters in the predicted number except for the last character; The checksum value is calculated based on the target corresponding value of the other characters; The checksum value is moduloed to obtain the check code; If the predicted number passes verification, the predicted number is output, including: If the checksum and the last character are the same, output the predicted number.
[0161] In one possible implementation, the device further includes: The filling module is used to fill the predicted number when the number of characters in the predicted number is equal to a preset number threshold minus one, thereby generating multiple first candidate numbers. The verification module is also used to verify each first candidate number; The output module is used to output the first candidate number that passes the verification.
[0162] In one possible implementation, the device further includes: The acquisition module 1203 is also used to acquire the confidence level of the target character corresponding to each character position when the verification of the predicted number fails. The acquisition module 1203 is further configured to, for each target character, acquire a potential candidate character corresponding to the target character when the confidence level of the target character is less than a preset confidence threshold, wherein the confidence level of the potential candidate character is less than the confidence level corresponding to the target character; The determination module is used to determine the target easily confused character corresponding to the target character based on a preset correspondence between characters and easily confused characters; The generation module is used to replace the target character with the potential candidate character and the target easily confused character to generate multiple second candidate numbers; The verification module is used to verify each second candidate number; The output module is used to output the second candidate number that has passed the verification.
[0163] In one possible implementation, the device further includes: The acquisition module 1203 is also used to acquire text recognition sample data; The training module is used to input the text recognition sample data into the neural network model and obtain the output result of the neural network model; The calculation module is used to calculate the letter constraint loss function corresponding to the letter character, the number constraint loss function corresponding to the number character, and the connectionist temporal classification CTC loss function based on the output result. The summation module is used to perform a weighted summation of the letter constraint loss function, the number constraint loss function, and the CTC loss function to obtain the loss function corresponding to the neural network model. The adjustment module is used to adjust the model parameters of the neural network model based on the loss function to obtain the character recognition model.
[0164] The container number identification device provided in this application embodiment can be used to execute the container number identification method provided in the above method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here for the sake of brevity.
[0165] Figure 13 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.
[0166] An electronic device may include a processor 1301 and a memory 1302 storing computer program instructions.
[0167] Specifically, the processor 1301 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0168] Memory 1302 may include mass storage for data or instructions. For example, and not limitingly, memory 1302 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 1302 may include removable or non-removable (or fixed) media. Where appropriate, memory 1302 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 1302 is non-volatile solid-state memory.
[0169] In a particular embodiment, memory 1302 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0170] The processor 1301 reads and executes computer program instructions stored in the memory 1302 to implement any of the container number identification methods in the above embodiments.
[0171] In one example, the electronic device may also include a communication interface 1303 and a bus 1304. For example, Figure 13 As shown, the processor 1301, memory 1302, and communication interface 1303 are connected through bus 1304 and complete communication with each other.
[0172] The communication interface 1303 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0173] Bus 1304 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 1304 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0174] This electronic device can execute the container number identification method in the embodiments of the present invention, thereby achieving... Figure 1 The method described is for identifying container numbers.
[0175] Furthermore, in conjunction with the container number identification method in the above embodiments, this invention can be implemented using a readable storage medium. This readable storage medium stores program instructions, which, when executed by a processor, implement any of the container number identification methods described in the above embodiments.
[0176] Furthermore, in conjunction with the container number identification method in the above embodiments, this invention can be implemented using a computer program product. When the instructions in the computer program product are executed by the processor of an electronic device, the electronic device is able to execute any of the container number identification methods in the above embodiments.
[0177] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0178] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0179] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0180] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, 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, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0181] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A method for identifying container numbers, characterized in that, include: The image containing the container number is subjected to feature extraction using a text recognition model to obtain a feature sequence, which includes multiple feature elements. The text recognition model assigns multiple feature elements according to the character position of the container number and the order of feature elements in the feature sequence, thereby obtaining the feature element corresponding to each character position in the container number. For each character position corresponding to a feature element, the character recognition model obtains a preset number of adjacent feature elements in the feature sequence. The text recognition model uses the feature elements and the preset number of feature elements as the target feature elements corresponding to the character position. For each character position, the target character corresponding to the character position is predicted by the character recognition model using the target feature elements corresponding to the character position.
2. The method according to claim 1, characterized in that, The step of assigning multiple feature elements according to the character position of the container number and the order of feature elements in the feature sequence using the text recognition model to obtain the feature element corresponding to each character position in the container number includes: Calculate the ratio of the number of feature elements in the feature sequence to the number of characters in the container number to obtain the number of basic elements corresponding to each character position; According to the character position of the container number and the order of the feature elements in the feature sequence, the number of feature elements of the basic element is assigned to each character position.
3. The method according to claim 2, characterized in that, After assigning the number of basic elements to each character position according to the character position of the container number and the order of the feature elements in the feature sequence, the method further includes: Zero-padding is performed on the feature elements corresponding to the first and last characters of the container number to obtain the feature elements corresponding to the first and last characters.
4. The method according to claim 1, characterized in that, The target character corresponding to the character position is predicted by the character recognition model using the target feature elements corresponding to the character position, including: For each feature element, the probability distribution corresponding to the feature element is predicted based on the feature element. For each character position, the probability distribution corresponding to each feature element is summed to obtain the character probability distribution corresponding to the character position. Calculate the ratio of the character probability distribution to the number of feature elements corresponding to the character position; The character corresponding to the largest ratio is taken as the target character at the character position.
5. The method according to claim 1, characterized in that, After predicting the target character corresponding to each character position using the target feature elements corresponding to the character position, the method further includes: Construct a predicted number based on the character corresponding to the character position; If the number of characters in the predicted number is equal to a preset threshold, the predicted number is verified. If the predicted number passes the verification, the predicted number is output.
6. The method according to claim 5, characterized in that, The verification of the predicted number includes: Based on the correspondence between characters and their corresponding values, obtain the target corresponding values for all characters in the predicted number except for the last character; The checksum value is calculated based on the target corresponding value of the other characters; The checksum value is moduloed to obtain the check code; If the predicted number passes verification, the predicted number is output, including: If the checksum and the last character are the same, output the predicted number.
7. The method according to claim 5, characterized in that, Also includes: If the number of characters in the predicted number is equal to a preset threshold minus one, the predicted number is filled to generate multiple first candidate numbers; Verify each first candidate number; Output the first candidate number that passes the verification.
8. The method according to claim 5, characterized in that, Also includes: If the predicted number fails the verification, obtain the confidence level of the target character corresponding to each character position; For each target character, if the confidence level of the target character is less than a preset confidence threshold, obtain the potential candidate character corresponding to the target character, wherein the confidence level of the potential candidate character is less than the confidence level corresponding to the target character; Based on the preset correspondence between characters and easily confused characters, determine the target easily confused character corresponding to the target character; The target character is replaced with the potential candidate character and the target easily confused character to generate multiple second candidate numbers; Verify each second candidate number; Output the second candidate number that passes the verification.
9. The method according to claim 1, characterized in that, The container number consists of alphanumeric characters; before performing feature extraction on the image of the text region to be identified to obtain a feature sequence, the method further includes: Obtain text recognition sample data; The text recognition sample data is input into the neural network model to obtain the output result of the neural network model; Based on the output results, calculate the letter constraint loss function corresponding to the letter character, the number constraint loss function corresponding to the number character, and the connectionist temporal classification CTC loss function; The loss function corresponding to the neural network model is obtained by weighted summing of the letter constraint loss function, the number constraint loss function, and the CTC loss function. The model parameters of the neural network model are adjusted based on the loss function to obtain the character recognition model.
10. A device for identifying container numbers, characterized in that, include: The feature extraction module is used to extract features from an image containing container numbers using a text recognition model to obtain a feature sequence, wherein the feature sequence includes multiple feature elements. The allocation module is used to allocate the multiple feature elements according to the character position of the container number and the order of feature elements in the feature sequence through the text recognition model, so as to obtain the feature element corresponding to each character position in the container number; The acquisition module is used to acquire a preset number of adjacent feature elements in the feature sequence for each character position through the character recognition model. The determination module is used to use the text recognition model to identify the feature elements and the preset number of feature elements as the target feature elements corresponding to the character position; The prediction module is used to predict the target character corresponding to each character position using the target feature elements corresponding to the character position through the character recognition model.