Method and device for detecting product defects of electronic cigarette production line, computer readable storage medium and computer program product

By building a training sample library and deep learning model combined with manual annotation, the problem of insufficient detection performance of OCR technology in complex scenarios is solved, efficient identification of product defects in electronic cigarette production line and online model optimization, and the stability of the detection system is improved accuracy.

CN118918591APending Publication Date: 2024-11-08DONGGUAN SUMIDA AUTOMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410940113.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The existing OCR technology has poor detection performance in complex scenarios (such as blurred image, low resolution, interference information, etc.) and cannot be effectively used for product defect detection in electronic cigarette production lines, resulting in error inspection and unrecognition, wasting manpower and material resources .

Method used

By collecting picture samples of normal products and defective products, building a training sample library, using deep learning models to train character recognition models, and identifying and detecting products to be inspected. If defect types are identified, they will be automatically classified. Otherwise, manual annotation will be performed and retrained. Combined with sliding window technology, character areas are cut for similarity matching and labeling.

Benefits of technology

It improves the accuracy and efficiency of defect detection of electronic cigarette production line products, enhances the stability of the machine vision system, can effectively identify defects in complex scenarios and train models online, gradually improving detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure HDA0004944488460000011
    Figure HDA0004944488460000011
  • Figure HDA0004944488460000021
    Figure HDA0004944488460000021
Patent Text Reader

Abstract

The invention relates to the technical field of machine vision, and discloses a method and device for detecting product defects of an electronic cigarette production line, a computer readable storage medium and a computer program product. The method comprises the following steps: training a deep learning model by using a training sample library to obtain a character recognition model for OCR detection; and identifying and detecting the image of the to-be-detected product by adopting a character identification model, automatically classifying the NG products of which the defect types can be identified according to the defect types, or notifying a worker to manually mark the image of the NG products of which the defect types cannot be identified. According to the method, traditional OCR detection and deep learning are combined, a way is opened up for intelligent character detection, a machine vision system has a brain, experience can be continuously accumulated in the actual generation process, the detection result is more and more accurate, and the generation efficiency is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine vision technology, and in particular to a method, device, computer-readable storage medium and computer program product for detecting product defects in an electronic cigarette production line. Background Art

[0002] OCR (Optical Character Recognition) refers to the process in which an electronic device (such as a scanner or digital camera) examines characters printed on paper, determines their shapes by detecting dark and light patterns, and then uses character recognition methods to translate the shapes into computer text. In daily life, text content is everywhere, and automatically analyzing text information in images based on the content of the photo has become a widespread demand. Through deep learning technology, text areas can be automatically located, and features containing rich semantic information can be learned to identify text content in images.

[0003] In the Chinese patent application number 202210553478.1, entitled "Parts defect detection and character recognition method and device based on segmentation network", it realizes defect detection of part images by training the segmentation model through classification and annotation, replacing the traditional manual visual method and improving the detection efficiency. However, it is also inferior to the manual visual method and cannot be applied to various complex scenes.

[0004] In the technical implementation of OCR, there are generally technical difficulties such as affine transformation, scale problems, insufficient lighting, and blurred shooting. Traditional OCR only performs well on relatively regular printed documents. In complex scenarios (such as blurred images, low resolution, interference information, etc.), the text detection and recognition performance of traditional OCR (including the above-mentioned patented technology) is not ideal. In addition, OCR applications often need to connect to massive amounts of data, so the data must be processed in a timely manner. For example, data that is misdetected on the production line and data that cannot identify defects need to be processed in a timely manner, otherwise it may cause batch misdetection or unrecognition, which will lead to the need for batch re-inspection operations, wasting unnecessary manpower and material costs.

[0005] Therefore, how to effectively solve OCR detection in complex scenes and improve the stability of visual inspection systems has become an urgent problem to be solved by technical personnel in this field. Summary of the invention

[0006] The object of the present invention is to provide a method, an apparatus, a computer-readable storage medium and a computer program product for characterizing the contour of an image region, so as to solve or at least partially solve the technical problems mentioned in the above background technology.

[0007] To achieve this object, the present invention adopts the following technical solutions:

[0008] In a first aspect, the present invention provides a method for detecting product defects in an electronic cigarette production line, comprising:

[0009] Collect image samples of normal products and various defective products to build a training sample library;

