Product packaging bag coding defect detection method and system based on AI technology

Through the combination of AI technology and deep learning model CRNN, the problem of poor generalization ability and robustness in the recognition of packaging bag coded characters in the existing technology is solved, and high-accuracy recognition and defect detection of complex backgrounds and low-contrast images are achieved. , improving recognition efficiency and robustness.

CN114266751BActive Publication Date: 2024-09-24FUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111589616.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-23
Publication Date
2024-09-24
Estimated Expiration
2041-12-23

AI Technical Summary

Technical Problem

The existing technology has poor generalization ability and robustness in product packaging bag coding character recognition, and is highly dependent on a large amount of annotated data and hardware conditions, making it difficult to adapt to complex background and low-contrast image recognition.

Method used

Using methods based on AI technology, automatic image collection, soft trigger or hard trigger recognition, deep learning model CRNN for character recognition, combined with DB algorithm and morphological processing, realize the recognition and defect detection of complex backgrounds and low-contrast images.

Benefits of technology

It achieves high-accuracy recognition and defect detection of various types of packaging, adapts to complex backgrounds and low-contrast images, improves recognition efficiency and robustness, and has real-time collection and real-time detection capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114266751B
    Figure CN114266751B
Patent Text Reader

Abstract

The present invention relates to a method for detecting defects in product packaging bag coding based on AI technology, comprising the following steps: step S1: obtaining a product packaging bag image and cropping it; step S2: triggering image recognition based on soft trigger or hard trigger according to the cropped product packaging bag image; step S3: preprocessing the cropped product packaging bag image; step S4: forming a text box based on the preprocessed image using a DB algorithm; step S5: performing character recognition based on the obtained text box based on a deep learning model CRNN to obtain the content results of character prediction and the corresponding probability value; step S6: obtaining the detection results of defective targets based on the content results of character prediction and the corresponding probability value. The present invention realizes product packaging recognition and defect detection for various types of packaging such as plastic packaging, paper boxes and other simple or complex backgrounds.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent identification, and in particular to a method and system for detecting coding defects in product packaging bags based on AI technology. Background Art

[0002] With the development of artificial intelligence technology, it has become a reality to use OCR technology and machine vision methods to perform character recognition and defect detection on product packaging bags.

[0003] The existing methods for character recognition in product packaging codes mainly include traditional OCR technology and OCR technology based on deep neural networks. Traditional OCR technology has formed a mature technical process system, which generally includes image preprocessing, image denoising, grayscale, binarization, and tilt correction; text positioning, locating the character area in the image for subsequent recognition; text recognition, extracting features from single characters, classifying them using classifiers, and then performing post-optimization processing. However, although the traditional OCR method has high recognition efficiency, it has poor generalization ability and robustness, and is only suitable for images with simple backgrounds. The OCR technology based on deep learning uses deep neural networks to integrate image preprocessing, text positioning, text recognition and other functions, and can achieve end-to-end pixel-level text annotation and keyword character detection.

[0004] How to overcome the poor generalization and robustness of traditional image recognition methods and the high dependence of deep learning on large amounts of labeled data and hardware conditions are also key issues that need to be addressed. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a product packaging bag coding defect detection method and system based on AI technology, which realizes the recognition and defect detection of product packaging in various types of packaging such as plastic packaging, paper boxes and other simple or complex backgrounds.

[0006] To achieve the above object, the present invention adopts the following technical solution:

[0007] A method for detecting coding defects in product packaging bags based on AI technology, comprising the following steps:

[0008] Step S1: Obtain product packaging bag image and crop it;

[0009] Step S2: triggering image recognition based on a soft trigger or a hard trigger according to the cropped product packaging bag image;

[0010] Step S3: preprocessing the cropped product packaging bag image;

[0011] Step S4: Based on the preprocessed image, a DB algorithm is used to form a text box;

[0012] Step S5: According to the obtained text box, character recognition is performed based on the deep learning model CRNN to obtain the content results of character prediction and the corresponding probability value;

[0013] Step S6: Based on the content results of character prediction and the corresponding probability values, the detection results of the defective target are obtained.

