Method for detecting quality of honey processing products based on visual detection

CN122841271APending Publication Date: 2026-09-29JIANGXI KANGHUI WANJIA AGRI PROD DEV CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610853618.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-12
Publication Date
2026-09-29

AI Technical Summary

Technical Problem

因而,当检测对象换成蜂蜜加工产品时,现有技术仍然存在适应性不足、检测项目分散以及综合判定能力不强的问题

Benefits of technology

[0066]本发明提供了基于视觉检测的蜂蜜加工产品质量检测方法,具备以下有益效果:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122841271A_ABST
    Figure CN122841271A_ABST
Patent Text Reader

Abstract

The application discloses a honey processing product quality detection method based on visual detection and relates to the technical field of honey quality detection, which comprises the following steps: collecting top-view images and side-view images, generating a product image group and establishing a historical sample set; training a target segmentation model based on the historical sample set and generating product detection quantities through a detection quantity generation mechanism; generating a candidate region combination based on multiple segmentation results, correcting the boundaries to form a target region combination and a target judgment range; determining a final region combination based on the target judgment range and outputting a defect type and a quality result, so that automatic detection and defect judgment of the quality state of a honey processing product are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of honey quality inspection technology, specifically a method for quality inspection of processed honey products based on visual inspection. Background Technology

[0002] During the filling, capping, labeling, and packaging of honey products, common inspection items include the capping status, liquid level, label placement, packaging defects, and the presence of visible abnormalities in the contents. While machine vision has begun to replace some manual sampling on existing production lines, most technical solutions still focus on single-item inspections, typically assessing only one aspect such as liquid level, cap, label, or foreign matter. There is a lack of multi-quantity combined analysis methods for honey products. Due to honey's high viscosity, slow flow rate, significant reflectivity under light, and the tendency for localized bubbles and crystallization areas to blend into the background, existing inspection methods, when applied to honey products, are prone to problems such as unstable detection area positioning, lack of unified judgment criteria between different quantities, and insufficient consistency of test results.

[0003] Chinese invention patent application CN102519972A, published on June 27, 2012, discloses a method for detecting PET bottle caps and liquid levels. This technical solution involves segmenting the bottle image into a region of interest, image preprocessing, symmetry axis positioning, and adapter ring positioning, followed by separate detection of cap defects and liquid level defects, thereby achieving automated visual inspection of packaging container quality on the production line. The patent disclosure indicates that it primarily focuses on detecting the state of the cap and liquid level, employing image segmentation, symmetry axis positioning, and statistical analysis of decision rectangles as implementation methods.

[0004] However, the aforementioned technical solution primarily addresses the detection of PET bottle caps and liquid levels, targeting ordinary filling containers. Its focus is on identifying cap and liquid level defects after bottle positioning. Therefore, this technical solution does not further disclose: how to establish a stable detection benchmark for the slow-flowing boundary caused by high viscosity in honey processing products; how to uniformly extract multiple quality inspection quantities for honey processing products; how to jointly determine packaging appearance and content state inspection quantities within the same product image; and how to output the final quality inspection result based on the combination relationship of multiple inspection quantities. Consequently, when the inspection target is changed to honey processing products, the existing technology still suffers from insufficient adaptability, fragmented inspection items, and weak comprehensive judgment capabilities.

[0005] Therefore, the present invention provides a method for quality inspection of honey processing products based on visual inspection. Summary of the Invention

[0006] (a) Technical problems to be solved

[0007] To address the shortcomings of existing technologies, this invention provides a visual inspection-based method for quality inspection of honey processed products. By visually acquiring top and side view images of honey processed products, and using instance segmentation to extract corresponding areas of the bottle body, honey, air bubbles, impurities, crystals, labels, bottle caps, and bottle mouth, the method further generates values ​​such as filling height, air bubble area ratio, impurity quantity, crystal area ratio, bottle cap coaxial offset, cap seam width, and label offset. This enables automatic detection and defect determination of the quality status of honey processed products.

[0008] (II) Technical Solution

[0009] To achieve the above objectives, the present invention provides the following technical solution: a method for quality inspection of honey processing products based on visual inspection, comprising:

[0010] S1. Collect top-view and side-view images, generate product image sets, and establish a historical sample set;

[0011] S2. Train the target segmentation model based on the historical sample set, and generate the product detection volume through the detection volume generation mechanism;

[0012] S3. Generate candidate region combinations based on multiple segmentation results, and form target region combinations and target determination ranges after boundary correction;

[0013] S4. Determine the final region combination based on the target determination range, and output the defect type and quality results.

[0014] Preferably, a photoelectric trigger, a side-view industrial camera, a top-view industrial camera, and a stable light source are sequentially arranged on the conveyor line. When a single honey processing product passes through the photoelectric trigger, the side-view industrial camera is triggered to capture a side view image of the honey processing product, and the top-view industrial camera is triggered to capture a top view image of the honey processing product. The side view image and the top view image obtained in the same trigger are assigned the same product number, thereby forming a product image group that corresponds one-to-one with the honey processing product. The product image group includes a top view image, a side view image, and a product number.

[0015] To ensure that subsequent pixel distances can be converted into actual distances, after the equipment is installed, the side-view industrial camera and the top-view industrial camera are calibrated using a calibration plate with known scribe line spacing to obtain the corresponding length conversion coefficients. The length conversion coefficient represents the actual length corresponding to a single pixel, and all subsequent height values, gap values, and offset values ​​are obtained by converting them using the length conversion coefficient.

[0016] Multiple sets of product images that have undergone manual review are used as historical sample sets. The historical sample set includes multiple historical samples, each of which contains product image sets and corresponding manual annotation results. The manual annotation results include the side view of the bottle body area, the side view of the honey area, the side view of the bubble area, the side view of the impurity area, the side view of the crystallization area, the side view of the label area, the side view of the bottle cap area, the side view of the bottle mouth area, the top view of the bottle cap area, and the top view of the bottle mouth area, as well as the manual quality judgment results of the product.

[0017] Preferably, the historical sample set is input into the MaskR-CNN network for training to obtain a target segmentation model for online detection; the product image group obtained in step S1 is input into the target segmentation model, and the side-view bottle area, side-view honey area, side-view bubble area, side-view impurity area, side-view crystal area, side-view label area, side-view bottle cap area and side-view bottle mouth area are output in the side-view image, and the top-view bottle cap area and top-view bottle mouth area are output in the top-view image.

[0018] Preferably, the detection quantities of the product image group are generated based on the detection quantity generation mechanism. These detection quantities include filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value, and label offset value, specifically:

[0019] The Suzuki-Ab contour tracking algorithm is used to extract the outer contour of the honey area viewed from the side, and the contour points with the smallest ordinate in each column of pixels are used to form the boundary of the liquid surface viewed from the side. The least squares straight line fitting is then used to obtain the liquid surface line viewed from the side. The minimum bounding rectangle algorithm is used to obtain the center line of the bottle viewed from the side. The distance between the center line of the bottle viewed from the side and the liquid surface line and the lower boundary of the bottle viewed from the side are calculated, and the filling height value is obtained by combining the length conversion factor.

