Infusion container combined cover-oriented machine vision quality detection method

By clustering and optimizing the edge point sets of combined cover images, the inaccuracy problem caused by the pull-up effect when detecting combined covers is solved, and a more accurate combined cover quality detection is achieved.

CN119671997AActive Publication Date: 2025-03-21HANGZHOU YUANQI INTELLIGENT EQUIPMENT CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411752012.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-21
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

The existing RANSAC algorithms cause inaccurate quality detection results due to the influence of the pull ring when detecting the combined cover.

Method used

By obtaining the edge point set of the combined cover image, clustering obtains the temporary center point and edge point cluster class, calculates the combined cover edge probability and reference weight of the edge point cluster class, and iteratively optimizes the fitted circle until the optimal fitted circle is obtained.

Benefits of technology

The accuracy of combined cover quality detection is improved, the interference of the pull ring on the fitting circle algorithm is reduced, and the accuracy of the detection results is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119671997A_ABST
    Figure CN119671997A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image data processing, and provides a machine vision quality detection method for a combined cover of an infusion container, which comprises the following steps: acquiring an edge point set; obtaining a temporary center point of the combined cover according to the edge point set; obtaining a combined cover edge probability, a combined cover edge point cluster and a reference cluster; obtaining a temporary radius of the combined cover according to the combined cover edge point cluster; obtaining a correlation degree according to the reference cluster and the combined cover edge point cluster; obtaining a reference weight according to the association degree and the combined cover edge probability; according to the temporary center point of the combined cover and the temporary radius of the combined cover, the fitting degree is obtained; obtaining a temporary fitting optimal probability according to the fitting degree and the reference weight of the edge points; and performing iteration to obtain an optimal fitting circle, and obtaining a visual quality detection result of the combined cover according to the optimal fitting circle. According to the invention, the quality of the combined cover is detected through the optimal fitting circle, so that the quality detection result is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and in particular to a machine vision quality inspection method for an infusion container combination cover. Background Art

[0002] Infusion containers in the pharmaceutical industry are divided into multiple categories. According to the packaging materials, infusion containers can be divided into three categories: glass bottles, plastic bottles, and soft bags. Glass bottle infusion containers have the disadvantages of being fragile, not resistant to high temperatures, and easily damaged during transportation. They have been gradually replaced by plastic bottle and soft bag infusion containers. As a combination cover for infusion containers, the output of combination covers is huge. The full name of the combination cover is polypropylene combination cover for plastic infusion containers. The combination cover consists of three parts: outer cover, glue, and inner cover.

[0003] As an important part of the infusion container, the combination cover is the part that is in direct contact with the liquid medicine, so the quality of the combination cover directly affects the safety of the infusion container. Common defects of the combination cover are burrs and missing edges on the outer periphery of the outer cover during the injection molding process of the combination cover mold.

[0004] To detect whether the outer contour of the combination cover is concave or convex, a circular fitting algorithm is usually used to obtain a fitting circle of the outer contour of the combination cover, and then the abnormality is judged by the spatial relationship between the outer contour of the combination cover and the fitting circle. At present, the commonly used fitting circle algorithm for detecting combination covers is the RANSAC algorithm, but the RANSAC algorithm has a better detection effect on combination covers with smooth surfaces. At present, pull ring covers are often provided on combination covers. Since there is a pull ring on the surface of the pull ring cover, the pull ring will show noise similar to a circle in the image, which makes the quality detection result of the combination cover of the infusion container obtained by the RANSAC algorithm inaccurate. Summary of the invention

[0005] The present invention provides a machine vision quality inspection method for an infusion container combination cover to solve the problem that the existing pull ring makes the quality inspection result of the infusion container combination cover obtained by using the RANSAC algorithm inaccurate. The technical solution adopted is as follows:

[0006] The present invention proposes a machine vision quality inspection method for an infusion container combined cover, the method comprising the following steps:

[0007] Obtain edge point set of combined cover image;

