Container BIC code identification method

Through high-resolution image preprocessing and deep learning technologies, including DB algorithms, multi-directional classification networks and CRNN architectures, combined with a priori knowledge base and minimum coverage rectangular algorithm, the inefficiency and accuracy of container BIC code recognition in complex environments are solved, and high-precision and reliability recognition results are achieved.

CN119649372AActive Publication Date: 2025-03-18BROAD VISION (XIAMEN) TECHNOLOGY CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411819473.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-18
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

The prior art has problems such as inefficiency, error prone, strong environmental dependence and difficulty in handling complex characters when dealing with container BIC code recognition in complex environments such as deficiencies, blur, and occlusion.

Method used

By acquiring high-resolution container images, denoising, graying and contrast enhancement are performed, text areas are detected using DB algorithms, text direction is corrected with multi-directional classification networks, character sequences are identified through CRNN architecture, BIC code areas are located in combination with prior knowledge bases and screening rules, and minimum coverage rectangular algorithms and joint probability fusion decisions are used to select the optimal BIC code recognition results.

Benefits of technology

It improves the accuracy and reliability of container BIC code recognition in complex environments, enhances the processing ability of fuzzy, dirty or occlusion characters, and ensures the accuracy of the recognition results and the overall performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649372A_ABST
    Figure CN119649372A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of container BIC code identification, in particular to a container BIC code identification method. Through a high-resolution multi-camera system and an image preprocessing technology, the method comprises the steps of denoising, graying, contrast enhancement and the like, it is ensured that high-quality images are collected in a complex environment, and the recognition accuracy is improved. In the scheme, a DB algorithm is adopted to detect a text area, a text direction is corrected in combination with a multi-direction classification network, and a character sequence is recognized through a CRNN architecture, so that the processing capacity for fuzzy, stained or shielded characters is comprehensively improved; a BIC code area is positioned by combining a priori knowledge base and a screening rule, and the accuracy and reliability of a final recognition result are ensured by utilizing a minimum coverage rectangle algorithm and a joint probability fusion decision; according to the method, efficient recognition of all parts of the BIC code, including a box main code, a serial number and a check bit, is ensured, and a final result is optimized through joint probability calculation in combination with a position detection probability, a character recognition probability and a rule verification probability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of container BIC code recognition, and in particular to a container BIC code recognition method. Background Art

[0002] In the context of global trade, containers are the main carrier of cargo transportation. The accuracy of their management and tracking is of great significance to improving logistics efficiency and reducing costs. The BIC code of a container is the unique identifier of the container, which contains information such as the container owner code, serial number and check digit. However, due to environmental factors, the surface condition of the container, etc., the automatic recognition and accurate reading of the container BIC code has always been a technical challenge. At present, the recognition of container BIC codes mainly relies on manual entry and traditional image processing technology. These methods have the following problems:

[0003] Inefficiency: Manual data entry is limited in speed and cannot cope with the high frequency of container entry and exit.

[0004] Error-prone: Human factors lead to data entry errors, affecting subsequent management and tracking;

[0005] Strong environmental dependence: Environmental factors such as lighting changes and weather influences have a significant impact on image quality, resulting in a decrease in recognition accuracy;

[0006] Difficulty in processing complex characters: The BIC code on the container may be damaged, blurred, or blocked, which makes it difficult for traditional algorithms to process effectively.

[0007] Therefore, the existing technology has limitations when processing container BIC codes in complex environments such as damage, blur, and occlusion. It is data-dependent and traditional methods have a strong reliance on large-scale samples, lack flexibility, and are not intelligent enough to adapt to changing operating environments and complex identification requirements. Summary of the invention

[0008] In view of the above-mentioned shortcomings of the prior art, the present invention provides a method for identifying a container BIC code, which can effectively solve the problem in the prior art that it is inconvenient to accurately identify the BIC code of the container.

[0009] To achieve the above objectives, the present invention is implemented through the following technical solutions:

[0010] The present invention provides a container BIC code recognition method, comprising the following steps:

[0011] Acquire high-resolution container images of the container;

[0012] De-noise, grayscale and contrast enhance container images;

[0013] Use DB algorithm to detect text area and generate a set of bounding boxes containing text area;

[0014] Through the multi-directional classification network, the direction of the text is determined, the classification confidence is calculated, and the direction correction is performed;

[0015] Use the CRNN architecture to recognize the corrected text image and output the text sequence and its corresponding confidence;

[0016] Based on the character recognition results, combined with the prior knowledge base and screening rules, the BIC code area is located;

[0017] The optimal BIC code recognition result is selected by jointly calculating the position detection probability, character recognition probability and BIC rule verification probability.

[0018] Furthermore, when obtaining a high-resolution container image of the container, the container image is obtained from multiple angles.

[0019] Furthermore, the parameters of the container image include: resolution: ≥1920x1080 pixels; frame rate: ≥30 frames / second.

[0020] Furthermore, the text area is detected and a method for generating a set of bounding boxes containing the text area is as follows:

[0021] Input original image matrix , where H represents height, W represents width, and C represents the number of color channels;

[0022] Processed by DB algorithm;

[0023] Output text area bounding box set , n represents the total number of bounding boxes in the set, describing the number of detected text regions, represents the i-th bounding box in the set, each bounding box is a rectangular area containing the text area;

[0024] Perform feature extraction:

[0025] F represents the extracted features, m represents the number of extracted features, represents the i-th feature in the set;

[0026] Probability Threshold calculate:

[0027] in, : Binarization threshold, used to convert continuous feature values ​​into binary features; : Region probability score, indicating the probability that a region contains text, Indicates taking The positive part of , if negative, takes 0;

[0028] Bounding box calculation:

[0029] in, represents the coordinates of the upper left corner of the bounding box, Represents the coordinates of the lower right corner of the bounding box, Represents the model's confidence that the bounding box contains text.