[0014] Furthermore, step S1 is specifically as follows: using an industrial camera to capture images of product packaging bags on a high-speed conveyor belt, and cropping the images of product packaging bags captured by the camera. After a cropping area is framed on the first image, the image within the cropping area is automatically retained in subsequent real-time acquisitions.

[0015] Furthermore, the soft trigger uses an interval time method, a similarity comparison method and an edge strength method to locate the image to be detected and identified.

[0016] Furthermore, the hard trigger automatically triggers subsequent character positioning recognition and defect detection by connecting to the encoder on the printing and packaging equipment and the serial port output signal hard trigger method of the PLC.

[0017] Furthermore, the preprocessing is specifically as follows: converting the read RGB image into a grayscale image, first performing fast noise reduction processing on it, then performing color inversion processing on the binary image after processing by the adaptive threshold algorithm, and finally performing morphological processing such as corrosion and expansion.

[0018] Furthermore, the DB algorithm is specifically as follows: the backbone network selects ResNet50_vd, and the output of the feature pyramid is transformed into the same size by upsampling, and features and feature layers are generated by cascading; then, the feature layer predicts the probability map and the text probability map to calculate the probability that the pixel belongs to the text to form a text probability map, and then a dynamic threshold map is formed according to the dynamic threshold of each pixel; a DB binary map is generated through the text probability map and the dynamic threshold map, and the label generation is expanded according to the DB binary map to form a text box.

[0019] Furthermore, the deep learning model CRNN is specifically as follows: the CRNN algorithm is adopted, the CNN+RNN network structure is adopted in the feature learning stage, and the CTC algorithm is selected during alignment; the backbone network uses ResNet34_vd, CNN extracts image pixel features, RNN extracts image time series features, and CTC summarizes the connection characteristics between characters, and the final output value is the prediction result of text recognition and the corresponding prediction probability value.

[0020] Furthermore, the step S6 is specifically as follows:

[0021] (1) For the cases of overprinting and missing prints, the length of the standard string input by the user is directly compared with the length of the predicted result string. If the length of the standard string is less than the length of the predicted result string, it is considered as missing print. Conversely, if the length of the standard string is greater than the length of the predicted result string, it is considered as overprinting.

[0022] (2) For misprints, directly compare the standard string input by the user with the predicted string to see if they are the same. If there are several characters that are different, it is considered a misprint;

[0023] (3) For missing characters, in order to reasonably judge whether there are missing characters, the statistical 3σ principle is used to judge whether it is abnormal based on the predicted character probability. The characters are considered abnormal characters;

[0024] (4) If none of the above three errors occurs, the defect detection result of the input image is considered to be completely correct.

[0025] A product packaging bag coding defect detection system based on AI technology, including an automatic image acquisition unit, a trigger recognition unit, an OCR character positioning recognition defect detection unit and a result output unit;

[0026] The automatic image acquisition unit automatically acquires images of product packaging bags on a high-speed conveyor belt in real time through an industrial camera, and can automatically crop the packaging bag images using the system's own recognition function, and the cropped images are transmitted to the trigger recognition module;

[0027] The trigger recognition module locates the image to be detected and recognized through the soft trigger methods of the interval time method, similarity comparison method and edge strength method, or automatically triggers the subsequent OCR character positioning recognition and defect detection module through the hard trigger method of the serial port output signal of the encoder and PLC connected to the printing and packaging equipment;

[0028] The OCR character positioning and recognition defect detection unit uses a deep neural network to pre-process the packaging bag image to be recognized, locate the text and perform OCR character recognition, and input the character recognition results and confidence levels to the defect detection module, supporting both dynamic recognition and offline recognition modes; then the defect detection module determines whether there are misprints, missing prints, multiple prints and blurs based on the OCR results, supporting both dynamic detection and offline detection modes;

[0029] The result output module outputs error category information for the detected error or defective frame or returns an Ng signal through the 232 serial port, and simultaneously cyclically saves the normal frame and defective frame images respectively.

[0030] Compared with the prior art, the present invention has the following beneficial effects:

[0031] 1. The present invention realizes the recognition and defect detection of product packaging of various types of packaging such as plastic packaging, paper boxes and other simple or complex backgrounds;