[0008] According to the edge point set, a temporary center point of the combined cover is obtained; according to the distance from the edge point in the edge point set to the temporary center point of the combined cover, several edge point clusters and the combined cover edge probability of each edge point cluster are obtained; the edge point clusters are divided into combined cover edge point clusters and reference clusters according to the combined cover edge probability; according to the distance from the edge point in the combined cover edge point cluster to the temporary center point of the combined cover, the temporary radius of the combined cover is obtained;

[0009] According to the fluctuation of the distance from the edge point in each reference cluster to the center point of the combined cover edge point cluster, and the difference between the distance from the edge point in the combined cover edge point cluster to the center point of the combined cover edge point cluster, the association degree of each reference cluster is obtained; according to the association degree of each reference cluster and its combined cover edge probability, the reference weight of each reference cluster is obtained;

[0010] According to the difference between the distance from the edge point in the edge point set to the temporary center point of the combination cover and the temporary radius of the combination cover, the fitting degree of the edge point is obtained; according to the fitting degree of the edge point and the reference weight of each reference cluster, the temporary fitting optimal probability is obtained; according to the fitting degree of the edge point, the edge point set is screened and updated to obtain a new edge point set;

[0011] The fit degree of the new edge points is obtained according to the new edge point set, and the new temporary fitting optimal probability is obtained according to the calculation method of the temporary fitting optimal probability, and the optimal fitting circle is obtained iteratively, and the visual quality detection result of the combined cover is obtained according to the optimal fitting circle.

[0012] Furthermore, the method of obtaining the temporary center point of the combined cover according to the edge point set includes the following specific methods:

[0013] The center point of all edge points in the edge point set of the combined cover image is recorded as the temporary center point of the combined cover.

[0014] Furthermore, the method of obtaining a plurality of edge point clusters and the probability of combined cover edge of each edge point cluster according to the distance from the edge point in the edge point set to the combined cover temporary center point includes the following specific methods:

[0015] The edge points in the edge point set of the combined cover image are clustered using K-means and elbow method. The distance between the edge point and the temporary center point of the combined cover is used as the measure of cluster distance to obtain several edge point clusters.

[0016] For any edge point cluster, the center point of all edge points in the edge point cluster is recorded as the center point of the edge point cluster;

[0017] The calculation method of the combined cover edge probability of the ath edge point cluster is:

[0018]

[0019] Where P a is the combined cover edge probability of the ath edge point cluster; N a is the number of edge points in the ath edge point cluster; D a is the distance between the center point of the ath edge point cluster and the temporary center point of the combined cover; S ais the variance of the distances from all edge points in the ath edge point cluster to the center point of the ath edge point cluster; Norm() is the linear normalization function; ε is a hyperparameter.

[0020] Furthermore, the step of dividing the edge point clusters into combined cover edge point clusters and reference clusters according to the combined cover edge probability includes the following specific methods:

[0021] The edge point cluster with the largest probability of combined cover edge is recorded as the combined cover edge point cluster; the other edge point clusters are recorded as reference clusters.

[0022] Furthermore, the temporary radius of the combined cover is obtained according to the distance from the edge point in the combined cover edge point cluster to the temporary center point of the combined cover, and the specific method includes:

[0023] The average of the distances from all edge points in the combined cover edge point cluster to the temporary center point of the combined cover is recorded as the temporary radius of the combined cover.

[0024] Further, the degree of association of each reference cluster is obtained according to the volatility of the distance from the edge point in each reference cluster to the center point of the combined cover edge point cluster, and the difference between the distance from the edge point in the combined cover edge point cluster to the center point of the combined cover edge point cluster, including the specific method of:

[0025] The calculation method of the correlation degree between the cth reference cluster and the combined cover edge point cluster is:

[0026] L c =exp(-S′ a ×|D′ a -D″|)

[0027] Where, L c is the degree of association between the cth reference cluster and the combined cover edge point cluster; S' c is the variance of the distance from all edge points in the cth reference cluster to the center point of the combined cover edge point cluster; D' c is the mean distance from all edge points in the cth reference cluster to the center point of the combined cover edge point cluster; D” is the mean distance from all edge points in the combined cover edge point cluster to the center point of the combined cover edge point cluster; exp() is an exponential function with a natural constant as the base; || is the absolute value function.