[0010] Use the training sample library to train the deep learning model and obtain the character recognition model for OCR detection;

[0011] Use the character recognition model to identify and detect the image of the product to be inspected, determine whether the product to be inspected is a NG product, and identify the defect type of the NG product;

[0012] Automatically classify NG products whose defect types can be identified according to the defect types; or manually annotate images of NG products whose defect types cannot be identified, and retrain the character recognition model using the manually annotated images.

[0013] Optionally, the adopting of a character recognition model to recognize and detect an image of a product to be inspected, determining whether the product to be inspected is a NG product, and identifying the defect type of the NG product specifically includes:

[0014] Use the character recognition model to identify and detect the image of the product to be inspected to determine whether the product to be inspected is a NG product;

[0015] If so, the NG products are automatically classified according to the defect type;

[0016] If not, manually annotate the images of NG products.

[0017] Optionally, manually labeling the images of NG products whose defect types cannot be identified specifically includes:

[0018] The character regions of the image of the NG product whose defect type cannot be identified are sequentially cut through a predetermined sliding window to obtain a plurality of sub-character features;

[0019] By using the sliding window, the character regions of the image samples of normal products having the same placement posture as the NG products whose defect types cannot be identified are cut in sequence to obtain a plurality of comparison features;

[0020] Performing similarity matching on each of the sub-character features and the corresponding comparison features to obtain the similarity corresponding to each sub-character feature;

[0021] Mark sub-character features whose similarity is lower than a preset similarity threshold as features to be marked;

[0022] Automatically jump to the page where the image of the NG product whose defect type cannot be identified is located, select the area where the feature to be annotated is located, and pop up an input box for typing or modifying the annotation on the page;

[0023] The defect types are manually labeled through the input box.

[0024] Optionally, collecting image samples of normal products and various defective products to construct a training sample library specifically includes:

[0025] Collect samples of images of normal products in various positions, and samples of images of various defective products;

[0026] According to the category of character defects, the collected image samples of each defective product are marked respectively;

[0027] Classify image samples of defects with the same marked category into the same defect sample group;

[0028] The collected image samples are subjected to data enhancement processing to obtain a training sample library.

[0029] Optionally, the training of the deep learning model using the training sample library to obtain a character recognition model for OCR detection specifically includes:

[0030] Select the deep learning model to be trained;

[0031] The image samples in the training sample library are input into the deep learning model, the training parameters of the deep learning model are adjusted, and the character recognition model is obtained through training.

[0032] In a second aspect, the present invention further provides a device for detecting product defects in an electronic cigarette production line, comprising:

[0033] A memory, used to store a training sample library, wherein the training sample library contains image samples of normal products and various defective products;

[0034] A deep learning module, electrically connected to the memory, for training a deep learning model using a training sample library to obtain a character recognition model for OCR detection;

[0035] A machine vision system, electrically connected to the deep learning module and the memory, respectively, for using a character recognition model to recognize and detect the image of the product to be inspected, determine whether the product to be inspected is a NG product, and identify the defect type of the NG product;

[0036] The machine vision system is also used to automatically classify NG products whose defect types can be identified according to the defect types; or to manually mark images of NG products whose defect types cannot be identified;

[0037] The deep learning module is also used to retrain the character recognition model using manually annotated images.

[0038] Optionally, the machine vision system includes a recognition and detection module for recognizing and detecting images of products to be inspected using a character recognition model, and the recognition and detection module is electrically connected to a sorting module for automatically classifying NG products, and an image processing module for manually annotating images.

[0039] Optionally, the image processing module includes:

[0040] An image segmentation unit, used to sequentially cut the character area of ​​the image of the NG product whose defect type cannot be identified through a predetermined sliding window to obtain a plurality of sub-character features; and used to sequentially cut the character area of ​​the image sample of the normal product with the same placement posture as the NG product whose defect type cannot be identified through the sliding window to obtain a plurality of comparison features;

[0041] A character feature comparison unit, electrically connected to the image segmentation unit, for performing similarity matching between each of the sub-character features and the corresponding comparison features to obtain the similarity corresponding to each sub-character feature;

[0042] A marking unit, electrically connected to the character feature comparison unit, for marking sub-character features whose similarity is lower than a preset similarity threshold as features to be marked;