[0030] Furthermore, the method of determining the direction of the text, calculating the classification confidence, and performing direction correction through a multi-directional classification network is as follows:

[0031] Input the detected text area image;

[0032] The text region image is processed using a multi-directional classification network to determine the direction of the text;

[0033] Output text angle , the angle represents the standard orientation of the text relative to the horizontal line;

[0034] Compute the confidence score for each angle to determine the most likely orientation of the text:

[0035] in, represents the score of the i-th angle, An exponential function representing the score, used to calculate the confidence level;

[0036] Angle correction transformation, based on the classification results, performs angle correction on the text image to ensure that the text is horizontal or vertical:

[0037] in, represents the angle correction function, represents the detected text image, represents the rectified text image.

[0038] Furthermore, the method of recognizing text images and outputting text sequences and their corresponding confidence levels is as follows:

[0039] Input the corrected text image;

[0040] Use CRNN architecture for processing;

[0041] Output text sequence and confidence, the recognized text content and its corresponding confidence score, indicating the model's confidence in the recognition result;

[0042] Feature sequence extraction:

[0043] in, represents the feature sequence extracted from the text image, represents the features extracted at time step t, is the length of the feature sequence, Represents the input text image;

[0044] Sequence code:

[0045] in, It represents the result of encoding the feature sequence by the bidirectional long short-term memory network. BiLSTM can capture the previous and next dependencies in the sequence data and is suitable for text recognition.

[0046] CTC probability calculation:

[0047] in, represents the probability of identifying the label sequence l given the input image x, Indicates that at time step t, given the input feature x, the output label Through CTC technology, the model can process variable-length input and output sequences and recognize blanks and repeated characters in the text;

[0048] Final output:

[0049] in: : The recognized text content, : Recognition confidence, : text box coordinates, Represents a set of N elements, each of which represents the result of a recognized text region.

[0050] Further, the method of the BIC code area is:

[0051] Input the recognition result output by the character recognition module in the previous stage:

[0052]

[0053] in: Represents the recognition result output by the character recognition module in the previous stage, including the recognized text content, confidence level, and text box coordinates;

[0054] : The recognized text content, : Recognition confidence, : text box coordinates;

[0055] Output the located candidate location box set:

[0056] Candidate Set = {OCCS, SNCS, CDCS, ECICS}, where Candidate Set represents a set containing different types of candidate location boxes for locating and identifying specific coding information. OCCS, the box owner code candidate set, is used to identify the code of the owner of the goods. SNCS, the serial number candidate set, is used to identify the unique serial number of the goods. CDCS, the check digit candidate set, is used to identify the check digit for error detection. ECICS, the 95 code candidate set, is used to assist in positioning.

[0057] From the character recognition results In the process, through the preliminary screening of character features, non-BIC code information is excluded, and the 95 code, BIC code and serial number area are screened out.

[0058] Furthermore, the method for selecting the optimal BIC code recognition result is:

[0059] Calculate the joint probability: Calculate the joint probability of each candidate combination by multiplying the position detection probability, character recognition probability and BIC rule verification probability;

[0060] Verify ISO6346 standard: Calculate the check digit of the candidate combination to ensure compliance with international standards;

[0061] Output the best result: select the candidate combination with the highest joint probability as the final BIC code recognition result.

[0062] Furthermore, assume that there are the following candidate sets:

[0063] Box master code candidate set OCCS= ;

[0064] Sequence number candidate set SNCS= ;

[0065] 95 code candidate set ECICS= ;

[0066] Two-by-two combinations:

[0067]

[0068] Represents the elements in the candidate set of the box primary code, Represents an element in the candidate set of sequence numbers;

[0069] For each combination , calculate the area of ​​the covering rectangle ;

[0070] For each BICowner code candidate, serial number candidate SNCS and 95 code candidate, calculate the area of ​​the minimum covering rectangle between the three;

[0071] Among them, the minimum covering rectangle and its area of ​​the two boxes are calculated:

[0072] Get the coordinate points of all candidate boxes;

[0073] Find the minimum and maximum x, y coordinate values;

[0074] Construct the minimum enclosing rectangle based on the extreme points;

[0075] Calculate the area of ​​a rectangle;

[0076] Select the first 2 smallest area combinations:

[0077]

[0078] step:

[0079] Traverse all possible combinations of OCCS and SNCS;

[0080] Calculate the minimum covering rectangle area for each combination;

[0081] Sort by area size;

[0082] Keep the first two combinations with the smallest area;

[0083] Three elements combination:

[0084]

[0085] Represents an element in the 95-code candidate set (ECICS), represents the combination of the first two minimum areas;

[0086] For each combination , calculate the area of ​​the covering rectangle .

[0087] Select the first two smallest area triples:

[0088]

[0089] step:

[0090] Combine the 95-code candidate with the first two combinations;

[0091] Calculate the minimum covering rectangle area of ​​three elements;

[0092] Sort by area size;

[0093] Select the best two three-element combinations;

[0094] Output the optimal combination:

[0095] According to the principle of minimizing the coverage area, the most reasonable combination scheme is selected as the final BIC code positioning result.

[0096] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of any one of the above methods are implemented.

[0097] Compared with the known prior art, the technical solution provided by the present invention has the following beneficial effects:

[0098] Through high-resolution multi-camera system and image preprocessing technology, including denoising, grayscale, contrast enhancement and other steps, we ensure that high-quality images are collected in complex environments and improve recognition accuracy. In the solution, the DB algorithm is used to detect text areas, combined with a multi-directional classification network to correct the text direction, and the CRNN architecture (CNN+RNN+CTC) is used to recognize character sequences, which comprehensively improves the processing capabilities of blurred, damaged or occluded characters. At the same time, by combining the prior knowledge base and screening rules to locate the BIC code area, the minimum covering rectangle algorithm and joint probability fusion decision are used to ensure the accuracy and reliability of the final recognition results. BRIEF DESCRIPTION OF THE DRAWINGS

