A method and device for detecting corner defects of packaging boxes
Through the deep neural network based on the YOLOV framework, the packaging box detection images are processed and analyzed, and the accuracy and cost problems of complex collision angle defect detection of tablet packaging boxes are solved, and efficient and accurate collision angle defect detection is achieved.
Patent Information
- Application Number
- CN202111189749.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-11
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2041-10-11
AI Technical Summary
The prior art is difficult to detect complex and multi-scale impact angle defects in tablet computer packaging boxes with high accuracy, resulting in low detection accuracy and high cost, and manual detection can easily lead to high error rates.
Using a lightweight deep neural network based on YOLOV framework, the detection images of the packaging box are acquired and processed, feature images are extracted, binary graph closed operations and sparse sampling of boundary points, determine the center position of the top angle, build a local mask, and perform multiplication operations. , obtain the top angle feature image, train the collision angle defect detection model, and achieve high-precision detection.
It realizes the rapid and accurate detection of complex and multi-scale impact angle defects, reduces detection costs, improves detection accuracy, and avoids the error rate of manual detection.
Smart Images

Figure CN114092396B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of defect detection, and in particular to a method and device for detecting corner defects of a packaging box. Background Art
[0002] Product packaging can prevent products from being damaged, contaminated, leaked or deteriorated during circulation. It is also the most powerful and convenient means for manufacturers to sell products. For example, a beautiful tablet computer outer packaging can improve the public's recognition of the tablet computer brand. However, due to the influence of the production process and transportation environment, tablet computer packaging boxes will inevitably have many defects during production and transportation. Among them, the corner collision on the inner and outer surfaces of the tablet computer box is the most common product defect. The existence of corner collision seriously affects the brand benefits of tablet computer products, so manufacturers must strictly detect products with such corner collision defects to avoid their impact on the brand value of tablet computers. Due to the complex types, sizes and scales of corner collision defects on the surface of tablet computers, most manufacturers currently use manual detection methods for such defects. Manual detection is not only costly, but also prone to fatigue for long-term detection by inspectors, resulting in a high error rate. Therefore, it is an inevitable trend in the future for machine detection to replace manual detection.
[0003] With the rapid development of computer vision detection technology, machine detection has been widely used in various fields, and many conventional detection technology solutions have also been formed. Nowadays, many product packaging defects and product defect detection tasks also use machine vision technology on a large scale, but the corner collision defects of smart devices such as tablets are fundamentally different from conventional product defects. They are highly complex and diverse, and in many cases the amplitude and angle of the corner collision are relatively light, which is a kind of micro-defect. It may be difficult for existing detection solutions to achieve high-precision detection results due to the inappropriate shooting angle. Summary of the invention
[0004] In order to solve the technical problems existing in the background technology, the present invention proposes a method and device for detecting corner defects of packaging boxes, which realizes rapid target detection of packaging boxes with complex and multi-scale corner defects.
[0005] The present invention provides a method for detecting corner defects of a packaging box, comprising:
[0006] S1: Acquire a packaging box detection image; process the detection image to obtain a feature image;
[0007] S2: extract the binary image of the feature image, and perform a closing operation on the binary image to obtain an image mask;
[0008] S3: Find the boundary of the packaging box in the image mask to obtain a boundary point set, perform multiple equidistant sparse sampling on the boundary point set, and determine the center positions of the four vertex corners of the packaging box based on the slopes of the lines connecting the sampled adjacent boundary points;
[0009] S4: preset the radius value, select the vertex area at the center of the four vertex corners on the feature image, and construct a local mask of the vertex area of the packaging box;
[0010] S5: multiplying the local mask of the top corner area of the packaging box with the feature image to obtain a top corner feature image of the packaging box;
[0011] S6: Collect a sample of a packaging box with corner defects, and obtain a set of top corner feature images of the packaging box according to steps S1-S5;
[0012] S7: Design a lightweight deep neural network based on the YOLOV framework, build a packaging box corner defect detection model, and train the detection model based on the top corner feature image set;
[0013] S8: Detect the packaging box according to the trained packaging box corner defect detection model.
[0014] Preferably, the step S1 specifically includes:
[0015] S101: Acquire two packaging box detection images of the same size, wherein the two detection images are an image shot in a high-light exposure mode and an image shot in a low-light exposure mode of the same packaging surface of the packaging box;
[0016] S102: performing nearest neighbor interpolation compression of the same scale on the two detection images respectively to obtain two compressed images;
[0017] S103: Calculate the gradients of the two compressed images respectively by combining high-pass filtering to obtain two gradient images;
[0018] S104: Using Wiener filtering to perform highlight fusion on the two gradient images to obtain a feature image.
[0019] Preferably, the detected image is a grayscale image.
[0020] Preferably, step S3 specifically includes:
[0021] S301: Find the packaging box boundary in the image mask to obtain the boundary point set S:
[0022] S={(x i ,y i )|i=1,2,...,N};
[0023] Where N is the number of boundary points, x i ,y iare the horizontal and vertical coordinates of the boundary point respectively;
[0024] S302: Perform equidistant sparse sampling on the boundary point set S to obtain a boundary point subset S0:
[0025] S0={(x j ,y j )|j=1,2,...,n}, where n is the number of samples;
[0026] S303: Calculate the slope k of the line connecting two adjacent points in the boundary point subset S0 j :
[0027] k j =(y j -y j-1 ) / (x j -x j-1 ),(j=1,2,...,n-1);
[0028] S304: Search and record the conditions that satisfy 1<|arctan((k j -k j+1 ) / (1+k j k j+1 ))|<1.6 target boundary point;
[0029] S305: Repeat steps S302-S304 to perform multiple equidistant sparse sampling on the boundary point set to obtain the target boundary point set X:
[0030] X={(x k ,y k )|(x k ,y k )∈S, k=1,2,...};
[0031] S306: Calculate the average coordinates of the target boundary points belonging to the same vertex respectively, and define the average coordinates as the center position of the vertex, thereby obtaining the center positions of the four vertexes.
[0032] Preferably, the step of calculating the average coordinates of the target boundary points belonging to the same vertex also includes determining whether the target boundary points belong to the same vertex, which specifically includes:
[0033] S3061: According to the formula Calculate the distance d between the target boundary points ij ;
[0034] S3062: If d ij <δ, then the vertex (x i ,y i ) and (x j ,y j) belong to the same vertex, where δ is twice the maximum spacing between adjacent boundary points in subset S0.
[0035] Preferably, the step of extracting a binary image of the feature image in step S2 specifically includes: performing median filtering on the feature image and extracting features using a canny operator to obtain a binary image of the feature image.
[0036] Preferably, the S7 specifically includes:
[0037] S701: Design a lightweight deep neural network model based on the YOLOV framework;
[0038] S702: sequentially labeling the collision angle information of the vertex feature images in the vertex feature image set, selecting two-thirds of the vertex feature images to form a model training set, and the remaining one-third of the vertex feature images to form a model test set;
[0039] S703: setting corresponding network parameters and training parameters based on Model, inputting the model training set into Model for training, and obtaining the corner defect detection model PreModel;
[0040] S704: input the model test set into the detection model PreModel for detection, compare the detection result with the marked collision angle information, and calculate the model error ε;
[0041] S705: Determine whether ε<c is satisfied. If the judgment result is yes, obtain a high-precision corner defect detection model Pre-Model; if the judgment result is no, return to step S703; wherein c represents the industry standard error.
[0042] Preferably, the network depth of the deep neural network Model is 27 layers.
[0043] The present invention also provides a device for detecting corner defects of a packaging box, comprising:
[0044] A feature fusion module is used to obtain a packaging box detection image and process the detection image to obtain a feature image;
[0045] The image processing module is used to extract the binary image of the feature image and perform a closing operation on the binary image to obtain an image mask; find the boundary of the packaging box in the image mask to obtain a boundary point set, perform multiple equidistant sparse sampling on the boundary point set, and determine the center positions of the four vertex corners of the packaging box based on the slope of the line connecting the sampled adjacent boundary points; preset a radius value, select the vertex area at the center position of the four vertex corners on the feature image, and construct a local mask of the vertex area of the packaging box; perform a multiplication operation on the local mask of the vertex area of the packaging box and the feature image to obtain a vertex feature image of the packaging box;
[0046] A data acquisition module is used to collect samples of packaging boxes with corner defects and obtain a set of feature images of the top corners of the packaging boxes;
[0047] Model building module: Design a lightweight deep neural network based on the YOLOV framework, build a packaging box corner defect detection model, and train the detection model based on the top corner feature image set;
[0048] The detection module is used to detect the packaging box according to the trained packaging box corner defect detection model.
[0049] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-mentioned packaging box corner defect detection method.
[0050] In the present invention, by collecting packaging box samples with corner defects, image compression, feature fusion, image segmentation and other processing methods are performed on them to obtain a set of feature images of the top corners of the packaging boxes. A lightweight deep neural network is designed based on the YOLOV framework, and a detection model is constructed. The model is trained using the top corner feature images of the samples to obtain a high-precision corner defect detection model. The packaging boxes are inspected according to the high-precision detection model, thereby achieving rapid detection of complex and multi-scale corner defects in the packaging boxes.
[0051] In the present invention, the acquired detection images are images taken by a grayscale high-definition industrial camera, which is conducive to obtaining tiny collision angle information and effectively capturing collision angle information; the two detection images are taken by a high-light and low-light double exposure mode, which enhances the shadow structure information of the collision angle defect;
[0052] In the present invention, by combining high-pass filtering to calculate the gradient of the compressed image to obtain a gradient image, the complexity of the corner impact defect type can be effectively reduced; the Wiener filter is used to perform highlight fusion on the gradient image to obtain a feature image, which effectively enhances the corner impact feature structure; the canny operator is used to extract the feature image binary image, which can simply and effectively obtain the edge structure characteristics of the packaging box; by performing a closing operation on the feature image binary image, a complete packaging box closed area information mask can be quickly obtained, which is conducive to quickly finding the packaging box area boundary and quickly and effectively obtaining the boundary point.
[0053] In the present invention, equidistant sparse sampling boundary points are selected to calculate the change rate of adjacent connecting lines, which effectively reduces the amount of calculation. Multiple sampling is used to locate the vertex angle, which can accurately determine the vertex position; the local vertex feature image is used as the detection input, which greatly reduces the target detection range.
[0054] In the present invention, a 27-layer lightweight network based on the YOLOV framework is constructed, which can ensure both detection accuracy and training speed. Sample data is used for training verification to ensure that a high-precision detection model is finally obtained.
[0055] The detection method proposed in the present invention is based on local positioning and local segmentation, adopts a lightweight learning network and a non-end-to-end training application strategy, directly takes the enhanced image gradient feature map as input, avoids the design of deeper learning module layers, and can quickly and efficiently detect mixed types and multi-scale corner defects. The designed deep network model is highly scalable and can be used for transfer learning applications of other types of problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 The present invention is a flowchart of a method for detecting corner defects of a packaging box. DETAILED DESCRIPTION
[0057] like Figure 1 As shown, Figure 1 The present invention is a flowchart of a method for detecting corner defects of a packaging box proposed in an embodiment of the present invention.
[0058] Reference Figure 1 , an embodiment of a method for detecting corner defects of a packaging box of the present invention, taking a packaging box of a tablet computer as an example, specifically includes:
[0059] S1: Acquire a packaging box detection image; process the detection image to obtain a feature image;
[0060] Specifically, the step S1 specifically includes:
[0061] S101: Acquire two packaging box detection images I1 and I2 of the same size;
[0062] It should be noted that the two detection images are two images of the packaging surface of the same packaging box of the tablet computer taken in high-light exposure mode and low-light exposure mode respectively. Specifically, a fixed grayscale industrial camera is perpendicular to the tablet computer packaging shooting surface, and a strip parallel light source for controlling the high-light exposure and low-light exposure is selected respectively. The parallel light emitted by the light source is perpendicular to the tablet computer packaging box surface, and then the camera is taken to obtain the detection image.
[0063] It should be noted that, in this embodiment, the detection image is captured by a grayscale high-definition industrial camera, which is conducive to the acquisition of information on small collision angles; in addition, when shooting, the edge color of the tablet computer packaging box is used as the reference color, and a pure color that is significantly different from it is selected as the background color, which can eliminate peripheral background interference as much as possible.
[0064] S102: Perform nearest neighbor interpolation compression on the two detection images of the same scale to obtain two compressed images J1 and J2;
[0065] It should be noted that the acquired high-definition images are compressed using nearest neighbor interpolation, which can greatly reduce the input size and computational complexity while ensuring the feature structure information.
[0066] S103: Calculate the gradients of the two compressed images respectively by combining high-pass filtering to obtain two gradient images C1 and C2;
[0067] S104: Use Wiener filtering to perform highlight fusion on the two gradient images to obtain a feature image G.
[0068] In this embodiment, high-pass filtering and the gradient feature image calculated by the gradient algorithm are fused to obtain a feature image, which is used as the detection input image and can effectively reduce the complexity of the corner defect type.
[0069] S2: extract the binary image of the feature image, and perform a closing operation on the binary image to obtain an image mask;
[0070] In this embodiment, extracting the binary image of the feature image specifically includes: performing median filtering on the feature image G and extracting features using a canny operator to obtain a feature binary image EdgeI of the feature image, and then performing a closing operation on EdgeI to obtain a complete tablet computer packaging box area mask Mask;
[0071] S3: Find the boundary of the packaging box in the image mask Mask to obtain a boundary point set, perform multiple equidistant sparse sampling on the boundary point set, and determine the center positions of the four vertex corners of the packaging box based on the slopes of the lines connecting the sampled adjacent boundary points;
[0072] In this embodiment, step S3 specifically includes:
[0073] S301: Find the boundary of the packaging box in the image mask Mask to obtain the boundary point set S:
[0074] S={(x i ,y i )|i=1,2,...,N};
[0075] Where N is the number of boundary points, x i ,y i are the horizontal and vertical coordinates of the boundary points respectively;
[0076] S302: Perform equidistant sparse sampling on the boundary point set S to obtain a boundary point subset S0:
[0077] S0={(x j ,y j )|j=1,2,...,n}, where n is the number of samples;
[0078] S303: Calculate the slope k of the line connecting two adjacent points in the boundary point subset S0 j:
[0079] k j =(y j -y j-1 ) / (x j -x j-1 ),(j=1,2,...,n-1);
[0080] S304: Search and record the conditions that satisfy 1<|arctan((k j -k j+1 ) / (1+k j k j+1 ))|<1.6 target boundary point;
[0081] It should be noted that, because the angle α between the two straight lines is: and So it satisfies 1<|arctan((k j -k j+1 ) / (1+k j k j+1 The boundary point where ))|<1.6 is determined as the target boundary point.
[0082] S305: Repeat steps S302-S304 to perform multiple equidistant sparse sampling on the boundary point set to obtain the target boundary point set X:
[0083] X={(x k ,y k )|(x k ,y k )∈S, k=1,2,...};
[0084] It should be noted that, in this embodiment, steps S302-S304 are repeated at least three times, that is, sampling needs to be performed more than three times.
[0085] S306: Calculate the average coordinates of the target boundary points belonging to the same vertex respectively, and define the average coordinates as the center position of the vertex, thereby obtaining the center positions of the four vertexes.
[0086] In this embodiment, before calculating the average coordinates of the target boundary points belonging to the same vertex, it also includes determining whether the target boundary points belong to the same vertex, specifically including:
[0087] S3061: According to the formula Calculate the distance d between the target boundary points ij ;
[0088] S3062: If d ij <δ, then the vertex (x i ,y i ) and (x j ,yj ) belong to the same vertex, where δ is twice the maximum spacing between adjacent boundary points in subset S0.
[0089] S4: preset the radius value, select the vertex area at the center of the four vertex corners on the feature image, and construct a local mask of the vertex area of the packaging box;
[0090] S5: multiplying the local mask of the top corner area of the packaging box with the feature image to obtain a top corner feature image of the packaging box;
[0091] S6: Collect samples of tablet computer packaging boxes with corner defects, and obtain a set of top corner feature images of the packaging boxes according to steps S1-S5;
[0092] In this embodiment, the vertex feature image data set F = {G0, G1, ..., G n}
[0093] S7: Design a lightweight deep neural network based on the YOLOV framework, build a packaging box corner defect detection model, and train the detection model based on the top corner feature image set;
[0094] In this embodiment, step S7 specifically includes:
[0095] S701: Design a lightweight deep neural network model based on the YOLOV framework; it should be noted that, in this embodiment, the optimal network depth of the deep neural network model is 27 layers.
[0096] S702: sequentially labeling the collision angle information of the vertex feature images in the vertex feature image set, selecting two-thirds of the vertex feature images to form a model training set, and the remaining one-third of the vertex feature images to form a model test set;
[0097] S703: setting corresponding network parameters and training parameters based on Model, inputting the model training set into Model for training, and obtaining the corner defect detection model PreModel;
[0098] S704: input the model test set into the corner impact defect detection model PreModel for detection, compare the detection result with the marked corner impact information, and calculate the model error ε;
[0099] S705: Determine whether ε<c is satisfied. If the judgment result is yes, obtain a high-precision corner defect detection model Pre-Model; if the judgment result is no, return to step S703; wherein c represents the industry standard error.
[0100] In this embodiment, when the judgment result is no, return to step S703, adjust the network parameters and training parameters, and then re-train and test according to the training set and the test set until the error of the detection model is within the standard error range, thereby obtaining a high-precision detection model.
[0101] In this embodiment, the high-precision corner defect detection model Pre-Model is a detection model PreModel that meets the error standard, that is, ε<c, and is finally obtained by continuously training the detection model PreModel.
[0102] S8: Detect the packaging box according to the trained packaging box corner defect detection model.
[0103] In this embodiment, a 27-layer lightweight network based on the YOLOV framework is constructed, which can ensure both detection accuracy and training speed. Sample data is used for training verification to ensure that a high-precision detection model of the tablet computer is finally obtained.
[0104] The embodiment of the present invention further provides a device for detecting corner defects of a packaging box, comprising:
[0105] A feature fusion module is used to obtain a packaging box detection image and process the detection image to obtain a feature image;
[0106] Specifically, the feature fusion module of the embodiment of the present invention performs feature fusion through steps S101-S104 in the above-mentioned packaging box corner defect detection method embodiment to obtain a feature image;
[0107] The image processing module is used to extract the binary image of the feature image and perform a closing operation on the binary image to obtain an image mask; find the boundary of the packaging box in the image mask to obtain a boundary point set, perform multiple equidistant sparse sampling on the boundary point set, and determine the center positions of the four vertex corners of the packaging box based on the slope of the line connecting the sampled adjacent boundary points; preset a radius value, select the vertex area at the center position of the four vertex corners on the feature image, and construct a local mask of the vertex area of the packaging box; perform a multiplication operation on the local mask of the vertex area of the packaging box and the feature image to obtain a vertex feature image of the packaging box;
[0108] Specifically, the image processing module of the embodiment of the present invention performs image processing through steps S2-S5 in the embodiment of the above-mentioned packaging box corner defect detection method to obtain a corner feature image of the packaging box;
[0109] A data acquisition module is used to collect samples of packaging boxes with corner defects and obtain a set of feature images of the top corners of the packaging boxes;
[0110] Specifically, after the data acquisition module of the embodiment of the present invention collects the packaging box sample with corner collision defects, the feature fusion module and the image processing module perform feature extraction and image processing through steps S1-S5 in the embodiment of the packaging box corner collision defect detection method to obtain a set of feature images of the top corners of the packaging box;
[0111] The model building module is used to design a lightweight deep neural network based on the YOLOV framework, build a packaging box corner defect detection model, and train the detection model based on the top corner feature image set;
[0112] Specifically, the model building module of the embodiment of the present invention performs image processing through steps S701-S705 in the above-mentioned package box corner impact defect detection method embodiment to obtain a package box corner impact defect detection model;
[0113] The detection module is used to detect the packaging box according to the trained packaging box corner defect detection model.
[0114] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-mentioned packaging box corner defect detection method.
[0115] The detection method proposed in the embodiment of the present invention is based on local positioning and local segmentation, adopts a lightweight learning network and a non-end-to-end training application strategy, directly uses the enhanced image gradient feature map as input, avoids the design of deeper learning module layers, and can quickly and efficiently detect mixed types and multi-scale corner defects. The designed deep network model is highly scalable and can be used for transfer learning applications of other types of problems.
[0116] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for detecting corner defects of a packaging box, characterized in that: include: S1: Acquire a packaging box detection image; process the detection image to obtain a feature image; S2: extract the binary image of the feature image, and perform a closing operation on the binary image to obtain an image mask; S3: Find the border of the packaging box in the image mask and obtain the boundary point set, perform multiple equidistant sparse sampling on the boundary point set, and determine the center positions of the four vertex corners of the packaging box based on the slopes of the lines connecting the sampled adjacent boundary points; S4: preset the radius value, select the vertex area at the center of the four vertex corners on the feature image, and construct a local mask of the vertex area of the packaging box; S5: multiplying the local mask of the top corner area of the packaging box with the feature image to obtain a top corner feature image of the packaging box; S6: Collect a sample of a packaging box with corner defects, and obtain a set of top corner feature images of the packaging box according to steps S1-S5; S7: Design a lightweight deep neural network based on the YOLOV framework, build a packaging box corner defect detection model, and train the detection model based on the top corner feature image set; S8: inspecting the packaging box according to the trained packaging box corner defect detection model; The step S3 specifically includes: S301: Find the packaging box boundary in the image mask to obtain the boundary point set S: S={(x i ,y i )i=1,2,...,N}, Where N is the number of boundary points, x i ,y i are the horizontal and vertical coordinates of the boundary point respectively; S302: Perform equidistant sparse sampling on the boundary point set S to obtain a boundary point subset S0: S0={(x j ,y j )j=1,2,...,n}, where n is the number of samples; S303: Calculate the slope k of the line connecting two adjacent points in the boundary point subset S0 j : k j (y j -y j-1 ) / (x j -x j-1 ),(j=1,2,…,n-1)? S304: Search and record the conditions that satisfy 1<|arctan((k j -k j+1 ) / (1+k j k j+1 ))|<1.6 target boundary point; S305: Repeat steps S302-S304 to perform multiple equidistant sparse sampling on the boundary point set to obtain the target boundary point set X: X={(x k ,and k )|(x k ,and k )∈S,k=1,2,...}; S306: Calculate the average coordinates of the target boundary points belonging to the same vertex respectively, and define the average coordinates as the center position of the vertex, thereby obtaining the center positions of the four vertexes.
2. The method for detecting corner defects of packaging boxes according to claim 1, characterized in that: The step S1 specifically includes: S101: Acquire two packaging box detection images of the same size, wherein the two detection images are an image shot in a high-light exposure mode and an image shot in a low-light exposure mode of the same packaging surface of the packaging box; S102: performing nearest neighbor interpolation compression of the same scale on the two detection images respectively to obtain two compressed images; S103: Calculate the gradients of the two compressed images respectively by combining high-pass filtering to obtain two gradient images; S104: Using Wiener filtering to perform highlight fusion on the two gradient images to obtain a feature image.
3. The method for detecting corner defects of packaging boxes according to claim 2, characterized in that: The detection image is a grayscale image.
4. The method for detecting corner defects of a packaging box according to claim 1, characterized in that: Before calculating the average coordinates of the target boundary points belonging to the same vertex, the step further includes determining whether the target boundary points belong to the same vertex, specifically including: S3061: According to the formula Calculate the distance d between the target boundary points ij ; S3062: If d ij <δ, then the vertex (x i ,y i ) and (x j ,y j ) belong to the same vertex, where δ is twice the maximum spacing between adjacent boundary points in subset S0.
5. The method for detecting corner defects of packaging boxes according to claim 1, characterized in that: The step S2 of extracting the binary image of the feature image specifically includes: performing median filtering on the feature image and extracting features using a canny operator to obtain a binary image of the feature image.
6. The method for detecting corner defects of a packaging box according to claim 1, characterized in that: The step S7 specifically includes: S701: Design a lightweight deep neural network model based on the YOLOV framework; S702: sequentially labeling the collision angle information of the vertex feature images in the vertex feature image set, selecting two-thirds of the vertex feature images to form a model training set, and the remaining one-third of the vertex feature images to form a model test set; S703: setting corresponding network parameters and training parameters based on Model, inputting the model training set into Model for training, and obtaining the corner defect detection model PreModel; S704: input the model test set into the corner impact defect detection model PreModel for detection, compare the detection result with the marked corner impact information, and calculate the model error ε; S705: Determine whether ε<c is satisfied. If the judgment result is yes, obtain a high-precision corner defect detection model Pre-Model; if the judgment result is no, return to step S703; wherein c represents the industry standard error.
7. The method for detecting corner defects of a packaging box according to claim 6, characterized in that: The network depth of the deep neural network Model is 27 layers.
8. A device for detecting corner defects of a packaging box based on the method for detecting corner defects of a packaging box according to any one of claims 1 to 7, characterized in that: include: A feature fusion module is used to obtain a packaging box detection image and process the detection image to obtain a feature image; The image processing module is used to extract the binary image of the feature image and perform a closing operation on the binary image to obtain an image mask; find the boundary of the packaging box in the image mask to obtain a boundary point set, perform multiple equidistant sparse sampling on the boundary point set, and determine the center positions of the four vertex corners of the packaging box based on the slope of the line connecting the sampled adjacent boundary points; preset a radius value, select the vertex area at the center position of the four vertex corners on the feature image, and construct a local mask of the vertex area of the packaging box; perform a multiplication operation on the local mask of the vertex area of the packaging box and the feature image to obtain a vertex feature image of the packaging box; A data acquisition module is used to collect samples of packaging boxes with corner defects and obtain a set of feature images of the top corners of the packaging boxes; The model building module is used to design a lightweight deep neural network based on the YOLOV framework, build a packaging box corner defect detection model, and train the detection model based on the top corner feature image set; The detection module is used to detect the packaging box according to the trained packaging box corner defect detection model.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the packaging box corner defect detection method described in any one of claims 1 to 7 are implemented.