[0020] The side-view bubble region, side-view impurity region, and side-view crystallization region are separated using an 8-neighborhood connected component labeling algorithm. Specifically, the areas of the bubble region and the crystallization region are calculated using a pixel counting method and then divided by the area of ​​the side-view honey region to obtain the bubble area ratio and the crystallization area ratio, respectively. The number of connected components in the impurity region is counted to obtain the impurity quantity value.

[0021] The minimum circumcircle algorithm is used to obtain the corresponding center of the bottle cap area and the bottle mouth area from the top view. The distance between the two center is calculated and the coaxial offset value of the bottle cap is obtained by combining the length conversion factor.

[0022] The Suzuki-Abe contour tracking algorithm is used to extract the contours of the side-view bottle cap area and the side-view bottle mouth area; the contour point with the largest ordinate in each column of pixels in the side-view bottle cap area is taken as the lower boundary of the bottle cap, and the contour point with the smallest ordinate in each column of pixels in the side-view bottle mouth area is taken as the upper boundary of the bottle mouth; the average distance between the two boundaries is calculated, and the sealing gap width is obtained by combining the length conversion factor.

[0023] The minimum bounding rectangle algorithm is used to obtain the center point for both the side-view label area and the side-view bottle area; the horizontal distance between the two center points is calculated, and the label offset value is obtained by combining the length conversion factor.

[0024] Preferably, global histogram equalization is performed on each group of product images in the historical sample set to obtain an enhanced product image group. Each group of product images in the historical sample set and the enhanced product image group are then input into the target segmentation model to obtain corresponding multiple segmentation results, which include multiple candidate regions.

[0025] Candidate region combinations are generated through a candidate region combination generation mechanism. Specifically, for each type of candidate region, regions corresponding to that type are collected from multiple segmentation results to form a candidate region set for that type. The candidate region set includes candidate sets for side-view bottle body regions, side-view honey regions, side-view bubble regions, side-view impurity regions, side-view crystallization regions, side-view label regions, side-view bottle cap regions, side-view bottle mouth regions, top-view bottle cap regions, and top-view bottle mouth regions.

[0026] Each side-view bottle area in the candidate set of side-view bottle areas is used as an initial area to form the first part of the combination; then, candidate areas are selected sequentially from the candidate sets of side-view honey area, side-view bubble area, side-view impurity area, side-view crystallization area, side-view label area, side-view bottle cap area, side-view bottle mouth area, top-view bottle cap area, and top-view bottle mouth area, and gradually added to the first part of the combination to form the second part of the combination;

[0027] After each new candidate region is added, the spatial relationship satisfaction score for each second part combination is calculated. The spatial relationships include: the side-view bubble region is located inside the side-view honey region, the side-view impurity region is located inside the side-view honey region, the side-view crystallization region is located inside the side-view honey region, the side-view liquid surface line is the upper boundary of the side-view honey region, the side-view bottle cap region is located above the side-view bottle mouth region, the top-view bottle mouth region is located inside the top-view bottle cap region, and the side-view label region is located inside the side-view bottle body region. For each second part combination, the above spatial relationships are judged one by one. A valid relationship is recorded as 1, and a invalid relationship is recorded as 0. The scores of all judged spatial relationships are summed to obtain the spatial relationship score of the second part combination.

[0028] Calculate the mean and variance of spatial relationship scores, sort the second part of the combination in descending order of spatial relationship scores, retain the second part of the combination whose spatial relationship score is not less than the mean of spatial relationship scores minus the variance of spatial relationship scores, and use the retained second part of the combination as multiple candidate region combinations.

[0029] For each candidate region combination, calculate the following: mean region overlap ratio, number of relationship violations, and detection bias:

[0030] Average overlap ratio of regions: Compare each type of region in the candidate region combination with the corresponding manually labeled region to obtain the overlap ratio of each type of region, and then take the average of all overlap ratios to obtain the average overlap ratio of regions.

[0031] Relationship Violation Quantity: This counts the number of side-view bubble areas, side-view impurity areas, side-view crystallization areas, side-view liquid level lines, side-view bottle cap areas, top-view bottle mouth areas, and side-view label areas in the candidate region combination that do not satisfy the physical positional relationships. The physical positional relationships include: the side-view bubble areas, side-view impurity areas, and side-view crystallization areas should be located inside the side-view honey area; the side-view liquid level line should be the upper boundary of the side-view honey area; the side-view bottle cap area should be located above the side-view bottle mouth area; the top-view bottle mouth area should be located inside the top-view bottle cap area; and the side-view label area should be located inside the side-view bottle body area. When any one of these areas in the candidate region combination does not satisfy the physical positional relationship, the relationship violation quantity is incremented by one. After determining whether the candidate region combination satisfies the physical positional relationship, the relationship violation quantity value is obtained.

[0032] Detection deviation sum: The detection quantity generation mechanism generates the filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value, and label offset value of the candidate area combination. Then, these detection quantities are subtracted from the corresponding manual measurements one by one to obtain the difference value. The absolute values ​​of the difference values ​​are added together to obtain the detection deviation sum.

[0033] Preferably, the candidate region combination with the largest average regional overlap ratio is retained first; when the average regional overlap ratios are the same, the candidate region combination with the smallest number of relationship violations is retained; when the number of relationship violations is still the same, the candidate region combination with the smallest detection deviation is retained.

[0034] Perform boundary correction on the retained candidate region combinations; the boundary correction includes:

[0035] The upper boundary of the side-viewed honey area was re-extracted as the side-viewed liquid level line;

[0036] Take the intersection of the side-viewed bubble region, side-viewed impurity region, and side-viewed crystallization region with the side-viewed honey region, so that all three fall into the interior of the side-viewed honey region;

[0037] When the lower boundary of the side-view bottle cap area is lower than the upper boundary of the side-view bottle mouth area, the pixels of the side-view bottle cap area that extend below the upper boundary of the side-view bottle mouth area will be deleted.

[0038] If there are pixels in the top-view bottle opening area that fall outside the top-view bottle cap area, delete those pixels.

[0039] If there are pixels in the side-view label area that fall outside the side-view bottle area, delete those pixels;

[0040] After each boundary correction, recalculate the mean regional overlap ratio, the number of relationship violations, and the sum of detection deviations. If the boundary correction increases the mean regional overlap ratio, retain the result. If the mean regional overlap ratio remains unchanged while the number of relationship violations decreases, retain the result. If both the mean regional overlap ratio and the number of relationship violations remain unchanged while the sum of detection deviations decreases, retain the result. Repeat the above boundary correction process until all three evaluation metrics no longer improve after one round of boundary correction, then stop boundary correction.

[0041] The candidate region combination obtained after stopping boundary correction is used as the target region combination of the product image group. The target region combination of the product image group with qualified historical samples by manual quality judgment is selected, and the corrected detection quantity of each qualified historical sample is generated through the detection quantity generation mechanism.

[0042] The target judgment range for the detection quantity is generated using a stable value selection mechanism:

[0043] First, sort the same type of correction detection quantity according to its size, and calculate the difference between every two adjacent correction detection quantities after sorting. Then, average the differences to obtain the average adjacent difference for the correction detection quantity. Next, starting from the smallest correction detection quantity after sorting, check the differences between adjacent correction detection quantities one by one. When the difference between two adjacent correction detection quantities is not greater than the average adjacent difference, classify these two correction detection quantities into the same group of similar values. When the difference between two adjacent correction detection quantities is greater than the average adjacent difference, determine the correction detection quantity that is ranked first and the correction detection quantities that have been classified before it into a group of similar values, and use the correction detection quantity that is ranked last as the starting value of the next group of similar values. Repeat the above steps to traverse all values ​​and obtain multiple groups of similar values.

