Container number identification method, device and equipment based on visual algorithm

By introducing the soft non-maximum suppression algorithm of the aggregated evaluation indicators of IoU intersection ratio, distance Δ and shape Ω into container number recognition, combined with linear and Gaussian function update strategies, the problem of inaccurate positioning in the existing technology is solved. , improving the accuracy of box number text recognition and the robustness of the model.

CN118736554APending Publication Date: 2024-10-01CHANGZHOU HAOMING INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410722028.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing container number recognition technology based on visual algorithms has weak generalization reasoning capabilities in complex industrial environments and severe weather. The traditional non-maximum suppression algorithm uses classification confidence and IoU intersection-union ratio as the main evaluation indicators, resulting in inaccurate positioning. , affecting the text recognition results.

Method used

The soft non-maximum suppression algorithm of the aggregated evaluation index IoU*, which considers the IoU intersection ratio, distance Δ and shape Ω, is used to locate the target box of the box number text from the candidate box, and combines linear and Gaussian function selection operator updates Strategies to improve the screening accuracy of candidate frames.

Benefits of technology

It improves the accuracy of box number text area detection, ensures that accurate text areas are input to the text recognition model, enhances the accuracy of box number text recognition, and enhances the training data set through multi-scale transformation and Gaussian noise to improve the model's robustness. Great sex.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736554A_ABST
    Figure CN118736554A_ABST
Patent Text Reader

Abstract

The invention relates to the field of image target detection, in particular to a container number identification method, device and equipment based on a visual algorithm. The method comprises the following steps: preprocessing a to-be-recognized picture, and reasoning all candidate boxes by using a trained text region detection model; positioning a target box of the box number text from the candidate box by adopting a soft non-maximum suppression algorithm of an aggregation evaluation index IoU * considering an IoU intersection-to-union ratio, a distance delta and a shape omega; and identifying a target box number in the target box by using the trained text identification model. According to the invention, the accurate container number text region can be input to the text recognition model, and the accuracy of container number text recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image target detection, and in particular to a method, device and equipment for container number recognition based on a visual algorithm. Background Art

[0002] By using computer vision algorithms to identify container numbers, we can avoid incorrect input and recognition errors caused by human factors, ensure the accuracy and reliability of container number data, speed up container information processing, and improve logistics and transportation efficiency. Therefore, an accurate and efficient container number recognition system has important value and role in the container logistics industry.

[0003] Container number recognition based on visual algorithms can be roughly divided into two parts, namely, the detection and recognition of text areas. For example, the Chinese patent "CN113792780 Container number recognition method based on deep learning and image post-processing" uses the YOLOv3 network combined with the CRAFT network to detect text areas, and uses the least squares method to linearly fit the center point of the detected image to determine the detection rectangle, and uses the LeNet5 network to build a text recognition network. The Chinese patent "CN113971811 A container feature intelligent recognition method based on machine vision and deep learning" uses the DBNet network to detect text areas and uses the improved CRNN network as the text recognition algorithm.

[0004] The image detection algorithms of the two invention patents mentioned above have weak generalization reasoning capabilities in complex and changeable industrial environments and severe weather. The inventors of the present invention also found that the traditional non-maximum suppression algorithm uses the classification confidence and the IoU (Intersection over Union) ratio of the candidate box as the main evaluation indicators, but because the positioning accuracy and classification confidence are not strongly correlated, and the IoU indicator does not consider other key factors such as the distance and shape between the two candidate boxes, it may filter out the target candidate box, resulting in inaccurate text area input to the OCR algorithm model, causing greater obstacles to text recognition and inaccurate text recognition results. Summary of the invention

[0005] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a container number recognition method based on a visual algorithm, which can input the accurate container number text area into a text recognition model to improve the accuracy of container number text recognition.

[0006] In order to solve the above technical problems, the technical solution of the present invention is: a container number recognition method based on a visual algorithm, the method comprising:

[0007] Preprocess the image to be recognized and use the trained text region detection model to infer all candidate boxes;

[0008] The aggregate evaluation index IoU is adopted, which considers IoU intersection, distance Δ and shape Ω. * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box;

[0009] Use the trained text recognition model to identify the target box number in the target box.

[0010] Furthermore, the aggregate evaluation index IoU is adopted, which considers IoU intersection-over-union ratio, distance Δ and shape Ω. * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box; specifically:

