A container BIC code identification method
By using high-resolution image acquisition and advanced algorithm processing, including the DB algorithm, multi-directional classification network and CRNN architecture, combined with prior knowledge base and minimum coverage rectangle algorithm, the problems of low efficiency, error susceptibility and environmental dependence in container BIC code recognition are solved, and high-precision recognition in complex environments is achieved.
Patent Information
- Application Number
- CN202411819473.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2044-12-11
AI Technical Summary
Existing technologies for container BIC code recognition are inefficient, error-prone, and highly dependent on the environment, making it difficult to handle recognition needs in complex environments such as soiling, blurring, and occlusion.
High-resolution image acquisition, denoising, grayscale conversion, and contrast enhancement are employed, combined with the DB algorithm to detect text regions, a multi-directional classification network to correct text orientation, and a CRNN architecture to identify character sequences. The BIC code region is located by combining prior knowledge base and filtering rules, and the minimum covering rectangle algorithm and joint probability decision are utilized.
The accuracy and reliability of container BIC code recognition have been improved in complex environments, and the ability to handle blurred, dirty or obscured characters has been enhanced to ensure the accuracy of recognition results.
Smart Images

Figure CN119649372B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of container BIC code recognition, and particularly relates to a container BIC code recognition method. BACKGROUND
[0002] Under the background of globalization trade, as the main carrier of cargo transportation, the accuracy of container management and tracking is of great significance to improve logistics efficiency and reduce costs. The BIC code of the container is the unique identifier of the container, which contains information such as box code, serial number and check digit. However, due to environmental factors, surface conditions of the container and other factors, automatic recognition and accurate reading of the container BIC code has always been a technical challenge. At present, the recognition of container BIC code mainly depends on manual input and traditional image processing technology. These methods have the following problems:
[0003] Low efficiency: manual input speed is limited, which is difficult to meet the high frequency of container in and out of port demand;
[0004] Error-prone: human factors lead to input errors, affecting subsequent management and tracking;
[0005] Strong environmental dependence: environmental factors such as light changes and weather have a great impact on image quality, resulting in a decrease in recognition accuracy;
[0006] Difficult to process complex characters: the BIC code on the container may be dirty, blurred, blocked and other problems, and traditional algorithms are difficult to effectively process.
[0007] Therefore, the existing technology has limitations in processing container BIC codes in complex environments such as dirt, blur and blockage, and relies on data. Traditional methods have strong dependence on large-scale samples, lack of flexibility, insufficient intelligence, and are difficult to adapt to changing operating environments and complex recognition requirements. SUMMARY
[0008] In view of the above shortcomings of the prior art, the present application provides a container BIC code recognition method, which can effectively solve the problem of not being convenient for accurate recognition of the BIC code of the container in the prior art.
[0009] To achieve the above purpose, the present application is implemented by the following technical scheme:
[0010] The present application provides a container BIC code recognition method, comprising the following steps:
[0011] Obtaining a high-resolution container image of the container;
[0012] Denoising, graying and contrast enhancement are performed on the container image;
[0013] The DB algorithm is used to detect the text region, and a bounding box set containing the text region is generated;
[0014] The direction of the text is determined through the multi-direction classification network, the classification confidence is calculated, and the direction is corrected;
[0015] The corrected text image is recognized using the CRNN architecture, and the text sequence and its corresponding confidence are output;
[0016] Based on the character recognition result, the prior knowledge base and the screening rules are combined to locate the BIC code region;
[0017] Through the joint calculation of position detection probability, character recognition probability and BIC rule verification probability, the optimal BIC code recognition result is selected.
[0018] Further, when obtaining the high-resolution container image of the container, the container image is obtained through multiple angles.
[0019] Further, the parameters of the container image include: resolution: ≥1920x1080 pixels; frame rate: ≥30 frames / second.
[0020] Further, the method for detecting the text region to generate a bounding box set containing the text region is:
[0021] Input the original image matrix , where H represents the height, W represents the width, and C represents the number of color channels;
[0022] Processed by DB algorithm;
[0023] Output the text region bounding box set , n represents the total number of bounding boxes in the set, describes the number of detected text regions, represents the i-th bounding box in the set, and each bounding box is a rectangular region containing a text region;
[0024] Feature extraction:
[0025]
[0026] F represents the extracted features, and m represents the number of extracted features, represents the i-th feature in the set;
[0027] Probability threshold Calculation:
[0028]
[0029] where, : binary threshold, used to convert continuous feature values into binary features; : regional probability score, representing the probability that a certain region contains text, represents the positive part of , if negative, take 0;
[0030] Boundary box calculation:
[0031]
[0032] wherein, represents the upper left corner coordinates of the boundary box, represents the right lower corner coordinates of the boundary box, represents the confidence of the model that the boundary box contains text.
[0033] Further, by the multi-direction classification network, the direction of the text is determined, the classification confidence is calculated, and the method for direction correction is:
[0034] input the detected text region image;
[0035] using a multi-direction classification network to process the text region image to determine the direction of the text;
[0036] output the text angle , the angle represents the standard direction of the text relative to the horizontal line;
[0037] Calculate the confidence of each angle to determine the most likely direction of the text:
[0038]
[0039] wherein, represents the score of the jth angle, represents the exponential function of the score
[0040] Angle correction transformation, according to the classification result, the text image is angle corrected to ensure that the text is horizontal or vertical:
[0041]
[0042] wherein, represents the angle correction function, represents the detected text image, represents the corrected text image.
[0043] Further, the method for recognizing the text image and outputting the character sequence and its corresponding confidence is:
[0044] input the corrected text image;
[0045] processed using the CRNN architecture;
[0046] Output the text sequence and confidence score. The identified text content and its corresponding confidence score represent the model's confidence in the recognition result.
[0047] Feature sequence extraction:
[0048]
[0049] in, This represents the feature sequence extracted from the text image. This represents the features extracted at time step t. It is the length of the feature sequence. Represents the input text image;
[0050] Sequence encoding:
[0051]
[0052] in, BiLSTM represents the result of encoding a feature sequence by a bidirectional long short-term memory network. It can capture the sequential dependencies in sequence data and is suitable for text recognition.
[0053] CTC probability calculation:
[0054]
[0055] in, This represents the probability of recognizing the label sequence l given an input image x. This indicates that at time step t, given the input features Output tags The probability of this is obtained through CTC technology, which enables the model to handle variable-length input and output sequences and to identify whitespace and repeating characters in the text.
[0056] Final output:
[0057]
[0058] in: The identified text content : Identify confidence level, : Text box coordinates, This represents a set containing N elements, where each element represents the result of a identified text region.
[0059] Furthermore, the method for the BIC code region is as follows:
[0060] Input the recognition result output by the character recognition module in the previous stage:
[0061]
[0062] in: This indicates the recognition result output by the character recognition module in the previous stage, including the recognized text content, confidence score, and text box coordinates;
[0063] The identified text content : Identify confidence level, : Text box coordinates;
[0064] Output the set of candidate location boxes:
[0065] Candidate Set = {OCCS, SNCS, CDCS, ECICS}, where Candidate Set represents a set containing different types of candidate location boxes used to locate and identify specific coding information; OCCS, the box owner code candidate set, used to identify the code of the cargo owner; SNCS, the serial number candidate set, used to identify the unique serial number of the cargo; CDCS, the check digit candidate set, used to identify the check digit used for error detection; and ECICS, the 95 code candidate set, used to assist in location.
[0066] From character recognition results In the process, through preliminary screening of character features, non-BIC code information is excluded, and the 95 code, BIC code and serial number areas are selected.
[0067] Furthermore, the method for selecting the optimal BIC code recognition result is as follows:
[0068] Calculate the joint probability: Calculate the joint probability of each candidate combination by multiplying the location detection probability, character recognition probability, and BIC rule verification probability;
[0069] Verify ISO 6346 standard: Calculate check bits for candidate combinations to ensure compliance with international standards;
[0070] Output the optimal result: Select the candidate combination with the highest joint probability as the final BIC code recognition result.
[0071] Furthermore, suppose we have the following candidate set:
[0072] Box master code candidate set OCCS= ;
[0073] Serial Number Candidate Set SNCS= ;
[0074] 95-code candidate set ECICS= ;
[0075] Pairing up:
[0076]
[0077] This represents an element in the candidate set of box master codes. Represents an element in the candidate set of sequence numbers;
[0078] For each combination Calculate the area of the covered rectangle ;
[0079] For each BICowner code candidate, serial number candidate SNCS, and 95 code candidate, calculate the area of the minimum coverage rectangle among the three;
[0080] Specifically, the minimum covering rectangle of the two boxes and its area are calculated:
[0081] Get the coordinates of all candidate boxes;
[0082] Find the minimum and maximum x and y coordinate values;
[0083] Construct the minimum bounding rectangle based on the extreme points;
[0084] Calculate the area of the rectangle;
[0085] Choose the first two smallest area combinations:
[0086]
[0087] step:
[0088] Iterate through all possible combinations of OCCS and SNCS;
[0089] Calculate the minimum covering rectangle area for each combination;
[0090] Sort by area;
[0091] The two combinations with the smallest retained area;
[0092] Three-element combination:
[0093]
[0094] This represents an element in the 95-code candidate set (ECICS). This represents the combination of the two smallest areas;
[0095] For each combination Calculate the area of the covered rectangle .
[0096] Choose the first two smallest area combinations of three elements:
[0097]
[0098] step:
[0099] Combine the 95-code candidate with the first two combination schemes;
[0100] Calculate the area of the minimum covering rectangle for the three elements;
[0101] Sort by area;
[0102] Choose the optimal combination of two three-element combinations;
[0103] Output the optimal combination:
[0104] Based on the principle of minimizing the coverage area, the most reasonable combination scheme is selected as the final BIC code positioning result.
[0105] A computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of any one of the methods described above.
[0106] The technical solution provided by this invention has the following advantages compared with the known prior art:
[0107] By employing a high-resolution multi-camera system and image preprocessing techniques, including denoising, grayscale conversion, and contrast enhancement, the system ensures high-quality image acquisition in complex environments and improves recognition accuracy. The solution utilizes the DB algorithm to detect text regions, combines a multi-directional classification network to correct text orientation, and employs a CRNN architecture (CNN+RNN+CTC) to recognize character sequences, comprehensively enhancing the ability to handle blurred, damaged, or occluded characters. Simultaneously, by combining prior knowledge bases and filtering rules to locate BIC code regions, and utilizing the minimum coverage rectangle algorithm and joint probability fusion decision-making, the system ensures the accuracy and reliability of the final recognition results. Attached Figure Description
[0108] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0109] Figure 1 This is a schematic diagram of the overall method of the present invention. Detailed Implementation
[0110] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0111] The present invention will be further described below with reference to embodiments.
[0112] Example 1 (see Figure 1 A container BIC code identification method, comprising at least:
[0113] Image acquisition is performed, responsible for obtaining high-quality container images from multi-camera systems or other image acquisition devices, ensuring that the image resolution and frame rate meet the requirements of subsequent processing. Key parameters:
[0114] Resolution: ≥1920x1080 pixels; Frame rate: ≥30 frames / second.
[0115] The acquired images are preprocessed, including denoising, grayscale conversion, contrast enhancement, and edge detection, to improve the subsequent container BIC recognition effect.
[0116] The character recognition processing algorithm (CPM) is used to extract character information from the preprocessed image, output a candidate character set and its position information, and further accurately recognize the characters by combining it with a custom deep neural network.
[0117] include:
[0118] Text detection stage:
[0119] Input: Original image matrix Where H represents height, W represents width, and C represents the number of color channels;
[0120] Processing: The DB (Differentiable Binarization) algorithm is a differentiable binarization method used to improve the accuracy of text detection;
[0121] Output: Set of text region bounding boxes , where n represents the total number of bounding boxes in the set, describing the number of detected text regions. This represents the i-th bounding box in the set. Each bounding box is a rectangular region containing text.
[0122] Feature extraction:
[0123]
[0124] F represents the extracted features, and m represents the number of extracted features. This represents the i-th feature in the set.
[0125] probability threshold calculate:
[0126]
[0127] in, Binarization threshold: used to convert continuous feature values into binary features; Region probability score: This represents the probability that a certain region contains text. Indicates taking The positive part is taken as 0 if it is negative.
[0128] Bounding box calculation:
[0129]
[0130] in, This represents the coordinates of the top-left corner of the bounding box. This represents the coordinates of the bottom right corner of the bounding box. This indicates the model's confidence that the bounding box contains text.
[0131] Directional classification stage:
[0132] Input: Images of detected text regions, extracted from the original image, which may contain tilted text;
[0133] Processing: A multi-directional classification network is used to process the text region image to determine the orientation of the text;
[0134] Output: Text Angle These angles represent the standard orientation of the text relative to the horizontal line;
[0135] Classification confidence scores are calculated for each angle to determine the most likely direction of the text.
[0136]
[0137] in, This represents the score for the j-th angle. Exponential function representing the score
[0138] Angle correction transformation: Based on the classification results, the text image is angle-corrected to ensure that the text is horizontal or vertical.
[0139]
[0140] in, Represents the angle correction function. This indicates the detected text image. This represents the corrected text image.
[0141] Text recognition stage:
[0142] Input: Corrected text images, which have undergone angle correction in the orientation classification stage to facilitate text recognition;
[0143] Processing: The CRNN (CNN+RNN+CTC) architecture is used for processing. CRNN combines convolutional neural networks (CNN), recurrent neural networks (RNN), and connection-temporal classification (CTC) techniques to achieve text image recognition;
[0144] Output: Text sequence and confidence score, i.e., the recognized text content and its corresponding confidence score, representing the model's confidence in the recognition result;
[0145] Core Algorithm:
[0146] Feature sequence extraction:
[0147]
[0148] in, This represents the feature sequence extracted from the text image. This represents the features extracted at time step t. It is the length of the feature sequence. Represents the input text image;
[0149] Sequence encoding:
[0150]
[0151] in, This represents the result of encoding a feature sequence by a Bidirectional Long Short-Term Memory (BiLSTM) network. BiLSTM can capture the sequential dependencies in sequence data and is suitable for text recognition.
[0152] CTC probability calculation:
[0153]
[0154] in, This represents the probability of recognizing the label sequence l given an input image x. This indicates that at time step t, given the input features Output tags With the probability of CTC, the model can handle variable-length input and output sequences and can identify whitespace and repeating characters in the text.
[0155] Final output:
[0156] Result format:
[0157]
[0158] in: The identified text content : Identify confidence level, : Text box coordinates, This represents a set containing N elements, where each element represents the result of a identified text region.
[0159] The BIC region positioning module locates the BIC code within the identified character region, improving positioning accuracy through multi-stage filtering.
[0160] include:
[0161] Input the recognition result output by the character recognition module in the previous stage:
[0162]
[0163] in: This indicates the recognition result output by the character recognition module in the previous stage, including the recognized text content, confidence score, and text box coordinates;
[0164] : The identified text content.
[0165] : Identify confidence level.
[0166] : Coordinates of the text box.
[0167] Output the set of candidate location boxes:
[0168] Candidate Set = {OCCS, SNCS, CDCS, ECICS}, where Candidate Set is a set containing different types of candidate location boxes used to locate and identify specific coded information. OCCS is the box owner code candidate set, used to identify the code of the cargo owner. SNCS is the serial number candidate set, used to identify the unique serial number of the cargo. CDCS is the check digit candidate set, used to identify the check digit used for error detection. ECICS is the 95 code candidate set, used to assist in location.
[0169] From character recognition results In the process, through preliminary screening of character features, non-BIC code information is excluded, and possible 95 code, BIC code and serial number areas are selected.
[0170] Screening criteria:
[0171] Code 95: Matches exactly four consecutive characters (0, 9, A, Z).
[0172] BIC owner code: Matches 3 consecutive letters, with the fourth character being one of {U, J, Z, R}.
[0173] Serial number: 6 or more digits, with more than 80% being numbers.
[0174] Non-BIC code: The proportion of non-numeric and non-alphanumeric characters such as ., ,, - in the string exceeds 10%.
[0175] step:
[0176] Character recognition results:
[0177] For each identified text Based on its length and character composition, a preliminary screening is performed. Text containing more than 10% of non-numeric and non-alphanumeric characters such as ",", ":, etc. is excluded.
[0178] Application screening criteria: For
[0179] ECICS 95-yard candidate criteria:
[0180] The string length is exactly 4;
[0181] The ratio of numbers is ≥0.5;
[0182] Excluding decimal points and commas;
[0183] BIC owner code candidate criteria:
[0184] String length ≥ 3;
[0185] The proportion of letters in the first three characters is >0.6;
[0186] The fourth character is contained in {U,J,Z,R};
[0187] SNCS serial number candidate criteria:
[0188] String length ≥ 6;
[0189] The ratio of numbers is greater than 0.8;
[0190] Excluding decimal points and commas;
[0191] It is recommended to add: allow the inclusion of hyphens "-", which means that hyphens can be included as separators when identifying serial numbers;
[0192] Similarly, the calculation of letter ratios is similar.
[0193] Based on the above, through this step, we can exclude most of the non-BIC code regions.
[0194] By using a prior knowledge base to filter the candidate set of box owner codes (OCCS) and code 95, and by building an index and using fuzzy search to obtain the Top-k results (in fuzzy search, obtaining the k most likely results) and their probabilities, we have:
[0195] OCCS: OwnerCodeCandidateSet, the set of candidate owner codes for a container.
[0196] The problem this section addresses is that the character recognition results from the previous step may be partially incorrect. For example:
[0197] The detected value of 1 may actually be 1, I, or L.
[0198] The detected 'O' could actually be 'O', '0', or 'Q'.
[0199] The system identifies 5, but it may actually be 5, S;
[0200] The fourth character could be U, J, Z, or R;
[0201] describe:
[0202] The container owner code (BICOwner Code) is used to identify the owner of a container.
[0203] The process involves filtering by using BICowner codes from the prior knowledge base DictionaryOwnerCode. First, an index is built from the list of known BICowner codes. Then, during the recognition process, fuzzy search technology is used to obtain the most similar Top-k results from the DictionaryOwnerCode index and calculate their matching probability. The fourth character \in{U,J,Z,R} is added for processing.
[0204] The BIC owner dictionary in the prior knowledge base, for example:
[0205] DictionaryOwnerCode={'TCDU','TEIJ','TGGZ','TGTU','THAU','THJU','THNZ','THTR',....}
[0206] step:
[0207] Create an index:
[0208] Convert all BIC owner codes in the prior knowledge base DictionaryOwnerCode to uppercase.
[0209] Using various index structures such as Trie tree indexes, length indexes, prefix indexes, and character indexes accelerates subsequent fuzzy matching queries.
[0210] Fuzzy search:
[0211] Enter your query terms and convert them to uppercase.
[0212] Using the established index structure, the most similar Top k BIC owner codes in DictionaryOwnerCode are retrieved through a fuzzy matching algorithm.
[0213] Calculate the matching probability for each matching result.
[0214] Mathematical description:
[0215] Assuming the query term is The words in the DictionaryOwnerCode knowledge base are , The set of words is represented by the similarity function. Then the Top-k candidate set is:
[0216]
[0217] ECICS95 code filtering:
[0218] ECICS95 codes are used to represent container type categories. Similarly, the best matching candidate set needs to be selected from the prior knowledge base Dictionary95Code. The steps are similar to the OCCS selection process, including index building and fuzzy query to obtain the top k results and their probabilities.
[0219] Dictionary95Code={'25G1','25G1','25R1','2CG1','2FG1','2FG1','42G1','42G1','42P1','42R1','42U1','42V1','45G1','45P1', '45R1',....}
[0220] step:
[0221] Create an index:
[0222] Convert all 95 codes in the prior knowledge base Dictionary95Code to uppercase.
[0223] The Dictionary95Code index is constructed using the same index structure as OCCS (Trie tree, length index, prefix index, character index).
[0224] Fuzzy search:
[0225] Input a 95-character string and convert it to uppercase.
[0226] The most similar Top-k95 code is retrieved from the index using a fuzzy matching algorithm.
[0227] Calculate the matching probability for each matching result.
[0228] Mathematical description:
[0229] Assuming the query code is 95 The 95 code in the Dictionary95Code knowledge base is... The similarity function is Then the Top-k candidate set is:
[0230]
[0231] SNCS: Serial Number CandidateSet;
[0232] The candidate serial numbers do not require additional prior knowledge base filtering at present. The candidate serial numbers (SNCS) selected in the preliminary filtering stage can be used directly without further processing.
[0233] CDCS: Check Digit Candidate Set;
[0234] The check digit candidate set (CDCS) is a single digit closely related to the serial number and used to verify its correctness. Its position and recognition strategy directly depend on the recognition result of the SNCS.
[0235] Furthermore, for the case where SNCS is a 7-digit number:
[0236] CDCS and SNCS share the same area, so there's no need to distinguish between them for now. A neural network will be used to identify this checksum.
[0237] Maintain the original confidence level
[0238] When SNCS is a 6-digit number:
[0239] Different expansion strategies are used depending on the character arrangement direction:
[0240] Horizontal arrangement processing:
[0241] Expand the original box width to the right by 50%;
[0242] Expand the height by 10% both vertically and horizontally;
[0243] The extended area is the location of the CDCS;
[0244] Vertical arrangement processing:
[0245] Expand the original box height downwards by 50%;
[0246] Expand the width by 10% on both the left and right sides;
[0247] The extended area of the record is the location of the CDCS.
[0248] For the selected candidate sets of container owner codes (OCCS), serial number codes (SNCS), and 95 code codes (ECICS), the minimum coverage rectangle area between them is calculated, the spatial relationship of the candidate areas is analyzed, and the most reasonable combination scheme is selected. The input is these three candidate sets (each with about 3 candidates), and the output is the optimal Top 3 combination (including BICowner code, numerical serial number, and 95 code) to further reduce the number of candidates and provide high-quality areas for more accurate container BIC code detection in the next stage.
[0249] Operating principle:
[0250] The BIC owner code, serial number, and 95 code are usually placed close together on a container, so their minimum coverage rectangle should not be too large. A large coverage area may mean that at least one of the candidates is not the actual BIC code location. Therefore, by minimizing the area of the coverage rectangle, the most likely correct combination can be effectively selected.
[0251] step:
[0252] Suppose we have the following candidate set:
[0253] Box master code candidate set OCCS=
[0254] Serial Number Candidate Set SNCS=
[0255] 95-code candidate set ECICS=
[0256] Since the check code candidate set CDCS depends on the sequence number candidate set SNCS, we can disregard CDCS here.
[0257] The steps are as follows:
[0258] Pairing up:
[0259]
[0260] This represents an element in the candidate set of box master codes. Represents an element in the candidate set of sequence numbers;
[0261] For each combination Calculate the area of the covered rectangle ;
[0262] For each BICowner code candidate (OCCS), serial number candidate (SNCS), and 95 code candidate (ECICS), calculate the area of the smallest coverage rectangle among the three.
[0263] Specifically, the minimum covering rectangle of the two boxes and its area are calculated:
[0264] Get the coordinates of all candidate boxes;
[0265] Find the minimum and maximum x and y coordinate values;
[0266] Construct the minimum bounding rectangle based on the extreme points;
[0267] Calculate the area of the rectangle;
[0268] Choose the first two smallest area combinations:
[0269]
[0270] Specific steps:
[0271] Iterate through all possible combinations of OCCS and SNCS;
[0272] Calculate the minimum covering rectangle area for each combination;
[0273] Sort by area;
[0274] The two combinations with the smallest retained area;
[0275] Three-element combination:
[0276]
[0277] This represents an element in the 95-code candidate set (ECICS). This represents the combination of the two smallest areas;
[0278] For each combination Calculate the area of the covered rectangle .
[0279] Choose the first two smallest area combinations of three elements:
[0280]
[0281] step:
[0282] Combine the 95-code candidate with the first two combination schemes;
[0283] Calculate the area of the minimum covering rectangle for the three elements;
[0284] Sort by area;
[0285] Choose the optimal combination of two three-element combinations;
[0286] Output the optimal combination:
[0287] Based on the principle of minimizing the coverage area, the most reasonable combination scheme is selected as the final BIC code positioning result:
[0288]
[0289] in, This represents the optimal combination chosen at the end, i.e., the three three-element combinations with the smallest coverage area. These represent the two combinations with the smallest coverage area among all possible combinations of three elements.
[0290] By following the steps above, the top 3 combinations with the most reasonable spatial relationships can be effectively selected, further reducing the number of candidates and providing a high-quality area for more accurate container BIC code detection in the next stage.
[0291] Joint probability inference BIC identification results:
[0292] Given a container image and the location information of its BIC code, the goal is to identify the complete BIC code at that location. According to the ISO 6346 standard, a BIC code consists of the following three parts:
[0293] OCCS(OwnerCodeCandidateSet): The set of candidate owner codes for the container.
[0294] SNCS (SerialNumberCandidate Set): Serial number candidate set;
[0295] CDCS (CheckDigitCandidate Set): Check Digit Candidate Set;
[0296] Definition of probability:
[0297] Location detection probability ( );
[0298] Definition: The confidence level of the detection model in the location of the BIC code region;
[0299] Value range: ;
[0300] Each candidate region Each corresponds to one ;
[0301] Character recognition probability of neural networks:
[0302] Box owner code recognition probability ( ), Serial number recognition probability ( ), check digit recognition probability ( ), BIC rule verification probability ( ).
[0303] Compliant with ISO 6346 standard: It does not comply with ISO 6346 standard: .
[0304] The BIC rules in ISO 6346 are as follows:
[0305] Check digit calculation process:
[0306] Letter conversion:
[0307] Convert letters to numbers, conversion rules:
[0308] A=10, B=12, C=13, D=14, E=15;
[0309] F=16, G=17, H=18, I=19, J=20;
[0310] K=21, L=23, M=24, N=25, O=26;
[0311] P=27, Q=28, R=29, S=30, T=31;
[0312] U=32, V=34, W=35, X=36, Y=37;
[0313] Z=38;
[0314] Mathematical calculation formula:
[0315]
[0316] in, This represents the calculated check digit. It is the value of the i-th digit (the converted value). Starting from 0 from left to right, mod11 and mod10 are two consecutive modulo operations used to calculate the parity bit;
[0317] BIC rule verification probability The calculation formula is:
[0318]
[0319] That is, if the calculated check digit With the expected check bit If they are equal, then The value is 1, which conforms to the ISO 6346 standard; if they are not equal, then they do not conform.
[0320] Joint probability calculation:
[0321] Assuming that the probabilistic events are independent, define the joint probability. for:
[0322]
[0323] in, This represents the probability of location detection. This indicates the probability of recognizing the box owner's code. Indicates the probability of serial number recognition. This indicates the probability of identifying the check digit. Indicates the probability of rule verification;
[0324] For each candidate combination Calculate their joint probability :
[0325]
[0326] in: For candidate region indexing, index for candidate combinations
[0327] Total number of candidate combinations: This indicates possible combinations to match the Container Owner Code (OCCS), Serial Number (SNCS), and Code 95 (ECICS).
[0328] Optimal result selection:
[0329] Select the candidate combination with the highest joint probability as the optimal result:
[0330]
[0331] in, Indicates the choice to make The largest index i represents the candidate combination with the highest joint probability. Indicates the optimal result;
[0332] Output format example:
[0333] BIC code string: ABCU1234567;
[0334] confidence (the confidence level of the recognition result, representing the degree of confidence the model has in the recognition result): 0.95;
[0335] position (BIC code position information in the image, an array containing four coordinate values): [x1, y1, x2, y2).
[0336] This paper focuses on the design and implementation of neural networks for three key modules in a container identification system: owner code (OC / OCCS), serial number (SN / SNCS), and check digit (CD / CDCS). By designing independent neural network models, each character is detected and recognized, aiming to improve the accuracy of character recognition and the overall performance of the system.
[0337] Three neural network models were used to identify the following three parts of container information with higher quality:
[0338] Image of the candidate set of box master codes (OC / OCCS) at the box master code location;
[0339] Serial number / Serial number candidate set (SN / SNCS);
[0340] Check bit / Check bit candidate set (CD / CDCS).
[0341] include:
[0342] Input Crop image preprocessing:
[0343] The input image is a cropped image of the BIC position from the original image.
[0344] Preprocessing steps:
[0345] Grayscale conversion: Converts the input color image into a grayscale image, reducing computational complexity.
[0346] Binarization: Adaptive thresholding is applied to perform binarization processing to enhance the contrast between the numbers and the background.
[0347] Size unification: Adjust the input image to a uniform size. For pixels, padding is used to fill in the edges of images in different orientations to avoid distortion.
[0348] Normalization: Normalizes pixel values to... Within this range, accelerate the model training process.
[0349] Probability vector: The output probability vector is represented as... ,in This indicates that the check digit is a number. The probability of.
[0350]
[0351] Neural network design for bin master code candidate set (OC / OCCS):
[0352] Neural network structure:
[0353] Input layer: The input is an image containing the location of the box master code, which consists of 4 characters. The image size is uniformly adjusted to [specific dimensions]. For both horizontal and vertical images, padding is used to complete the image to a uniform size to avoid severe imbalance in aspect ratio after scaling.
[0354] Convolutional layers:
[0355] Convolutional layer 1: 32 Convolution kernel, stride of 1, padding type of "same", output size of [missing information] .
[0356] Pooling layer 1: Max pooling with a stride of 2 and an output size of [value missing]. .
[0357] Convolutional layer 2: 64 layers Convolution kernel, stride of 1, padding type of "same", output size of [missing information] .
[0358] Pooling layer 2: Max pooling with a stride of 2 and an output size of [value missing]. .
[0359] Fully connected layer:
[0360] Fully connected layer 1: 1024 neurons, ReLU activation function, input size The output size is .
[0361] Fully connected layer 2: 512 neurons, ReLU activation function, output size is .
[0362] Output layer: Fully connected layer 3, output is The probability matrix is activated using softmax, and the values correspond to the categories of the first three characters.
[0363] In the above, convolutional layers: multi-layer convolution and pooling can effectively extract spatial features in images and are suitable for character recognition tasks.
[0364] Fully connected layer: integrates and classifies high-dimensional features to improve recognition accuracy.
[0365] Output layer structure: According to the BIC encoding rules, the fourth character is fixed as U, and only the first three characters need to be predicted.
[0366] Training data generation:
[0367] Data generation process description:
[0368] Generate a random combination of 3 uppercase letters:
[0369] Use AZ to randomly generate 3 letters, such as "BIC".
[0370] Add a fixed character U:
[0371] Add the fixed character U to the generated letter combination to form "BICU".
[0372] Generate the corresponding box master code image:
[0373] An image is generated based on the character combination and its size is adjusted to a uniform value. For each pixel, add padding to maintain the aspect ratio.
[0374] Application data augmentation:
[0375] Font variation: Randomly select different font styles.
[0376] Noise Addition: Randomly add noise to the image.
[0377] Viewpoint transformation: performing transformations such as rotation and tilt on an image.
[0378] Layout method: Simulates horizontal and vertical layout.
[0379] Occlusion simulation: Simulates paint chipping or partial occlusion.
[0380] Generate a labeled training dataset:
[0381] Each generated image is labeled with a corresponding character tag to form the dataset required for supervised learning.
[0382] Training method description:
[0383] Loss function: The cross-entropy loss function is used, which is suitable for multi-class classification problems.
[0384] Optimizer: Use the Adam optimizer, with the learning rate set to... To accelerate convergence.
[0385] Training strategy:
[0386] Dataset splitting: The dataset is split into a training set (80%), a validation set (10%), and a test set (10%).
[0387] Batch size: Set to 64.
[0388] Number of rounds: Training continues until the loss on the validation set no longer decreases significantly or reaches the preset maximum number of rounds (e.g., 50 rounds).
[0389] To prevent overfitting: Employ an early stopping strategy, monitor model performance using a validation set, and use dropout layers when necessary.
[0390] Input image preprocessing:
[0391] Preprocessing steps,
[0392] Grayscale conversion: Converting the input color image into a grayscale image to reduce computational complexity.
[0393] Binarization: Adaptive thresholding is applied for binarization to enhance the contrast between characters and background.
[0394] Size unification: Adjust the input image to a uniform size. Pixels. For images in different orientations, use padding to fill in the edges and avoid aspect ratio distortion.
[0395] Normalization: Normalizes pixel values to... Within this range, accelerate the model training process.
[0396] Probability matrix: The output probability matrix is represented as follows ,in Indicates the first The character is the first The probability of each English letter.
[0397]
[0398] Among them, A, B, ... Z are used to form the box master code.
[0399] Neural network structures, including
[0400] Input layer: The input is an image containing a sequence number position with 6 or 7 characters, and the image size is uniformly adjusted. Pixels are padded to ensure that the aspect ratio of horizontal and vertical images is not distorted.
[0401] Convolutional layers:
[0402] Convolutional layer 1: 32 Convolution kernel, stride 1, padding same, output size is .
[0403] Pooling layer 1: Max pooling, stride 2, output size is .
[0404] Convolutional layer 2: 64 layers Convolution kernel, stride 1, padding same, output size is .
[0405] Pooling layer 2: Max pooling, stride 2, output size is .
[0406] Fully connected layer:
[0407] Fully connected layer 1: 2048 neurons, ReLU activation function, input size The output size is .
[0408] Fully connected layer 2: 1024 neurons, ReLU activation function, output size is .
[0409] Output layer: Fully connected layer 3, output is The probability matrix, activated using softmax, corresponds to the classification of the 6-digit sequence number.
[0410] In the above, convolutional layers: multi-layer convolution and pooling effectively extract visual features of digital characters, and are suitable for processing consecutive numbers in serial numbers.
[0411] Fully connected layer: integrates and classifies high-dimensional features to improve recognition accuracy.
[0412] Output layer structure: For a 6-digit serial number, each digit is classified independently, ignoring the possible 7th check digit.
[0413] Training data generation:
[0414] Generate a random 6-digit number combination:
[0415] Use 0-9 to randomly generate a 6-digit number, such as "123456".
[0416] Add verification code (optional):
[0417] Randomly decide whether to add a 1-digit checksum with a box, forming "1234567".
[0418] Generate the corresponding serial number image:
[0419] Generate an image based on the generated number combinations (vertical images need to be rotated 90 degrees), and adjust the size to a uniform value. For each pixel, add padding to maintain the aspect ratio.
[0420] Application data augmentation:
[0421] Font variation: Randomly select different font styles.
[0422] Noise Addition: Randomly add noise to the image.
[0423] Viewpoint transformation: performing transformations such as rotation and tilt on an image.
[0424] Layout method: Simulates horizontal and vertical layout.
[0425] Occlusion Simulation: When simulating an operation error, the checksum with a square box is partially obscured.
[0426] Generate a labeled training dataset:
[0427] Each generated image is labeled with a corresponding numerical label to form the dataset required for supervised learning.
[0428] Training methods:
[0429] Loss function: Cross-entropy loss function is used for multi-label classification problems.
[0430] Optimizer: Use the Adam optimizer, with the learning rate set to... To accelerate convergence.
[0431] Training strategy:
[0432] Dataset splitting: The dataset is split into a training set (80%), a validation set (10%), and a test set (10%).
[0433] Batch size: Set to 64.
[0434] Number of rounds: Training continues until the loss on the validation set no longer decreases significantly or reaches the preset maximum number of rounds (e.g., 50 rounds).
[0435] To prevent overfitting: Employ an early stopping strategy, monitor model performance using a validation set, and use dropout layers when necessary.
[0436] Input image preprocessing
[0437] Grayscale conversion: Converts the input color image into a grayscale image, reducing computational complexity.
[0438] Binarization: Adaptive thresholding is applied to perform binarization processing to enhance the contrast between the numbers and the background.
[0439] Size unification: Adjust the input image to a uniform size. Pixels. For images in different orientations, use padding to fill in the edges and avoid distortion.
[0440] Normalization: Normalizes pixel values to... Within this range, accelerate the model training process.
[0441] Probability matrix: The output probability matrix is represented as follows ,in Indicates the first The serial number is a number. The probability of.
[0442]
[0443] Neural network design for check digit candidate set (CD / CDCS):
[0444] Neural network structure
[0445] Input layer: The input is an image containing the location of a checksum with a single bounding number, or an image containing six characters plus the location of a checksum with a bounding number. The image size should be uniformly adjusted. Pixels. Padding is used to ensure the aspect ratio remains correct.
[0446] Convolutional layers:
[0447] Convolutional layer 1: 32 Convolution kernel, stride 1, padding same, output size is .
[0448] Pooling layer 1: Max pooling, stride 2, output size is .
[0449] Convolutional layer 2: 64 layers Convolution kernel, stride 1, padding same, output size is .
[0450] Pooling layer 2: Max pooling, stride 2, output size is .
[0451] Fully connected layer:
[0452] Fully connected layer 1: 2048 neurons, ReLU activation function, input size The output size is .
[0453] Fully connected layer 2: 1024 neurons, ReLU activation function, output size is .
[0454] Output layer: Fully connected layer 3, output is The probability vector is activated using softmax, and the corresponding check digits are classified.
[0455] In this embodiment, the convolutional layer effectively extracts the visual features of a single digit through multi-layer convolution and pooling, making it suitable for processing check codes with boxes or serial number images containing check codes; the fully connected layer integrates and classifies high-dimensional features to improve recognition accuracy; and the output layer structure classifies each digit independently for a single check bit.
[0456] Training data generation:
[0457] Generate random check code combinations:
[0458] Case 1: Use 0-9 to randomly generate a 1-digit number and add a box around the number, such as adding a box around "5".
[0459] Scenario 2: Use 0-9 to randomly generate a 6-digit number combination, such as "123456", and add a check digit with a box at the end to form "1234567".
[0460] Generate the corresponding checksum image:
[0461] Generate an image based on the generated number combinations (vertical images need to be rotated 90 degrees) and adjust the size to a uniform level. For each pixel, add padding to maintain the aspect ratio.
[0462] Application data augmentation:
[0463] Font variation: Randomly select different font styles.
[0464] Noise Addition: Randomly add noise to the image.
[0465] Viewpoint transformation: performing transformations such as rotation and tilt on an image.
[0466] Layout method: Simulates horizontal and vertical layout.
[0467] Occlusion Simulation: When simulating an operation error, the checksum with a square box is partially obscured.
[0468] Generate a labeled training dataset:
[0469] Each generated image is labeled with a corresponding numerical label to form the dataset required for supervised learning.
[0470] Training methods:
[0471] Loss function: Cross-entropy loss function is used for multi-class classification problems.
[0472] Optimizer: Use the Adam optimizer, with the learning rate set to... In order to improve training efficiency.
[0473] Training strategy:
[0474] Dataset splitting: The dataset is split into a training set (80%), a validation set (10%), and a test set (10%).
[0475] Batch size: Set to 64.
[0476] Number of rounds: Training continues until the loss on the validation set no longer decreases significantly or reaches the preset maximum number of rounds (e.g., 50 rounds).
[0477] To prevent overfitting: Employ an early stopping strategy, monitor model performance using a validation set, and use dropout layers when necessary.
[0478] Input image preprocessing
[0479] Grayscale conversion: Converts the input color image into a grayscale image, reducing computational complexity.
[0480] Binarization: Adaptive thresholding is applied to perform binarization processing to enhance the contrast between the numbers and the background.
[0481] Size unification: Adjust the input image to a uniform size. Pixels. For images in different orientations, use padding to fill in the edges and avoid distortion.
[0482] Normalization: Normalizes pixel values to... Within this range, accelerate the model training process.
[0483] Probability vector: The output probability vector is represented as... ,in This indicates that the check digit is a number. The probability of.
[0484] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. 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 of the technical features. Such modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying container BIC codes, characterized in that, Includes the following steps: Acquire high-resolution images of shipping containers; Denoising, grayscale conversion, and contrast enhancement are performed on container images; The DB algorithm is used to detect text regions and generate a set of bounding boxes containing the text regions. The orientation of the text is determined by a multi-directional classification network, the classification confidence is calculated, and orientation correction is performed. The CRNN architecture is used to recognize the corrected text image and output the text sequence and its corresponding confidence score. Based on the character recognition results, combined with prior knowledge base and filtering rules, the BIC code region is located; The optimal BIC code recognition result is selected by jointly calculating the position detection probability, character recognition probability, and BIC rule verification probability. The following candidate sets are given: Box master code candidate set OCCS= ; Serial Number Candidate Set SNCS= ; 95-code candidate set ECICS= ; Pairing up: ; This represents an element in the candidate set of box master codes. Represents an element in the candidate set of sequence numbers; For each combination Calculate the area of the covered rectangle ; For each BICowner code candidate, serial number candidate SNCS, and 95 code candidate, calculate the area of the minimum coverage rectangle among the three; Specifically, the minimum covering rectangle of the two boxes and its area are calculated: Get the coordinates of all candidate boxes; Find the minimum and maximum x and y coordinate values; Construct the minimum bounding rectangle based on the extreme points; Calculate the area of the rectangle; Choose the first two smallest area combinations: ; step: Iterate through all possible combinations of OCCS and SNCS; Calculate the minimum covering rectangle area for each combination; Sort by area; The two combinations with the smallest retained area; Three-element combination: ; This represents an element in the 95-code candidate set (ECICS). This represents the combination of the two smallest areas; For each combination Calculate the area of the covered rectangle ; Choose the first two smallest area combinations of three elements: ; step: Combine the 95-code candidate with the first two combination schemes; Calculate the area of the minimum covering rectangle for the three elements; Sort by area; Choose the optimal combination of two three-element combinations; Output the optimal combination: Based on the principle of minimizing the coverage area, the most reasonable combination scheme is selected as the final BIC code positioning result.
2. The container BIC code identification method according to claim 1, characterized in that, When acquiring high-resolution images of the container, the images are acquired from multiple angles.
3. The container BIC code identification method according to claim 1, characterized in that, The parameters of the container image include: resolution: ≥1920x1080 pixels; frame rate: ≥30 frames / second.
4. The container BIC code identification method according to claim 1, characterized in that, The method for detecting the text region and generating a set of bounding boxes containing the text region is as follows: Input original image matrix Where H represents height, W represents width, and C represents the number of color channels; Processed using the DB algorithm; Output text region bounding box set , where n represents the total number of bounding boxes in the set, describing the number of detected text regions. This represents the i-th bounding box in the set, where each bounding box is a rectangular region containing text. Perform feature extraction: ; F represents the extracted features, and m represents the number of extracted features. This represents the i-th feature in the set; probability threshold calculate: ; in, Binarization threshold: used to convert continuous feature values into binary features; Region probability score: This represents the probability that a certain region contains text. Indicates taking The positive part is taken as 0 if it is negative. Bounding box calculation: ; in, This represents the coordinates of the top-left corner of the bounding box. This represents the coordinates of the bottom right corner of the bounding box. This indicates the model's confidence that the bounding box contains text.
5. The container BIC code identification method according to claim 1, characterized in that, The method for determining the orientation of text, calculating classification confidence, and performing orientation correction using a multi-directional classification network is as follows: Input the detected text region image; A multi-directional classification network is used to process text region images to determine the orientation of the text; Output text angle Angle indicates the standard direction of the text relative to the horizontal line; Calculate the confidence score for each angle to determine the most likely direction of the text: ; in, This represents the score for the j-th angle. An exponential function representing the score, used to calculate the confidence level; Angle correction transformation: Based on the classification results, the text image is angle-corrected to ensure that the text is horizontal or vertical. ; in, Represents the angle correction function. This indicates the detected text image. This represents the corrected text image.
6. The container BIC code identification method according to claim 1, characterized in that, The method for recognizing the text image and outputting the text sequence and its corresponding confidence score is as follows: Input the corrected text image; Processing is done using a CRNN architecture; Output the text sequence and confidence score, the identified text content and its corresponding confidence score, the confidence score represents the model's confidence in the recognition result; Feature sequence extraction: ; in, This represents the feature sequence extracted from the text image. This represents the features extracted at time step t. It is the length of the feature sequence. Represents the input text image; Sequence encoding: ; in, BiLSTM represents the result of encoding a feature sequence by a bidirectional long short-term memory network. It can capture the sequential dependencies in sequence data and is suitable for text recognition. CTC probability calculation: ; in, This represents the probability of recognizing the label sequence l given an input image x. This indicates that at time step t, given the input features Output tags The probability of this is obtained through CTC technology, which enables the model to handle variable-length input and output sequences and to identify whitespace and repeating characters in the text. Final output: ; in: The identified text content : Identify confidence level, : Text box coordinates, This represents a set containing N elements, where each element represents the result of a identified text region.
7. The container BIC code identification method according to claim 1, characterized in that, The method for defining the BIC code region is as follows: Input the recognition result output by the character recognition module in the previous stage: ; in: This indicates the recognition result output by the character recognition module in the previous stage, including the recognized text content, confidence score, and text box coordinates; The identified text content : Identify confidence level, : Text box coordinates; Output the set of candidate location boxes: Candidate Set = {OCCS, SNCS, CDCS, ECICS}, where Candidate Set represents a set containing different types of candidate location boxes used to locate and identify specific coding information; OCCS, the box owner code candidate set, used to identify the code of the cargo owner; SNCS, the serial number candidate set, used to identify the unique serial number of the cargo; CDCS, the check digit candidate set, used to identify the check digit used for error detection; and ECICS, the 95 code candidate set, used to assist in location. From character recognition results In the process, through preliminary screening of character features, non-BIC code information is excluded, and the 95 code, BIC code and serial number areas are selected.
8. The container BIC code identification method according to claim 1, characterized in that, The method for selecting the optimal BIC code recognition result is as follows: Calculate the joint probability: Calculate the joint probability of each candidate combination by multiplying the location detection probability, character recognition probability, and BIC rule verification probability; Verify ISO 6346 standard: Calculate check bits for candidate combinations to ensure compliance with international standards; Output the optimal result: Select the candidate combination with the highest joint probability as the final BIC code recognition result.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Small target real-time detection and positioning method, system and equipment based on priori knowledge
CN113158743A
Container code identification method and device
CN114529893A
Container number automatic identification method, device and system, electronic equipment and medium
CN116503867A