[0044] The number of corrected detection quantities in each similar value group is compared, and the similar value group with the largest number of corrected detection quantities is determined as the stable value group corresponding to the corrected detection quantity. When there are multiple similar value groups with the same number of corrected detection quantities, the similar value group with the smallest numerical range of the corrected detection quantities is determined as the stable value group. Then, the corrected detection quantity with the smallest value in the stable value group is taken as the lower boundary, and the corrected detection quantity with the largest value in the stable value group is taken as the upper boundary, thereby forming the target judgment range corresponding to the detection quantity. The target judgment range includes the target judgment range of filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, sealing seam width value, and label offset value.

[0045] Preferably, for the product image group obtained in step S1, global histogram equalization is performed to obtain an enhanced product image group. The product image group and the enhanced product image group are respectively input into the target segmentation model to obtain corresponding multiple segmentation results. Multiple candidate region combinations are generated through a candidate region combination generation mechanism.

[0046] For each candidate region combination, perform boundary correction to obtain the target region combination; then calculate the relationship violation quantity and interval deviation sum:

[0047] Interval Deviation Sum: The target area combination generates filling height, bubble area ratio, impurity quantity, crystallization area ratio, cap coaxial offset, cap seam width, and label offset values ​​through the detection quantity generation mechanism. For each detection quantity, if it is within the corresponding target judgment range, the deviation value is recorded as zero; if it is less than the lower boundary of the corresponding target judgment range, the absolute value of the difference between it and the lower boundary is recorded as the deviation value; if it is greater than the upper boundary of the corresponding target judgment range, the absolute value of the difference between it and the upper boundary is recorded as the deviation value. The interval deviation sum is obtained by summing the deviation values ​​of all detection quantities.

[0048] First, retain the candidate region combination with the smallest number of relationship violations; when the number of relationship violations is the same, continue to retain the candidate region combination with the smallest interval deviation.

[0049] Preferably, based on the final region combination, the filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value, and label offset value of the product to be inspected are generated, and these detection quantities are compared with the corresponding target judgment range item by item to determine the defect type. The defect type includes filling defects, cap defects, label defects, bubble defects, impurity defects, and crystallization defects.

[0050] When the filling height value is not within the target judgment range corresponding to the filling height value, it is judged as a filling defect;

[0051] When the coaxial offset value of the bottle cap or the width of the sealing gap is not within the corresponding target judgment range, it is judged as a sealing defect;

[0052] When the label offset value is not within the target judgment range corresponding to the label offset value, it is judged as a label defect;

[0053] When the bubble area percentage is not within the target judgment range corresponding to the bubble area percentage, it is judged as a bubble defect;

[0054] When the impurity quantity value is not within the target judgment range corresponding to the impurity quantity value, it is judged as an impurity defect;

[0055] When the percentage of crystallized area is not within the target judgment range corresponding to the percentage of crystallized area, it is judged as a crystallization defect;

[0056] When there are no defect types, a pass mark is output; when any defect type exists, the honey processing product is placed between the top incident light source and the bottom imaging device. The top incident light source emits detection light downward along the bottle axis, and the bottom imaging device collects the image of the light emitted from the bottom of the bottle after the detection light passes through the honey.

[0057] Based on the emitted light image, the effective transmission area corresponding to the location of the honey inside the bottle is extracted; the pixel brightness in the effective transmission area is statistically analyzed, and the average brightness value of the pixels in the effective transmission area is calculated; dark areas with brightness lower than the average brightness value and which are interconnected are extracted as continuous dark areas; the area of ​​each continuous dark area is calculated, and the area of ​​each continuous dark area is averaged to obtain the average dark area; continuous dark areas with an area not less than the average dark area are identified as black spot areas, and the number of black spot areas is counted to obtain the number of black spots; the ratio of the black spot area to the effective transmission area is calculated to obtain the black spot area ratio.

[0058] The effective transmission area is then divided into multiple sub-regions of equal area. The average brightness value of each sub-region is calculated, and the difference between the maximum and minimum average brightness values ​​of each sub-region is determined as the light transmission distribution difference.

[0059] Extract historical samples that have been manually verified as qualified, and perform the same top transmission detection process on each historical sample to obtain the number of black spots, the proportion of black spot area, and the difference in light transmission distribution. Then, arrange the number of black spots, the proportion of black spot area, and the difference in light transmission distribution corresponding to each historical sample in sequence to form a historical transmission quality feature group.

[0060] Subsequently, for the number of black dots, the proportion of black dot area, and the difference in light transmission distribution, the corresponding value ranges in all historical transmission quality feature groups were statistically analyzed. The number of black dots, the proportion of black dot area, and the difference in light transmission distribution in each historical transmission quality feature group were converted into comparison values ​​under a unified dimension to reduce the impact of different numerical scales between the number of black dots, the proportion of black dot area, and the difference in light transmission distribution on subsequent processing.

[0061] Each historical transmission quality feature group is then regarded as a historical sample point in the feature space, and the average value of the number of black points, the proportion of black point area, and the difference in light transmission distribution of all historical sample points is taken as the initial center point.

[0062] After obtaining the initial center point, the envelope boundary is gradually expanded outward from the adjusted initial center point. During the expansion process, it is continuously checked whether each historical sample point is located inside the current envelope boundary. When the difference between the value covered by the envelope boundary and the initial center point is not greater than the variance of the number of black dots, the proportion of black dot area, and the difference in light transmission distribution of all historical sample points, the expansion is stopped. The boundary formed at this time is determined as the qualified sample envelope boundary.

[0063] Historical sample points located near the boundary of the qualified sample envelope are used as boundary support sample points to define the position and shape of the qualified sample envelope boundary; the qualified sample envelope boundary is used to characterize the distribution range of qualified samples in the transmission quality feature space.

[0064] When judging the quality of the current honey processed product, the same top transmission detection process is performed on the current honey processed product to obtain the current transmission quality feature group, and the current transmission quality feature group is converted into a comparison value consistent with the historical transmission quality feature group; then it is determined whether the current sample point corresponding to the current transmission quality feature group is located inside the qualified sample envelope boundary; when it is located inside the qualified sample envelope boundary, a qualified mark is output; when it is located outside the qualified sample envelope boundary, a non-qualified mark and the corresponding defect type are output, and the rejection execution mechanism is controlled to remove the product to be inspected from the conveyor line.

[0065] (III) Beneficial Effects

[0066] This invention provides a visual inspection-based method for quality inspection of honey processed products, which has the following beneficial effects:

[0067] 1. This invention, by jointly acquiring top and side view images of honey processed products and extracting corresponding areas of the bottle, honey, air bubbles, impurities, crystals, labels, bottle caps, and bottle mouth, can simultaneously obtain multiple detection quantities corresponding to the filling state, sealing state, labeling state, and contents state. Therefore, compared with the existing technology that only targets a single item for detection, it improves the completeness of honey processed product quality detection.

[0068] 2. This invention quantifies the quality status of honey processing products by generating values ​​such as filling height, bubble area ratio, impurity quantity, crystallization area ratio, cap coaxial offset, seal seam width, and label offset. This improves the consistency and reproducibility of test results compared to methods that rely solely on human experience or single image features for judgment.