[0043] The annotation modification unit is electrically connected to the marking unit and is used to automatically jump to a page of the machine vision system that displays an image of an NG product whose defect type cannot be identified, select the area where the feature to be annotated is located, and pop up an input box on the page for typing or modifying the annotation.

[0044] In a third aspect, the present invention provides a computer-readable storage medium, in which at least one instruction is stored, characterized in that the instruction is loaded and executed by a processor to implement a method for detecting product defects in an electronic cigarette production line as described above.

[0045] In a fourth aspect, the present invention provides a computer program product, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, a method for detecting product defects in an electronic cigarette production line as described above is implemented.

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

[0047] The present invention combines traditional OCR detection and deep learning, paving the way for realizing intelligent character detection, giving the machine vision system a "brain". Moreover, it can also be trained online during the actual generation process, continuously accumulating experience, making the detection results more and more accurate, and greatly improving the generation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] 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 description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0049] Figure 1 A flow chart of a method for detecting product defects in an electronic cigarette production line provided in an embodiment of the present invention.

[0050] Figure 2 A schematic diagram of the structure of a device for detecting product defects in an electronic cigarette production line provided by an embodiment of the present invention.

[0051] In the figure:

[0052] 10. Memory; 20. Deep learning module; 30. Machine vision system; 31. Sorting module; 32. Recognition and detection module; 33. Image processing module; 331. Image segmentation unit; 332. Character feature comparison unit; 333. Marking unit; 334. Standard modification unit. DETAILED DESCRIPTION

[0053] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions 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 embodiments described below are only 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.

[0054] Embodiment 1:

[0055] Please refer to Figure 1 , Figure 1 A flow chart of a method for detecting product defects in an electronic cigarette production line provided by an embodiment of the present invention, the method specifically includes:

[0056] Step 101: Collect image samples of normal products and various defective products to build a training sample library.

[0057] This step is a preset step, that is, before training the deep learning model, it is necessary to collect enough samples so that the trained model can identify the defect type more accurately.

[0058] Specifically, at least one group of image samples of defective products of each defect is included. The more image samples in the sample library, the better the learning effect and the higher the subsequent detection accuracy. When constructing a training sample library, the number of samples of different categories should be balanced as much as possible. For example, when the number of input image samples is insufficient, data enhancement methods (such as small-angle rotation, shift, scaling and other transformation operations) can be used to obtain more data, which further increases the variability of the input data. In addition, the image samples of normal products also need to be data enhanced to obtain image samples in various postures, thereby improving the robustness of the algorithm.

[0059] Specifically, the implementation process of step 101 includes:

[0060] Step 1011: collect image samples of normal products in various placements and image samples of various defective products.

[0061] On an electronic cigarette production line, electronic cigarette parts transported by a conveyor belt may be placed in various postures. Therefore, when constructing samples, it is necessary to consider image samples of the products to be inspected in various postures. The image samples can be obtained manually or by the above-mentioned data enhancement method. Therefore, in step 1021, the construction materials of the training sample library should include image samples of normal products in various postures and image samples of various defective products.

[0062] Step 1012: Label the collected image samples of each defective product according to the category of the character defect.

[0063] Image samples used to construct the training sample library need to be manually labeled in advance for the categories of character defects in the image samples. For example, normal products are labeled as "normal" or "OK", and defective products are labeled as "line ghosting", "dirty", "missing characters", etc.

[0064] Step 1013: group the image samples with defects of the same marked category into the same defect sample group.

[0065] The labeled image samples are grouped, and image samples of defects of the same category are divided into the same defect sample group to facilitate later maintenance or updating; specifically, they can be distinguished by naming. For example, for the "missing character" defect, the image sample can be renamed "ZFQS-X", where X is the sample number of the defect in the group.

[0066] Step 1014: perform data enhancement processing on the collected image samples to obtain a training sample library.

[0067] After all, the input samples are limited. In order to ensure the training effect, it is generally necessary to perform data augmentation operations on them to increase the number of image samples.

[0068] Step 102: Use the training sample library to train the deep learning model to obtain a character recognition model for OCR detection.

[0069] Specifically, step 102 includes:

[0070] Step 1021: Select a deep learning model to be trained;

[0071] Step 1022: input the image samples in the training sample library into the deep learning model, adjust the training parameters of the deep learning model, and train to obtain a character recognition model.