[0032] 2. The present invention has high accuracy in character recognition of the production date of product packaging bags and high precision in defect detection. It can adapt to images with complex backgrounds and low contrast and has strong scene adaptability. At the same time, the system integrates real-time image acquisition, real-time text positioning, real-time OCR recognition, and real-time error and defect detection functions, and can complete acquisition, recognition, and defect detection quickly. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a schematic diagram of the system structure of the present invention;

[0034] Figure 2 This is a schematic diagram of a DB algorithm network in one embodiment of the present invention;

[0035] Figure 3 This is a schematic diagram of a CRNN algorithm network in one embodiment of the present invention;

[0036] Figure 4 It is an operation interface of a module for online real-time identification of production date of packaging bags in one embodiment of the present invention;

[0037] Figure 5 It is a parameter setting interface in one embodiment of the present invention;

[0038] Figure 6 In one embodiment of the present invention, the parameter "interval time" is a drop-down menu;

[0039] Figure 7 is the parameter "serial port setting" in one embodiment of the present invention;

[0040] Figure 8 This is an interface for offline identification of packaging production date in one embodiment of the present invention. DETAILED DESCRIPTION

[0041] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0042] Please refer to Figure 1 , the present invention provides a product packaging bag coding defect detection system based on AI technology, including an automatic image acquisition unit, a trigger recognition unit, an OCR character positioning recognition defect detection unit and a result output unit;

[0043] The automatic image acquisition unit automatically captures the product packaging bag images on the high-speed conveyor belt in real time through the industrial camera, and can automatically crop the packaging bag images using the system's built-in recognition function, and the cropped images are transmitted to the trigger recognition module;

[0044] The trigger recognition module locates the image to be detected and recognized through the soft trigger methods of interval time method, similarity comparison method and edge strength method, or automatically triggers the subsequent OCR character positioning recognition and defect detection module through the hard trigger method of connecting the encoder on the printing and packaging equipment and the serial port output signal of the PLC;

[0045] The OCR character positioning and recognition defect detection unit uses a deep neural network to pre-process the packaging bag image to be identified, locate the text and perform OCR character recognition, and input the character recognition results and confidence levels to the defect detection module, supporting both dynamic and offline recognition modes. Afterwards, the defect detection module determines whether there are misprints, missing prints, multiple prints, and blurs based on the OCR results, supporting both dynamic and offline detection modes.

[0046] The result output module outputs the error category information of the detected error or defect frame or returns the Ng signal through the 232 serial port, and at the same time, it cyclically saves the normal frame and defect frame images respectively.

[0047] In this embodiment, the image acquisition module consists of three parts: acquisition control, camera setting, and image cropping. The hardware of image acquisition control consists of an industrial camera, an optical lens, and a light source.

[0048] Preferably, in this embodiment, a plug-in integrated LED circular ring light source and a patch-type integrated circular industrial light source are selected. The plug-in integrated LED circular ring light source has the advantages of high light brightness and good directivity, while the patch-type integrated circular industrial light source has the advantages of uniform light and elimination of surface reflection.

[0049] Preferably, in this embodiment, the product packaging bag image captured by the camera is first automatically cropped, and after the cropping area is framed on the first image, the image in the cropping area can be automatically retained in the subsequent real-time acquisition. The cropping area can be the area where the characters to be recognized are located and the acceptable printing area. After cropping, the image size will be greatly reduced, which can greatly improve the recognition speed and can also play a role in detecting whether the characters are printed in the wrong area.

[0050] In this embodiment, the trigger recognition module uses two trigger recognition methods: soft trigger and hard trigger.

[0051] The soft trigger method is a method designed by the present invention based on machine vision technology to adapt to various complex working conditions. It is suitable for both static and dynamic recognition modes without the need for external sensors. Soft triggering implements three main methods: interval time shooting, edge strength algorithm, and similarity neural network comparison algorithm.

[0052] When the product packaging bag is transported on a uniform conveyor belt, it is proposed to use the interval time shooting method to determine whether to trigger character recognition. When the product packaging bag is transported on a uniform conveyor belt, the camera will continuously shoot multiple pictures, many of which are irrelevant to the recognition purpose. For a uniform conveyor belt, when the speed is constant, since the product packaging bag is placed at a fixed distance from the camera, the time the camera takes each shot of the product is also fixed. Based on this, the interval time method can be used to locate the picture that needs to be recognized.