[0069] 3. By screening candidate combinations and correcting boundaries of the extraction areas, this invention makes the bubble area, impurity area, crystallization area, bottle cap area, bottle mouth area and label area more consistent with their actual positions, thereby reducing the impact of regional extraction deviation on the detection results and improving the stability of the detection quantity and the accuracy of quality judgment.

[0070] 4. This invention compares multiple detection quantities with the corresponding target judgment ranges one by one and outputs the quality results corresponding to filling defects, capping defects, label defects, bubble defects, impurity defects and crystallization defects. This enables the identification and rejection of unqualified honey products directly on the production line, improving online detection efficiency and reducing the workload of manual re-inspection. Attached Figure Description

[0071] Figure 1 This is a schematic diagram of the process for the quality inspection method of honey processing products based on visual inspection according to the present invention. Detailed Implementation

[0072] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0073] Please see Figure 1 This invention provides a visual inspection-based method for quality inspection of honey processed products, comprising the following steps:

[0074] S1. Collect top-view and side-view images, generate product image sets, and establish a historical sample set.

[0075] A photoelectric trigger, a side-view industrial camera, a top-view industrial camera, and a stable light source are sequentially installed on the conveyor line. When a single honey processing product passes through the photoelectric trigger, the side-view industrial camera is triggered to capture a side view image of the honey processing product, and the top-view industrial camera is triggered to capture a top view image of the honey processing product. The side view image and the top view image obtained in the same trigger are assigned the same product number, thereby forming a product image group that corresponds one-to-one with the honey processing product. The product image group includes a top view image, a side view image, and a product number.

[0076] To ensure that subsequent pixel distances can be converted into actual distances, after the equipment is installed, the side-view industrial camera and the top-view industrial camera are calibrated using a calibration plate with known scribe line spacing to obtain the corresponding length conversion coefficients. The length conversion coefficient represents the actual length corresponding to a single pixel, and all subsequent height values, gap values, and offset values ​​are obtained by converting them using the length conversion coefficient.

[0077] Multiple sets of product images that have undergone manual review are used as historical sample sets. The historical sample set includes multiple historical samples, each of which contains product image sets and corresponding manual annotation results. The manual annotation results include the side view of the bottle body area, the side view of the honey area, the side view of the bubble area, the side view of the impurity area, the side view of the crystallization area, the side view of the label area, the side view of the bottle cap area, the side view of the bottle mouth area, the top view of the bottle cap area, and the top view of the bottle mouth area, as well as the manual quality judgment results of the product.

[0078] S2. Train the target segmentation model based on the historical sample set, and generate the product detection volume through the detection volume generation mechanism.

[0079] The historical sample set is input into the MaskR-CNN network for training to obtain a target segmentation model for online detection; the product image group obtained in step S1 is input into the target segmentation model, and the side-view bottle area, side-view honey area, side-view bubble area, side-view impurity area, side-view crystal area, side-view label area, side-view bottle cap area and side-view bottle mouth area are output in the side-view image, and the top-view bottle cap area and top-view bottle mouth area are output in the top-view image.

[0080] The detection parameters of the product image group are generated based on the detection parameter generation mechanism. These parameters include filling height, bubble area ratio, impurity quantity, crystallization area ratio, cap coaxial offset, cap seam width, and label offset. Specifically:

[0081] The Suzuki-Ab contour tracking algorithm is used to extract the outer contour of the honey area viewed from the side, and the contour points with the smallest ordinate in each column of pixels are used to form the boundary of the liquid surface viewed from the side. The least squares straight line fitting is then used to obtain the liquid surface line viewed from the side. The minimum bounding rectangle algorithm is used to obtain the center line of the bottle viewed from the side. The distance between the center line of the bottle viewed from the side and the liquid surface line and the lower boundary of the bottle viewed from the side are calculated, and the filling height value is obtained by combining the length conversion factor.

[0082] The side-view bubble region, side-view impurity region, and side-view crystallization region are separated using an 8-neighborhood connected component labeling algorithm. Specifically, the areas of the bubble region and the crystallization region are calculated using a pixel counting method and then divided by the area of ​​the side-view honey region to obtain the bubble area ratio and the crystallization area ratio, respectively. The number of connected components in the impurity region is counted to obtain the impurity quantity value.

[0083] The minimum circumcircle algorithm is used to obtain the corresponding center of the bottle cap area and the bottle mouth area from the top view. The distance between the two center is calculated and the coaxial offset value of the bottle cap is obtained by combining the length conversion factor.

[0084] The Suzuki-Abe contour tracking algorithm is used to extract the contours of the side-view bottle cap area and the side-view bottle mouth area; the contour point with the largest ordinate in each column of pixels in the side-view bottle cap area is taken as the lower boundary of the bottle cap, and the contour point with the smallest ordinate in each column of pixels in the side-view bottle mouth area is taken as the upper boundary of the bottle mouth; the average distance between the two boundaries is calculated, and the sealing gap width is obtained by combining the length conversion factor.

[0085] The minimum bounding rectangle algorithm is used to obtain the center point for both the side-view label area and the side-view bottle area; the horizontal distance between the two center points is calculated, and the label offset value is obtained by combining the length conversion factor.

[0086] S3. Generate candidate region combinations based on multiple segmentation results, and form target region combinations and target determination ranges after boundary correction.

[0087] Each group of product images in the historical sample set is subjected to global histogram equalization to obtain an enhanced product image group. Each group of product images in the historical sample set and the enhanced product image group are input into the target segmentation model to obtain multiple segmentation results, which include multiple candidate regions.

[0088] Candidate region combinations are generated through a candidate region combination generation mechanism. Specifically, for each type of candidate region, regions corresponding to that type are collected from multiple segmentation results to form a candidate region set for that type. The candidate region set includes candidate sets for side-view bottle body regions, side-view honey regions, side-view bubble regions, side-view impurity regions, side-view crystallization regions, side-view label regions, side-view bottle cap regions, side-view bottle mouth regions, top-view bottle cap regions, and top-view bottle mouth regions.

[0089] Each side-view bottle area in the candidate set of side-view bottle areas is used as an initial area to form the first part of the combination; then, candidate areas are selected sequentially from the candidate sets of side-view honey area, side-view bubble area, side-view impurity area, side-view crystallization area, side-view label area, side-view bottle cap area, side-view bottle mouth area, top-view bottle cap area, and top-view bottle mouth area, and gradually added to the first part of the combination to form the second part of the combination;

[0090] After each new candidate region is added, the spatial relationship satisfaction score for each second part combination is calculated. The spatial relationships include: the side-view bubble region is located inside the side-view honey region, the side-view impurity region is located inside the side-view honey region, the side-view crystallization region is located inside the side-view honey region, the side-view liquid surface line is the upper boundary of the side-view honey region, the side-view bottle cap region is located above the side-view bottle mouth region, the top-view bottle mouth region is located inside the top-view bottle cap region, and the side-view label region is located inside the side-view bottle body region. For each second part combination, the above spatial relationships are judged one by one. A valid relationship is recorded as 1, and a invalid relationship is recorded as 0. The scores of all judged spatial relationships are summed to obtain the spatial relationship score of the second part combination.