[0099] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0100] Figure 1 It is a schematic diagram of the overall method of the present invention. DETAILED DESCRIPTION

[0101] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0102] The present invention will be further described below in conjunction with the embodiments.

[0103] Example 1 (see Figure 1): A container BIC code recognition method, comprising at least:

[0104] Image acquisition is responsible for obtaining high-quality container images from a multi-camera system or other image acquisition equipment to ensure that the image resolution and frame rate meet the requirements of subsequent processing. Key parameters:

[0105] Resolution: ≥1920x1080 pixels; frame rate: ≥30 frames per second.

[0106] The collected images are preprocessed, including denoising, grayscale, contrast enhancement, edge detection, etc., to improve the effect of subsequent container BIC recognition.

[0107] The character recognition processing algorithm (CPM) is used to extract character information from the preprocessed image, output a set of candidate characters and their position information, and combine it with a customized deep neural network for further accurate recognition.

[0108] include:

[0109] Text detection stage:

[0110] Input: original image matrix , where H represents height, W represents width, and C represents the number of color channels;

[0111] Processing: DB (Differentiable Binarization) algorithm is a differentiable binarization method used to improve the accuracy of text detection;

[0112] Output: A collection of text area bounding boxes , n represents the total number of bounding boxes in the set, describing the number of detected text regions, represents the i-th bounding box in the set, each bounding box is a rectangular area containing the text area,

[0113] Feature extraction:

[0114] F represents the extracted features, m represents the number of extracted features, represents the i-th feature in the set,

[0115] Probability Threshold calculate:

[0116] in, : Binarization threshold, used to convert continuous feature values ​​into binary features; : Region probability score, indicating the probability that a region contains text, Indicates taking If it is negative, it is taken as 0.

[0117] Bounding box calculation:

[0118] in, represents the coordinates of the upper left corner of the bounding box, Represents the coordinates of the lower right corner of the bounding box, Represents the model's confidence that the bounding box contains text.

[0119] Direction classification stage:

[0120] Input: Detected text region images, which are extracted from the original images and may contain tilted text;

[0121] Processing: Use a multi-directional classification network to process the text region image to determine the direction of the text;

[0122] Output: Text angle , these angles represent the standard orientation of the text relative to the horizontal;

[0123] Classification confidence, calculates the confidence of each angle to determine the most likely direction of the text:

[0124] in, represents the score of the i-th angle, An exponential function representing the score, used to calculate the confidence level;

[0125] Angle correction transformation, based on the classification results, performs angle correction on the text image to ensure that the text is horizontal or vertical:

[0126] in, represents the angle correction function, represents the detected text image, represents the rectified text image.

[0127] Text recognition stage:

[0128] Input: rectified text images, which have been angle-corrected by the orientation classification stage for easier text recognition;

[0129] Processing: Use CRNN (CNN+RNN+CTC) architecture for processing. CRNN combines convolutional neural network (CNN), recurrent neural network (RNN) and connection temporal classification (CTC) technology to achieve text image recognition;

[0130] Output: text sequence and confidence, that is, the recognized text content and its corresponding confidence score, indicating the model's confidence in the recognition result;

[0131] Core algorithm:

[0132] Feature sequence extraction:

[0133] in, represents the feature sequence extracted from the text image, represents the features extracted at time step t, is the length of the feature sequence, Represents the input text image;

[0134] Sequence code:

[0135] in, It represents the result of encoding the feature sequence by the BiLSTM network. BiLSTM can capture the dependencies between the previous and next sequences and is suitable for text recognition.

[0136] CTC probability calculation:

[0137] in, represents the probability of identifying the label sequence l given the input image x, Indicates that at time step t, given the input feature x, the output label Through CTC technology, the model can handle input and output sequences of variable lengths and can recognize blanks and repeated characters in the text.

[0138] Final output:

[0139] Result format:

[0140] in: : The recognized text content, : Recognition confidence, : text box coordinates, Represents a set of N elements, each of which represents the result of a recognized text region.

[0141] The BIC area positioning module locates the BIC code in the recognized character area and improves the positioning accuracy through multi-stage screening.

[0142] include:

[0143] Input the recognition result output by the character recognition module in the previous stage:

[0144]

[0145] in: Indicates the recognition result output by the character recognition module in the previous stage, including the recognized text content, confidence level and text box coordinates;

[0146] : Recognized text content.

[0147] : Recognition confidence.

[0148] : Text box coordinates.

[0149] Output the located candidate location box set:

[0150] 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 coding information. OCCS, the box owner code candidate set, is used to identify the code of the owner of the goods. SNCS, the serial number candidate set, is used to identify the unique serial number of the goods. CDCS, the check digit candidate set, is used to identify the check digit for error detection. ECICS, the 95 code candidate set, is used to assist positioning.

[0151] From the character recognition results In the process, through the preliminary screening of character features, non-BIC code information is excluded, and possible 95 code, BIC code and serial number areas are screened out.

[0152] Selection criteria:

[0153] Code 95: Match exactly 4 consecutive characters (0_9 A_Z).

[0154] BIC owner code: matches 3 consecutive letters, and the fourth character is one of {U,J,Z,R}.

[0155] Serial number: The length must be more than 6 digits, and the digital ratio must exceed 80%.

[0156] Non-BIC code: The character string contains non-digital and non-alphanumeric characters such as ., ,, -, etc., which accounts for more than 10%.

[0157] step:

[0158] Traverse the character recognition results:

[0159] For each recognized text , perform preliminary screening based on its length and character composition. Exclude texts that contain "," :,, and other non-numeric and alphabetic characters with a ratio of more than 10% in the string.

[0160] Apply filter criteria: For

[0161] ECICS 95 code candidate conditions:

[0162] The string length is exactly 4;