[0028] Furthermore, the reference weight of each reference cluster is obtained according to the association degree of each reference cluster and the combined cover edge probability thereof, including the specific method of:

[0029] For any reference cluster, the linear normalized result of the ratio of the association degree between the reference cluster and the combined cover edge point cluster to the combined cover edge probability of the reference cluster is recorded as the reference weight of the reference cluster.

[0030] Furthermore, the fitting degree of the edge point is obtained according to the difference between the distance from the edge point in the edge point set to the temporary center point of the combined cover and the temporary radius of the combined cover, and the specific method includes:

[0031] For any edge point, the result of normalizing the inverse proportion of the absolute value of the difference between the distance from the edge point to the temporary center point of the combined cover and the temporary radius of the combined cover is recorded as the fit of the edge point.

[0032] Furthermore, the temporary optimal fitting probability is obtained according to the fit degree of the edge points and the reference weights of each reference cluster, including the specific method of:

[0033] The reference weight of the combined cover edge point cluster is recorded as 1;

[0034] The calculation method of the temporary fit optimal probability is:

[0035]

[0036] Where M is the temporary optimal fitting probability; n is the total number of edge points in the edge point set; Y k is the reference weight of the edge point cluster where the kth edge point is located; X k is the fit degree of the kth edge point; softmax() is the weight normalization function.

[0037] Furthermore, the method of obtaining the fit of new edge points according to the new edge point set, obtaining a new temporary optimal fitting probability according to the calculation method of the temporary optimal fitting probability, and iterating to obtain the optimal fitting circle includes the following specific methods:

[0038] The new edge point set is iterated using the RANSAC algorithm to obtain the fitting circle, and the center and radius of the fitting circle obtained by the RANSAC algorithm are used as the temporary center point and temporary radius of the combined cover respectively. In each iteration, the new edge point set is clustered using K-means and the elbow method. The clustering distance is measured by the distance between the edge point and the temporary center point of the combined cover, and several new edge point clusters are obtained. The combined cover edge probability and new combined cover edge point clusters of the new edge point clusters are obtained, and the fit of the new edge points and the new temporary fitting optimal probability are obtained. The iteration is stopped until the temporary fitting optimal probability is greater than the optimal threshold, and the latest fitting circle is recorded as the optimal fitting circle.

[0039] The beneficial effects of the present invention are as follows: when quality inspection is performed on the combination cover of the infusion container, the fitting effect of the fitting circle algorithm will be poor due to the influence of the pull ring. The present invention analyzes the clustering results of the edge points by the shape characteristics and positional relationship of the combination cover in the combination cover image, roughly obtains the position of the fitting circle, and reduces the interference of the pull ring on the fitting circle algorithm; in the process of clustering the edge points, there may be under-clustering. The present invention makes the evaluation of the fitting circle more accurate by judging the reference weight of the reference cluster; the fitting circle obtained by clustering result analysis is not accurate. The present invention makes the fitting result of the fitting circle more in line with the real edge of the combination cover by iterating the fitting circle multiple times and obtaining the corresponding temporary optimal fitting probability. So far, the present invention performs visual quality inspection on the combination cover of the infusion container by fitting circles, so that the quality inspection results of the combination cover are more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0041] Figure 1 A schematic flow chart of a machine vision quality inspection method for an infusion container assembly cover provided in one embodiment of the present invention. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0043] See also Figure 1 , which shows a flow chart of a machine vision quality inspection method for an infusion container assembly cover provided by an embodiment of the present invention, the method comprising the following steps:

[0044] Step S001: Obtain an edge point set of a combined cover image.

[0045] It should be noted that the purpose of this embodiment is to perform quality inspection on the combined cover in the combined cover image of the infusion container, so the combined cover image needs to be collected first.