[0091] Calculate the mean and variance of spatial relationship scores, sort the second part of the combination in descending order of spatial relationship scores, retain the second part of the combination whose spatial relationship score is not less than the mean of spatial relationship scores minus the variance of spatial relationship scores, and use the retained second part of the combination as multiple candidate region combinations.

[0092] For each candidate region combination, calculate the following: mean region overlap ratio, number of relationship violations, and detection bias:

[0093] Average overlap ratio of regions: Compare each type of region in the candidate region combination with the corresponding manually labeled region to obtain the overlap ratio of each type of region, and then take the average of all overlap ratios to obtain the average overlap ratio of regions.

[0094] Relationship Violation Quantity: This counts the number of side-view bubble areas, side-view impurity areas, side-view crystallization areas, side-view liquid level lines, side-view bottle cap areas, top-view bottle mouth areas, and side-view label areas in the candidate region combination that do not satisfy the physical positional relationships. The physical positional relationships include: the side-view bubble areas, side-view impurity areas, and side-view crystallization areas should be located inside the side-view honey area; the side-view liquid level line should be the upper boundary of the side-view honey area; the side-view bottle cap area should be located above the side-view bottle mouth area; the top-view bottle mouth area should be located inside the top-view bottle cap area; and the side-view label area should be located inside the side-view bottle body area. When any one of these areas in the candidate region combination does not satisfy the physical positional relationship, the relationship violation quantity is incremented by one. After determining whether the candidate region combination satisfies the physical positional relationship, the relationship violation quantity value is obtained.

[0095] Detection deviation sum: The filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value and label offset value of the candidate area combination are generated by the detection quantity generation mechanism. Then, these detection quantities are subtracted from the corresponding manual measurements one by one to obtain the difference value. The absolute values ​​of the difference values ​​are added together to obtain the detection deviation sum.

[0096] First, retain the candidate region combination with the highest average overlap ratio; when the average overlap ratios are the same, continue to retain the candidate region combination with the smallest number of relationship violations; when the number of relationship violations is still the same, then retain the candidate region combination with the smallest detection deviation.

[0097] Perform boundary correction on the retained candidate region combinations; the boundary correction includes:

[0098] The upper boundary of the side-viewed honey area was re-extracted as the side-viewed liquid level line;

[0099] Take the intersection of the side-viewed bubble region, side-viewed impurity region, and side-viewed crystallization region with the side-viewed honey region, so that all three fall into the interior of the side-viewed honey region;

[0100] When the lower boundary of the side-view bottle cap area is lower than the upper boundary of the side-view bottle mouth area, the pixels of the side-view bottle cap area that extend below the upper boundary of the side-view bottle mouth area will be deleted.

[0101] If there are pixels in the top-view bottle opening area that fall outside the top-view bottle cap area, delete those pixels.

[0102] If there are pixels in the side-view label area that fall outside the side-view bottle area, delete those pixels;

[0103] After each boundary correction, recalculate the mean regional overlap ratio, the number of relationship violations, and the sum of detection deviations. If the boundary correction increases the mean regional overlap ratio, retain the result. If the mean regional overlap ratio remains unchanged while the number of relationship violations decreases, retain the result. If both the mean regional overlap ratio and the number of relationship violations remain unchanged while the sum of detection deviations decreases, retain the result. Repeat the above boundary correction process until all three evaluation metrics no longer improve after one round of boundary correction, then stop boundary correction.

[0104] The candidate region combination obtained after stopping boundary correction is used as the target region combination of the product image group. The target region combination of the product image group with qualified historical samples by manual quality judgment is selected, and the corrected detection quantity of each qualified historical sample is generated through the detection quantity generation mechanism.

[0105] The target judgment range for the detection quantity is generated using a stable value selection mechanism:

[0106] First, sort the same type of correction detection quantity according to its size, and calculate the difference between every two adjacent correction detection quantities after sorting. Then, average the differences to obtain the average adjacent difference for the correction detection quantity. Next, starting from the smallest correction detection quantity after sorting, check the differences between adjacent correction detection quantities one by one. When the difference between two adjacent correction detection quantities is not greater than the average adjacent difference, classify these two correction detection quantities into the same group of similar values. When the difference between two adjacent correction detection quantities is greater than the average adjacent difference, determine the correction detection quantity that is ranked first and the correction detection quantities that have been classified before it into a group of similar values, and use the correction detection quantity that is ranked last as the starting value of the next group of similar values. Repeat the above steps to traverse all values ​​and obtain multiple groups of similar values.

[0107] The number of corrected detection quantities in each similar value group is compared, and the similar value group with the largest number of corrected detection quantities is determined as the stable value group corresponding to the corrected detection quantity. When there are multiple similar value groups with the same number of corrected detection quantities, the similar value group with the smallest numerical range of the corrected detection quantities is determined as the stable value group. Then, the corrected detection quantity with the smallest value in the stable value group is taken as the lower boundary, and the corrected detection quantity with the largest value in the stable value group is taken as the upper boundary, thereby forming the target judgment range corresponding to the detection quantity. The target judgment range includes the target judgment range of filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, sealing seam width value, and label offset value.

[0108] S4. Determine the final region combination based on the target determination range, and output the defect type and quality results.

[0109] For the product image group obtained in step S1, first output multiple groups of segmentation results under different image scaling ratios, different brightness compensation amplitudes and different segmentation confidence values ​​in the same way as in step S3, and then recombine them to form multiple groups of candidate region combinations.

[0110] For each candidate region combination, first perform the same boundary correction as in step S3 to obtain the target region combination; then calculate the relationship violation quantity, interval deviation, and inter-class overlap area.

[0111] Relationship violation count: The number of cases in the combination of target areas that do not satisfy the physical location relationship;

[0112] Interval Deviation Sum: This function uses a combination of target regions to generate values ​​for filling height, bubble area ratio, impurity quantity, crystallization area ratio, cap coaxial offset, cap seam width, and label offset. For each detected quantity, if it falls within the corresponding target judgment range, its deviation value is recorded as zero. If it is less than the lower boundary of the corresponding target judgment range, the absolute value of the difference between it and the lower boundary is recorded as its deviation value. If it is greater than the upper boundary of the corresponding target judgment range, the absolute value of the difference between it and the upper boundary is recorded as its deviation value. The deviation values ​​of all detected quantities are summed to obtain the interval deviation sum.

[0113] Inter-class overlap area sum: The sum of the overlap areas between different categories of regions in a combination of target regions is obtained as the inter-class overlap area sum.

[0114] First, retain the candidate region combination with the smallest number of relationship violations; when the number of relationship violations is the same, continue to retain the candidate region combination with the smallest sum of interval deviations; when the sum of interval deviations is still the same, then retain the candidate region combination with the smallest sum of inter-class overlap areas; the final candidate region combination retained is recorded as the final region combination of the image group of the product to be inspected.

[0115] Based on the final region combination, the filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value, and label offset value of the product to be inspected are generated. These detection quantities are then compared with the corresponding target judgment range item by item to determine the defect type. The defect types include filling defects, cap defects, label defects, bubble defects, impurity defects, and crystallization defects.

[0116] When the filling height value is not within the target judgment range corresponding to the filling height value, it is judged as a filling defect;

[0117] When the coaxial offset value of the bottle cap or the width of the sealing gap is not within the corresponding target judgment range, it is judged as a sealing defect;