[0053] When the product packaging bag is transported on a uniform or non-uniform conveyor belt, an edge strength method is proposed to determine whether to trigger character recognition. When the camera continuously takes a group of pictures, the difference between the picture to be tested and the m pictures before and after it is calculated, and an edge strength curve can be drawn. The picture corresponding to the highest point of the curve is the product packaging bag picture that needs to be identified.

[0054] When product packaging bags are transported on a non-uniform conveyor belt, the image similarity comparison algorithm can also be used to determine whether to trigger character recognition. For the same product packaging bag, in actual situations, the first picture is a standard and defect-free picture that can be determined to be recognized. The subsequent pictures taken are compared with the first picture using a neural network algorithm for similarity. When the similarity with the first picture is greater than a certain threshold, it is the picture that needs to be recognized later.

[0055] In addition, in the dynamic recognition mode, the hard trigger method can also be used to determine whether to trigger character recognition. The hard trigger receives the signal sent by the sensor or encoder connected to the packaging machine through the RS232 serial port to trigger recognition and detection, and the rejection signal can be transmitted to the lower computer or PLC through the 232 serial port line.

[0056] The computer USB interface is connected to an external USB to RS232 serial port cable, and the rejection signal can be transmitted to the lower computer or PLC through the 232 serial port cable.

[0057] In this embodiment, the OCR character positioning recognition defect detection part consists of four parts: image preprocessing, character positioning detection, text recognition and defect detection, which are as follows:

[0058] Image preprocessing: First, convert the read RGB image into a grayscale image, perform fast noise reduction on it, then invert the binary image after processing by the adaptive threshold algorithm, and finally perform morphological processing such as corrosion and expansion. The convolution kernel uses 5*5, and the adaptive threshold algorithm uses the Gaussian function.

[0059] Character positioning detection: Use the DB algorithm (Differentiable Binarization) which can quickly give a better framing effect. Figure 2As shown in the figure, the backbone network uses ResNet50_vd, and the output of the feature pyramid is transformed into the same size by upsampling, and cascaded to generate features and feature layers; then, the feature layer predicts the probability map and the text probability map to calculate the probability that the pixel belongs to the text to form a text probability map, and then forms a dynamic threshold map according to the dynamic threshold of each pixel. Among them, the minimum probability threshold is set to 0.7 in the character detection stage of this system, that is, the frame result with an algorithm output value less than 0.7 may be an interference result and is regarded as an invalid frame. Finally, the DB binary map is generated by the text probability map and the dynamic threshold map, and the label generation is expanded according to the DB binary map to form a text box. In addition, through a large number of tests, it is found that directly using the frame result of the network may cause the frame result of the edge part to be more conservative, resulting in the subsequent character recognition algorithm being affected, and the most edge characters are not easy to be correctly recognized. For this reason, this system optimizes and enlarges the positioning box based on the results obtained by the DB algorithm to effectively avoid the problem of unrecognizable edge characters.

[0060] Character recognition: An end-to-end deep learning model CRNN is used for character recognition. There is no need to segment the character string. Instead, text recognition is converted into a sequence learning problem. Although the input image scales and text lengths are different, the entire text image can be segmented and recognized after passing through CNN and RNN.

[0061] like Figure 3 As shown, the present invention adopts the CRNN algorithm (Convolutional Recurrent Neural Network), the CNN+RNN network structure is used in the feature learning stage, and the CTC algorithm is selected for alignment, which is mainly used for end-to-end recognition of text sequences of indefinite length. The backbone network uses ResNet34_vd, the input value of the network is the fixed frame area obtained by the character detection algorithm in Section 2.1, CNN extracts image pixel features, RNN extracts image time series features, and CTC summarizes the connection characteristics between characters. The final output value is the prediction result of text recognition and the corresponding prediction probability value. Among them, the minimum probability threshold is set to 0.7 in the character recognition stage of this system, that is, it is considered that the recognition result with an algorithm output value less than 0.7 may be an interference factor and is regarded as an invalid result.