[0072] The training of deep learning models is a conventional technical means in this field. There are many optional models or algorithms, but the algorithm itself or the model is not the innovation of this embodiment, so its principle or algorithm construction process will not be repeated here.

[0073] Step 110 , monitor in real time whether the product to be inspected reaches the predetermined inspection position; if so, execute step 120 ; otherwise, continue to execute step 110 .

[0074] After the training is completed, the character recognition model can be put into use. The electronic cigarette production line has a machine vision system for detecting the position of the product to be inspected, that is, it can monitor in real time whether the product to be inspected has reached the predetermined inspection position.

[0075] Step 120 , use a character recognition model to identify and detect the image of the product to be inspected to determine whether the product to be inspected is an NG product; if so, execute step 130 ; otherwise, return to step 110 .

[0076] When the product to be inspected arrives at the predetermined inspection position, the machine vision system immediately collects the image of the product to be inspected and uses the character recognition model to identify and detect the image of the product to be inspected. At this time, the trained character recognition model can identify whether the product to be inspected is a normal product or an NG (no good, defective) product.

[0077] In addition, the character recognition model based on deep learning can further identify the types of defects of NG products, which is very convenient and more efficient than manual inspection.

[0078] Step 130 : Whether the defect type of the NG product can be identified; if so, execute step 131 ; otherwise, return to step 132 .

[0079] The character recognition model is trained based on the constructed training sample library. Therefore, in the actual production application, if the image of the product to be inspected acquired in real time has some defects that are not covered by the training sample library, the defect type of the NG product cannot be identified. Therefore, based on this, this embodiment proposes the following troubleshooting solution.

[0080] Step 131: Automatically classify NG products according to defect types.

[0081] For NG products whose defect types can be identified, they can be automatically classified according to the defect types.

[0082] Step 132: manually label the images of NG products.

[0083] For NG products whose defect types cannot be identified, this embodiment uses manual labeling to label the images of NG products. Although the manual visual method is not as efficient as the machine method, it is applicable to various complex scenarios. The organic combination of the two can effectively solve the above-mentioned fault problems.

[0084] Specifically, as an optional implementation, step 132 includes:

[0085] Step 1321: sequentially cut the character area of ​​the image of the NG product whose defect type cannot be identified through a predetermined sliding window to obtain a plurality of sub-character features.

[0086] In this sub-step, the image can be divided into multiple sub-images through a sliding window, that is, a number of sub-character features can be obtained; in order to improve the efficiency of image comparison, only the image area with character features can be selected for segmentation; for example, each character can be segmented separately, or the image can be divided into multiple equal blocks.

[0087] Step 1322: By sliding the window, the character regions of the image samples of normal products having the same placement posture as the NG products whose defect types cannot be identified are cut in sequence to obtain a number of comparison features.

[0088] Similarly, the same segmentation rule in step 1321 is used to segment the image samples of normal products with the same placement posture as the NG products whose defect types cannot be identified. Since the placement posture is the same, the segmented images can be easily compared, eliminating unnecessary data conversion operations, which can effectively improve the comparison efficiency and the accuracy of the comparison results.

[0089] Step 1323: perform similarity matching on each sub-character feature and the corresponding comparison feature to obtain the similarity corresponding to each sub-character feature.

[0090] By comparing the corresponding sub-character features, the similarity of all sub-character features of NG products can be obtained.

[0091] Step 1324: Mark sub-character features whose similarity is lower than a preset similarity threshold as features to be marked.

[0092] A similarity threshold may be preset, and sub-character features with similarity lower than the preset similarity threshold may be marked as features to be marked, and the features to be marked are "suspected defects" and require further manual confirmation.

[0093] Step 1325, automatically jump to the page where the image of the NG product whose defect type cannot be identified is located, select the area where the feature to be annotated is located, and pop up an input box on the page for typing or modifying the annotation.

[0094] After finding the features to be labeled, in order to facilitate manual operation and improve work efficiency, in this embodiment, after determining the features to be labeled, the page automatically jumps to the page where the image of the NG product whose defect type cannot be identified is located, selects the area where the features to be labeled are located, and pops up an input box for typing or modifying the annotation on the page.

[0095] Step 1326: Manually label the defect types through the input box.

[0096] Staff can complete manual labeling of defect types by typing information in the input box.

[0097] Step 140: Add the manually labeled images of NG products into the training sample library.

[0098] After manual labeling is completed, the images of NG products after manual labeling need to be added to the training sample library for online learning of the model.