[0118] When the label offset value is not within the target judgment range corresponding to the label offset value, it is judged as a label defect;

[0119] When the bubble area percentage is not within the target judgment range corresponding to the bubble area percentage, it is judged as a bubble defect;

[0120] When the impurity quantity value is not within the target judgment range corresponding to the impurity quantity value, it is judged as an impurity defect;

[0121] When the percentage of crystallized area is not within the target judgment range corresponding to the percentage of crystallized area, it is judged as a crystallization defect;

[0122] When there are no defect types, a pass mark is output; when any defect type exists, the honey processing product is placed between the top incident light source and the bottom imaging device. The top incident light source emits detection light downward along the bottle axis, and the bottom imaging device collects the image of the light emitted from the bottom of the bottle after the detection light passes through the honey.

[0123] Based on the emitted light image, the effective transmission area corresponding to the location of the honey inside the bottle is extracted; the pixel brightness in the effective transmission area is statistically analyzed, and the average brightness value of the pixels in the effective transmission area is calculated; dark areas with brightness lower than the average brightness value and which are interconnected are extracted as continuous dark areas; the area of ​​each continuous dark area is calculated, and the area of ​​each continuous dark area is averaged to obtain the average dark area; continuous dark areas with an area not less than the average dark area are identified as black spot areas, and the number of black spot areas is counted to obtain the number of black spots; the ratio of the black spot area to the effective transmission area is calculated to obtain the black spot area ratio.

[0124] The effective transmission area is then divided into multiple sub-regions of equal area. The average brightness value of each sub-region is calculated, and the difference between the maximum and minimum average brightness values ​​of each sub-region is determined as the light transmission distribution difference.

[0125] Extract historical samples that have been manually verified as qualified, and perform the same top transmission detection process on each historical sample to obtain the number of black spots, the proportion of black spot area, and the difference in light transmission distribution. Then, arrange the number of black spots, the proportion of black spot area, and the difference in light transmission distribution corresponding to each historical sample in sequence to form a historical transmission quality feature group.

[0126] Subsequently, for the number of black dots, the proportion of black dot area, and the difference in light transmission distribution, the corresponding value ranges in all historical transmission quality feature groups were statistically analyzed. The number of black dots, the proportion of black dot area, and the difference in light transmission distribution in each historical transmission quality feature group were converted into comparison values ​​under a unified dimension to reduce the impact of different numerical scales between the number of black dots, the proportion of black dot area, and the difference in light transmission distribution on subsequent processing.

[0127] Each historical transmission quality feature group is then regarded as a historical sample point in the feature space, and the average value of the number of black points, the proportion of black point area, and the difference in light transmission distribution of all historical sample points is taken as the initial center point.

[0128] After obtaining the initial center point, the envelope boundary is gradually expanded outward from the adjusted initial center point. During the expansion process, it is continuously checked whether each historical sample point is located inside the current envelope boundary. When the difference between the value covered by the envelope boundary and the initial center point is not greater than the variance of the number of black dots, the proportion of black dot area, and the difference in light transmission distribution of all historical sample points, the expansion is stopped. The boundary formed at this time is determined as the qualified sample envelope boundary.

[0129] Historical sample points located near the boundary of the qualified sample envelope are used as boundary support sample points to define the position and shape of the qualified sample envelope boundary; the qualified sample envelope boundary is used to characterize the distribution range of qualified samples in the transmission quality feature space.

[0130] When judging the quality of the current honey processed product, the same top transmission detection process is performed on the current honey processed product to obtain the current transmission quality feature group, and the current transmission quality feature group is converted into a comparison value consistent with the historical transmission quality feature group; then it is determined whether the current sample point corresponding to the current transmission quality feature group is located inside the qualified sample envelope boundary; when it is located inside the qualified sample envelope boundary, a qualified mark is output; when it is located outside the qualified sample envelope boundary, a non-qualified mark and the corresponding defect type are output, and the rejection execution mechanism is controlled to remove the product to be inspected from the conveyor line.

[0131] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.

[0132] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0133] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for quality inspection of honey processed products based on visual inspection, characterized in that, include: S1. Collect top-view and side-view images, generate product image sets, and establish a historical sample set; S2. Train the target segmentation model based on the historical sample set, and generate the product detection volume through the detection volume generation mechanism; S3. Generate candidate region combinations based on multiple segmentation results, and form target region combinations and target determination ranges after boundary correction; S4. Determine the final region combination based on the target determination range, and output the defect type and quality results.

2. The method for quality inspection of honey processed products based on visual inspection according to claim 1, characterized in that: In S1, top-view and side-view images are acquired to generate product image sets and establish historical sample sets, as follows: Product images are acquired, including side view images and top view images; side view images and top view images acquired at the same acquisition time are assigned the same product number, thereby forming a product image group that corresponds one-to-one with the honey processed product; the product image group includes a top view image, a side view image, and a product number; After the equipment is installed, the side-view industrial camera and the top-view industrial camera are calibrated using a ruler with known scale spacing to obtain the corresponding length conversion coefficients; the length conversion coefficients represent the actual length of a single pixel. Multiple sets of product images that have undergone manual review are used as a historical sample set. The historical sample set includes multiple historical samples, each containing product image sets and manual annotation results. The manual annotation results include side views of the bottle body area, honey area, bubble area, impurity area, crystallization area, label area, cap area, bottle mouth area, top view of the cap area, and top view of the bottle mouth area, as well as the manual quality judgment results and manual measurement results for the product. The manual quality judgment results indicate whether the historical sample is qualified or unqualified. The manual measurement results include the filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value, and label offset value for the historical sample.

3. The method for quality inspection of honey processed products based on visual inspection according to claim 1, characterized in that: In S2, a target segmentation model is trained based on a historical sample set, and product detection quantities are generated through a detection quantity generation mechanism, as follows: The historical sample set is input into the MaskR-CNN network for training to obtain a target segmentation model for online detection. The product image group obtained in step S1 is input into the target segmentation model. The side view image outputs the side bottle area, side honey area, side bubble area, side impurity area, side crystal area, side label area, side cap area and side bottle mouth area. The top view image outputs the top cap area and top bottle mouth area.