[0062] Defect detection: The CRNN algorithm in the character recognition stage can obtain the content results of character prediction and the corresponding probability values. In order to detect defect targets, this system stipulates the following defect detection standards:

[0063] 1. For the cases of multiple printing and missing printing, directly compare the string length between the standard string input by the user and the predicted result string. If the length of the standard string is less than the length of the predicted result string, it is considered as missing printing. On the contrary, if the length of the standard string is greater than the length of the predicted result string, it is considered as multiple printing.

[0064] 2. For misprints, directly compare the standard string input by the user with the predicted string to see if they are the same. If there are several characters that are different, it is considered a misprint;

[0065] 3. For missing characters, in order to reasonably judge whether there are missing characters, the statistical 3σ principle is used to judge whether it is abnormal according to the predicted character probability. The characters are considered abnormal characters;

[0066] 4. If none of the above three errors occurs, the defect detection result of the input image is considered to be completely correct.

[0067] Embodiment 1:

[0068] In this embodiment, the system is divided into two modules: online real-time identification of packaging bag production date and offline identification of packaging bag production date.

[0069] (1) Online real-time identification module for packaging bag production date

[0070] The operation interface of the module for online real-time identification of packaging bag production date is as follows Figure 4 shown.

[0071] The parameter information of the online real-time recognition interface is shown in Table 3.

[0072] Table 3 Online real-time identification interface parameter information

[0073] Main parameters illustrate Exposure Set to 1.4271ms Reference text Enter the correct production date characters on the product packaging bag Resolution It has been set to 640*480, ranging from 64*48 to 1280*960, and increases by 0.1 times when moving one grid to the right Storage path The storage location of the image and recognition results has a default path, which can be reset Interval time The default setting is 5 milliseconds per frame. Label inspection Enter reference text to determine whether there are character defects set up Parameter information settings: screenshot interval and M value of edge strength method Manual screenshot Capture the entire picture Automatic cropping Crop the production date character area of ​​the image Turn on recognition and start taking screenshots Recognize the cropped image Serial port settings After the device is connected to the serial port, the corresponding settings can be made Delay frame setting Identify the interval between several packets Set standard image When comparing similarity, set the first correct image Identification dot matrix Enable when the character is a dot matrix character

[0074] In Table 3, when the parameter "storage path" runs the file for the first time, two subfolders "right" and "error" will be automatically created under this storage path. The "right" folder stores correct pictures, and the "error" folder stores defective pictures. If it is a label inspection, it is stored in these two folders. If it is unlabeled, it is stored in the set path. The default path is "C: / picture".

[0075] The parameter "Label Inspection" is a drop-down menu, which also includes the "No Label Inspection" mode. The "Label Inspection" mode requires the correct production date to be entered under "Reference Text" to determine whether the production date characters on the product packaging bag are defective. The "No Label Inspection" mode does not require the production date to be entered under "Reference Text" and directly recognizes the image.

[0076] The parameter "Settings" can set the screenshot interval multiple (base is 1ms) and the parameter M value in the edge strength method. The setting interface is as follows: Figure 5 shown.

[0077] The parameter "Interval Time" is a drop-down menu with multiple modes to choose from, such as Figure 6 shown.

[0078] The "Interval" mode indicates the interval between taking a picture (only applicable to the case of a constant speed conveyor belt).

[0079] The "similarity comparison" mode is when the product packaging bag is transported on the conveyor belt. The neural network can be used to measure the similarity between the two pictures. The picture with the greatest similarity to the first product packaging bag picture is the product packaging bag picture that needs to be identified. This situation is suitable for non-uniform conveyor belts.

[0080] The "edge strength" mode is used because when the camera takes multiple pictures continuously, it is necessary to determine which picture to identify. Therefore, the difference between the current picture to be tested and the previous m pictures and the next m pictures can be used to draw an edge strength curve. The highest point of the curve is the picture to be identified. The above three modes are all soft trigger modes.

[0081] The "serial port control" mode can realize the control function through the serial port, that is, the host computer sends instructions in a specific protocol format to the controller through the serial port to control the peripheral equipment or devices. This is a hard trigger mode.