[0099] Step 150: Retrain the character recognition model using the manually annotated images to improve the character recognition model in real time.

[0100] In actual generation applications, the character recognition model can also be retrained through manually annotated images, continuously improving its own model, making the detection results more and more accurate, and greatly improving the generation efficiency.

[0101] Embodiment 2:

[0102] Please refer to Figure 2 , Figure 2 A schematic diagram of the structure of a device for detecting product defects in an electronic cigarette production line provided by an embodiment of the present invention.

[0103] The device specifically comprises:

[0104] The memory 10 is used to store a training sample library, in which the image samples of normal products and various defective products are collected;

[0105] A deep learning module 20, electrically connected to the memory 10, for training a deep learning model using a training sample library to obtain a character recognition model for OCR detection;

[0106] The machine vision system 30 is electrically connected to the deep learning module 20 and the memory 10, respectively, and is used to use the character recognition model to recognize and detect the image of the product to be inspected, determine whether the product to be inspected is a NG product, and identify the defect type of the NG product;

[0107] The machine vision system 30 is also used to automatically classify NG products whose defect types can be identified according to the defect types; or to manually label the images of NG products whose defect types cannot be identified;

[0108] The deep learning module 20 is also used to retrain the character recognition model using manually annotated images.

[0109] Specifically, the machine vision system 20 includes a recognition and detection module 32 for recognizing and detecting images of products to be inspected using a character recognition model. The recognition and detection module is electrically connected to a sorting module 31 for automatically classifying NG products, and an image processing module 33 for manually annotating images.

[0110] Specifically, the image processing module 33 includes:

[0111] The image segmentation unit 331 is used to sequentially cut the character area of ​​the image of the NG product whose defect type cannot be identified through a predetermined sliding window to obtain a plurality of sub-character features; and is used to sequentially cut the character area of ​​the image sample of the normal product with the same placement posture as the NG product whose defect type cannot be identified through the sliding window to obtain a plurality of comparison features;

[0112] The character feature comparison unit 332 is electrically connected to the image segmentation unit 331 and is used to perform similarity matching between each sub-character feature and the corresponding comparison feature to obtain the similarity corresponding to each sub-character feature;

[0113] The marking unit 333 is electrically connected to the character feature comparison unit 332 and is used to mark sub-character features whose similarity is lower than a preset similarity threshold as features to be marked;

[0114] The annotation modification unit 334 is electrically connected to the marking unit 333, and is used to automatically jump to the page of the machine vision system that displays the image of the NG product whose defect type cannot be identified, select the area where the feature to be annotated is located, and pop up an input box on the page for typing or modifying the annotation.

[0115] This embodiment organically combines the machine vision system 30 and the deep learning model, realizes online learning on the production line, integrates the advantages of OCR detection and manual visual method, and eliminates the disadvantages of both, thereby effectively solving OCR detection in complex scenarios and improving the stability of the visual detection system.

[0116] Based on the same concept, an embodiment of the present invention further provides a computer-readable storage medium, in which at least one instruction is stored. The instruction is loaded and executed by a processor to implement a method for detecting product defects in an electronic cigarette production line provided by an embodiment of the present invention.

[0117] Based on the same concept, an embodiment of the present invention further provides a computer program product, including a computer program / instruction. When the computer program / instruction is executed by a processor, a method for detecting product defects in an electronic cigarette production line provided by an embodiment of the present invention is implemented.

[0118] Those skilled in the art can understand that all or part of the steps of the above embodiments can be completed by hardware, or by a program to instruct the relevant hardware to complete, and the program can be stored in a computer-readable storage medium, and the storage medium mentioned above can be a read-only memory, a disk or an optical disk, etc. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0119] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting product defects in an electronic cigarette production line, characterized in that: include: Collect image samples of normal products and various defective products to build a training sample library; Use the training sample library to train the deep learning model and obtain the character recognition model for OCR detection; Use character recognition models to identify and detect images of products to be inspected, determine whether the products to be inspected are NG products, and identify the types of defects of NG products; Automatically classify NG products whose defect types can be identified according to the defect types; or manually annotate images of NG products whose defect types cannot be identified, and retrain the character recognition model using the manually annotated images.