4. The method for quality inspection of honey processed products based on visual inspection according to claim 1, characterized in that: In S2, a target segmentation model is trained based on a historical sample set, and product detection quantities are generated through a detection quantity generation mechanism, as follows: The detection parameters of the product image group are generated based on the detection parameter generation mechanism. These parameters include filling height, bubble area ratio, impurity quantity, crystallization area ratio, cap coaxial offset, cap seam width, and label offset. Specifically: The Suzuki-Ab contour tracking algorithm is used to extract the outer contour of the honey area viewed from the side, and the contour points with the smallest ordinate in each column of pixels are used to form the boundary of the liquid surface viewed from the side. The least squares straight line fitting is then used to obtain the liquid surface line viewed from the side. The minimum bounding rectangle algorithm is used to obtain the center line of the bottle viewed from the side. The distance between the center line of the bottle viewed from the side and the liquid surface line and the lower boundary of the bottle viewed from the side are calculated, and the filling height value is obtained by combining the length conversion factor. The side-view bubble region, side-view impurity region, and side-view crystallization region are separated using an 8-neighborhood connected component labeling algorithm. Specifically, the areas of the bubble region and the crystallization region are calculated using a pixel counting method and then divided by the area of ​​the side-view honey region to obtain the bubble area ratio and the crystallization area ratio, respectively. The number of connected components in the impurity region is counted to obtain the impurity quantity value. The minimum circumcircle algorithm is used to obtain the corresponding center of the bottle cap area and the bottle mouth area from the top view. The distance between the two center is calculated and the coaxial offset value of the bottle cap is obtained by combining the length conversion factor. The Suzuki-Abe contour tracking algorithm is used to extract the contours of the side-view bottle cap area and the side-view bottle mouth area; the contour point with the largest ordinate in each column of pixels in the side-view bottle cap area is taken as the lower boundary of the bottle cap, and the contour point with the smallest ordinate in each column of pixels in the side-view bottle mouth area is taken as the upper boundary of the bottle mouth; the average distance between the two boundaries is calculated, and the sealing gap width is obtained by combining the length conversion factor. The minimum bounding rectangle algorithm is used to obtain the center point of the side-view label area and the center point of the side-view bottle area, respectively. The horizontal distance between the center point of the side-view label area and the center point of the side-view bottle area is calculated, and the label offset value is obtained by combining the length conversion coefficient.

5. The method for quality inspection of honey processed products based on visual inspection according to claim 1, characterized in that: In S3, candidate region combinations are generated based on multiple segmentation results. After boundary correction, target region combinations and target determination ranges are formed, as follows: Global histogram equalization is performed on each group of product images in the historical sample set to obtain an enhanced product image group. Each group of product images in the historical sample set and the enhanced product image group are then input into the target segmentation model to obtain multiple segmentation results, which include multiple candidate regions. Candidate region combinations are generated through a candidate region combination generation mechanism. Specifically, for each type of candidate region, regions corresponding to that type are collected from multiple segmentation results to form a candidate region set for that type. The candidate region set includes candidate sets for side-view bottle body regions, side-view honey regions, side-view bubble regions, side-view impurity regions, side-view crystallization regions, side-view label regions, side-view bottle cap regions, side-view bottle mouth regions, top-view bottle cap regions, and top-view bottle mouth regions. Each side-view bottle region in the candidate set of side-view bottle regions is used as an initial region to form the first part of the combination; Then, candidate regions are selected sequentially from the candidate sets of the side-view honey region, the candidate sets of the side-view bubble region, the candidate sets of the side-view impurity region, the candidate sets of the side-view crystallization region, the candidate sets of the side-view label region, the candidate sets of the side-view bottle cap region, the candidate sets of the side-view bottle mouth region, the candidate sets of the top-view bottle cap region, and the candidate sets of the top-view bottle mouth region, and gradually added to the first part of the combination to form the second part of the combination; After each new candidate region is added, the spatial relationship satisfaction score of each combination of the second part is calculated. Spatial relationships include: the side-viewed bubble area is located inside the side-viewed honey area; the side-viewed impurity area is located inside the side-viewed honey area; the side-viewed crystallization area is located inside the side-viewed honey area; the side-viewed liquid level line is the upper boundary of the side-viewed honey area; the side-viewed bottle cap area is located above the side-viewed bottle mouth area; the top-viewed bottle mouth area is located inside the top-viewed bottle cap area; and the side-viewed label area is located inside the side-viewed bottle body area. For the second part of the combination, each of the above spatial relationships is judged to see if it holds true. A true relationship is recorded as 1, and a false relationship is recorded as 0. The scores of all judged spatial relationships are summed to obtain the spatial relationship score of the second part of the combination. Calculate the mean and variance of spatial relationship scores, sort the second part of the combination in descending order of spatial relationship scores, retain the second part of the combination whose spatial relationship score is not less than the mean of spatial relationship scores minus the variance of spatial relationship scores, and use the retained second part of the combination as multiple candidate region combinations. For each candidate region combination, calculate the following: mean region overlap ratio, number of relationship violations, and detection bias: Average overlap ratio of regions: Compare each type of region in the candidate region combination with the corresponding manually labeled region to obtain the overlap ratio of each type of region, and then take the average of all overlap ratios to obtain the average overlap ratio of regions. Relationship Violation Quantity: This counts the number of side-view bubble areas, side-view impurity areas, side-view crystallization areas, side-view liquid level lines, side-view bottle cap areas, top-view bottle mouth areas, and side-view label areas in the candidate region combination that do not satisfy the physical positional relationships. The physical positional relationships include: the side-view bubble areas, side-view impurity areas, and side-view crystallization areas should be located inside the side-view honey area; the side-view liquid level line should be the upper boundary of the side-view honey area; the side-view bottle cap area should be located above the side-view bottle mouth area; the top-view bottle mouth area should be located inside the top-view bottle cap area; and the side-view label area should be located inside the side-view bottle body area. When any one of these areas in the candidate region combination does not satisfy the physical positional relationship, the relationship violation quantity is incremented by one. After determining whether the candidate region combination satisfies the physical positional relationship, the relationship violation quantity value is obtained. Detection deviation sum: The filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value, and label offset value of the candidate area combination are generated by the detection quantity generation mechanism. Then, these detection quantities are subtracted from the corresponding manual measurements one by one to obtain the difference value. The absolute values ​​of the difference values ​​are added together to obtain the detection deviation sum.

6. The method for quality inspection of honey processed products based on visual inspection according to claim 1, characterized in that: In S3, candidate region combinations are generated based on multiple segmentation results. After boundary correction, target region combinations and target determination ranges are formed, as follows: First, retain the candidate region combination with the highest average overlap ratio; when the average overlap ratios are the same, continue to retain the candidate region combination with the smallest number of relationship violations; when the number of relationship violations is still the same, then retain the candidate region combination with the smallest detection deviation. Perform boundary correction on the retained candidate region combinations; the boundary correction includes: The upper boundary of the side-viewed honey area was re-extracted as the side-viewed liquid level line; Take the intersection of the side-viewed bubble region, side-viewed impurity region, and side-viewed crystallization region with the side-viewed honey region, so that all three fall into the interior of the side-viewed honey region; When the lower boundary of the side-view bottle cap area is lower than the upper boundary of the side-view bottle mouth area, the pixels of the side-view bottle cap area that extend below the upper boundary of the side-view bottle mouth area will be deleted. If there are pixels in the top-view bottle opening area that fall outside the top-view bottle cap area, delete those pixels. If there are pixels in the side-view label area that fall outside the side-view bottle area, delete those pixels; After each boundary correction, recalculate the mean regional overlap ratio, the number of relationship violations, and the sum of detection deviations. If the boundary correction increases the mean regional overlap ratio, retain the result. If the mean regional overlap ratio remains unchanged while the number of relationship violations decreases, retain the result. If both the mean regional overlap ratio and the number of relationship violations remain unchanged while the sum of detection deviations decreases, retain the result. Repeat the above boundary correction process until all three evaluation metrics no longer improve after one round of boundary correction, then stop boundary correction. The candidate region combination obtained after stopping boundary correction is used as the target region combination of the product image group. The target region combination of the product image group with qualified historical samples by manual quality judgment is selected, and the corrected detection quantity of each qualified historical sample is generated through the detection quantity generation mechanism. The target judgment range for the detection quantity is generated using a stable value selection mechanism: First, sort the same type of correction detection quantity according to its size, and calculate the difference between every two adjacent correction detection quantities after sorting. Then, average the differences to obtain the average adjacent difference for the correction detection quantity. Next, starting from the smallest correction detection quantity after sorting, check the differences between adjacent correction detection quantities one by one. When the difference between two adjacent correction detection quantities is not greater than the average adjacent difference, classify these two correction detection quantities into the same group of similar values. When the difference between two adjacent correction detection quantities is greater than the average adjacent difference, determine the correction detection quantity that is ranked first and the correction detection quantities that have been classified before it into a group of similar values, and use the correction detection quantity that is ranked last as the starting value of the next group of similar values. Repeat the above steps to traverse all values ​​and obtain multiple groups of similar values. The number of corrected detection quantities in each similar value group is compared, and the similar value group with the largest number of corrected detection quantities is determined as the stable value group corresponding to the corrected detection quantity. When there are multiple similar value groups with the same number of corrected detection quantities, the similar value group with the smallest numerical range of the corrected detection quantities is determined as the stable value group. Then, the corrected detection quantity with the smallest value in the stable value group is taken as the lower boundary, and the corrected detection quantity with the largest value in the stable value group is taken as the upper boundary, thereby forming the target judgment range corresponding to the detection quantity. The target judgment range includes the target judgment range of filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, sealing seam width value, and label offset value.