[0082] The parameter "Serial Port Settings" can be set after the device is connected to the serial port. The serial port information setting interface is as follows: Figure 7 As shown, the parameters "Serial port number", "Baud rate", "Delay time (base milliseconds)" and "Password" will retain the default values ​​when the user does not enter any input.

[0083] The operation process of the online real-time identification of packaging bag production date interface:

[0084] Before launching the "test9_24.exe" application software, connect the camera to the computer USB port and turn on the light source. Then launch the "test9_24.exe" application software and the following will appear: Figure 4 The online real-time identification interface of the production date of the packaging bag is shown. The interface will show the picture of the product packaging bag captured by the camera in real time. Adjust the camera and light source until the picture is clear and the lighting is even. The production date characters on the product packaging bag should be in a horizontal position on the picture. At this time, the recognition effect is best.

[0085] In the "Interval Time" drop-down menu bar, you can select modes such as "Interval Time" and "Similarity Comparison".

[0086] Then click "Manual Screenshot", click "Auto Crop", select the picture in the folder dialog box that pops up, crop the production date character area on the picture, and the cropped picture will pop up after cropping, then close the two picture dialog boxes.

[0087] Next, if you select the "Label Inspection" mode, enter the production date in the "Reference Text", click "OK" after confirming that it is correct, click "Browse" in the "Storage Path", and select the storage location for the image and recognition results.

[0088] Click "Start Recognition" and then click "Start Screenshot". The system will automatically recognize the production date of the packaging bag and display the recognition results on the interface. At the same time, the recognition results are saved in the corresponding folder path. Click "Stop Screenshot" to stop recognition. If the coded characters to be recognized are dot matrix characters, after clicking "Start Recognition", click "Recognize Dot Matrix" and then click "Start Screenshot".

[0089] If you select the "No Label Inspection" mode, you do not need to enter the date in the "Reference Text". Just click "Start Recognition" and then click "Start Screenshot". The system will automatically identify the production date of the packaging bag and display the recognition result on the interface. At the same time, the recognition result will be saved in the corresponding folder path. Click "Stop Screenshot" to stop recognition.

[0090] (2) Offline identification module for packaging bag production date

[0091] Offline identification of packaging production date interface Figure 8 As shown. The interface parameter "Label Inspection" is a drop-down menu, which includes "Label Inspection" mode and "No Label Inspection" mode. The "Label Inspection" mode can inspect whether the characters have defects. "No Label Inspection" directly recognizes the characters. "Image Path" selects the location of the image to be identified. "Reference Text" sets the correct production date.

[0092] The operation process of the offline identification of packaging bag production date interface:

[0093] Click "Identify" in the upper left corner. Figure 8 In the offline recognition interface shown, click "Browse" in the "Picture Path" column to select a picture or a picture folder.

[0094] Then in the "Identification Method" column, if you select the "Label Verification" mode, enter the production date in the "Reference Text", and click "OK" after confirming that it is correct. If you select a certain picture, click "Start Identification", and the system will identify the production date of the packaging bag and display the identification results on the interface. If you select a certain picture folder, click "Automatic Identification".

[0095] If you select the "No Label Inspection" mode, you do not need to enter the date in the "Reference Text". In the "Image Path" column, click "Browse" to select a picture or a picture folder. If you select a picture, click "Start Recognition". The system will recognize the production date of the packaging bag and display the recognition result on the interface. If you select a picture folder, click "Auto Recognition".

