Deep learning-based can making defect detection method, system and equipment
Through the combined combination of multi-directional light source irradiation and tank rotation, the problem of screening and removing metal packaging tank defects before spraying is solved, the detection efficiency and quality are improved, and cost loss is reduced.
Patent Information
- Application Number
- CN202510617390.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2045-05-14
AI Technical Summary
The prior art cannot effectively screen out the appearance defects of the metal packaging can body before spraying, causing the defective can body to enter the spraying process and cause cost loss.
Multi-directional light source irradiation combined with the tank rotation is used to capture reflected light images to perform the first defect analysis; after spraying, texture images are taken and plane conversion and splicing are performed, and region segmentation and second defect analysis are used to use deep learning algorithms.
It realizes efficient screening to eliminate appearance defects before spraying, reduces production costs, and ensures analysis accuracy and efficiency.
Smart Images

Figure CN120471892A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of production detection technology, and in particular to a canning defect detection method, system and equipment based on deep learning. Background Art
[0002] In the metal packaging manufacturing industry, defect detection of cans (such as food and beverage cans) is a key component in ensuring product quality and safety. Common defects include surface scratches, pits, deformation, uneven coatings, and misaligned printing. These defects can be caused by raw material flaws, fluctuations in the stamping process, or wear and tear on production line equipment.
[0003] To achieve automated inspection of can metal, the following methods have been proposed in the prior art. For example, Chinese patent document CN115330702A discloses a method for identifying filling defects in beverage bottles based on depth vision. After acquiring an image of the can, this method uses a convolutional neural network to perform comprehensive inspection of the can's appearance defects, thereby identifying various appearance defects during the filling and subpackaging process. Another example is Chinese patent document CN119228800A, which discloses a method for detecting external defects in packaging cans. This method calculates the comprehensive reflective characteristics of the target area by analyzing the grayscale distribution characteristics, gradient effects, and similarity between target areas in adjacent frame images, thereby reducing misjudgments caused by reflections. The gamma coefficient is then determined based on the evaluation results. The gamma transform can adjust the image contrast to make the defect features more obvious, thereby improving the accuracy of defect detection.
[0004] None of the above solutions involve the process of detecting defects in the base material of the tank before spraying, and it is impossible to remove the tanks with appearance defects in advance before the spraying process, resulting in the defective tanks still entering the subsequent spraying process, causing cost losses. Summary of the Invention
[0005] In order to solve the problems raised in the above background technology, the present application provides a canning defect detection method, system and equipment based on deep learning.
[0006] In order to achieve the above-mentioned purpose of the invention, the present invention proposes a canning defect detection method based on deep learning, comprising: Using light sources to illuminate the can body to be inspected in multiple directions, the can body to be inspected rotates multiple times during the illumination process, and capturing a reflected light image of the surface of the can body to be inspected after each rotation; performing a first defect analysis on the can body to be inspected based on the reflected light image to classify the can body to be inspected into a first qualified can body or a defective can body; After the first qualified can body is sprayed with color, a texture image of the surface of the first qualified can body is photographed again; Performing plane transformation on the texture image to obtain a plane image, and splicing the plane images to obtain a complete image; The complete image is segmented into regions based on a deep learning algorithm to obtain multiple sub-images, and a second defect analysis is performed on the first qualified tank body based on the sub-images to classify the first qualified tank body as a second qualified tank body or the defective tank body.
[0007] Furthermore, the first defect analysis of the tank to be inspected includes the following steps: Each image of the surface of the tank to be inspected is divided into a grid to obtain a plurality of subgrids, and the reflected light images from multiple directions are integrated to obtain an average brightness value of each subgrid. The subgrids located in the same horizontal direction are regarded as a horizontal sequence, and the subgrids located in the same vertical direction are regarded as a vertical sequence. Based on the average brightness values, a first numerical sequence corresponding to the horizontal sequence and a second numerical sequence corresponding to the vertical sequence are constructed; Analyze changes in the first numerical sequence and the second numerical sequence to determine a defective grid in the subgrid, merge adjacent defective grids to obtain a defective region of the can body to be inspected, and classify the can body to be inspected as the defective can body if the area of the defective region is greater than a first threshold; otherwise, classify the can body as the first qualified can body.
[0008] Furthermore, obtaining the average brightness value of each sub-grid includes the following steps: A light source is used to illuminate the tank body to be inspected in four directions. The tank body to be inspected rotates three times, each time by 25 degrees. After each rotation, the reflected light image of the tank body to be inspected is captured in each direction. The brightness values of the subgrid in each reflected light image are summed and averaged to obtain the average brightness value of the subgrid.
[0009] Furthermore, determining the defective grid in the subgrid comprises the following steps: The first numerical sequence and the second numerical sequence are processed based on a sliding window method to obtain a first average value sequence and a second average value sequence, a second threshold is set, and the first average value sequence and the second average value sequence are binarized based on the second threshold to obtain a first processed sequence and a second processed sequence. If sequence points with a value of 1 appear multiple times consecutively in the first processed sequence and the second processed sequence, the grid with the abnormal average brightness value in the sub-grid corresponding to the generation of the sequence point is located as the defective grid.
[0010] Furthermore, performing a second defect analysis on the first qualified tank body includes the following steps: Obtain a template image of the sub-image, align the sub-image with the template image, and after alignment, calculate the absolute value of the difference between the corresponding pixels of the sub-image and the template image, sum the absolute values to obtain a comprehensive value. If the comprehensive value is greater than a third threshold, determine that the sub-image has a defect, and classify the corresponding first qualified can body as the defective can body.
[0011] Furthermore, aligning the sub-image with the template image comprises the following steps: setting a plurality of reference areas for the template image, selecting one of the reference areas as a calibration area, recording standard area coordinates and a standard pixel distribution of the calibration area, intercepting a control area within the standard area coordinates in the sub-image after acquiring the sub-image, and acquiring an actual pixel distribution of the control area, calculating a similarity between the calibration area and the control area based on the standard pixel distribution and the actual pixel distribution, and if the similarity is greater than a fourth threshold, aligning the sub-image and the template image based on the calibration area and the control area; If the similarity is less than or equal to the fourth threshold, then another reference area is reselected as the calibration area; if the similarity between the reselected calibration area and the corresponding control area is less than or equal to the fourth threshold, then the first qualified can body is directly classified as the defective can body.
[0012] Further, after first acquiring the similarity between the calibration area and the control area, if the similarity is less than or equal to the fourth threshold, splitting the calibration area into a first grid image and splitting the control area into a second grid image, determining a similarity distribution trend between the calibration area and the control area based on the first grid image and the second grid image, and intercepting an extended area in the template image according to the similarity distribution trend; The extended area and the calibrated area are merged into an extended image; if a matching area is located in the extended image, and the similarity between the matching area and the control area is greater than the fourth threshold, the sub-image is aligned with the template image based on the control area and the matching area; if the matching area is not located, another reference area is reselected as the calibrated area.
[0013] Furthermore, the deep learning algorithm is a U-Net semantic segmentation model, which performs planar transformation on the texture image based on affine transformation.
[0014] A canning defect detection system based on deep learning is used to implement the above-mentioned canning defect detection method based on deep learning. The system includes: an acquisition module, which uses a light source to illuminate the can body to be inspected in multiple directions, and the can body to be inspected rotates multiple times during the illumination process. After each rotation, an image of the reflected light on the surface of the can body to be inspected is captured. After the first qualified can body is painted, a texture image of the surface of the first qualified can body is captured again. a first analysis module, performing a first defect analysis on the can body to be inspected based on the reflected light image, so as to classify the can body to be inspected as a first qualified can body or a defective can body; a conversion module, performing plane conversion on the texture image to obtain a plane image, and splicing the plane images to obtain a complete image; The second analysis module performs regional segmentation on the complete image based on a deep learning algorithm to obtain multiple sub-images, and performs a second defect analysis on the first qualified tank body based on the sub-images to classify the first qualified tank body as a second qualified tank body or the defective tank body.
[0015] A canning defect detection device based on deep learning includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method described above is implemented.
[0016] This embodiment first uses a deep learning algorithm to segment the complete image into multiple sub-regions. A corresponding sub-image is generated based on the image content of each sub-region. Then, using a difference method, the sub-image is compared with a pre-set template image to determine whether the sub-region has defects. The complete image is analyzed in two stages: the deep learning algorithm only segments the image contours, and then uses a difference method to quickly compare each region, significantly improving analysis efficiency while ensuring accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flowchart of the steps of the canning defect detection method based on deep learning in this application; Figure 2 This is a schematic diagram of the tank rotation process for this application; Figure 3 A comparative diagram of the expanded area and the designated area for this application; Figure 4 This is a structural diagram of the canning defect detection system based on deep learning in this application. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0019] It is understood that the terms "first," "second," etc., used herein may be used to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script without departing from the scope of this application.
[0020] like Figure 1 As shown, a canning defect detection method based on deep learning includes: S1: Use light sources to illuminate the can to be inspected in multiple directions. During the illumination process, the can to be inspected rotates multiple times. After each rotation, an image of the reflected light on the surface of the can to be inspected is captured.
[0021] This embodiment inspects the sides of cans, specifically using light sources to illuminate the cans from the front, back, left, and right directions. After the can enters the inspection area, it rotates three times, each 25 degrees. A camera is positioned on either side of each light source. After the can enters the inspection area, the camera illuminates the can once, and then captures an image of the reflected light with each subsequent rotation. In other embodiments, only one light source may be used, with two or more rotations.
[0022] S2: performing a first defect analysis on the can body to be inspected based on the reflected light image, so as to classify the can body to be inspected into a first qualified can body or a defective can body.
[0023] When there are scratches, pits, etc. on the surface of the can to be inspected, the brightness value of the pixel point will change. Therefore, the defect analysis of the can to be inspected can be performed based on the change in the brightness value of the pixel point in the reflected light image. When defects are detected on the surface of the can, the can is judged as a defective can and subsequent spraying is no longer performed. The can without defects is set as the first qualified can and subsequent spraying is continued.
[0024] S3: After the first qualified can body is sprayed with color, a texture image of the surface of the first qualified can body is photographed again.
[0025] S4: performing plane transformation on the texture image to obtain a plane image, and splicing the plane images to obtain a complete image.
[0026] After the first qualified can is sprayed with the pattern, it reenters the inspection area. Specifically, this embodiment features cameras positioned in all four directions, eliminating the need for rotation. If only one camera were used, at least one rotation would be required to obtain images of the front and rear sides. Since the can is non-planar, a plane transformation would be required after acquiring the image to obtain a flat image. Finally, if only one camera is used, the texture images are spliced based on the can's rotation direction. If four cameras are used, the four images are spliced based on the camera's shooting position.
[0027] S5: Performing regional segmentation on the complete image based on a deep learning algorithm to obtain multiple sub-images, and performing a second defect analysis on the first qualified can body based on the sub-images to classify the first qualified can body as a second qualified can body or a defective can body.
[0028] This embodiment first uses a deep learning algorithm to segment the complete image into multiple sub-regions. A corresponding sub-image is generated based on the image content of each sub-region. Then, using a difference method, the sub-image is compared with a pre-set template image to determine whether the sub-region has defects. The complete image is analyzed in two stages: the deep learning algorithm only segments the image contours, and then uses a difference method to quickly compare each region, significantly improving analysis efficiency while ensuring accuracy.
[0029] The present invention uses multi-directional light source illumination and combines the reflected light image captured by the rotation of the tank body to perform preliminary defect analysis, thereby efficiently and accurately screening out defective tanks, avoiding ineffective spraying, and saving costs; after spraying qualified tanks, texture images are captured, and a complete image is obtained through plane conversion and splicing, ensuring the accuracy of subsequent analysis; finally, after the complete image is completed using a deep learning algorithm, multiple sub-images are obtained, and each sub-image is then analyzed in detail. This method takes into account both analysis accuracy and efficiency, and comprehensively improves the effectiveness and quality of canning defect detection.
[0030] It is particularly noteworthy that, through the present invention, cans with appearance defects can be removed in advance before the spraying process, thereby reducing cost losses in the production process.
[0031] In this embodiment, performing the first defect analysis on the tank to be inspected includes the following steps: Each image of the tank surface to be inspected is divided into grids to obtain multiple sub-grids. The multi-directional reflected light images are integrated to obtain the average brightness value of each sub-grid. The sub-grids located in the same horizontal direction are regarded as a horizontal sequence, and the sub-grids located in the same vertical direction are regarded as a vertical sequence. Based on the average brightness value, a first numerical sequence corresponding to the horizontal sequence and a second numerical sequence corresponding to the vertical sequence are constructed.
[0032] Specifically, obtaining the average brightness value of each sub-grid includes the following steps: Light sources are used to illuminate the tank to be inspected in four directions. The tank to be inspected rotates three times, each time by 25 degrees. After each rotation, a reflected light image of the tank to be inspected is captured in each direction. The brightness values of the subgrids in each reflected light image are summed and averaged to obtain the average brightness value of the subgrids.
[0033] Reference Figure 2 Four light sources are used to illuminate the can H to be inspected. First, the can surface is segmented into a grid, for example, into 50x50 subgrids. At the same time, a corresponding relationship is established between each subgrid in different reflected light images based on the rotation angle. For example, in reflected light image 1 captured by camera R, subgrid W is in row 10, column 10. After the can rotates 25 degrees, subgrid W is in row 10, column 15 in reflected light image 2 captured by camera R.
[0034] At the location of subgrid W, since it faces the light source of camera R, there will be a relatively high brightness in the reflected light image 1 of camera C, which is defined here as brightness level A1. After the tank body rotates 25 degrees counterclockwise for the first time, the brightness level of subgrid W decreases to A2. After the tank body rotates 25 degrees counterclockwise for the second time, the brightness level of subgrid W decreases to A3. After the tank body rotates 25 degrees counterclockwise for the third time, the brightness level of grid W increases to A2 (entering the illumination range of the light source above).
[0035] Based on the reflected light image taken by camera R, the first brightness value of sub-grid W (corresponding to brightness level A1) is obtained, the second brightness value of sub-grid W after the first rotation (corresponding to brightness level A2), and the third brightness value of sub-grid W after the second rotation (corresponding to brightness level A3) is obtained. The fourth brightness value of sub-grid W (corresponding to the last brightness level A2) is obtained through the reflected light image taken by camera P. The first to fourth brightness values are summed and averaged to obtain the average brightness value of the sub-grid.
[0036] For each area on the tank surface, rotating in this way will obtain the above-mentioned brightness level A1, two brightness levels A2, and one brightness level A3. Therefore, by taking the summed average value, the brightness value changes caused by the light source change during the rotation process can be eliminated, thereby improving the accuracy of subsequent analysis.
[0037] The changes in the first and second numerical sequences are analyzed to determine the defective grid in the subgrid. Adjacent defective grids are merged to obtain the defective region of the can to be inspected. If the area of the defective region is greater than a first threshold, the can to be inspected is classified as a defective can; otherwise, it is classified as a first qualified can.
[0038] After obtaining the average brightness value, a first numerical sequence and a second numerical sequence are constructed for the subgrids. The first numerical sequence represents the horizontal brightness variation of the can under inspection, while the second numerical sequence represents the vertical brightness variation of the can under inspection. Therefore, if a sudden change in brightness occurs in the first or second numerical sequence, it may indicate a pit or scratch. The subgrid with the sudden change is considered a defective grid. Next, adjacent defective grids are merged to determine the defect area on the can surface. If the defect area is greater than a first threshold (for example, 1 / 30 of the can surface area under inspection), the can under inspection is considered defective.
[0039] In this embodiment, determining a defective grid in a subgrid includes the following steps: The first numerical sequence and the second numerical sequence are processed based on the sliding window method to obtain a first average value sequence and a second average value sequence, a second threshold is set, and the first average value sequence and the second average value sequence are binarized based on the second threshold to obtain a first processed sequence and a second processed sequence. If sequence points with a value of 1 appear multiple times consecutively in the first processed sequence and the second processed sequence, the grid with an abnormal average brightness value in the subgrid corresponding to the generation of the sequence point is located as a defective grid.
[0040] Set the sliding window size to 3. If the first numerical sequence is [3, 3, 8, 3, 3, 3], the corresponding first average value sequence generated is [4.67, 4.67, 4.67, 3]. If the second threshold is set to 4, sequence points greater than the second threshold are converted to 1, and sequence points less than or equal to the second threshold are converted to 0. The first processing sequence generated is [1, 1, 1,0]. Sequence point 1 appears continuously, and the average brightness value of the subgrid generated in this sequence point is [3, 3, 8, 3, 3,]. The average brightness value of the third subgrid is abnormal, so this subgrid is defined as a defective grid.
[0041] In this embodiment, performing a second defect analysis on the first qualified tank body includes the following steps: Obtain a template image of the sub-image, align the sub-image with the template image, and after alignment, calculate the absolute value of the difference between the corresponding pixels of the sub-image and the template image, sum the absolute values to obtain a comprehensive value. If the comprehensive value is greater than a third threshold, it is determined that the sub-image has defects, and the corresponding first qualified can body is classified as a defective can body.
[0042] The template image is a complete image prepared in advance that corresponds to the sub-image. Because the sub-image and template image similarity is calculated using a difference method, the two images must be aligned before calculation to ensure accuracy. After alignment, the pixel values of corresponding pixels in the sub-image and template image are subtracted, and the absolute values of the differences are accumulated as a composite value. A larger composite value indicates a greater difference between the two images. A third threshold is used to quantify the similarity between the two images. When the composite value exceeds the third threshold, it is determined that there is a significant difference between the sub-image and the template image, and the corresponding first qualified can is classified as a defective can.
[0043] In this embodiment, aligning the sub-image with the template image includes the following steps: A plurality of reference areas are set for the template image, and one reference area is selected as the calibration area. The standard area coordinates and the standard pixel distribution of the calibration area are recorded. After obtaining the sub-image, the control area within the standard area coordinates in the sub-image is intercepted, and the actual pixel distribution of the control area is obtained. The similarity between the calibration area and the control area is calculated based on the standard pixel distribution and the actual pixel distribution. If the similarity is greater than a fourth threshold, the sub-image and the template image are aligned based on the calibration area and the control area.
[0044] For example, three reference areas are set in the template image, and the size of the reference area is 1 / 10 or 1 / 8 of the template image. A coordinate system is established with a vertex of the template image as the coordinate origin, and the coordinates of each vertex of the reference area are obtained as the area coordinates. Before alignment, a reference area is randomly selected as the calibration area, and the corresponding area coordinates are used as the standard area coordinates. Based on the same method, a coordinate system is established in the sub-image, and the part of the standard area coordinates is intercepted as the control area. Afterwards, the actual pixel distribution of the control area and the standard pixel distribution of the calibration area are obtained, and the similarity between the two is determined specifically by the pixel distribution histogram. If the similarity is greater than the fourth threshold, it indicates that the calibration area and the control area are similar, and the sub-image is aligned with the template image based on the two as anchor points. The fourth threshold is, for example, 0.95. Since the control area and the calibration area are relatively small, the similarity of the two images can be quickly determined by the color histogram.
[0045] If the similarity is less than or equal to the fourth threshold, another reference area is reselected as the calibration area. If the similarity between the reselected calibration area and the corresponding control area is less than or equal to the fourth threshold, the first qualified can body is directly classified as a defective can body.
[0046] If the control area and the calibration area are determined to be dissimilar, this may be due to a coating problem. To continue the subsequent alignment, the present invention selects another reference area for comparison. If the comparison is successful, alignment is performed based on the successfully compared reference area and the control area. If the comparison fails, the first qualified can body is classified as a defective can body.
[0047] Furthermore, after obtaining the similarity between the calibration area and the control area for the first time, if the similarity is less than or equal to a fourth threshold, the calibration area is split into a first grid image, and the control area is split into a second grid image. Based on the first grid image and the second grid image, the similarity distribution trend of the calibration area and the control area is determined, and the extended area is intercepted in the template image according to the similarity distribution trend.
[0048] After selecting a reference area as the calibration area for the first time, if the similarity between the calibration area and the control area is less than a fourth threshold, the calibration area is split into a plurality of first grid images, and the control area is split into a second grid image, and then the similarity between each first grid image and the second grid image is compared to determine the similarity distribution trend between the calibration area and the control area; Figure 3 As shown in the figure, it is necessary to compare the sub-image X and the template image Y, where the calibration area I and the control area J are selected. Through comparison, it is determined that the lower half Q of the calibration area I and the upper half V of the control area J are very similar, indicating that the calibration area has deviated upward. Therefore, the extended area is intercepted downward with the calibration area as the starting point.
[0049] The extended area and the calibration area are merged into an extended image. If a matching area is located in the extended image and the similarity between the matching area and the control area is greater than a fourth threshold, the sub-image is aligned with the template image based on the control area and the matching area. If no matching area is located, another reference area is reselected as the calibration area.
[0050] By comparing the extended area with the control area, it is determined that a portion of the extended area is very similar to the control area, e.g. Figure 3 If region F in the calibration region is very similar to region G in the reference region, region F is merged with the lower half of the calibration region Q to form region Z. Region Z includes regions G and F, and the reference region includes V and F. If the similarity between region Z and the reference region exceeds a fourth threshold, region Z is selected as the matching region. The sub-image is then aligned with the template image based on the matching and reference regions. If no matching region is found, another reference region is selected for subsequent comparison based on the previous method.
[0051] In this embodiment, the deep learning algorithm is a U-Net semantic segmentation model, which performs planar transformation on the texture image based on affine transformation.
[0052] like Figure 4 As shown, a canning defect detection system based on deep learning is used to implement the above-mentioned canning defect detection method based on deep learning. The system includes: The acquisition module uses light sources to illuminate the can body to be inspected in multiple directions. During the illumination process of the light source, the can body to be inspected rotates multiple times. After each rotation, the reflected light image of the surface of the can body to be inspected is captured. After the first qualified can body is sprayed with color, the texture image of the surface of the first qualified can body is captured again.
[0053] The first analysis module performs a first defect analysis on the can body to be inspected based on the reflected light image, so as to classify the can body to be inspected into a first qualified can body or a defective can body.
[0054] The conversion module performs plane conversion on the texture image to obtain a plane image, and splices the plane images to obtain a complete image.
[0055] The second analysis module performs regional segmentation on the complete image based on a deep learning algorithm to obtain multiple sub-images, and performs a second defect analysis on the first qualified can body based on the sub-images to classify the first qualified can body as a second qualified can body or a defective can body.
[0056] A canning defect detection device based on deep learning includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method described above is implemented.
[0057] It should be understood that the various technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the various technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0058] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A canning defect detection method based on deep learning, characterized in that: Using light sources to illuminate the can body to be inspected in multiple directions, the can body to be inspected rotates multiple times during the illumination process, and capturing a reflected light image of the surface of the can body to be inspected after each rotation; performing a first defect analysis on the can body to be inspected based on the reflected light image to classify the can body to be inspected into a first qualified can body or a defective can body; After the first qualified can body is sprayed with color, a texture image of the surface of the first qualified can body is photographed again; Performing plane transformation on the texture image to obtain a plane image, and splicing the plane images to obtain a complete image; The complete image is segmented into regions based on a deep learning algorithm to obtain multiple sub-images, and a second defect analysis is performed on the first qualified tank body based on the sub-images to classify the first qualified tank body as a second qualified tank body or the defective tank body.
2. The method according to claim 1, characterized in that The first defect analysis of the tank to be inspected includes the following steps: Each image of the surface of the tank to be inspected is divided into a grid to obtain a plurality of subgrids, and the reflected light images from multiple directions are integrated to obtain an average brightness value of each subgrid. The subgrids located in the same horizontal direction are regarded as a horizontal sequence, and the subgrids located in the same vertical direction are regarded as a vertical sequence. Based on the average brightness values, a first numerical sequence corresponding to the horizontal sequence and a second numerical sequence corresponding to the vertical sequence are constructed; Analyze changes in the first numerical sequence and the second numerical sequence to determine a defective grid in the subgrid, merge adjacent defective grids to obtain a defective region of the can body to be inspected, and classify the can body to be inspected as the defective can body if the area of the defective region is greater than a first threshold; otherwise, classify the can body as the first qualified can body.
3. The method according to claim 2, characterized in that Obtaining the average brightness value of each sub-grid comprises the following steps: A light source is used to illuminate the tank body to be inspected in four directions. The tank body to be inspected rotates three times, each time by 25 degrees. After each rotation, the reflected light image of the tank body to be inspected is captured in each direction. The brightness values of the subgrid in each reflected light image are summed and averaged to obtain the average brightness value of the subgrid.
4. The method according to claim 2, characterized in that Determining the defective grid in the subgrid comprises the following steps: The first numerical sequence and the second numerical sequence are processed based on a sliding window method to obtain a first average value sequence and a second average value sequence, a second threshold is set, and the first average value sequence and the second average value sequence are binarized based on the second threshold to obtain a first processed sequence and a second processed sequence. If sequence points with a value of 1 appear multiple times consecutively in the first processed sequence and the second processed sequence, the grid with the abnormal average brightness value in the sub-grid corresponding to the generation of the sequence point is located as the defective grid.
5. The method according to claim 1, wherein Performing a second defect analysis on the first qualified tank body includes the following steps: Obtain a template image of the sub-image, align the sub-image with the template image, and after alignment, calculate the absolute value of the difference between the corresponding pixels of the sub-image and the template image, sum the absolute values to obtain a comprehensive value. If the comprehensive value is greater than a third threshold, determine that the sub-image has a defect, and classify the corresponding first qualified can body as the defective can body.
6. The method according to claim 5, characterized in that Aligning the sub-image with the template image comprises the following steps: setting a plurality of reference areas for the template image, selecting one of the reference areas as a calibration area, recording standard area coordinates and a standard pixel distribution of the calibration area, intercepting a control area within the standard area coordinates in the sub-image after acquiring the sub-image, and acquiring an actual pixel distribution of the control area, calculating a similarity between the calibration area and the control area based on the standard pixel distribution and the actual pixel distribution, and if the similarity is greater than a fourth threshold, aligning the sub-image and the template image based on the calibration area and the control area; If the similarity is less than or equal to the fourth threshold, then another reference area is reselected as the calibration area; if the similarity between the reselected calibration area and the corresponding control area is less than or equal to the fourth threshold, then the first qualified can body is directly classified as the defective can body.
7. The method according to claim 6, characterized in that After first acquiring the similarity between the calibration area and the control area, if the similarity is less than or equal to the fourth threshold, splitting the calibration area into a first grid image and splitting the control area into a second grid image, determining a similarity distribution trend between the calibration area and the control area based on the first grid image and the second grid image, and intercepting an extended area in the template image according to the similarity distribution trend; The extended area and the calibrated area are merged into an extended image; if a matching area is located in the extended image, and the similarity between the matching area and the control area is greater than the fourth threshold, the sub-image is aligned with the template image based on the control area and the matching area; if the matching area is not located, another reference area is reselected as the calibrated area.
8. The method according to claim 1, characterized in that The deep learning algorithm is a U-Net semantic segmentation model, which performs planar transformation on the texture image based on affine transformation.
9. A canning defect detection system based on deep learning, used to implement a canning defect detection method based on deep learning as described in any one of claims 1 to 8, characterized in that: The system includes: an acquisition module, which uses a light source to illuminate the can body to be inspected in multiple directions, and the can body to be inspected rotates multiple times during the illumination process. After each rotation, an image of the reflected light on the surface of the can body to be inspected is captured. After the first qualified can body is painted, a texture image of the surface of the first qualified can body is captured again. a first analysis module, performing a first defect analysis on the can body to be inspected based on the reflected light image, so as to classify the can body to be inspected as a first qualified can body or a defective can body; a conversion module, performing plane conversion on the texture image to obtain a plane image, and splicing the plane images to obtain a complete image; The second analysis module performs regional segmentation on the complete image based on a deep learning algorithm to obtain multiple sub-images, and performs a second defect analysis on the first qualified tank body based on the sub-images to classify the first qualified tank body as a second qualified tank body or the defective tank body.
10. A canning defect detection device based on deep learning, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Depth vision-based beverage bottle filling defect identification method
CN115330702A
Packaging tin appearance defect detection method
CN119228800A
Online detection method and system for surface defects of additive manufacturing part
CN113781585A
Fermentation tank processing procedure detection method and system based on artificial intelligence
CN115131346A
Full-automatic polyurea assembled tank production system and method
CN119259312A