[0046] Specifically, assembly line equipment is arranged in the quality inspection link of the combination caps of the infusion containers, and a black conveyor belt is used on the assembly line; an industrial camera is arranged directly above the conveyor belt, so that the lens of the industrial camera is aimed at the conveyor belt; and a sorting mechanism is provided to sort abnormal combination caps; during the operation of the conveyor belt, the combination caps to be inspected after production are placed horizontally and evenly on the conveyor belt to avoid stacking of the combination caps, and the overall image of the combination caps is acquired by using the industrial camera.

[0047] It should be noted that the overall image of the combined cover includes several combined covers. Since each combined cover needs to be quality inspected, each combined cover is segmented from the overall image of the combined cover.

[0048] Specifically, the overall image of the combined cover is input into the CNN neural network to obtain a number of combined cover images. The specific network model of the CNN neural network adopted in this embodiment is an Encoder-Decoder structure. Other models can be used in other embodiments, and this embodiment is not limited thereto. The training set of the neural network is a number of overall images of the combined cover. The labels are divided into two categories, namely, the combined cover and the background. This method is pixel-level classification, that is, all pixels in the overall image of the combined cover need to be labeled with corresponding labels. The pixels belonging to the combined cover are labeled with a value of 1, and the pixels belonging to the background are labeled with a value of 0. The loss function used by the neural network is a cross-entropy loss function. The specific training process is well known and will not be described in detail in this embodiment.

[0049] It should be noted that each combination cover image contains one combination cover.

[0050] Furthermore, the Canny edge detection algorithm is used to perform edge detection on any combined cover image to obtain a number of edge pixel points of the combined cover image, and the point set formed by all the edge pixel points of the combined cover image is recorded as the edge point set of the combined cover image; wherein, the Canny edge detection algorithm is a well-known technology, and the specific method is not introduced here; the following description will be taken as an example of any combined cover image and its edge point set.

[0051] Step S002, obtain the temporary center point of the combined cover according to the edge point set; obtain several edge point clusters and the combined cover edge probability of each edge point cluster according to the distance from the edge point in the edge point set to the temporary center point of the combined cover; divide the edge point clusters into combined cover edge point clusters and reference clusters according to the combined cover edge probability; obtain the combined cover temporary radius according to the distance from the edge point in the combined cover edge point cluster to the temporary center point of the combined cover.

[0052] It should be noted that when using the RANSAC algorithm to perform quality inspection on the combination cover, the traditional RANSAC algorithm will randomly select 3 edge points from the edge point set of the combination cover image, and perform circle fitting by locating the center of the circle through the 3 edge points. However, for the combination cover with a pull ring, the pull ring will also show an edge, so the edge point set of the combination cover image will include the edge pixel points of the pull ring, and the RANSAC algorithm may select the edge pixel points of the pull ring when selecting the edge point, thereby affecting the quality inspection result. In order to eliminate the influence of the pull ring on the quality inspection, the center of the fitting circle of the combination cover is first initially located.

[0053] It should be further explained that, since the combined cover image is obtained by segmentation of a neural network, the combined cover is usually located at the center of the combined cover image. Since the combined cover is mostly circular, the temporary center point of the combined cover is obtained accordingly.

[0054] Specifically, the center point of all edge points in the edge point set of the combined cover image is recorded as the temporary center point of the combined cover; in the present embodiment, the method for obtaining the temporary center point of the combined cover is: establishing a rectangular coordinate system with the lower left corner as the origin in the combined cover image; recording the average of the horizontal coordinates of all edge points in the edge point set of the combined cover image as the temporary center horizontal coordinate; recording the average of the vertical coordinates of all edge points in the edge point set of the combined cover image as the temporary center vertical coordinate; recording the pixel points at the corresponding positions of the temporary center horizontal coordinate and the temporary center vertical coordinate in the combined cover image as the temporary center point of the combined cover.

[0055] It should be noted that, since the distances between the edge of the pull ring and the edge of the combination cover relative to the temporary center point of the combination cover are different, the two types of edge pixel points are distinguished accordingly.

[0056] Specifically, K-means and elbow method are used to cluster the edge points in the edge point set of the combined cover image, and the cluster distance is measured by the distance between the edge point and the temporary center point of the combined cover to obtain several edge point clusters; among them, K-means and elbow method are well-known technologies, and the specific methods are not introduced here.