2. The method for detecting product defects in an electronic cigarette production line according to claim 1, characterized in that: The character recognition model is used to identify and detect the image of the product to be inspected, determine whether the product to be inspected is a NG product, and identify the defect type of the NG product, specifically including: Use the character recognition model to identify and detect the image of the product to be inspected to determine whether the product to be inspected is a NG product; If so, the NG products are automatically classified according to the defect type; If not, manually label the images of NG products.

3. The method for detecting product defects in an electronic cigarette production line according to claim 1, characterized in that: Manually labeling images of NG products whose defect types cannot be identified specifically includes: The character area of ​​the image of the NG product whose defect type cannot be identified is sequentially cut through a predetermined sliding window to obtain several sub-character features; Using the sliding window, sequentially cut character regions of the image samples of normal products with the same placement posture as the NG products whose defect types cannot be identified, to obtain a plurality of comparison features; Performing similarity matching on each of the sub-character features and the corresponding comparison features to obtain the similarity corresponding to each sub-character feature; Mark sub-character features whose similarity is lower than a preset similarity threshold as features to be marked; Automatically jump to the page where the image of the NG product whose defect type cannot be identified is located, select the area where the feature to be annotated is located, and pop up an input box for typing or modifying the annotation on the page; The defect types are manually labeled through the input box.

4. The method for detecting product defects in an electronic cigarette production line according to claim 1, characterized in that: The collection of image samples of normal products and various defective products to build a training sample library specifically includes: Collect sample images of normal products in various positions, and sample images of various defective products; According to the category of character defects, the collected image samples of each defective product are labeled separately; Classify image samples of defects with the same labeled category into the same defect sample group; The collected image samples are subjected to data enhancement processing to obtain a training sample library.

5. The method for detecting product defects in an electronic cigarette production line according to claim 4, characterized in that: The deep learning model is trained using the training sample library to obtain a character recognition model for OCR detection, specifically including: Select the deep learning model to be trained; The image samples in the training sample library are input into the deep learning model, the training parameters of the deep learning model are adjusted, and the character recognition model is obtained through training.

6. A device for detecting product defects in an electronic cigarette production line, characterized in that: include: A memory, configured to store a training sample library containing image samples of normal products and various defective products; A deep learning module, electrically connected to the memory, for training a deep learning model using a training sample library to obtain a character recognition model for OCR detection; a machine vision system, electrically connected to the deep learning module and the memory, respectively, for identifying and detecting an image of a product to be inspected using a character recognition model, determining whether the product to be inspected is a NG product, and identifying the type of defect of the NG product; The machine vision system is also used to automatically classify NG products whose defect types can be identified according to the defect type; or manually label images of NG products whose defect types cannot be identified; The deep learning module is also used to retrain the character recognition model using manually annotated images.

7. The device for detecting product defects in an electronic cigarette production line according to claim 6, characterized in that: The machine vision system includes a recognition and detection module for identifying and detecting images of products to be inspected using a character recognition model. The recognition and detection module is electrically connected to a sorting module for automatically classifying NG products and an image processing module for manually annotating images.

8. The device for detecting product defects in an electronic cigarette production line according to claim 6, characterized in that: The image processing module includes: an image segmentation unit for sequentially segmenting, using a predetermined sliding window, a character region of an image of an NG product whose defect type cannot be identified, to obtain a plurality of sub-character features; and for sequentially segmenting, using the sliding window, a character region of an image sample of a normal product having the same placement posture as the NG product whose defect type cannot be identified, to obtain a plurality of comparison features; a character feature comparison unit, electrically connected to the image segmentation unit, for performing similarity matching between each of the sub-character features and the corresponding comparison feature to obtain a similarity corresponding to each sub-character feature; a marking unit, electrically connected to the character feature comparison unit, for marking sub-character features whose similarity is lower than a preset similarity threshold as features to be marked; The annotation modification unit is electrically connected to the marking unit and is used to automatically jump to the page of the machine vision system that displays an image of an NG product whose defect type cannot be identified, select the area where the feature to be annotated is located, and pop up an input box on the page for typing or modifying the annotation.

9. A computer-readable storage medium storing at least one instruction, characterized in that: The instructions are loaded and executed by the processor to implement the method for detecting product defects in an electronic cigarette production line as described in any one of claims 1 to 5.

10. Computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by the processor, the method for detecting product defects in an electronic cigarette production line as described in any one of claims 1 to 5 is implemented.