7. The method for quality inspection of honey processed products based on visual inspection according to claim 1, characterized in that: In S4, the final region combination is determined based on the target determination range, and the defect type and quality results are output as follows: For the product image group obtained in step S1, global histogram equalization is performed to obtain an enhanced product image group. The product image group and the enhanced product image group are respectively input into the target segmentation model to obtain multiple corresponding segmentation results. Multiple candidate region combinations are generated through the candidate region combination generation mechanism. For each candidate region combination, perform boundary correction to obtain the target region combination; then calculate the relationship violation quantity and interval deviation sum: Interval Deviation Sum: The target area combination generates filling height, bubble area ratio, impurity quantity, crystallization area ratio, cap coaxial offset, cap seam width, and label offset values ​​through the detection quantity generation mechanism. For each detection quantity, if it is within the corresponding target judgment range, the deviation value is recorded as zero; if it is less than the lower boundary of the corresponding target judgment range, the absolute value of the difference between it and the lower boundary is recorded as the deviation value; if it is greater than the upper boundary of the corresponding target judgment range, the absolute value of the difference between it and the upper boundary is recorded as the deviation value. The interval deviation sum is obtained by summing the deviation values ​​of all detection quantities. First, retain the candidate region combination with the smallest number of relationship violations; when the number of relationship violations is the same, continue to retain the candidate region combination with the smallest interval deviation.

8. The method for quality inspection of honey processed products based on visual inspection according to claim 1, characterized in that: In S4, the final region combination is determined based on the target determination range, and the defect type and quality results are output as follows: Based on the final region combination, the filling height value, bubble area ratio value, impurity quantity value, crystallization area ratio value, cap coaxial offset value, cap seam width value, and label offset value of the product to be inspected are generated. These detection quantities are then compared with the corresponding target judgment range item by item to determine the defect type. The defect types include filling defects, cap defects, label defects, bubble defects, impurity defects, and crystallization defects. When the filling height value is not within the target judgment range corresponding to the filling height value, it is judged as a filling defect; When the coaxial offset value of the bottle cap or the width of the sealing gap is not within the corresponding target judgment range, it is judged as a sealing defect; When the label offset value is not within the target judgment range corresponding to the label offset value, it is judged as a label defect; When the bubble area percentage is not within the target judgment range corresponding to the bubble area percentage, it is judged as a bubble defect; When the impurity quantity value is not within the target judgment range corresponding to the impurity quantity value, it is judged as an impurity defect; When the percentage of crystallized area is not within the target judgment range corresponding to the percentage of crystallized area, it is judged as a crystallization defect; When there are no defect types, a pass mark is output; when any defect type exists, the honey processing product is placed between the top incident light source and the bottom imaging device. The top incident light source emits detection light downward along the bottle axis, and the bottom imaging device collects the image of the light emitted from the bottom of the bottle after the detection light passes through the honey. Based on the emitted light image, the effective transmission area corresponding to the location of the honey inside the bottle is extracted; the pixel brightness in the effective transmission area is statistically analyzed, and the average brightness value of the pixels in the effective transmission area is calculated; dark areas with brightness lower than the average brightness value and which are interconnected are extracted as continuous dark areas; the area of ​​each continuous dark area is calculated, and the area of ​​each continuous dark area is averaged to obtain the average dark area; continuous dark areas with an area not less than the average dark area are identified as black spot areas, and the number of black spot areas is counted to obtain the number of black spots; the ratio of the black spot area to the effective transmission area is calculated to obtain the black spot area ratio. The effective transmission area is then divided into multiple sub-regions of equal area. The average brightness value of each sub-region is calculated, and the difference between the maximum and minimum average brightness values ​​of each sub-region is determined as the light transmission distribution difference. Extract historical samples that have been manually verified as qualified, and perform the same top transmission detection process on each historical sample to obtain the number of black spots, the proportion of black spot area, and the difference in light transmission distribution. Then, arrange the number of black spots, the proportion of black spot area, and the difference in light transmission distribution corresponding to each historical sample in sequence to form a historical transmission quality feature group. Subsequently, for the number of black dots, the proportion of black dot area, and the difference in light transmission distribution, the corresponding value ranges in all historical transmission quality feature groups were statistically analyzed. The number of black dots, the proportion of black dot area, and the difference in light transmission distribution in each historical transmission quality feature group were converted into comparison values ​​under a unified dimension to reduce the impact of different numerical scales between the number of black dots, the proportion of black dot area, and the difference in light transmission distribution on subsequent processing. Each historical transmission quality feature group is then regarded as a historical sample point in the feature space, and the average value of the number of black points, the proportion of black point area, and the difference in light transmission distribution of all historical sample points is taken as the initial center point. After obtaining the initial center point, the envelope boundary is gradually expanded outward from the adjusted initial center point. During the expansion process, it is continuously checked whether each historical sample point is located inside the current envelope boundary. When the difference between the value covered by the envelope boundary and the initial center point is not greater than the variance of the number of black dots, the proportion of black dot area, and the difference in light transmission distribution of all historical sample points, the expansion is stopped. The boundary formed at this time is determined as the qualified sample envelope boundary. Historical sample points located near the boundary of the qualified sample envelope are used as boundary support sample points to define the position and shape of the qualified sample envelope boundary; the qualified sample envelope boundary is used to characterize the distribution range of qualified samples in the transmission quality feature space. When judging the quality of the current honey processed product, the same top transmission detection process is performed on the current honey processed product to obtain the current transmission quality feature group, and the current transmission quality feature group is converted into a comparison value consistent with the historical transmission quality feature group; then it is determined whether the current sample point corresponding to the current transmission quality feature group is located inside the qualified sample envelope boundary; when it is located inside the qualified sample envelope boundary, a qualified mark is output; when it is located outside the qualified sample envelope boundary, a non-qualified mark and the corresponding defect type are output, and the rejection execution mechanism is controlled to remove the product to be inspected from the conveyor line.

Citation Information

Patent Citations

  • Detection method of PET bottle cap and liquid level

    CN102519972A