[0057] It should be noted that since the distances between the edge pixels of the combination cover and the temporary center point of the combination cover are similar, among the several edge point clusters obtained, there is a certain edge point cluster that belongs to the combination cover edge point cluster, and the number of edge points in this edge point cluster is relatively large; since the pull ring of the pull ring type combination cover is usually not horizontal, the performance of the pull ring edge in the image is more elliptical than the edge of the combination cover, so the distance between the pull ring edge pixel points and the temporary center point of the combination cover is fluctuating, and the distance between the center point of the point set formed by the pull ring edge pixel points and the temporary center point of the combination cover is large.

[0058] Specifically, for any edge point cluster, the center point of all edge points in the edge point cluster is recorded as the center point of the edge point cluster;

[0059] The calculation method of the combined cover edge probability of the ath edge point cluster is:

[0060]

[0061] Where P a is the combined cover edge probability of the ath edge point cluster; N a is the number of edge points in the ath edge point cluster; D a is the distance between the center point of the ath edge point cluster and the temporary center point of the combined cover; S a is the variance of the distance from all edge points in the ath edge point cluster to the center point of the ath edge point cluster; Norm() is a linear normalization function, and the normalization object is the distance of all edge point clusters. ε is a hyperparameter to avoid the denominator being 0, and this embodiment uses ε=1 for description.

[0062] It should be noted that, since the distances between the edge pixels of the combination cover and the temporary center point of the combination cover are similar, the edge pixels of the combination cover are mainly concentrated in one edge point cluster.

[0063] Furthermore, the edge point cluster with the largest probability of combined cover edge is recorded as the combined cover edge point cluster; and the other edge point clusters are recorded as reference clusters.

[0064] It should be noted that, since the combined cover edge point cluster is currently the cluster closest to the real edge of the combined cover, the combined cover temporary radius is obtained according to the combined cover edge point cluster.

[0065] Specifically, the average of the distances from all edge points in the combined cover edge point cluster to the combined cover temporary center point is recorded as the combined cover temporary radius.

[0066] Step S003, obtain the degree of association of each reference cluster based on the volatility of the distance from the edge point in each reference cluster to the center point of the combined cover edge point cluster, and the difference between the distance from the edge point in the combined cover edge point cluster to the center point of the combined cover edge point cluster; obtain the reference weight of each reference cluster based on the degree of association of each reference cluster and its combined cover edge probability.

[0067] It should be noted that since the temporary center point and temporary radius of the combination cover currently obtained are relatively rough, they need to be adjusted iteratively to obtain the optimal fitting circle. In this iterative process, due to the interference of the pull tube in the pull ring combination cover, it is necessary to adjust the weights of the edge points that do not belong to the true contour of the combination cover, so as to obtain a more accurate optimal fitting circle. Since there may be under-clustering in the process of clustering edge points, it is still necessary to analyze the edge point clusters other than the combination cover edge point clusters, that is, the reference clusters. Since the under-clustered edge points are mainly distributed near the true contour of the combination cover, but exist in other edge point clusters, the reference clusters are strongly associated with the combination cover edge point clusters. When evaluating the fitting circle, the reference weight of this reference cluster is also relatively large.

[0068] It should be further explained that, due to the reference cluster formed by under-clustering, that is, the reference cluster with a strong correlation with the combined cover edge point cluster, the distances from all edge points in this reference cluster to the center point of the combined cover edge point cluster are similar, and the distances from all edge points in this reference cluster and all edge points in the combined cover edge point cluster to the center point of the combined cover edge point cluster are similar.

[0069] Specifically, the calculation method of the correlation degree between the cth reference cluster and the combined cover edge point cluster is:

[0070] L c =exp(-S′ c ×|D′ c -D″|)