[0163] Digital ratio ≥ 0.5;

[0164] No decimal points or commas;

[0165] BIC owner code candidate conditions:

[0166] The string length is ≥3;

[0167] The ratio of letters in the first three characters is > 0.6;

[0168] The fourth character is contained in {U,J,Z,R};

[0169] SNCS serial number candidate conditions:

[0170] The string length is ≥ 6;

[0171] Digital ratio>0.8;

[0172] No decimal points or commas;

[0173] Suggested addition: Allow hyphens "-", which means that when identifying serial numbers, hyphens can be included as separators;

[0174] Similarly, the calculation of letter ratio is similar.

[0175] Based on the above, through this step, we exclude most of the non-BIC code areas.

[0176] The prior knowledge base is used to screen the candidate set of the box main code (OCCS) and the candidate set of the 95 code. The Top-k (in the fuzzy query, the most likely first k results are obtained) results and their probabilities are obtained by establishing an index and performing a fuzzy query. Then, we have:

[0177] OCCS: OwnerCodeCandidateSet, box owner code candidate set

[0178] The problem to be solved in this part is that the character recognition results in the previous step may be partially wrong. For example:

[0179] Recognized as 1, it may actually be 1, I, L;

[0180] Recognize O, it may actually be O, 0, Q;

[0181] The recognized value is 5, which may actually be 5, S;

[0182] The fourth character may be U, J, Z, or R;

[0183] Description: BICOwner Code is used to identify the owner of the container.

[0184] Through the BICowner code in the prior knowledge base DictionaryOwnerCode, we first create an index from the known BICowner code list, and then use fuzzy query technology in the recognition process to obtain the most similar Top-k results from the DictionaryOwnerCode index and calculate its matching probability. We also add the fourth character \in{U,J,Z,R}.

[0185] BIC owner dictionary in the prior knowledge base, for example:

[0186] DictionaryOwnerCode={'TCDU','TEIJ','TGGZ','TGTU','THAU','THJU','THNZ','THTR',....}

[0187] step:

[0188] Create index:

[0189] Convert all BIC owner codes in the prior knowledge base DictionaryOwnerCode to uppercase.

[0190] Use multiple index structures such as Trie tree index, length index, prefix index and character index to speed up subsequent fuzzy matching queries.

[0191] Fuzzy query:

[0192] Enter the search term and convert it to upper case.

[0193] Using the established index structure, the most similar Top k BIC owner codes in DictionaryOwnerCode are retrieved through fuzzy matching algorithm.

[0194] Calculate the matching probability for each matching result.

[0195] Mathematical description:

[0196] Assume the query is , the word in the DictionaryOwnerCode knowledge base is , represents a word set, and the similarity function is , then the Top-k candidate set is:

[0197]

[0198] ECICS95 code screening:

[0199] ECICS95 code is used to indicate the type of container. It is also necessary to select the best matching candidate set from the prior knowledge base Dictionary95Code. The steps are similar to the screening process of OCCS, including indexing and fuzzy query to obtain the Top k results and their probabilities.

[0200] Dictionary95Code={'25G1','25G1','25R1','2CG1','2FG1','2FG1','42G1','42G1','42P1','42R1','42U1','42V1','45G1','45P1', '45R1',....}

[0201] step:

[0202] Create index:

[0203] Convert all 95 codes in the prior knowledge base Dictionary95Code to uppercase.

[0204] The Dictionary95Code index is constructed using the same index structure as OCCS (Trie tree, length index, prefix index, character index).

[0205] Fuzzy query:

[0206] Enter the 95-code string and convert it to uppercase.

[0207] The most similar Top-k95 codes are retrieved from the index through a fuzzy matching algorithm.

[0208] Calculate the matching probability for each matching result.

[0209] Mathematical description:

[0210] Assume the query code 95 is , the 95 code in the Dictionary95Code knowledge base is , the similarity function is , then the Top-k candidate set is:

[0211]

[0212] SNCS: Serial Number CandidateSet, serial number candidate set;

[0213] Currently, the serial number candidate set does not require additional prior knowledge base screening operations, and the serial number candidate set (SNCS) screened out in the preliminary screening stage is directly used without further processing.

[0214] CDCS: Check Digit Candidate Set, check digit candidate set;

[0215] The check digit candidate set (CDCS) is a single digit closely related to the serial number and is used to verify the correctness of the serial number. Its location and recognition strategy directly depend on the recognition result of the SNCS.

[0216] Furthermore, when the SNCS is 7 digits:

[0217] CDCS and SNCS share the same area, so there is no need to distinguish between them for now. A neural network will be used to identify this check code:

[0218] Maintain original confidence

[0219] When SNCS is 6 digits, different expansion strategies are adopted according to the character arrangement direction:

[0220] Horizontal arrangement processing:

[0221] Expand to the right by 50% of the original box width;

[0222] Expand the height by 10% up and down;

[0223] The record extension area is the CDCS location;

[0224] Vertical arrangement processing:

[0225] Expand downward by 50% of the original box height;

[0226] Expand the width by 10% on each side;

[0227] The record extension area is the CDCS location.