[0011] Step A, for the set of inference results B = {b1,...,b N}, and its corresponding confidence set is S = {s1,...,s N}, traverse the set B and take the individual b with the highest confidence value m Move them into the candidate set M, and delete the individuals in the selected set M from sets B and S;

[0012] Step B, calculate the individual b with the highest confidence value m The IoU intersection and union ratio, distance Δ and shape Ω evaluation indicators of the remaining candidate boxes in set B are used to calculate the aggregate evaluation indicator IoU * ;

[0013] Step C, calculate the average confidence value of set S, when the average confidence value in set S is greater than N a Then use the continuous Gaussian penalty function to update all individuals in the set S, otherwise use the linear function to update all individuals in the set S;

[0014] The linear function is:

[0015]

[0016] The Gaussian penalty function is:

[0017]

[0018] Where b i is the i-th candidate box, s i Its confidence value, IoU * (·) is the aggregate IoU evaluation index IoU * The calculation function, N t For the pre-set IoU * Index threshold, set D is the set of individuals that have been traversed in set B;

[0019] Step D, return to step A until N is moved into set M m Candidate box individuals b m ;

[0020] Step E, calculate N in set M m The coordinates of the minimum enclosing rectangle of the candidate boxes are calculated and the result is returned, and the minimum enclosing rectangle is used as the target box of the box number text.

[0021] Further, calculate the IoU intersection-over-union ratio, distance Δ, shape Ω and aggregation evaluation index IoU * The formula is:

[0022]

[0023] where |b∩b m | and |b∪b m | is the candidate box b m The area of ​​the intersection and union of a and b.

[0024]

[0025] where b c and For candidate boxes b and b m is the center point of , ρ(·) is the Euclidean distance function between two points, and diag(·) is the diagonal distance function for finding the minimum circumscribed rectangle of two rectangular boxes.

[0026]

[0027] in w and w m For candidate boxes b and b m The width, h and h m For candidate boxes b and b m The height of , max(·) is the function that returns the maximum value.

[0028]

[0029] Where IoU * for b m The aggregate IoU evaluation index value with other candidate boxes b in set B.

[0030] Furthermore, the method also includes: verifying the identified target box number and outputting the result after verification.

[0031] Furthermore, the verification method includes: first verifying the number of digits, and if the number of digits is correct, then calculating and verifying the check code.

[0032] Furthermore, the text region detection model is built based on YOLOv8; the text recognition model is built based on the CnOCR framework.

[0033] Furthermore, the training set for training the text region detection model includes multiple video frame images extracted from different monitoring containers, and introduces multi-scale transformation and Gaussian noise data enhancement processing.

[0034] Furthermore, the image to be identified is preprocessed, specifically: the size of the image to be identified is adjusted, normalized, and the color space channel is switched.

[0035] The present invention also provides a container number recognition device based on a visual algorithm, comprising:

[0036] A preprocessing module, used to preprocess the image to be recognized;

[0037] The candidate box inference module is used to infer all candidate boxes using the trained text region detection model;

[0038] The target box positioning module is used to adopt the aggregate evaluation index IoU considering IoU intersection, distance Δ and shape Ω * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box;

[0039] The target box number recognition module is used to use the trained text recognition model to recognize the target box number in the target box.

[0040] The present invention also provides a device, comprising:

[0041] Memory for storing computer programs;

[0042] A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the container number recognition method based on a visual algorithm as described in any one of claims 1 to 8 are implemented.

[0043] After adopting the above technical solution, the present invention has the following beneficial effects:

[0044] 1. The present invention combines the more advanced image detection and text recognition in the current computer vision field, and is applied to container transportation operations in complex industrial environments, replacing the traditional methods of manual transcription and verification, and can accurately and quickly identify container numbers; and, the aggregation evaluation index IoU of the three candidate box relationships, namely, the IoU intersection over union ratio, the distance Δ and the shape Ω *The invention provides a more comprehensive screening basis for the non-maximum suppression algorithm, adopts the soft non-maximum suppression algorithm which considers the aggregation evaluation index of IoU, distance and shape to locate the text target frame, can comprehensively measure the relationship between the candidate frames, improve the accuracy of the box number text area detection, and alleviate the problem of inaccurate positioning of the box number text area caused by the traditional non-maximum suppression algorithm which uses the classification confidence and the single intersection-over-union index as the main measurement means; the invention can input the accurate box number text area into the text recognition model, and improve the accuracy of the box number text recognition;