[0071] Where, L c is the degree of association between the cth reference cluster and the combined cover edge point cluster; S' c is the variance of the distance from all edge points in the cth reference cluster to the center point of the combined cover edge point cluster; D' c is the mean distance from all edge points in the cth reference cluster to the center point of the combined cover edge point cluster; D” is the mean distance from all edge points in the combined cover edge point cluster to the center point of the combined cover edge point cluster; exp() is an exponential function with a natural constant as the base; || is the absolute value function.

[0072] It should be noted that under-clustering mainly occurs when there is a small fluctuation in the edge of the combined cover, so the probability of the combined cover edge of the reference cluster formed due to under-clustering will be relatively small.

[0073] Specifically, for any reference cluster, the linear normalization result of the ratio of the degree of association between the reference cluster and the combined cover edge point cluster to the combined cover edge probability of the reference cluster is recorded as the reference weight of the reference cluster; wherein the normalization object is the ratio of the degree of association between each reference cluster and the combined cover edge point cluster to the corresponding combined cover edge probability of each reference cluster.

[0074] Step S004, obtaining the degree of fit of the edge points according to the difference between the distance from the edge points in the edge point set to the temporary center point of the combination cover and the temporary radius of the combination cover; obtaining the temporary optimal fitting probability according to the degree of fit of the edge points and the reference weights of each reference cluster; and filtering and updating the edge point set according to the degree of fit of the edge points to obtain a new edge point set.

[0075] It should be noted that after obtaining the fitting circle according to the temporary center point and temporary radius of the combined cover, for any edge point, if the edge point is near the fitting circle, it means that the fit between the edge point and the fitting circle is higher.

[0076] Specifically, for any edge point, the result of normalizing the inverse proportion of the absolute value of the difference between the distance from the edge point to the temporary center point of the combined cover and the temporary radius of the combined cover is recorded as the fit of the edge point.

[0077] It should be noted that, since not all edge points are the real edges of the combined cover, it is only necessary to make the edge points with larger reference weights have a higher fit, so the temporary optimal fitting probability is calculated based on this.

[0078] Specifically, the reference weight of the combined cover edge point cluster is recorded as 1;

[0079] The calculation method of the temporary fit optimal probability is:

[0080]

[0081] Where M is the temporary optimal fitting probability; n is the total number of edge points in the edge point set; Y k is the reference weight of the edge point cluster where the kth edge point is located; X k is the fit degree of the kth edge point; softmax() is the weight normalization function, and the normalized object is the reference weight of the edge point cluster where all edge points are located.

[0082] It should be noted that when the temporary optimal fitting probability is low, it means that the obtained fitting circle is relatively rough, so it is necessary to exclude the edge points that do not belong to the real edge of the combination cover, so as to improve the fitting effect of the fitting circle.

[0083] Specifically, edge points whose fit degree is less than a fit threshold W are removed from the edge point set to obtain a new edge point set; wherein, this embodiment is described by taking W=10 as an example.

[0084] Step S005, obtaining the fit degree of the new edge points according to the new edge point set, and obtaining a new temporary fitting optimal probability according to the calculation method of the temporary fitting optimal probability, iteratively obtaining the optimal fitting circle, and obtaining the visual quality detection result of the combined cover according to the optimal fitting circle.

[0085] It should be noted that in order to improve the fitting effect of the fitting circle, the fitting process needs to be iterated multiple times.

[0086] Specifically, the new edge point set is iterated using the RANSAC algorithm to obtain a fitting circle, and the center and radius of the fitting circle obtained by the RANSAC algorithm are used as the temporary center point and temporary radius of the combination cover respectively. In each iteration process, the new edge point set is clustered using K-means and the elbow method, and the clustering distance is measured by the distance between the edge point and the temporary center point of the combination cover to obtain several new edge point clusters, and the combined cover edge probability and new combined cover edge point clusters of the new edge point clusters are obtained. The fit of the new edge points and the new temporary fitting optimal probability are obtained using the method of step S003-step S004, and the iteration is stopped until the temporary fitting optimal probability is greater than the optimal threshold E, and the latest fitting circle is recorded as the optimal fitting circle; wherein, the RANSAC algorithm is a well-known technology, and the specific method is not introduced here; wherein, this embodiment is described using E=0.8 as an example.

