Laser coding and visual inspection integrated machine and use method thereof
By designing a laser coding and visual detection all-in-one machine, combining color vision sensors and deep learning OCR detection and identification methods, the problem of poor coding quality in packaging bags during high-speed production is solved, automated detection and removal are achieved, unqualified products are improved, and product quality and production efficiency are improved.
Patent Information
- Application Number
- CN202411934138.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-04
AI Technical Summary
During high-speed production, the soft texture and jitter of the packaging bags lead to laser coding errors, missed and missing, affecting product quality and output.
Design a laser coding and visual detection all-in-one machine, integrating laser coding devices, coding detection devices and removal devices, and through OCR detection and recognition methods of color vision sensors, industrial cameras and deep learning, detect coding quality in real time and eliminate unqualified products.
It improves product factory pass rate, reduces manual operation, realizes production automation, reduces costs, and is suitable for a variety of production environments.
Smart Images

Figure CN119747239A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of laser coding quality detection, and in particular to a laser coding and visual detection integrated machine and a use method thereof. Background Art
[0002] At present, laser coding quality detection technology is a detection technology developed based on laser coding technology. Its core lies in using the high energy density characteristics of the laser beam to accurately and efficiently mark objects, and ensure the quality of the marking through corresponding detection means. Laser coding technology plays a key role in food safety traceability with its unique advantages such as high precision, high speed and non-contact processing. Through the laser marking machine, high-precision graphics, text, QR codes, barcodes and other marks can be achieved on food packaging. These marks contain key information such as the production date, batch number, origin, manufacturer, etc. of the food. This information is crucial for tracking the source, processing flow, production date, etc. of the food, and helps to ensure the safety and traceability of the food.
[0003] Nowadays, when using laser coding devices to code packaging bags, in order to ensure production, it is necessary to code them through laser coding devices during the high-speed production of material filling and packaging, and then use coding detection devices to detect the coding quality of the products. Due to the soft texture of packaging bags, there are jitters during the production process, which is prone to coding errors, omissions, and missing problems. The rejection device can reject unqualified products based on the detection results to improve the quality of the coding of the products. Summary of the invention
[0004] The present invention provides a laser coding and visual inspection integrated machine and a use method thereof, which codes products on packaging bags, detects the quality of the laser coding on the packaging bags, and eliminates unqualified products, thereby ensuring the laser coding quality of the products leaving the packaging bags, realizing production automation, and reducing labor costs.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] A laser coding and visual inspection integrated machine comprises a cabinet, a main body, a sensing device, a rejecting device, a laser coding device, and a coding detection device. The cabinet is provided with an industrial computer and a touch display and a three-color light connected to the industrial computer. The main body is located at one side of the cabinet. The sensing device, the laser coding device, and the coding detection device are installed in the main body through a bracket. A rejecting device is provided under the main body and is installed on a conveyor line. The sensing device, the laser coding device, the coding detection device, and the rejecting device are all connected to the industrial computer.
[0007] As a preferred embodiment of the above solution, the sensing device adopts a color vision sensor.
[0008] As a preferred embodiment of the above scheme, the laser coding device includes a laser and a laser controller connected to each other, and the laser can be an infrared laser or an ultraviolet laser.
[0009] As a preferred embodiment of the above scheme, the coding detection device includes an image sensor, a light source, and a processor that are connected to each other. The image sensor and the light source are fixed inside the main body and are located parallel to the laser. The image sensor can be an industrial camera.
[0010] As a preferred embodiment of the above scheme, the rejection device includes a rodless cylinder and a rejection controller. The rodless cylinder is controlled by the rejection controller. A push plate is installed at the front end of the rodless cylinder, and the unqualified coded products are pushed from the conveyor line to a defective product box located on one side of the conveyor line through the push plate.
[0011] As a preferred embodiment of the above scheme, a protective layer of thin film tape is adhered to the outer surface of the push plate, and a very small gap is left between the lower edge of the push plate and the plane of the conveyor line.
[0012] A method for using a laser coding and visual inspection integrated machine comprises the following steps:
[0013] S1. Start the production line and production equipment, turn on the industrial computer to run the all-in-one machine. When the product starts to move, the color vision sensor senses the color change and sends a signal to the industrial computer. The industrial computer controls the laser through the laser controller to code the product's coding area;
[0014] S2. When the coding is completed, the industrial computer sends a signal to the image sensor to collect images. After the collection, the image is processed by the processor and compared with the preset coding text to determine whether the product coding quality is qualified. The judgment result is displayed by the three-color light. At the same time, the industrial computer records the unqualified products and sends a signal to the rejection controller;
[0015] S3. When the product coding quality is unqualified, the rejection controller controls the rodless cylinder to move forward, and pushes the unqualified coding products from the conveyor line to the defective product box on one side of the conveyor line through the push plate. After the rejection is completed, the rejection controller controls the rodless cylinder to return to its original position.
[0016] As a preferred embodiment of the above solution, in step S2, the industrial control machine displays the judgment result by controlling the color of the three-color light.
[0017] As a preferred embodiment of the above solution, step S2 specifically includes:
[0018] S21, Image acquisition and processing: Based on the OpenCV library, the image sensor acquires the original image data, and performs image preprocessing, denoising and ROI area selection;
[0019] S22, OCR detection: Construct a feature extraction network consisting of Backbone, Neck and Head. Backbone uses the ResNet architecture to extract the features of the image; Neck uses the DBFPN structure to connect Backbone and Head to fuse and enhance the features extracted by the network; Head uses the DB algorithm to detect objects;
[0020] S23, OCR recognition: The OCR recognition model is constructed using a sequence recognition algorithm based on the attention mechanism, and the OCR recognition model is trained using the cross entropy loss function, and finally the OCR recognition result of the target image is output;
[0021] S24, result comparison: skip spaces and line breaks, and compare the differences between the actually recognized characters and the preset correct characters one by one.
[0022] As a preferred embodiment of the above solution, in step S3, after the rejection is completed, the rejection controller controls the rodless cylinder to return to its original position.
[0023] Due to the above structure, the beneficial effects of the present invention are:
[0024] 1. The present invention integrates the laser coding device, coding detection device and rejection device into one machine, and cooperates with the touch display to realize the all-in-one machine design. By coding the packaging bag area and detecting the coding content, unqualified products are rejected, which is conducive to improving the product factory qualification rate and the performance of production equipment. At the same time, it reduces the number of manual operation stations, is more convenient to use, saves time and work costs, and is more practical.
[0025] 2. The coding detection adopts a deep learning OCR detection and recognition method. This method is different from the traditional template matching method. It can accurately identify characters under different backgrounds and lighting conditions. It is suitable for a variety of different production environments and has strong robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for describing the embodiments are briefly introduced below.
[0027] Figure 1 It is a schematic diagram of the overall structure of the present invention;
[0028] Figure 2 It is a schematic diagram of the internal structure of the present invention;
[0029] Figure 3 is a flow chart of the method of the present invention;
[0030] Figure 4 It is the image processing workflow diagram of the present invention;
[0031] Legend: 1. Main body; 2. Three-color light; 3. Touch display; 4. Cabinet; 5. Conveyor line; 6. Laser coding device; 7. Coding detection device; 8. Sensing device; 9. Rejection device; 10. Defective product box; 11. Packaging bag; 12. Light source; 13. Laser; 14. Image sensor. DETAILED DESCRIPTION
[0032] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention.
[0033] like Figure 1 , Figure 2 As shown, this embodiment provides a laser coding and visual inspection integrated machine, including a cabinet 4, a main body 1, a sensing device 8, a rejection device 9, a laser coding device 6, and a coding detection device 7. The cabinet 4 is provided with an industrial computer and a touch display 3 and a three-color light 2 connected to the industrial computer. The main body 1 is located on one side of the cabinet 4. The sensing device 8, the laser coding device 6, and the coding detection device 7 are installed in the main body 1 through a bracket. A rejection device 9 is provided under the main body 1, and the rejection device 9 is installed on the conveyor line 5. The sensing device 8, the laser coding device 6, the coding detection device 7, and the rejection device 9 are all connected to the industrial computer.
[0034] In this embodiment, the sensing device 8 is a color vision sensor.
[0035] In this embodiment, the laser marking device 6 includes a laser 13 and a laser controller connected to each other. The laser 13 can be an infrared laser 13 or an ultraviolet laser 13, facing the product plane. The laser controller has a control system, which covers aspects such as input and editing of marking content, processing and system uploading of marking data, docking of external devices, and data import.
[0036] In this embodiment, the coding detection device 7 includes an image sensor 14, a light source 12, and a processor that are interconnected. The image sensor 14 and the light source 12 are fixed inside the main body 1, facing the product plane, and are located parallel to the laser 13. The image sensor 14 can be an industrial camera.
[0037] In this embodiment, the rejection device 9 includes a rodless cylinder and a rejection controller. The rodless cylinder is controlled by the rejection controller. A push plate is installed at the front end of the rodless cylinder, and the unqualified coded products are pushed from the conveyor line 5 to the defective product box 10 located on one side of the conveyor line 5 by the push plate. The rodless cylinder has the advantages of compact structure, long stroke and small space occupation. It can achieve efficient linear reciprocating motion in a limited space, and can fully meet the requirements of the rejection action for space and stroke. Considering that the bagged milk is packed in plastic and filled with liquid milk, the overall texture is relatively soft. In order to prevent the bagged milk from deforming and getting stuck at the lower edge of the push plate during the pushing process, thereby causing the rejection action to fail or damage the bagged milk, the lower edge of the push plate is designed to maintain a very small gap with the plane of the conveyor line 5. The size of this gap is determined through repeated experiments and debugging, which is to ensure that the push plate can pass smoothly under the bagged milk and be as close to the bagged milk as possible to provide sufficient thrust to push it into the defective product box 10. In the actual production process, this gap will be fine-tuned in time according to the packaging specifications, thickness and filling degree of the bagged milk, so as to ensure that the best rejection effect can always be achieved. In order to further prevent the bagged milk from being scratched during the pushing process of the push plate, a layer of special film tape is pasted on the outer surface of the push plate. This film tape has good flexibility and wear resistance, which can effectively reduce the friction between the push plate and the bagged milk, and prevent the sharp edges or protrusions on the surface of the push plate from scratching the bagged milk. When selecting the film tape, its compatibility with the plastic packaging material of the bagged milk is fully considered to ensure that no chemical reaction will occur during long-term contact, thereby affecting the quality and safety of the bagged milk. In addition, the pasting process of the film tape has also been strictly controlled to ensure that it is flat and firmly attached to the surface of the push plate, and will not fall off or wrinkle during the reciprocating motion of the push plate.
[0038] The above structure can be applied to the production line of filling bagged milk in the production workshop. The packaging bags of bagged milk are continuous and will be straightened during the production process, and then filled and packaged. The packaged products have irregular shapes, which makes coding and inspection difficult. Therefore, it is necessary to code and inspect the straightened packaging bags during the filling process. Figure 3 , Figure 4 As shown, this embodiment provides a method for using a laser coding and visual inspection integrated machine, comprising the following steps:
[0039] S0. The integrated machine of the present application is installed on a bagged milk filling machine. The filling machine itself does not have coding and detection functions. It is only responsible for transporting the outer packaging of the bagged milk to the filling port, then filling it and sealing it with a heat sealer. Finally, the filled bagged milk slides onto the conveyor line 5 in the most stable posture. The packaging bag 11 is roll-packed and installed inside the main body 1. It can move from top to bottom driven by the transmission mechanism of the filling machine.
[0040] S1. Start the bagged milk filling production line and production equipment, turn on the industrial computer to run the integrated machine, when the packaging bag 11 transported to the filling port below is being filled, the packaging bag 11 above will pause for a while, when the packaging bag 11 above passes through the area where the color vision sensor is located, the color vision sensor senses the color change and sends a signal to the industrial computer, the industrial computer controls the laser 13 through the laser controller to code the coding area of the packaging bag 11, the coded text includes any one or more of Chinese characters, numbers, English letters (uppercase and lowercase), punctuation marks, etc., mainly the production date and listing date on the bagged milk (for example, 20241203).
[0041] S2. When the coding is completed, the industrial computer sends a signal to the image sensor 14 to collect images. After the collection, the image is processed by the processor, and the quality of the coding is identified by the OCR detection and recognition method in deep learning, and compared with the preset coding text to determine whether the product coding quality is qualified, that is, whether it is consistent with the correct content, whether there are coding errors, coding leaks, coding defects, etc. The judgment result is displayed by the three-color light 2. If it is consistent, the three-color light 2 will display green and display on the touch display 3. If it is inconsistent, the three-color light 2 will display red and an alarm will be issued, and it will be displayed on the touch display 3; at the same time, the industrial computer records and displays unqualified products, performs statistics on the data and presets the coding content, and sends a signal to the rejection controller. Specifically:
[0042] S21. Based on the OpenCV library, the image acquisition device (image sensor 14) obtains the original image data, and performs image preprocessing, denoising and ROI area selection.
[0043] S22, OCR detection:
[0044] The Backbone network uses the ResNet architecture for feature extraction. In ResNet, there is a residual block (ResidualBlock), and its core formula is as follows:
[0045] The input of the residual block is x, and the input is y, so y=F(x)+x, and the residual function is F(x). It usually consists of multiple convolutional layers, batch normalization (Batch Normalization, BN) layers and activation functions (such as ReLU).
[0046] The Neck network uses the DBFPN structure to fuse and enhance the features extracted by the network. The formula is based on the idea of the Feature Pyramid Network (FPN).
[0047] Feature map C of the backbone network i The upsampling operation is U(x), the downsampling operation is recorded as D(x), and the fusion operation is as follows:
[0048] P6=D(C5)
[0049] P5=Conv(C5+U(P6))
[0050] P4=Conv(C4+U(P5))
[0051] The Head network uses the DB algorithm. In the algorithm, there are a prediction map (P) and a threshold map (T). The approximate binary map (B) is obtained by the following formula: Where k is a learnable parameter.
[0052] The loss function consists of three parts:
[0053] Binary graph loss L b (usually using binary cross entropy loss):
[0054] where y ij is the pixel value in the real binary image, is the pixel value in the predicted binary image.
[0055] Threshold map loss L t (using mean square error loss): where t ij is the pixel value in the true threshold map is the pixel value in the predicted threshold map.
[0056] Probabilistic map loss L p (Binary cross entropy loss is usually used). Text detection loss L d =L b +α×L t +β×L p , where α and β are weight parameters.
[0057] S23, OCR recognition:
[0058] A sequence recognition algorithm based on the attention mechanism is adopted.
[0059] The input image feature sequence is X = (x1, x2···, x n), the hidden state of the decoder at step t is h t Attention weight α ti is calculated by the following formula:
[0060] where e ti = score(h t-1 , x i ), and the score function can be in different forms such as dot product, additive attention, etc.
[0061] Context vector
[0062] The probability distribution p(y t |y < t, X) = softmax(w s [concat(h t , c t )] + b s ), where W s and b s are weight and bias parameters, and the softmax function is used to convert the scores into probabilities.
[0063] The loss function for text recognition usually adopts cross - entropy loss, which is used to minimize the difference between the predicted character probability distribution and the true character sequence.
[0064] S24. Result comparison:
[0065] Result comparison usually involves comparing the recognition result with a predefined standard or template. The character matching function is mainly implemented by the MyStrcmp function, which is used to determine whether two strings match, and further determine whether the recognition result is correct.
[0066] 1. Function definition:
[0067] This function accepts two parameters of type string, src (source string, that is, the actually recognized characters) and dst (target string, that is, the expected correct characters), and returns an integer representing the matching result (0 indicates successful match, 1 indicates mismatch, and 2 indicates that the target string is empty).
[0068] 2. Basic character comparison:
[0069] The characters in the two strings are compared one by one through a loop. The loop condition is i < src.length() && j < dst.length(), that is, as long as there are uncompared characters in both strings, the loop continues.
[0070] In the loop, two characters are considered to match if one of the following conditions is met: the current characters are equal, that is, src[i] == dst[j]. The ASCII code difference of the characters is 32 (taking into account the difference in uppercase and lowercase, for example, the ASCII code difference between A and a is 32), that is, abs(src[i]-dst[j]) == 32. If the character in src is *, the corresponding position in dst can be any character except space, carriage return \r and line feed \n, that is, (src[i] == '*' && dst[j] != " && dst[j] != '\r' && dst[j] != '\n').
[0071] If none of the above conditions are met, it means the characters do not match and 1 is returned directly.
[0072] 3. Handling spaces and line breaks:
[0073] If the character in src is a space, carriage return \r or line feed \n, skip the character and continue to compare the next character, that is, if (src[i] == "||src[i] == '\r'||src[i] == '\n')i++;.
[0074] Similarly, if the character in dst is a space, carriage return \r or line feed \n, skip the character and continue to compare the next character, that is, if (dst[j] == "||dst[j] == '\r'||dst[j] == '\n') j++;.
[0075] 4. Process the remaining characters:
[0076] When the loop ends, if there are remaining characters in src and these characters are not spaces, carriage returns, or line feeds, 1 is returned, indicating no match.
[0077] If there are characters remaining in dst and these characters are not space, carriage return, or line feed, then 1 is returned, indicating no match.
[0078] S3, the coded packaging bag 11 will continue to move downward to the filling port for filling. After the filling is completed, it will slide onto the conveyor line 5 through the arc surface (the shape and angle of this arc surface have been calculated, and its end is structurally designed to be as close to the conveyor line plane as possible while ensuring that the cylinder push plate can pass smoothly. Such a design, on the one hand, can make the bagged milk slide onto the conveyor line in the most stable posture, reducing the possibility of deformation or damage of the bagged milk due to falling impact; on the other hand, it also provides favorable conditions for the normal operation of the rejection mechanism, ensuring that the push plate can accurately contact the bagged milk when performing the rejection operation without being interfered by the arc surface structure) When the coding quality of the packaging bag 11 is unqualified, the rejection controller controls the rodless cylinder to move forward, and pushes the bagged milk with unqualified coding from the conveyor line 5 to the defective product box 10 located on one side of the conveyor line 5 through the push plate. After the rejection is completed, the rejection controller controls the rodless cylinder to return to its original position. Specifically, when the rejection controller receives the signal from the industrial computer, it will quickly issue an action command to the rodless cylinder. Under the action of air pressure, the piston inside the rodless cylinder begins to move forward along the axial direction of the cylinder, and the movement of the piston is transmitted and amplified through the push plate rigidly connected to it. Driven by the piston, the push plate moves forward at a stable and fast speed, directly acting on the problematic bagged milk, pushing it from the conveyor line 5 to the defective product box 10 on one side. In the process of the push plate moving forward, its movement speed and thrust have been precisely debugged and optimized, which not only ensures that the bagged milk can be pushed out of the conveyor line 5 smoothly, but also avoids additional damage to the bagged milk due to excessive speed or excessive thrust. After the push plate successfully pushes the problematic bagged milk to the defective product box 10, the industrial computer will send a confirmation signal to the rejection controller again, indicating that the rejection action has been completed. The rejection controller then sends a reverse motion command to the rodless cylinder again. The piston of the rodless cylinder begins to move backward under the action of air pressure, driving the push plate back to its initial position, ready for the next possible rejection task. The return speed of the push plate is also carefully adjusted to ensure that the action rhythm of the entire rejection mechanism is compact and efficient, without affecting the normal conveying process of bagged milk.
[0079] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A laser coding and visual inspection integrated machine, characterized in that: It includes a cabinet, a main body, a sensing device, a rejecting device, a laser coding device, and a coding detection device. The cabinet is provided with an industrial computer and a touch display and a three-color light connected to the industrial computer. The main body is located on one side of the cabinet. The sensing device, the laser coding device, and the coding detection device are installed in the main body through a bracket. A rejecting device is provided under the main body and is installed on the conveyor line. The sensing device, the laser coding device, the coding detection device, and the rejecting device are all connected to the industrial computer.
2. The integrated laser coding and visual inspection machine according to claim 1, characterized in that: The sensing device adopts a color vision sensor.
3. The integrated laser coding and visual inspection machine according to claim 1, characterized in that: The laser coding device comprises a laser and a laser controller which are connected to each other. The laser can be an infrared laser or an ultraviolet laser.
4. The integrated laser coding and visual inspection machine according to claim 1, characterized in that: The coding detection device comprises an image sensor, a light source and a processor which are connected to each other. The image sensor and the light source are fixed inside the main body and are located parallel to and below the laser. The image sensor can be an industrial camera.
5. The integrated laser coding and visual inspection machine according to claim 1, characterized in that: The rejection device includes a rodless cylinder and a rejection controller. The rodless cylinder is controlled by the rejection controller. A push plate is installed at the front end of the rodless cylinder. The push plate pushes the unqualified coded products from the conveyor line to a defective product box located on one side of the conveyor line.
6. The integrated laser coding and visual inspection machine according to claim 5, characterized in that: A protective layer of film tape is pasted on the outer surface of the push plate, and a very small gap is left between the lower edge of the push plate and the plane of the conveyor line.
7. A method for using a laser coding and visual inspection integrated machine according to any one of claims 1 to 6, characterized in that: The following steps are involved: S1. Start the production line and production equipment, turn on the industrial computer to run the all-in-one machine. When the product starts to move, the color vision sensor senses the color change and sends a signal to the industrial computer. The industrial computer controls the laser through the laser controller to code the product's coding area; S2. When the coding is completed, the industrial computer sends a signal to the image sensor to collect images. After the collection, the image is processed by the processor and compared with the preset coding text to determine whether the product coding quality is qualified. At the same time, the industrial computer records unqualified products and sends a signal to the rejection controller; S3. When the product coding quality is unqualified, the rejection controller controls the rodless cylinder to move forward, and pushes the unqualified coding products from the conveyor line to the defective product box on one side of the conveyor line through the push plate.
8. The method for using the integrated laser coding and visual inspection machine according to claim 7, characterized in that: In step S2, the industrial computer displays the judgment result by controlling the color of the three-color light.
9. The method for using the integrated laser coding and visual inspection machine according to claim 7, characterized in that: Step S2 specifically includes: S21, Image acquisition and processing: Based on the OpenCV library, the image sensor acquires the original image data, and performs image preprocessing, denoising and ROI area selection; S22, OCR detection: Construct a feature extraction network consisting of Backbone, Neck and Head. Backbone uses the ResNet architecture to extract the features of the image; Neck uses the DBFPN structure to connect Backbone and Head to fuse and enhance the features extracted by the network; Head uses the DB algorithm to detect objects; S23, OCR recognition: The OCR recognition model is constructed using a sequence recognition algorithm based on the attention mechanism, and the OCR recognition model is trained using the cross entropy loss function, and finally the OCR recognition result of the target image is output; S24, result comparison: skip spaces and line breaks, and compare the differences between the actually recognized characters and the preset correct characters one by one.
10. The method for using the integrated laser coding and visual inspection machine according to claim 7, characterized in that: In step S3, after the rejection is completed, the rejection controller controls the rodless cylinder to return to its original position.