[0045] 2. The present invention combines linear and Gaussian function selection operators, and can adjust the update strategy according to the evaluation index and classification confidence of the candidate box, so as to further improve the accuracy of the detection and positioning of the box number text area;

[0046] 3. This embodiment constructs a training data set based on the box number recognition application scenario in a complex industrial scenario, which includes scenes such as low light and bad weather, and introduces multi-scale transformation and Gaussian noise to enhance the data set and enhance the robustness of the text area recognition model. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flow chart of the container number recognition method based on visual algorithm of the present invention;

[0048] Figure 2 This is the identification diagram of the present invention. DETAILED DESCRIPTION

[0049] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments in conjunction with the accompanying drawings.

[0050] like Figure 1 , 2 As shown, a container number recognition method based on a visual algorithm comprises:

[0051] Step S1, preprocessing the image to be identified;

[0052] Step S2, using the trained text region detection model to infer all candidate boxes of the image to be identified;

[0053] Step S3: use the aggregation evaluation index IoU considering IoU intersection-over-union ratio, distance Δ and shape Ω * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box;

[0054] Step S4, using the trained text recognition model to identify the target box number in the target box;

[0055] Step S5, verify the identified target box number and output the result after verification.

[0056] Specifically, this embodiment combines the more advanced image detection and text recognition in the current computer vision field, and is applied to container transportation operations in complex industrial environments, replacing the traditional methods of manual transcription and verification, and can accurately and quickly identify container numbers; and aggregates the three candidate box relationship aggregation evaluation indicators IoU, distance Δ, and shape Ω. * It provides a more comprehensive screening basis for the non-maximum suppression algorithm, and uses a soft non-maximum suppression algorithm that considers the aggregation evaluation index of IoU, distance and shape to locate the text target box, which can comprehensively measure the relationship between candidate boxes, improve the accuracy of the box number text area detection, and alleviate the problem of inaccurate text area positioning caused by the traditional non-maximum suppression algorithm using classification confidence and a single intersection-over-union ratio as the main measurement method. Therefore, this embodiment can input the accurate box number text area into the text recognition model, thereby improving the accuracy of box number text recognition.

[0057] In one embodiment, step S1 specifically includes adjusting the size of the image to be identified, performing normalization, and switching color space channel processing.

[0058] In one embodiment, step S2 specifically includes:

[0059] Step S21, obtain pictures through the on-site video stream, and after preprocessing, construct a training data set for the text area detection model.

[0060] Step S211, extracting video frame images from different monitoring camera positions, and labeling the target images using a labeling tool in the YOLO format.

[0061] In step S212, data enhancement processing is performed by using multi-scale transformation and Gaussian noise introduction, and the position information of the marked rectangles of the data set is saved in the form of a txt file.

[0062] Step S22, building a text region detection model based on the YOLOv8 network and the pre-trained model;

[0063] Step S23, training a text region detection model;

[0064] Step S231, configure the training parameters of the YOLOv8 network, including the initial learning rate, weight decay coefficient, momentum constant, training algebra, etc.

[0065] Step S232: Use the open source pre-trained weights provided by Ultralytics to perform transfer learning to train the text region detection model.

[0066] Step S233, convert the trained weight file with the best accuracy into ONNX format. ;

[0067] Step S24, input the image preprocessed in step S1 into the trained text region detection model, and use the ONNXRuntime reasoning framework to perform reasoning on the image to be recognized.

[0068] Specifically, this embodiment constructs a training data set based on the box number recognition application scenario in a complex industrial scenario, which includes scenarios such as low light and severe weather, and introduces multi-scale transformation and Gaussian noise to enhance the data set and enhance the robustness of the text region recognition model.

[0069] In one embodiment, step S3 specifically includes:

[0070] Step S31: for the set of inference results B = {b1, ..., b N}, and its corresponding confidence set is S = {s1,...,s N}, traverse the set B and take the individual b with the highest confidence value m Move them into the candidate set M, and delete the individuals in the selected set M from sets B and S;