[0087] Furthermore, for any combination cover image, the number of all edge pixel points in the combination cover image that are outside the optimal fitting circle is obtained, which is recorded as the abnormality index of the combination cover image, and the combination cover corresponding to the combination cover image whose abnormality index is greater than the abnormality threshold U is recorded as an abnormal combination cover, and the abnormal combination covers are sorted by using a sorting mechanism; wherein, this embodiment is described using U=10 as an example.

[0088] This embodiment uses the exp(-mx) model to present the inverse proportional relationship and normalization processing, mx is the input of the model, and the implementer can set the inverse proportional function and normalization function according to actual conditions.

[0089] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A machine vision quality inspection method for an infusion container combination cover, characterized in that: The method comprises the following steps: Obtain edge point set of combined cover image; According to the edge point set, a temporary center point of the combined cover is obtained; according to the distance from the edge point in the edge point set to the temporary center point of the combined cover, several edge point clusters and the combined cover edge probability of each edge point cluster are obtained; the edge point clusters are divided into combined cover edge point clusters and reference clusters according to the combined cover edge probability; according to the distance from the edge point in the combined cover edge point cluster to the temporary center point of the combined cover, the temporary radius of the combined cover is obtained; According to the fluctuation of the distance from the edge point in each reference cluster to the center point of the combined cover edge point cluster, and the difference between the distance from the edge point in the combined cover edge point cluster to the center point of the combined cover edge point cluster, the association degree of each reference cluster is obtained; according to the association degree of each reference cluster and its combined cover edge probability, the reference weight of each reference cluster is obtained; According to the difference between the distance from the edge point in the edge point set to the temporary center point of the combination cover and the temporary radius of the combination cover, the fitting degree of the edge point is obtained; according to the fitting degree of the edge point and the reference weight of each reference cluster, the temporary fitting optimal probability is obtained; according to the fitting degree of the edge point, the edge point set is screened and updated to obtain a new edge point set; The fit degree of the new edge points is obtained according to the new edge point set, and the new temporary fitting optimal probability is obtained according to the calculation method of the temporary fitting optimal probability, and the optimal fitting circle is obtained iteratively, and the visual quality detection result of the combined cover is obtained according to the optimal fitting circle.

2. The machine vision quality inspection method for the combined cover of an infusion container according to claim 1, characterized in that: The specific method of obtaining the temporary center point of the combined cover according to the edge point set is as follows: The center point of all edge points in the edge point set of the combined cover image is recorded as the temporary center point of the combined cover.

3. The machine vision quality inspection method for the combined cover of an infusion container according to claim 1, characterized in that: The specific method of obtaining a plurality of edge point clusters and the probability of combined cover edge of each edge point cluster according to the distance from the edge point in the edge point set to the temporary center point of the combined cover is as follows: The edge points in the edge point set of the combined cover image are clustered using K-means and elbow method. The distance between the edge point and the temporary center point of the combined cover is used as the measure of cluster distance to obtain several edge point clusters. For any edge point cluster, the center point of all edge points in the edge point cluster is recorded as the center point of the edge point cluster; The calculation method of the combined cover edge probability of the ath edge point cluster is: Where P a is the combined cover edge probability of the ath edge point cluster; N a is the number of edge points in the ath edge point cluster; D a is the distance between the center point of the ath edge point cluster and the temporary center point of the combined cover; S a is the variance of the distances from all edge points in the ath edge point cluster to the center point of the ath edge point cluster; Norm() is the linear normalization function; ε is a hyperparameter.

4. The machine vision quality inspection method for the combined cover of an infusion container according to claim 1, characterized in that: The method of dividing the edge point clusters into combined cover edge point clusters and reference clusters according to the combined cover edge probability includes: The edge point cluster with the largest probability of combined cover edge is recorded as the combined cover edge point cluster; the other edge point clusters are recorded as reference clusters.

