A Deep Learning-Based Method and System for Identifying Container Information During Operations
By using a deep learning-based method to extract the inverted binary image of the container and combining it with container number definition rules and a deep learning model, the problems of low efficiency and poor accuracy in container number recognition are solved, achieving efficient and accurate recognition in complex environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-24
- Publication Date
- 2026-03-13
AI Technical Summary
In existing technologies, container number identification suffers from low efficiency and poor accuracy, especially in complex environments where efficient and accurate identification is difficult to achieve.
A deep learning-based approach is adopted. By acquiring red-green-blue images, extracting and segmenting inverted binary images, and combining box number definition rules with deep learning to build a character recognition model, the model is optimized using cross-entropy loss and character constraint terms to perform character recognition and probability matching, and finally determine the box number.
It significantly improves the accuracy and efficiency of container number recognition, can stably recognize container numbers in complex environments, reduces noise interference, and improves character recognition and the performance of the recognition model.
Smart Images

Figure CN121170826B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, specifically a method and system for recognizing information from operational containers based on deep learning. Background Technology
[0002] With the acceleration of global trade integration, containers, as standardized logistics carriers, have become the core unit for cargo flow in ports, terminals, logistics parks, and other scenarios. According to industry statistics, the global annual container throughput exceeds tens of millions of TEUs. The container number, as the unique identifier of a container, directly determines the efficiency of cargo scheduling, loading and unloading operations, warehousing management, and cross-border customs clearance, making it a crucial node in ensuring the smooth operation of the logistics chain. However, in actual operational scenarios, container number identification has long faced the dual challenges of complex environmental interference and technological bottlenecks.
[0003] In early and some small- to medium-sized operations, container number identification relied primarily on manual operation. Workers needed to closely observe the container numbers printed on them or use handheld barcode scanners to read the labels. However, this method had significant limitations. Firstly, the efficiency was extremely low, with single-container identification typically taking 3-5 seconds. During peak port hours with thousands of containers handled daily, this easily caused vehicle congestion and loading / unloading delays. Secondly, the accuracy of identification heavily depended on human condition and environmental conditions. Rainy or foggy weather could blur the container numbers, and dust, oil, or scratches on the container surface could obscure the characters. Workers fatigued could also lead to visual misjudgments. Research indicated that the error rate for manual identification could reach 5%-8%, leading to a chain reaction of problems such as misdelivery, missed shipments, and scheduling deviations.
[0004] To overcome the bottleneck of manual recognition, traditional image recognition technology has been gradually applied to the field of container number recognition. Its core idea is to capture RGB images of the container using a camera, then extract character regions through edge detection and fixed threshold segmentation, and finally achieve character recognition through template matching. However, this technology has stringent requirements for image quality and shooting conditions. If the lighting in the working scene is uneven, or the contrast between the container color and the character color is low, traditional threshold segmentation algorithms are prone to missing character detection or misjudging the background. Furthermore, containers may tilt, characters may be deformed, or partially obscured by other goods during transportation. Traditional template matching methods, which rely on fixed character shapes, are difficult to adapt to such variables, leading to a sharp drop in character recognition rate.
[0005] Therefore, there is an urgent need for a more efficient and accurate method for identifying container numbers in order to improve the accuracy of container number identification and increase the efficiency of container operations. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention provides a method and system for identifying operational container information based on deep learning, which solves the problem of inaccurate identification of operational container numbers in existing technologies.
[0007] To achieve the above objectives, one aspect of the present invention provides a method for identifying operational container information based on deep learning. The method includes: acquiring a red-green-blue image of an operational container and extracting a container inverted binary image from the red-green-blue image; segmenting the container inverted binary image to obtain multiple character binary images and character serial numbers; acquiring container number definition rules and constructing a character recognition model based on the container number definition rules and deep learning; obtaining the container number character and character probability using the character recognition model according to the character binary image and the character serial number; and matching the container number character with a pre-obtained set of real container numbers based on the character probability to obtain the operational container number.
[0008] This invention extracts an inverted binary image, which preserves container number character details and reduces noise interference through image preprocessing. By segmenting the inverted binary image to obtain character binary images and serial numbers, the container number characters can be accurately located, avoiding character confusion. A recognition model is constructed based on container number rules, ensuring that the model's predictions conform to the container number structure and reducing invalid predictions. The character recognition model is used to obtain the container number characters and probabilities, achieving accurate character recognition and quantifying credibility. By combining the probabilities with the real container number set and filtering through probability, the container numbers of the operational containers are obtained, greatly improving the accuracy of operational container number recognition.
[0009] Optionally, the step of extracting the container inverted binary image from the red-green-blue image includes: extracting the container image from the red-green-blue image and performing grayscale processing on the container image to obtain a container grayscale image; performing noise reduction processing on the container grayscale image using an opening operation to obtain an optimized grayscale image; and obtaining the container inverted binary image based on the optimized grayscale image.
[0010] This invention simplifies data by converting a three-channel image into a single channel while preserving key visual information and avoiding interference from the color channel. Then, it employs opening operations for noise reduction, first eroding to remove small noises such as dust and scratches, and then dilating to restore the outline of the box number characters. This process eliminates noise interference while preserving character edge details. Finally, it generates an inverted binary image, creating a strong contrast between the box number characters and the background, significantly improving character recognition.
[0011] Optionally, the step of constructing a character recognition model based on the container number definition rules and deep learning includes: setting cross-entropy loss as a loss function; constructing character constraint terms using the container number definition rules; adding the character constraint terms to the loss function to obtain an optimized loss function; and constructing a character recognition model based on deep learning using the optimized loss function.
[0012] This invention uses cross-entropy loss as the basic loss function, which can accurately measure the difference between the model's predicted values and the true values, ensuring the model's basic classification ability. By constructing character constraint terms in conjunction with container number definition rules, the position and type restrictions of the container number characters can be incorporated into model training, preventing the model from outputting characters that do not conform to the rules and reducing invalid predictions. The optimized loss function formed by adding these constraint terms to the loss function can simultaneously optimize classification accuracy and rule compliance during training, improving the performance of the character recognition model.
[0013] Optionally, constructing character constraint items using the container number definition rules includes: setting multiple character rule sets according to the container number definition rules; and constructing character constraint items based on the character rule sets.
[0014] This invention sets a corresponding set of character rules by setting box number rules, clarifies the range of character types for each sequence number, provides a basis for constraints, and then constructs constraint terms accordingly. This can limit the range of character prediction during model training, avoid outputting characters that do not conform to the rules, reduce invalid predictions, and further improve the performance of the character recognition model.
[0015] Optionally, obtaining the container number character and character probability using the character recognition model based on the character binary image and the character sequence number includes: inputting the character binary image into the character recognition model for prediction to obtain the character prediction probability; and filtering the character prediction probability using the container number definition rules and the character sequence number to obtain the character probability and the container number character corresponding to the character probability.
[0016] This invention predicts the probability of the current character using a character recognition model, and then combines the container number definition rules with the character sequence number to accurately filter out the probability of legal characters under the corresponding sequence number and the matching container number characters, thereby improving the accuracy of container number characters and character probability calculations.
[0017] Optionally, the step of matching the container number character with a pre-obtained set of real container numbers based on the character probability to obtain the operational container number includes: sorting the character probabilities in descending order; associating the character probabilities, the container number character, and the character sequence number based on the descending order to form a triplet list; constructing a character bit hash table for the set of real container numbers; and using the triplet list and the character bit hash table to filter the set of real container numbers to obtain the operational container number.
[0018] This invention first sorts characters in descending order of probability and associates them to form a triplet list, which clarifies the high-confidence characters for each sequence number, providing a clear direction for screening. It then constructs a character bit hash table for the real container number set, which can quickly locate container numbers containing target characters under a specific sequence number, greatly shortening the query time. Combining the two methods to screen the real container number set greatly improves the accuracy and efficiency of container number identification in operations.
[0019] Optionally, the step of filtering the real container number set using the triplet list and the character bit hash table to obtain the operational container number includes: iteratively filtering the real container number set using the triplet list and the character bit hash table to obtain a final candidate container number set; and determining the operational container number based on the final candidate container number set.
[0020] This invention utilizes a high-probability character list based on triples and a character bit hash table for rapid retrieval to gradually eliminate non-compliant container numbers, thereby obtaining a focused final candidate container number set and avoiding invalid matches. The container number is then determined from the candidate set to further improve the accuracy of container number identification.
[0021] Optionally, the step of iteratively filtering the real box number set using the triplet list and the character bit hash table to obtain the final candidate box number set includes: extracting the first triplet from the triplet list; querying the character bit hash table using the triplet to obtain the query box number set; calculating the intersection of the query box number set and the real box number set; determining a temporary candidate box number set based on the intersection using a backtracking mechanism; and determining the final candidate box number set based on the result of the iteration and the temporary candidate box number set by iterating through the triplet list.
[0022] This invention quickly locates the initial query container number set by extracting the first high-probability triplet from the triplet list and querying a hash table. Then, it filters out valid container numbers through intersection operations. When the intersection is empty, a backtracking mechanism is triggered to select the next highest-probability character for a re-query, avoiding missing valid container numbers due to single prediction errors. Subsequent iterations of the triplet list optimize the temporary candidate container number set, gradually eliminating invalid entries, thus improving the scientific rigor and robustness of the final candidate container number set calculation.
[0023] Optionally, determining the container number based on the final candidate container number set includes: matching the container number character with the corresponding character of each candidate container number in the final candidate container number set; filtering the characters in the candidate container numbers based on the matching results to obtain valid characters; summing the character probabilities corresponding to the valid characters to obtain the confidence score of the candidate container number; and determining the container number based on the confidence score.
[0024] This invention filters out valid characters by matching the container number characters with the candidate container number characters one by one, ensuring the relevance of the matching. Then, it obtains a confidence score by summing the probabilities of the valid characters, quantifying the credibility of the candidate container number. Finally, the container number is determined based on the score, avoiding the one-sidedness of a single matching judgment and further improving the scientificity and accuracy of container number calculation.
[0025] In another aspect, a deep learning-based container information identification system is provided, comprising: a processor, an input device, an output device, and a memory, wherein the processor, the input device, the output device, and the memory are interconnected, wherein the memory is used to store a computer program, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the deep learning-based container information identification method according to any one of the preceding aspects of the present invention.
[0026] The present invention provides a deep learning-based container information identification system, which is compact, stable, highly integrated, and simple in construction. It can stably execute the deep learning-based container information identification method provided in the preceding part of the present invention, further improving the overall applicability and practical application capability of the present invention. Attached Figure Description
[0027] Figure 1 This is a flowchart of a deep learning-based method for identifying operational container information according to an embodiment of the present invention.
[0028] Figure 2 This is a schematic diagram of a deep learning-based container information identification system according to an embodiment of the present invention. Detailed Implementation
[0029] Specific embodiments of the present invention will now be described in detail. It should be noted that the embodiments described herein are for illustrative purposes only and are not intended to limit the invention. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be apparent to those skilled in the art that these specific details are not necessary to practice the invention. In other instances, well-known circuits, software, or methods have not been specifically described to avoid obscuring the invention.
[0030] Throughout this specification, references to "an embodiment," "an embodiment," "an example," or "an example" mean that a particular feature, structure, or characteristic described in connection with that embodiment or example is included in at least one embodiment of the invention. Therefore, the phrases "in an embodiment," "in an embodiment," "an example," or "an example" appearing in various places throughout the specification do not necessarily refer to the same embodiment or example. Furthermore, specific features, structures, or characteristics can be combined in one or more embodiments or examples in any suitable combination and / or sub-combination. Moreover, those skilled in the art will understand that the illustrations provided herein are for illustrative purposes and are not necessarily drawn to scale.
[0031] Please see Figure 1 To address the shortcomings of the prior art, in one alternative embodiment, such as Figure 1 The deep learning-based method for identifying container information in operations, as shown, includes the following steps:
[0032] Step S1: Obtain the red-green-blue image of the working container, and extract the container's inverted binary image from the red-green-blue image.
[0033] In this embodiment, in operational scenarios such as logistics parks and port terminals where the containers are located, industrial-grade red-green-blue (RGB) image acquisition equipment is used, such as industrial cameras with a resolution of no less than 1920×1080 and a frame rate adapted to the container's moving speed, to acquire images of the containers in operation. During the acquisition process, the device's built-in adaptive lighting module ensures image clarity. The adaptive lighting module can automatically adjust the lighting intensity according to the ambient light intensity to avoid overexposure in strong light or underexposure in weak light, and to ensure that the acquired RGB image completely covers the container number marking area on the container body. For example, if there is no obvious obstruction or distortion, the pixel proportion of the container number character in the image is no less than 5% of the total pixels of the image, in order to meet the subsequent character segmentation requirements.
[0034] The extraction of the container inverted binary image from the red-green-blue image specifically includes the following sub-steps:
[0035] Step S101: Extract the container image from the red-green-blue image and perform grayscale processing on the container image to obtain a container grayscale image.
[0036] In this embodiment, a deep learning-based object detection model (such as YOLOv5s or Faster R-CNN models suitable for industrial scenarios, with the model training dataset containing container samples of different sizes, colors, and operating environments) or a traditional image segmentation algorithm based on container geometric features (rectangular outline, grayscale difference between container color and background) is used to locate and extract the complete container region in the RGB image, resulting in a container image containing only the container body. This ensures that the container in the image is not obviously truncated, and the container number identification area is completely within the extracted image range.
[0037] Next, the container image is processed to grayscale using a weighted average grayscale algorithm that conforms to the characteristics of human vision (the grayscale value calculation formula is: R, G, and B are the red, green, and blue channel pixel values of the corresponding pixels in the container image, respectively, with a value range of 0-255. The three-channel container image is converted into a single-channel container grayscale image, in which the pixel value range is 0-255, where black corresponds to 0 and white corresponds to 255.
[0038] Step S102: Denoise the container grayscale image using opening operation to obtain an optimized grayscale image.
[0039] In this embodiment, when performing denoising processing on the container grayscale image, the appropriate structural element is first selected based on the size characteristics of common noise in the container grayscale image (such as dust spots, small scratches, and local bright spots caused by uneven lighting in the working scene; such noise is mostly discrete noise with small pixel area). 3×3 or 5×5 rectangular structural elements are preferred. The selection criteria are: they can effectively cover and remove typical small-sized noise, and avoid the loss of edge details of the container number characters due to the structural element being too large. The container grayscale image is then processed according to the core workflow of opening operation: first, erosion followed by dilation. The first step is to perform an erosion operation, using the selected structuring element to traverse the grayscale image and remove bright noise points (such as isolated high grayscale pixels) smaller than the structuring element, thus initially eliminating noise interference. The second step is to perform a dilation operation based on the same structuring element to restore the outline of the container number characters that may shrink after erosion, filling in the tiny gaps at the character edges caused by erosion, ensuring the integrity and continuity of the container number characters. Through the above opening operation processing, an optimized grayscale image is finally obtained with significantly reduced noise, stable contrast between the container number characters and the container background, and clear details at the character edges.
[0040] Step S103: Obtain the container inverted binary image based on the optimized grayscale image.
[0041] In this embodiment, the grayscale distribution characteristics of the optimized grayscale image are first analyzed. Since the container numbers are mostly dark-colored printed on light-colored containers, the optimal binarization threshold needs to be automatically calculated using the Otsu algorithm (maximum inter-class variance method). This algorithm can divide pixels into foreground (container number characters) and background based on the image grayscale histogram and maximize the variance between the two classes, thereby avoiding the adaptation problem caused by manual parameter tuning. It ensures that characters and background can be accurately distinguished under different lighting and container colors. Then, binarization processing is performed, setting pixels with grayscale values greater than the threshold to 255 and pixels with grayscale values less than or equal to the threshold to 0, resulting in an initial binary image where characters are white and the background is black. The inversion operation is then performed, swapping pixel values of 0 and 255, so that the container number characters are uniformly converted to a black foreground and a white background.
[0042] Step S2: The container inverted binary image is segmented to obtain multiple character binary images and character serial numbers.
[0043] In this embodiment, character region localization is performed on the inverted binary image. The proportion of black pixels in each row of the image in the vertical direction is counted by the horizontal projection method. The range of rows with a black pixel proportion higher than a set threshold (such as 3%, which can be adjusted according to the size of the box number character) is selected to determine the horizontal region where the 11 characters are located. The vertical projection method is used to count the pixels in the vertical direction of the located character horizontal region to obtain the vertical projection curve. Since there are very few black pixels at the intervals, the troughs in the curve correspond to the interval regions between characters, and since there are dense black pixels at the characters, the peaks correspond to the character regions. The vertical projection curve is then processed using the rule of uniform character spacing. First, the curve is smoothed by a moving average filter (such as a sliding window of 5-7 pixels) to eliminate false valleys caused by tiny spikes at the character edges. Then, all valleys in the curve are identified and the horizontal distance between adjacent valleys is calculated, i.e., the character width. Abnormal valleys with a deviation of more than 20% from the average character width are removed to avoid misjudging tiny gaps inside the character as character intervals. This ensures that 10 evenly distributed effective valleys are retained. Finally, the horizontal coordinates of these 10 valleys are used as dividing lines to divide the horizontal region of the character into 11 independent sub-images from left to right. Each sub-image is a binary image of a single character and is assigned a character number from 1 to 11 according to the division order, corresponding to the 1st to 11th characters of the box number, respectively.
[0044] Step S3: Obtain the container number definition rules, and construct a character recognition model based on the container number definition rules and deep learning.
[0045] In this embodiment, the standard container number is defined as a fixed 11-character structure, which must meet the following requirements: the first 3 characters are the owner code, which is limited to uppercase letters and is used to identify the owner of the container; the 4th character is the equipment identification code, which is fixed to uppercase letters; the 5th to 10th characters are numbers, consisting of the numbers 0-9, which is the unique number of the container owner for his / her container; and the 11th character is a check code, which can be either uppercase letters or numbers.
[0046] The character recognition model built based on the container number definition rules and deep learning specifically includes the following sub-steps:
[0047] Step S301: Set the cross-entropy loss as the loss function.
[0048] The loss function satisfies the following formula:
[0049]
[0050] in, For loss function, For the sample size, For the first Each sample was predicted to be the true label. The probability of.
[0051] Cross-entropy loss guides model learning by quantifying the fit between the predicted probability of a sample and the true label. The closer to 1 (the more accurate the prediction), the smaller the loss; when The greater the deviation from 1 (the less accurate the prediction), the greater the loss, thereby driving the model to improve the accuracy of its prediction of the true label.
[0052] Step S302: Construct character constraint items using the container number definition rules.
[0053] The construction of character constraint items using the container number definition rules specifically includes the following sub-steps:
[0054] Step S30201: Set multiple character rule sets according to the box number definition rules.
[0055] In this embodiment, according to the container number definition rules and the 11-digit standard container number structure, 11 character rule sets need to be set accordingly. The specific definitions of each set are as follows: The first to fourth character rule sets correspond to the first to fourth digits of the container number and must be uppercase letters, so they are set as the set of 26 uppercase Latin letters A, B, C...Z. The fifth to tenth character rule sets correspond to the fifth to tenth digits of the container number and must be numbers, so they are set as the set of numbers 0 to 9. The eleventh character rule set corresponds to the eleventh digit of the container number and can be either uppercase letters or numbers, so it is set as the set of letters and numbers.
[0056] Step S30202: Construct character constraint terms based on the character rule set.
[0057] Character constraint terms satisfy the following formula:
[0058]
[0059] in, For character constraint items, For the sample size, For the number of character types, For the first The predicted character corresponding to each probability. For character sequence number The corresponding set of character rules, For the first In the nth sample The predicted probability of each character.
[0060] against One sample Character classes, via indicator functions Determine the predicted character Does it violate its serial number? Corresponding character rule set If a violation occurs, I is 1; otherwise, it is 0. This is then combined with the... The nth sample pair Predicted probability of class characters The character constraint loss is obtained by summing the probability contributions of all rule violations and then averaging the samples. Essentially, it applies a loss to predictions that violate character rules (the higher the prediction probability, the greater the loss), thereby guiding the model to learn results that conform to character rules, improving the accuracy of character recognition at the box number structure rule level, and avoiding erroneous predictions that violate the rules.
[0061] Step S303: Add the character constraint term to the loss function to obtain the optimized loss function.
[0062]
[0063] in, To optimize the loss function, For the sample size, For the first Each sample was predicted to be the true label. The probability, To constrain the weights, For the number of character types, For the first The predicted character corresponding to each probability. For character sequence number The corresponding set of character rules, For the first In the nth sample The predicted probability of each character.
[0064] Step S304: Construct a character recognition model based on deep learning using the optimized loss function.
[0065] In this embodiment, the deep learning uses a lightweight convolutional neural network (CNN) architecture as the basic model framework. The model is explicitly designed as a multi-classification model, with the classification target corresponding to all possible types of box number characters, namely the digits 0-9 (10 classes) and the uppercase Latin letters AZ (26 classes), totaling 36 categories, to ensure coverage of all legal characters in the box number. The model output layer is fixed at 36 neurons, and the output is transformed into a probability distribution of 36 classes through the Softmax activation function (the sum of the probabilities of each class is 1), directly outputting the predicted probability of each character's binary image belonging to each of the 36 classes.
[0066] In terms of model structure details, the input layer needs to preprocess the segmented binary character images: the image size is unified, for example, 32 pixels × 32 pixels to balance feature preservation and computational efficiency, and the pixel values are normalized to the [0,1] range to eliminate the interference of pixel value range differences on model training. Then, two convolutional layers are set. The first layer uses 6 3×3 convolutional kernels and ReLU activation function, and the second layer uses 16 3×3 convolutional kernels and ReLU activation function to gradually extract local features such as stroke inflection points and line segments of characters. After the convolutional layers, max pooling layers (2×2 pooling kernels, stride of 2) are connected to achieve feature dimensionality reduction and spatial information aggregation, reducing the number of model parameters. After the output of the pooling layer, two fully connected layers are connected. The first layer has 120 neurons and the second layer has 84 neurons, both activated by ReLU, which maps the features extracted by convolution into high-dimensional feature vectors to support the final classification. Finally, the output layer is set with 36 neurons and Softmax activation to output 36 class probabilities.
[0067] The training samples are obtained by collecting RGB images of containers under different operating scenarios, lighting conditions and occlusion conditions. After the same processing as in steps S1 and S2, historical character binary images are obtained. A corresponding real character label is set for each historical character binary image to form a sample set. The sample set is divided into a training set and a test set according to the proportion. After training, the character recognition model is trained using the training set according to the optimized loss function, and the character recognition model is evaluated using the test set.
[0068] Step S4: Based on the character binary image and the character sequence number, use the character recognition model to obtain the box number character and the character probability.
[0069] The specific steps for obtaining the box number character and its probability using the character recognition model based on the character binary image and the character sequence number include the following:
[0070] Step S401: Input the character binary image into the character recognition model to predict the character prediction probability.
[0071] In this embodiment, the binary image of a character is input into the character recognition model. The character recognition model classifies the binary image of the character, and the output layer outputs the predicted probability of the character belonging to 36 categories, namely 10 digits and 26 uppercase letters, through the Softmax activation function. The sum of the probabilities is 1.
[0072] Step S402: Using the container number definition rules and the character sequence number, the predicted probability of the character is filtered to obtain the character probability and the container number character corresponding to the character probability.
[0073] In this embodiment, the type of the character corresponding to the character number is determined according to the container number definition rules. The type includes letters and numbers. The 36 probabilities are filtered according to the type to ensure that the character category corresponding to the filtered probability belongs to this type. For example, if the predicted character can only be a letter, the probabilities corresponding to all letters are filtered. Then, the character type corresponding to the highest probability among the filtered probabilities is determined as the container number corresponding to this character number. After the recognition of 11 characters is completed, all container number characters and the probabilities corresponding to the container number characters are obtained.
[0074] Step S5: Based on the character probability, match the container number character with the pre-obtained set of real container numbers to obtain the container number of the work container.
[0075] The process of matching the container number character with a pre-obtained set of real container numbers based on the character probability to obtain the container number for operation specifically includes the following sub-steps:
[0076] Step S501: Sort the character probabilities in descending order, and associate the character probabilities, the box number characters, and the character sequence numbers based on the result of the descending sort to form a triplet list.
[0077] In this embodiment, for each character number from 1 to 11, the character probabilities after being filtered by the container number definition rules are sorted in descending order. Then, each sorted probability is associated with its corresponding container number character and character number to form a single triplet of (character number, container number character, character probability). The single triplets are combined according to the probability sorting order to obtain a triplet list.
[0078] Step S502: Construct a character bit hash table for the real box number set.
[0079] In this embodiment, the character sequence number (1-11, corresponding to the 1st to 11th positions of the box number) is used as the top-level key. The key of the sub-hash table is the valid character that appears in all real box numbers under that sequence number, and the value of the sub-hash table is a set consisting of all real box numbers containing that character at the corresponding sequence number position. Specifically, by traversing each 11-digit real box number in the real box number set, the character at each position is split out sequentially according to the character sequence number 1-11. For each sequence number, if the top-level key of that sequence number has not been created in the hash table, the top-level key and the corresponding sub-hash table are created first; then it is checked whether the split character has been used as the key of the sub-hash table. If it does not exist, the subkey is created and its value is initialized to an empty set. Then, the currently traversed real box number is added to the set corresponding to the subkey; if the subkey already exists, the current real box number is directly added to the corresponding set, finally forming a character position hash table with a clear hierarchy and matching the box number rules, thus improving the filtering efficiency.
[0080] Step S503: Use the triplet list and the character bit hash table to filter the real container number set to obtain the operational container number.
[0081] The process of filtering the actual container number set using the triplet list and the character bit hash table to obtain the container number for operation specifically includes the following sub-steps:
[0082] Step S50301: Iteratively filter the real box number set using the triplet list and the character bit hash table to obtain the final candidate box number set.
[0083] The process of iteratively filtering the real box number set using the triplet list and the character bit hash table to obtain the final candidate box number set specifically includes the following sub-steps:
[0084] Step S5030101: Extract the first triplet from the triplet list.
[0085] In this embodiment, the triplet list is formed by associating characters in descending order of probability. The first triplet represents the highest probability character combination under a certain character number after filtering by the box number rule. This serves as the starting point for subsequent queries of the character position hash table, which can quickly locate the query box number set containing the high probability character, greatly narrowing the initial filtering range, avoiding redundant calculations caused by starting the query from low probability characters, and improving the efficiency of intersection calculation with the real box number set.
[0086] Step S5030102: Use the triple to query the character bit hash table to obtain the query box number set.
[0087] In this embodiment, based on the character index in the triplet, the top-level key identified by that index in the character bit hash table is located. Then, in the sub-hash table corresponding to the top-level key, the entry with the high-probability box number character in the triplet as the subkey is searched. Since the character bit hash table is constructed and stored according to the character bit characteristics of the real box number set, that is, the value corresponding to the subkey contains all real box numbers with that character at the corresponding index position, the set of real box numbers corresponding to the subkey is directly determined as the query box number set for the first query, completing the initial precise range filtering based on the highest probability character.
[0088] Step S5030103: Calculate the intersection of the query box number set and the actual box number set.
[0089] In this embodiment, the actual container number is obtained by the responsible entity, such as the logistics company or shipping company to which the container belongs, transmitting the container number information (including the container owner code, equipment identification code, container number, and check code) to the management system of the operation site in advance before the container arrives at the port, logistics park, or other operation site.
[0090] According to the logic of set intersection operation, traverse and query each box number in the box number set, determine whether it exists in the actual box number set, extract and integrate all box numbers that belong to both sets, and form the intersection of the two.
[0091] Step S5030104: Determine a temporary candidate box number set based on the intersection using a backtracking mechanism.
[0092] In this embodiment, it is first determined whether the intersection of the query box number set and the real box number set is not empty. If the intersection is not empty, it means that the box numbers in the intersection meet both the legality requirements of the real box numbers and the filtering conditions of the current high-probability characters. The intersection is directly determined as a temporary candidate box number set. If the intersection is empty, it means that there is a prediction error in the probability of the character sequence number and the box number character in the current triplet (the character has no matching box number at the corresponding sequence number position in the real box number set). The backtracking mechanism needs to be triggered to return to the triplet list corresponding to the character sequence number, skip the current high-probability characters, select the second highest probability legal characters, and use the new characters to re-query the character position hash table to obtain a new query box number set. The intersection with the real box number set is calculated again. This backtracking process is repeated until a character that makes the intersection not empty is found. The intersection at this time is used as a temporary candidate box number set.
[0093] Step S5030105: Iterate through the triplet list and determine the final candidate box number set based on the results of the iteration and the temporary candidate box number set.
[0094] In this embodiment, when iterating through the triplet list, the characters in the bin numbers 1-11 are processed sequentially. Using the temporary candidate bin number set obtained from the initial backtracking as the initial basis, for the current character number to be processed, the triplet with the highest probability under that number is extracted from the triplet list. Its character information is used to query the character position hash table to obtain a new query bin number set containing that character under that number. Then, the intersection of the new query bin number set and the current temporary candidate bin number set is calculated. If the intersection is not empty, it is updated to a new temporary candidate bin number set, and the iteration proceeds to the next character number. If the intersection is empty, the backtracking mechanism is immediately triggered, skipping the current high-probability character, selecting the next high-probability legal character (conforming to the bin number rules), and re-querying the hash table and calculating the intersection until a non-empty intersection is obtained and the temporary candidate bin number set is updated. After iterating through all triplets of the 11 character numbers, the final remaining temporary candidate bin number set is the final candidate bin number set.
[0095] It should be noted that, due to the existence of the backtracking mechanism, the final candidate container number set may contain multiple container numbers, because the backtracking mechanism skips the screening of incorrect predictions.
[0096] Step S50302: Determine the container number for operation based on the final candidate container number set.
[0097] The specific steps for determining the container number based on the final candidate container number set include the following:
[0098] Step S5030201: Match the box number character with the corresponding character of each candidate box number in the final candidate box number set.
[0099] In this embodiment, when performing the matching operation, the core logic of the matching is first clarified as being based on the correspondence of character numbers. The box number characters are the predicted results associated with character numbers 1-11 (i.e., each number corresponds to a box number character predicted by the model and filtered by rules), while each candidate box number in the final candidate box number set is a real box number derived result conforming to the 11-character standard structure (also containing 1-11 characters). During the matching process, for each candidate box number in the final candidate box number set, the predicted box number characters (such as the predicted character of number 1, the predicted character of number 2, ..., the predicted character of number 11) are compared one by one with the characters at the corresponding number positions of the candidate box number (such as the characters of candidate box number number 1, number 2, ..., number 11) in the order of character numbers 1-11. It is determined whether the characters at the same character position are completely consistent, thereby achieving accurate positional pairing and consistency verification between the predicted characters and the candidate box number characters.
[0100] Step S5030202: Based on the matching result, the characters in the candidate box number are filtered to obtain valid characters.
[0101] In this embodiment, the matching result refers to whether two characters are consistent or inconsistent. That is, it clarifies whether each character in the candidate box number is consistent or inconsistent with the predicted character of the corresponding sequence number. Then, according to the rule of keeping consistent characters and deleting inconsistent characters, the characters in the candidate box number that are consistent with the predicted character of the corresponding sequence number are kept, and the characters that are inconsistent with the predicted character of the corresponding sequence number are deleted. Finally, the characters at each consistent matching position are the valid characters corresponding to the candidate box number.
[0102] Step S5030203: Sum the character probabilities corresponding to the valid characters to obtain the confidence score of the candidate box number.
[0103] In this embodiment, the confidence score provides a quantitative and accurate reliability basis for the final determination of the container number. The effective character is the result of the prediction of the container number character matching the corresponding character of the candidate container number. The probability of the corresponding character itself represents the confidence of the prediction at that position. The summation process can comprehensively reflect the overall matching quality of the candidate container numbers. The higher the score, the more matching characters there are in the candidate container number, and the higher the prediction confidence of each matching character. This effectively distinguishes the merits of different candidate container numbers. At the same time, this scoring mechanism can avoid the one-sidedness of relying solely on the number of matching characters to judge, and eliminate low-reliability candidate container numbers with many matching characters but low prediction probability of a single character. This further narrows down the selection range of the optimal container number, directly helping to solve the problem of insufficient accuracy in the identification of container numbers in the existing technology, and improving the accuracy and confidence of the final container number identification result.
[0104] Step S5030204: Determine the container number for operation based on the confidence score.
[0105] In this embodiment, the confidence scores of all candidate container numbers in the final candidate container number set (obtained by summing the probabilities corresponding to the valid characters of each candidate container number) are sorted in descending order, and the candidate container number with the highest score is selected first. If there are special cases where multiple candidate container numbers have the same score, a review is required, and the container is photographed again for secondary calculation.
[0106] A deep learning-based method for identifying operational container information further includes: determining the operational container information based on the operational container number. After obtaining the operational container number, the container information matching the operational container number from the actual container numbers is extracted as the operational container information.
[0107] like Figure 2As shown, in another aspect, the present invention also provides a deep learning-based container information identification system, comprising: a processor, an input device, an output device, and a memory, wherein the processor, the input device, the output device, and the memory are interconnected, wherein the memory is used to store a computer program, the computer program including program instructions, and the processor is configured to call the program instructions to execute the relevant steps of a relevant embodiment of the deep learning-based container information identification method of the present invention.
[0108] This invention provides a deep learning-based container information identification system. The functional components can be integrated into a single processing unit, exist as separate physical entities, or be integrated into a single unit. The integrated components can be implemented in hardware or as software functions.
[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.
Claims
1. A method for identifying operational container information based on deep learning, characterized in that, The method includes: Obtain the red-green-blue images of the containers being handled, and extract the inverted binary images of the containers from the red-green-blue images; The inverted binary image of the container is segmented to obtain multiple character binary images and character numbers; Obtain the container number definition rules, and build a character recognition model based on the container number definition rules and deep learning; Based on the character binary image and the character sequence number, the box number character and the character probability are obtained using the character recognition model. Based on the character probability, the container number character is matched with a pre-obtained set of real container numbers to obtain the operational container number, including: The character probabilities are sorted in descending order, and the character probabilities, the box number characters, and the character sequence numbers are associated based on the descending order to form a triplet list; Construct a character bit hash table for the actual box number set; The container numbers for operations are obtained by filtering the set of actual container numbers using the list of triples and the character bit hash table, including: The true box number set is iteratively filtered using the triplet list and the character bit hash table to obtain the final candidate box number set, including: Extract the first triplet from the list of triplets; The set of query box numbers is obtained by querying the character bit hash table using the triplet; Calculate the intersection of the query box number set and the actual box number set; A temporary candidate box number set is determined based on the intersection using a backtracking mechanism; The final candidate box number set is determined by iterating through the list of triples and based on the results of the iteration and the temporary candidate box number set. The container number for the operation is determined based on the final candidate container number set, including: The box number character is matched with the corresponding character of each candidate box number in the final candidate box number set; Based on the matching results, the characters in the candidate box numbers are filtered to obtain valid characters; The confidence score of the candidate box number is obtained by summing the probabilities of the valid characters. The container number is determined based on the confidence score.
2. The method for identifying operational container information based on deep learning according to claim 1, characterized in that, The step of extracting the container inverted binary image from the red-green-blue image includes: Extract the container image from the red-green-blue image, and perform grayscale processing on the container image to obtain a container grayscale image; The grayscale image of the container is denoised using an opening operation to obtain an optimized grayscale image. The container inverted binary image is obtained based on the optimized grayscale image.
3. The method for identifying operational container information based on deep learning according to claim 1, characterized in that, The character recognition model constructed based on the container number definition rules and deep learning includes: Set the cross-entropy loss as the loss function; Character constraint items are constructed using the container number definition rules; The character constraint term is added to the loss function to obtain the optimized loss function; A character recognition model is constructed based on deep learning using the optimized loss function.
4. The method for identifying operational container information based on deep learning according to claim 3, characterized in that, The step of constructing character constraint items using the container number definition rules includes: Multiple character rule sets are set according to the box number definition rules; Character constraint terms are constructed based on the set of character rules.
5. The method for identifying operational container information based on deep learning according to claim 1, characterized in that, The step of obtaining the box number character and its probability using the character recognition model based on the character binary image and the character sequence number includes: The binary image of the character is input into the character recognition model to obtain the character prediction probability; The predicted probabilities of the characters are filtered using the container number definition rules and the character sequence number to obtain the character probability and the corresponding container number character.
6. A deep learning-based container information identification system, characterized in that, include: The system includes a processor, an input device, an output device, and a memory, all interconnected. The memory stores a computer program, which includes program instructions. The processor is configured to invoke the program instructions to execute a deep learning-based method for identifying operational container information as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Container number identification method
CN102024144A
Container identification method and device applied to quay crane system
CN117935274A