[0071] Step S32, calculate the individual b with the highest confidence value m The IoU intersection and union ratio, distance Δ and shape Ω evaluation indicators of the remaining candidate boxes in set B are used to calculate the aggregate evaluation indicator IoU * ;

[0072]

[0073] where |b∩b m | and |b∪b m | is the candidate box b m The area of ​​the intersection and union of a and b.

[0074]

[0075] where b c and For candidate boxes b and b m is the center point of , ρ(·) is the Euclidean distance function between two points, and diag(·) is the diagonal distance function for finding the minimum circumscribed rectangle of two rectangular boxes.

[0076]

[0077] in w and w m For candidate boxes b and b m The width, h and h m For candidate boxes b and b m The height of , max(·) is the function that returns the maximum value.

[0078]

[0079] Where IoU * for b m The aggregate IoU evaluation index value with other candidate boxes b in set B;

[0080] Step S33, calculate the average confidence value of set S, when the average confidence value in set S is greater than N a Then use the continuous Gaussian penalty function to update all individuals in the set S, otherwise use the linear function to update all individuals in the set S;

[0081] The linear function is:

[0082]

[0083] The Gaussian penalty function is:

[0084]

[0085] Where b i is the i-th candidate box, s i Its confidence value, IoU * (·) is the aggregate IoU evaluation index IoU * The calculation function, N t For the pre-set IoU * Index threshold, set D is the set of individuals that have been traversed in set B;

[0086] Step S34, return to step S31 until N is moved into the set M. m Candidate box individuals b m ;

[0087] Step S35, calculate N in the set M m The coordinates of the minimum enclosing rectangle of the candidate boxes are calculated and the result is returned, and the minimum enclosing rectangle is used as the target box of the box number text.

[0088] Specifically, this embodiment combines linear and Gaussian function selection operators, and can adjust the update strategy according to the evaluation index and classification confidence of the candidate box, thereby further improving the accuracy of the box number text area detection and positioning.

[0089] In one embodiment, step S4 specifically includes:

[0090] The image to be recognized is cropped according to the coordinate result returned in step S3, and the CnOCR text recognition model is used for inference recognition.

[0091] In one embodiment, step S5 specifically includes: first verifying the number of digits, and if the number of digits is correct, then calculating and verifying the check code.

[0092] The standard container number consists of 11 digits, including a four-digit main code, a six-digit registration code and a one-digit check code. Figure 2 Shown: TBJU-132000-4.

[0093] In the verification, the calculation values ​​corresponding to the first 10 digits of the box owner code and the registration code are multiplied by 2 to the N-1th power (N is the number of digits of the current box number, N = 1, 2, 3..., 10), and then the modulus is taken by 11 to obtain the value of the verification code. The calculation value of the digital registration code is this number. For the box owner letter code (AZ), they are A = 10; B = 12; C = 13; D = 14; D = 15, and so on, which does not include 11 and its multiples.

[0094] When checking, take the box number "TBJU1320004" as an example, the first code "T" corresponds to the calculation value of 31, then the code value = 31 × 2 (1-1) =31, the fifth digit code operation value is 1, code value = 1×2 (5-1) =16, and so on, the sum of the first ten code values ​​is 631, and the check code obtained by taking the modulus of 11 is 4. The above process can verify the accuracy of the text recognition result.

[0095] In one embodiment, a container number recognition device based on a visual algorithm includes:

[0096] A preprocessing module, used to preprocess the image to be recognized;

[0097] The candidate box inference module is used to infer all candidate boxes using the trained text region detection model;

[0098] The target box positioning module is used to adopt the aggregate evaluation index IoU considering IoU intersection, distance Δ and shape Ω * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box;

[0099] The target box number recognition module is used to use the trained text recognition model to recognize the target box number in the target box.

[0100] In one embodiment, a device includes:

[0101] Memory for storing computer programs;

[0102] A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the container number recognition method based on a visual algorithm as described in any one of claims 1 to 8 are implemented.

[0103] In this embodiment, the processor may include one or more processing cores, such as a 3-core processor, an 8-core processor, and the like. The processor may be implemented in at least one of the following hardware forms: a digital signal processor DSP (Digital Signal Processing), a field programmable gate array FPGA (Field-Programmable Gate Array), and a programmable logic array PLA (Programmable Logic Array). The processor may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor may be integrated with a graphics processor GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor may also include an artificial intelligence AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0104] The memory may include one or more readable storage media, which may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices, flash memory storage devices.