5. The machine vision quality inspection method for the combined cover of an infusion container according to claim 1, characterized in that: The method of obtaining the temporary radius of the combined cover according to the distance from the edge point in the combined cover edge point cluster to the temporary center point of the combined cover includes: The average of the distances from all edge points in the combined cover edge point cluster to the temporary center point of the combined cover is recorded as the temporary radius of the combined cover.

6. The machine vision quality inspection method for the combined cover of an infusion container according to claim 1, characterized in that: The method of obtaining the degree of association of each reference cluster class according to the volatility of the distance from the edge point in each reference cluster class to the center point of the combined cover edge point cluster class and the difference between the distance from the edge point in the combined cover edge point cluster class to the center point of the combined cover edge point cluster class is as follows: The calculation method of the correlation degree between the cth reference cluster and the combined cover edge point cluster is: L c =exp(-S′ c ×|D′ c -D″|) Where, L c is the degree of association between the cth reference cluster and the combined cover edge point cluster; S' c is the variance of the distance from all edge points in the cth reference cluster to the center point of the combined cover edge point cluster; D' c is the mean distance from all edge points in the cth reference cluster to the center point of the combined cover edge point cluster; D” is the mean distance from all edge points in the combined cover edge point cluster to the center point of the combined cover edge point cluster; exp() is an exponential function with a natural constant as the base; || is the absolute value function.

7. The machine vision quality inspection method for the combined cover of an infusion container according to claim 1, characterized in that: The specific method of obtaining the reference weight of each reference cluster class according to the association degree of each reference cluster class and the combined cover edge probability thereof includes: For any reference cluster, the linear normalized result of the ratio of the association degree between the reference cluster and the combined cover edge point cluster to the combined cover edge probability of the reference cluster is recorded as the reference weight of the reference cluster.

8. The machine vision quality inspection method for the combined cover of an infusion container according to claim 1, characterized in that: The method of obtaining the degree of fit of the edge point according to the difference between the distance from the edge point in the edge point concentration to the temporary center point of the combined cover and the temporary radius of the combined cover includes: For any edge point, the result of normalizing the inverse proportion of the absolute value of the difference between the distance from the edge point to the temporary center point of the combined cover and the temporary radius of the combined cover is recorded as the fit of the edge point.

9. The machine vision quality inspection method for the combined cover of an infusion container according to claim 8, characterized in that: The specific method of obtaining the temporary optimal fitting probability according to the fit degree of the edge points and the reference weights of each reference cluster is as follows: The reference weight of the combined cover edge point cluster is recorded as 1; The calculation method of the temporary fit optimal probability is: Where M is the temporary optimal fitting probability; n is the total number of edge points in the edge point set; Y k is the reference weight of the edge point cluster where the kth edge point is located; X k is the fit degree of the kth edge point; softmax() is the weight normalization function.

10. The machine vision quality inspection method for the combined cover of an infusion container according to claim 9, characterized in that: The method of obtaining the fit degree of new edge points according to the new edge point set, obtaining a new temporary optimal fitting probability according to the calculation method of the temporary optimal fitting probability, and iterating to obtain the optimal fitting circle includes the following specific methods: The new edge point set is iterated using the RANSAC algorithm to obtain the fitting circle, and the center and radius of the fitting circle obtained by the RANSAC algorithm are used as the temporary center point and temporary radius of the combined cover respectively. In each iteration, the new edge point set is clustered using K-means and the elbow method. The clustering distance is measured by the distance between the edge point and the temporary center point of the combined cover, and several new edge point clusters are obtained. The combined cover edge probability and new combined cover edge point clusters of the new edge point clusters are obtained, and the fit of the new edge points and the new temporary fitting optimal probability are obtained. The iteration is stopped until the temporary fitting optimal probability is greater than the optimal threshold, and the latest fitting circle is recorded as the optimal fitting circle.

Citation Information

Patent Citations

  • Jar cover surface defect detection method based on machine vision

    CN108389179A

  • Object roundness measuring method

    CN110349199A

  • Defective circle fitting method and device for drilling blasting and medium

    CN112991307A

  • Object positioning method and device, electronic equipment and readable storage medium

    CN114998274A