[0096] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A product packaging bag coding defect detection method based on AI technology, characterized in that: The following steps are involved: Step S1: Obtain product packaging bag image and crop it; Step S2: triggering image recognition based on a soft trigger or a hard trigger according to the cropped product packaging bag image; Step S3: preprocessing the cropped product packaging bag image; Step S4: Based on the preprocessed image, a DB algorithm is used to form a text box; Step S5: According to the obtained text box, character recognition is performed based on the deep learning model CRNN to obtain the content results of character prediction and the corresponding probability value; Step S6: Based on the content result of the character prediction and the corresponding probability value, the detection result of the defect target is obtained; The DB algorithm is specifically as follows: the backbone network uses ResNet50_vd, and the output of the feature pyramid is transformed into the same size by upsampling, and features and feature layers are generated by cascading; then, the feature layer predicts the probability map and the text probability map to calculate the probability that the pixel belongs to the text to form a text probability map, and then a dynamic threshold map is formed according to the dynamic threshold of each pixel; a DB binary map is generated by the text probability map and the dynamic threshold map, and the label generation is expanded according to the DB binary map to form a text box; The step S6 is specifically as follows: (1) For the cases of multiple printing and missing printing, the string lengths of the standard string input by the user and the predicted string are directly compared. If the length of the standard string is less than the length of the predicted string, it is considered as missing printing. On the contrary, if the length of the standard string is greater than the length of the predicted string, it is considered as multiple printing; (2) For misprints, the standard character string input by the user is directly compared with the predicted character string to see if they are the same. If there are several characters that are different, it is considered a misprint; (3) In order to reasonably judge whether missing characters exist, the statistical 3σ principle is used to judge whether the characters are abnormal according to the predicted probability. Characters with a probability less than μ-λσ are considered abnormal characters. (4) If none of the above three errors occurs, the defect detection result of the input image is considered to be completely correct.

2. The method for detecting coding defects of product packaging bags based on AI technology according to claim 1 is characterized in that: The step S1 specifically includes: collecting images of product packaging bags on a high-speed conveyor belt through an industrial camera, and cropping the images of product packaging bags captured by the camera. After a cropping area is framed on the first image, the image within the cropping area is automatically retained in subsequent real-time acquisitions.

3. The method for detecting coding defects of product packaging bags based on AI technology according to claim 1 is characterized in that: The soft trigger uses an interval time method, a similarity comparison method and an edge strength method to locate the image to be detected and identified.

4. The method for detecting coding defects of product packaging bags based on AI technology according to claim 1 is characterized in that: The hard trigger automatically triggers subsequent character positioning recognition and defect detection by connecting the encoder on the printing and packaging equipment and the serial port output signal hard trigger method of the PLC.

5. The method for detecting coding defects of product packaging bags based on AI technology according to claim 1 is characterized in that: The preprocessing is specifically as follows: converting the read RGB image into a grayscale image, first performing a fast noise reduction process on it, then performing a color inversion process on the binary image processed by the adaptive threshold algorithm, and finally performing morphological processes such as corrosion and expansion.

6. The method for detecting coding defects of product packaging bags based on AI technology according to claim 1 is characterized in that: The deep learning model CRNN specifically adopts the CRNN algorithm, the CNN+RNN network structure is adopted in the feature learning stage, and the CTC algorithm is selected for alignment; the backbone network uses ResNet34_vd, CNN extracts image pixel features, RNN extracts image time series features, and CTC summarizes the connection characteristics between characters, and the final output value is the prediction result of text recognition and the corresponding prediction probability value.

7. A product packaging bag coding defect detection system based on AI technology, characterized in that: The system is implemented by a product packaging bag coding defect detection method based on AI technology as described in any one of claims 1 to 6, including an automatic image acquisition unit, a trigger recognition unit, an OCR character positioning recognition defect detection unit and a result output unit; The automatic image acquisition unit automatically acquires images of product packaging bags on a high-speed conveyor belt in real time through an industrial camera, and can automatically crop the packaging bag images using the system's own recognition function, and the cropped images are transmitted to the trigger recognition module; The trigger recognition module locates the image to be detected and recognized through the soft trigger methods of the interval time method, similarity comparison method and edge strength method, or automatically triggers the subsequent OCR character positioning recognition and defect detection module through the hard trigger method of the serial port output signal of the encoder and PLC connected to the printing and packaging equipment; The OCR character positioning and recognition defect detection unit uses a deep neural network to pre-process the packaging bag image to be recognized, locate the text and perform OCR character recognition, and input the character recognition results and confidence levels to the defect detection module, supporting both dynamic recognition and offline recognition modes; then the defect detection module determines whether there are misprints, missing prints, multiple prints and blurs based on the OCR results, supporting both dynamic detection and offline detection modes; The result output module outputs error category information for the detected error or defective frame or returns an Ng signal through the 232 serial port, and simultaneously cyclically saves the normal frame and defective frame images respectively.