[0228] For the selected container owner code candidate set (OCCS), serial number candidate set (SNCS) and 95 code candidate set (ECICS), the minimum covering rectangular 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 has about 3 candidates), and the output is the optimal Top3 combination (including BICowner code, digital serial number, 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.

[0229] Principle of use: The BIC owner code, digital serial number and 95 code are usually close to each other on the container, so their minimum coverage rectangle should not be too large. A larger 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 screened out.

[0230] step:

[0231] Assume that there are the following candidate sets:

[0232] Box master code candidate set OCCS=

[0233] Sequence number candidate set SNCS=

[0234] 95 code candidate set ECICS=

[0235] Since the check code candidate set CDCS depends on the sequence number candidate set SNCS, we can ignore CDCS here.

[0236] Here are the steps:

[0237] Two-by-two combinations:

[0238]

[0239] Represents the elements in the candidate set of the box primary code, Represents an element in the candidate set of sequence numbers;

[0240] For each combination , calculate the area of ​​the covering rectangle ;

[0241] For each BICowner code candidate (OCCS), serial number candidate (SNCS) and 95 code candidate (ECICS), calculate the area of ​​the minimum covering rectangle between the three.

[0242] Among them, the minimum covering rectangle and its area of ​​the two boxes are calculated:

[0243] Get the coordinate points of all candidate boxes;

[0244] Find the minimum and maximum x, y coordinate values;

[0245] Construct the minimum enclosing rectangle based on the extreme points;

[0246] Calculate the area of ​​a rectangle;

[0247] Select the first 2 smallest area combinations:

[0248]

[0249] Specific steps:

[0250] Traverse all possible combinations of OCCS and SNCS;

[0251] Calculate the minimum covering rectangle area for each combination;

[0252] Sort by area size;

[0253] Keep the first two combinations with the smallest area;

[0254] Three elements combination:

[0255]

[0256] Represents an element in the 95-code candidate set (ECICS), represents the combination of the first two minimum areas;

[0257] For each combination , calculate the area of ​​the covering rectangle .

[0258] Select the first two smallest area triples:

[0259]

[0260] step:

[0261] Combine the 95-code candidate with the first two combinations;

[0262] Calculate the minimum covering rectangle area of ​​three elements;

[0263] Sort by area size;

[0264] Select the best two three-element combinations;

[0265] Output the optimal combination:

[0266] According to the principle of minimizing the coverage area, the most reasonable combination scheme is selected as the final BIC code positioning result:

[0267]

[0268] in, represents the optimal combination finally selected, that is, the first three three-element combinations with the smallest coverage area, Represents the first two combinations of three elements with the smallest coverage area, which are screened out from all possible three-element combinations.

[0269] Through the above steps, the top 3 combination solutions with the most reasonable spatial relationship can be effectively screened out, further reducing the number of candidates and providing high-quality areas for more accurate container BIC code detection in the next stage.

[0270] Joint probability inference BIC recognition results:

[0271] Given a container image and the location of the BIC code in it, the goal is to identify the complete BIC code at that location. According to the ISO6346 standard, the BIC code consists of the following three parts:

[0272] OCCS (OwnerCodeCandidateSet): box owner code candidate set;

[0273] SNCS (Serial Number Candidate Set): serial number candidate set;

[0274] CDCS (CheckDigitCandidate Set): Check digit candidate set;

[0275] Probability definition:

[0276] Position detection probability ( );

[0277] Definition: The confidence of the detection model in the location of the BIC code area;

[0278] Value range: ;

[0279] Each candidate region Each corresponds to one ;

[0280] Character recognition probability of neural network:

[0281] Box master code recognition probability ( ), serial number recognition probability ( ), check digit recognition probability ( ), BIC rule verification probability ( ).

[0282] Compliant with ISO6346 standard: , which does not comply with ISO6346 standard: .

[0283] The BIC rules of the ISO6346 standard are:

[0284] Check digit calculation process:

[0285] Letter conversion: Convert letters to numbers, conversion rules:

[0286] A=10, B=12, C=13, D=14, E=15; F=16, G=17, H=18, I=19, J=20; K=21, L=23, M= 24, N=25, O=26; P=27, Q=28, R=29, S=30, T=31; U=32, V=34, W=35, X=36, Y=37;

[0287] Z = 38;

[0288] Mathematical calculation formula:

[0289]

[0290] in, represents the calculated check digit, is the value of the i-th position (the converted value), Counting from left to right starting from 0, mod11 and mod10 are two consecutive modulo operations used to calculate the check digit;

[0291] BIC rule verification probability The calculation formula is

[0292]

[0293] That is, if the calculated check digit The expected check digit If they are equal, If it is 1, it complies with the ISO6346 standard; if they are not equal, it does not comply.

[0294] Joint probability calculation:

[0295] Assuming that each probability event is independent, define the joint probability for:

[0296]

[0297] in, represents the probability of position detection, represents the probability of box master code recognition, represents the probability of serial number recognition, represents the probability of check digit recognition, represents the probability of rule verification;

[0298] For each candidate combination , calculate the joint probability :

[0299]

[0300] in: is the candidate region index, Index for candidate combinations

[0301] Total number of candidate combinations: , indicating possible combinations to match the case master code (OCCS), serial number (SNCS) and 95 code (ECICS).

[0302] Best result selection:

[0303] Select the candidate combination with the highest joint probability as the optimal result:

[0304]

[0305] in, Indicates the choice The largest index i, that is, select the candidate combination with the highest joint probability, represents the optimal result;

[0306] Output format example:

[0307] BIC code string: ABCU1234567; confidence (confidence of the recognition result, indicating the model's confidence in the recognition result): 0.95; position (the location information of the BIC code in the image, an array containing four coordinate values): [x1, y1, x2, y2].

[0308] The neural network design and implementation of the three key modules of the container identification system, namely the main code (OC / OCCS), serial number (SN / SNCS) and check digit (CD / CDCS), aims to improve the accuracy of character recognition and the overall performance of the system by designing independent neural network models to detect and identify each character one by one.

[0309] Three neural network models are used to identify the following three parts of container information with higher quality:

[0310] The image box main code candidate set (OC / OCCS) of the box main code position;

[0311] Sequence number / sequence number candidate set (SN / SNCS);

[0312] Check digit / check digit candidate set (CD / CDCS).

[0313] include:

[0314] Input Crop image preprocessing:

[0315] The input image is a crop image of the BIC position cropped from the original image.

[0316] Preprocessing steps:

[0317] Grayscale: Convert the input color image into a grayscale image to reduce computational complexity.

[0318] Binarization: Apply the adaptive threshold method to perform binarization processing to enhance the contrast between numbers and background.

[0319] Size unification: Adjust the input image to be Pixels, for images in different directions, use padding to fill in the edges to avoid distortion.

[0320] Normalization: Normalize pixel values ​​to range, speeding up the model training process.

[0321] Probability vector: The output probability vector is expressed as ,in Indicates that the check digit is a number probability.

[0322]

[0323] Neural network design of box main code candidate set (OC / OCCS):

[0324] Neural network structure:

[0325] Input layer: The input is a box master code position image containing 4 characters. The image size is uniformly adjusted to For horizontal and vertical images, padding is used to fill them to the same size to avoid serious imbalance in the aspect ratio after scaling.

[0326] Convolutional Layer:

[0327] Convolutional layer 1: 32 Convolution kernel, stride 1, padding method is the same, output size is .

[0328] Pooling layer 1: Max pooling with a stride of 2 and an output size of .

[0329] Convolutional layer 2: 64 Convolution kernel, stride 1, padding method is the same, output size is .

[0330] Pooling layer 2: Max pooling with a stride of 2 and an output size of .

[0331] Fully connected layer:

[0332] Fully connected layer 1: 1024 neurons, activation function ReLU, input size , the output size is .

[0333] Fully connected layer 2: 512 neurons, activation function ReLU, output size .

[0334] Output layer: Fully connected layer 3, the output is The probability matrix of , using softmax activation, corresponds to the classification of the first three characters.

[0335] In the above, convolution layer: multi-layer convolution and pooling can effectively extract spatial features in images and are suitable for processing character recognition tasks.

[0336] Fully connected layer: integration and classification of high-dimensional features to improve recognition accuracy.

[0337] Output layer structure: According to the BIC encoding rule, the fourth character is fixed to U, and only the first three characters need to be predicted.

[0338] Training data generation:

[0339] Description of data generation process:

[0340] Generate a random 3-capital letter combination:

[0341] Use A-Z to randomly generate 3 letters, such as "BIC".

[0342] Add fixed character U:

[0343] Combine the generated letters and add the fixed character U to form "BICU".

[0344] Generate the corresponding box master code image:

[0345] Generate images based on character combinations and resize them to a uniform size pixels, adding padding to maintain proportions.

[0346] Applying Data Augmentation:

[0347] Font Change: Randomly select different font styles.

[0348] Noise Add: Adds random noise to the image.

[0349] Perspective transformation: rotate, tilt, and other transformations of the image.

[0350] Layout method: simulate horizontal and vertical layout.

[0351] Occlusion simulation: simulate paint peeling or partial occlusion.

[0352] Generate a labeled training dataset:

[0353] Annotate each generated image with the corresponding character label to form the data set required for supervised learning.

[0354] Description of training method:

[0355] Loss function: The cross entropy loss function is used, which is suitable for multi-classification problems.

[0356] Optimizer: Use Adam optimizer, and the learning rate is set to , to accelerate convergence.

[0357] Training strategy:

[0358] Dataset partitioning: The dataset is divided into training set (80%), validation set (10%) and test set (10%).

[0359] Batch size: set to 64.

[0360] Number of epochs: Train until the validation set loss no longer decreases significantly or reaches the preset maximum number of epochs (such as 50 epochs).

[0361] Prevent overfitting: Use an early stopping strategy, use a validation set to monitor model performance, and use a dropout layer when necessary.

[0362] Input image preprocessing:

[0363] Preprocessing steps,

[0364] Grayscale: Convert the input color image to grayscale to reduce computational complexity.

[0365] Binarization: Apply the adaptive threshold method to perform binarization processing to enhance the contrast between characters and background.

[0366] Size unification: Adjust the input image to be For images in different directions, padding is used to fill in the edges to avoid aspect ratio imbalance.

[0367] Normalization: Normalize pixel values ​​to range, speeding up the model training process.

[0368] Probability matrix: The output probability matrix is ​​expressed as ,in Indicates The characters are The probability of English letters.

[0369]

[0370] Among them, A, B, ... Z are used to form the box master code.

[0371] Neural network structure, including

[0372] Input layer: The input is a serial number position image containing 6 or 7 characters, and the image size is uniformly adjusted to Pixels are filled in by padding to ensure that the aspect ratio of horizontal and vertical images is not distorted.

[0373] Convolutional Layer:

[0374] Convolutional layer 1: 32 Convolution kernel, stride 1, padding same, output size is .

[0375] Pooling layer 1: Max pooling, stride 2, output size is .

[0376] Convolutional layer 2: 64 Convolution kernel, stride 1, padding same, output size is .

[0377] Pooling layer 2: Max pooling, stride 2, output size is .

[0378] Fully connected layer:

[0379] Fully connected layer 1: 2048 neurons, activation function ReLU, input size , the output size is .

[0380] Fully connected layer 2: 1024 neurons, activation function ReLU, output size .

[0381] Output layer: Fully connected layer 3, the output is The probability matrix of , using softmax activation, corresponds to the classification of the 6-digit serial number.

[0382] In the above, convolution layer: multi-layer convolution and pooling effectively extract the visual features of digital characters, which is suitable for processing consecutive numbers in serial numbers.

[0383] Fully connected layer: integrates and classifies high-dimensional features to improve recognition accuracy.

[0384] Output layer structure: For the 6-digit serial number, each digit is classified independently, and the possible 7th check code is ignored.

[0385] Training data generation:

[0386] Generate a random 6-digit combination:

[0387] Use 0-9 to randomly generate a 6-digit number, such as "123456".

[0388] Add verification code (optional):

[0389] Randomly decide whether to add a check digit with a box to form "1234567".

[0390] Generate the corresponding serial number image:

[0391] Generate an image based on the generated digital combination (vertical images need to be rotated 90 degrees) and adjust the size to a uniform size pixels, adding padding to maintain proportions.

[0392] Applying Data Augmentation:

[0393] Font Change: Randomly select different font styles.

[0394] Noise Add: Adds random noise to the image.

[0395] Perspective transformation: rotate, tilt, and other transformations of the image.

[0396] Layout method: simulate horizontal and vertical layout.

[0397] Occlusion simulation: partial occlusion with box verification code when simulating operation errors.

[0398] Generate a labeled training dataset:

[0399] Annotate each generated image with a corresponding digital label to form the data set required for supervised learning.

[0400] Training method:

[0401] Loss function: cross entropy loss function is used for multi-label classification problems.

[0402] Optimizer: Use Adam optimizer, and the learning rate is set to , to accelerate convergence.

[0403] Training strategy:

[0404] Dataset partitioning: The dataset is divided into training set (80%), validation set (10%) and test set (10%).

[0405] Batch size: set to 64.

[0406] Number of epochs: Train until the validation set loss no longer decreases significantly or reaches the preset maximum number of epochs (such as 50 epochs).

[0407] Prevent overfitting: Use an early stopping strategy, use a validation set to monitor model performance, and use a dropout layer when necessary.

[0408] Input image preprocessing

[0409] Grayscale: Convert the input color image into a grayscale image to reduce computational complexity.

[0410] Binarization: Apply the adaptive threshold method to perform binarization processing to enhance the contrast between numbers and background.

[0411] Size unification: Adjust the input image to be For images in different directions, padding is used to fill in the edges to avoid distortion.

[0412] Normalization: Normalize pixel values ​​to range, speeding up the model training process.

[0413] Probability matrix: The output probability matrix is ​​expressed as ,in Indicates The bit sequence number is a number probability.

[0414]

[0415] Check digit candidate set (CD / CDCS) neural network design:

[0416] Neural Network Architecture

[0417] Input layer: The input is a checksum position image containing a number with a square frame, or a checksum position image containing 6 characters and a number with a square frame. The image size is uniformly adjusted to Pixels. Padding is used to make sure the aspect ratio is not out of balance.

[0418] Convolutional Layer:

[0419] Convolutional layer 1: 32 Convolution kernel, stride 1, padding same, output size is .

[0420] Pooling layer 1: Max pooling, stride 2, output size is .

[0421] Convolutional layer 2: 64 Convolution kernel, stride 1, padding same, output size is .

[0422] Pooling layer 2: Max pooling, stride 2, output size is .

[0423] Fully connected layer:

[0424] Fully connected layer 1: 2048 neurons, activation function ReLU, input size , the output size is .

[0425] Fully connected layer 2: 1024 neurons, activation function ReLU, output size .

[0426] Output layer: Fully connected layer 3, the output is The probability vector of , using softmax activation, corresponds to the digital classification of the check digit.

[0427] In this embodiment, convolution layer: multi-layer convolution and pooling effectively extract the visual features of a single digit, which is suitable for processing check codes with boxes or serial number images containing check codes; fully connected layer: high-dimensional feature integration and classification to improve recognition accuracy; output layer structure: for a single check digit, each digit is classified independently.

[0428] Training data generation:

[0429] Generate a random checksum combination:

[0430] Case 1: Generate 1 digit randomly using 0-9 and add boxes around the number, like "5" appended box.

[0431] Case 2: Use 0-9 to randomly generate a 6-digit combination, such as "123456", and add a check digit with a box at the end to form "1234567".

[0432] Generate the corresponding verification code image:

[0433] Generate an image based on the generated digital combination (vertical images need to be rotated 90 degrees) and adjust the size to a uniform size pixels, adding padding to maintain proportions.

[0434] Applying Data Augmentation:

[0435] Font Change: Randomly select different font styles.

[0436] Noise Add: Adds random noise to the image.

[0437] Perspective transformation: rotate, tilt, and other transformations of the image.

[0438] Layout method: simulate horizontal and vertical layout.

[0439] Occlusion simulation: partial occlusion with box verification code when simulating operation errors.

[0440] Generate a labeled training dataset:

[0441] Annotate each generated image with a corresponding digital label to form the data set required for supervised learning.

[0442] Training method:

[0443] Loss function: cross entropy loss function is used for multi-classification problems.

[0444] Optimizer: Use Adam optimizer, and the learning rate is set to , in order to improve training efficiency.

[0445] Training strategy:

[0446] Dataset partitioning: The dataset is divided into training set (80%), validation set (10%) and test set (10%).

[0447] Batch size: set to 64.

[0448] Number of epochs: Train until the validation set loss no longer decreases significantly or reaches the preset maximum number of epochs (such as 50 epochs).

[0449] Prevent overfitting: Use an early stopping strategy, use a validation set to monitor model performance, and use a dropout layer when necessary.

[0450] Input image preprocessing

[0451] Grayscale: Convert the input color image into a grayscale image to reduce computational complexity.

[0452] Binarization: Apply the adaptive threshold method to perform binarization processing to enhance the contrast between numbers and background.

[0453] Size unification: Adjust the input image to be For images in different directions, padding is used to fill in the edges to avoid distortion.

[0454] Normalization: Normalize pixel values ​​to range, speeding up the model training process.

[0455] Probability vector: The output probability vector is expressed as ,in Indicates that the check digit is a number probability.

[0456] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements 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 container BIC code recognition method, characterized in that: The steps include: Acquire high-resolution container images of the container; De-noise, grayscale and contrast enhance container images; Use DB algorithm to detect text area and generate a set of bounding boxes containing text area; Through the multi-directional classification network, the direction of the text is determined, the classification confidence is calculated, and the direction correction is performed; Use the CRNN architecture to recognize the corrected text image and output the text sequence and its corresponding confidence; Based on the character recognition results, combined with the prior knowledge base and screening rules, the BIC code area 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.

2. A container BIC code recognition method according to claim 1, characterized in that: When obtaining the high-resolution container image of the container, the container image is obtained from multiple angles.

3. A container BIC code recognition method according to claim 1, characterized in that: The parameters of the container image include: resolution: ≥1920x1080 pixels; frame rate: ≥30 frames / second.

4. A container BIC code recognition method according to claim 1, characterized in that: The method for detecting the text area and generating a set of bounding boxes containing the text area is: Input original image matrix , where H represents height, W represents width, and C represents the number of color channels; Processed by DB algorithm; Output text area bounding box set , n represents the total number of bounding boxes in the set, describing the number of detected text regions, represents the i-th bounding box in the set, each bounding box is a rectangular area containing the text area; Perform feature extraction: F represents the extracted features, m represents the number of extracted features, 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, indicating the probability that a region contains text, Indicates taking The positive part of , if negative, takes 0; Bounding box calculation: in, represents the coordinates of the upper left corner of the bounding box, Represents the lower right corner coordinate of the bounding box, Represents the model's confidence that the bounding box contains text.

5. A container BIC code recognition method according to claim 1, characterized in that: The method of determining the direction of the text, calculating the classification confidence, and performing direction correction through a multi-directional classification network is as follows: Input the detected text area image; The text region image is processed using a multi-directional classification network to determine the direction of the text; Output text angle , the angle represents the standard orientation of the text relative to the horizontal line; Calculate the confidence for each angle to determine the most likely orientation of the text: in, represents the score of the i-th angle, An exponential function representing the score, used to calculate the confidence level; Angle correction transformation, based on the classification results, performs angle correction on the text image to ensure that the text is horizontal or vertical: in, represents the angle correction function, represents the detected text image, represents the rectified text image.

6. A container BIC code recognition method according to claim 1, characterized in that: The method for identifying the text image and outputting the text sequence and its corresponding confidence is: Input the corrected text image; Use CRNN architecture for processing; Output text sequence and confidence, the recognized text content and its corresponding confidence score. The confidence score indicates the model's confidence in the recognition result. Feature sequence extraction: in, represents the feature sequence extracted from the text image, represents the features extracted at time step t, is the length of the feature sequence, Represents the input text image; Sequence code: in, It represents the result of encoding the feature sequence by the bidirectional long short-term memory network. BiLSTM can capture the previous and next dependencies in the sequence data and is suitable for text recognition. CTC probability calculation: in, represents the probability of identifying the label sequence l given the input image x, Indicates that at time step t, given the input feature x, the output label Through CTC technology, the model can process input and output sequences of variable lengths and can recognize blanks and repeated characters in the text; Final output: in: : The recognized text content, : Recognition confidence, : text box coordinates, Represents a set of N elements, each of which represents the result of a recognized text region.

7. A container BIC code recognition method according to claim 1, characterized in that: The method of the BIC code area is: Input the recognition result output by the character recognition module in the previous stage: in: Indicates the recognition result output by the character recognition module in the previous stage, including the recognized text content, confidence level, and text box coordinates; : The recognized text content, : Recognition confidence, : text box coordinates; Output the located candidate location box set: Candidate Set = {OCCS, SNCS, CDCS, ECICS}, where Candidate Set represents a set containing different types of candidate location boxes for locating and identifying specific coding information. OCCS, the box owner code candidate set, is used to identify the code of the owner of the goods. SNCS, the serial number candidate set, is used to identify the unique serial number of the goods. CDCS, the check digit candidate set, is used to identify the check digit for error detection. ECICS, the 95 code candidate set, is used to assist in positioning. From the character recognition results In the process, through the preliminary screening of character features, non-BIC code information is excluded, and the 95 code, BIC code and serial number area are screened out.

8. A container BIC code recognition method according to claim 1, characterized in that: The method for selecting the optimal BIC code recognition result is: Calculate the joint probability: Calculate the joint probability of each candidate combination by multiplying the position detection probability, character recognition probability and BIC rule verification probability; Verify ISO6346 standard: Calculate the check digit of the candidate combination to ensure compliance with international standards; Output the best result: select the candidate combination with the highest joint probability as the final BIC code recognition result.

9. A container BIC code recognition method according to claim 1, characterized in that: Assume that there are the following candidate sets: Box master code candidate set OCCS= ; Sequence number candidate set SNCS= ; 95 code candidate set ECICS= ; Two-by-two combinations: Represents the elements in the candidate set of the box primary code, Represents an element in the candidate set of sequence numbers; For each combination , calculate the area of ​​the covering rectangle ; For each BICowner code candidate, serial number candidate SNCS and 95 code candidate, calculate the area of ​​the minimum covering rectangle between the three; Among them, the minimum covering rectangle and its area of ​​the two boxes are calculated: Get the coordinate points of all candidate boxes; Find the minimum and maximum x, y coordinate values; Construct the minimum enclosing rectangle based on the extreme points; Calculate the area of ​​a rectangle; Select the first 2 smallest area combinations: step: Traverse all possible combinations of OCCS and SNCS; Calculate the minimum covering rectangle area for each combination; Sort by area size; Keep the first two combinations with the smallest area; Three elements combination: Represents an element in the 95-code candidate set (ECICS), represents the combination of the first two minimum areas; For each combination , calculate the area of ​​the covering rectangle . Select the first two smallest area triples: step: Combine the 95-code candidate with the first two combinations; Calculate the minimum covering rectangle area of ​​three elements; Sort by area size; Select the best two three-element combinations; Output the optimal combination: According to the principle of minimizing the coverage area, the most reasonable combination scheme is selected as the final BIC code positioning result.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Method, device and system for accurately positioning characters in image

    CN107203766A

  • License plate color recognition method and system

    CN108154160A

  • Image data processing method, apparatus, computer device, and storage medium

    CN109492143A

  • Container number identification method and device

    CN111563500A

  • Small target real-time detection and positioning method, system and equipment based on priori knowledge

    CN113158743A