[0105] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. A container number recognition method based on visual algorithm, It is characterized in that Methods include: Preprocess the image to be recognized and use the trained text region detection model to infer all candidate boxes; The aggregate evaluation index IoU is adopted, which considers IoU intersection, distance Δ and shape Ω. * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box; Use the trained text recognition model to identify the target box number in the target box.

2. The container number recognition method based on visual algorithm according to claim 1, It is characterized in that The aggregate evaluation index IoU is adopted, which considers IoU intersection, distance Δ and shape Ω. * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box; specifically: Step A, for the set of inference results B = {b 1 ,...,b N }, and its corresponding confidence set is S = {s 1 ,...,s N }, traverse the set B and take the individual b with the highest confidence value m Move them into the candidate set M, and delete the individuals in the selected set M from sets B and S; Step B, calculate the individual b with the highest confidence value m The IoU intersection and union ratio, distance Δ and shape Ω evaluation indicators of the remaining candidate boxes in set B are used to calculate the aggregate evaluation indicator IoU * ; Step C, calculate the average confidence value of set S, when the average confidence value in set S is greater than N a Then use the continuous Gaussian penalty function to update all individuals in the set S, otherwise use the linear function to update all individuals in the set S; The linear function is: The Gaussian penalty function is: Where b i is the i-th candidate box, s i Its confidence value, IoU * (·) is the aggregate IoU evaluation index IoU * The calculation function, N t For the pre-set IoU * Index threshold, set D is the set of individuals that have been traversed in set B; Step D, return to step A until N is moved into set M m Candidate box individuals b m ; Step E, calculate N in set M m The coordinates of the minimum enclosing rectangle of the candidate boxes are calculated and the result is returned, and the minimum enclosing rectangle is used as the target box of the box number text.

3. The container number recognition method based on visual algorithm according to claim 2, It is characterized in that Calculate IoU intersection-over-union ratio, distance Δ, shape Ω, and aggregation evaluation index IoU * The formula is: where |b∩b m | and |b∪b m | is the candidate box b m The area of ​​the intersection and union of a and b; where b c and For candidate boxes b and b m The center point of , ρ(·) is the Euclidean distance function between two points, and diag(·) is the diagonal distance function for finding the minimum circumscribed rectangle of two rectangular boxes; in w and w m For candidate boxes b and b m The width, h and h m For candidate boxes b and b m The height of , max(·) is the function that returns the maximum value; Where IoU * for b m The aggregate IoU evaluation index value with other candidate boxes b in set B.

4. The container number recognition method based on visual algorithm according to claim 1, It is characterized in that The method also includes: verifying the identified target box number and outputting the result after the verification.

5. The container number recognition method based on visual algorithm according to claim 4, It is characterized in that The verification method includes: first verifying the number of digits, and if the number of digits is correct, then calculating the check code and verifying it.

6. The container number recognition method based on visual algorithm according to claim 1, It is characterized in that The text region detection model is built based on YOLOv8; The text recognition model is built based on the CnOCR framework.

7. The container number recognition method based on visual algorithm according to claim 1, It is characterized in that The training set for training the text region detection model includes multiple video frame images extracted from different monitoring containers, and introduces multi-scale transformation and Gaussian noise data enhancement processing.

8. The method for recognizing container numbers based on visual algorithms according to claim 1, It is characterized in that Preprocess the image to be identified, specifically: adjust the size of the image to be identified, normalize it, and switch the color space channel.

9. A container number recognition device based on visual algorithm, It is characterized in that include: A preprocessing module, used to preprocess the image to be recognized; The candidate box inference module is used to infer all candidate boxes using the trained text region detection model; The target box positioning module is used to adopt the aggregate evaluation index IoU considering the IoU intersection-over-union ratio, distance Δ and shape Ω * The soft non-maximum suppression algorithm locates the target box of the box number text from the candidate box; The target box number recognition module is used to use the trained text recognition model to recognize the target box number in the target box.

10. A device, It is characterized in that include: Memory for storing computer programs; A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the container number recognition method based on a visual algorithm as described in any one of claims 1 to 8 are implemented.