Visual identification defect filtering control method and system applied to plastic bottle handle

By acquiring and analyzing visual image data of plastic bottle handles, and combining spatial location and geometric orientation features, the problem of distinguishing similar defects in traditional visual recognition methods has been solved. This has enabled accurate identification and classification of defects in plastic bottle handles, improving production efficiency and the accuracy of product quality control.

CN122425008APending Publication Date: 2026-07-21NANNING PEGASUS PACKAGING PRODUCTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANNING PEGASUS PACKAGING PRODUCTS CO LTD
Filing Date
2026-03-17
Publication Date
2026-07-21

Smart Images

  • Figure CN122425008A_ABST
    Figure CN122425008A_ABST
Patent Text Reader

Abstract

The application provides a visual recognition defect filtering control method and system applied to plastic bottle handles, and relates to the technical field of visual recognition. The method comprises the following steps: extracting the visual features of the plastic bottle handle and calculating the feature deviation; marking the image area with a feature deviation exceeding a preset threshold as an abnormal pattern candidate area and determining the defect type of the abnormal pattern candidate area, and generating a control instruction according to the defect type to control the automatic equipment to perform a reservation or rejection operation. The method aims to solve the problem that the traditional visual recognition method is difficult to accurately distinguish the defects of the plastic bottle handle, leading to qualified products being mistakenly rejected or unqualified products being missed, causing resource waste and damaging the product image, and can realize accurate identification and classification of the defects of the plastic bottle handle, effectively distinguishing between serious appearance defects and tiny process defects, thereby avoiding misjudgment and missing judgment, and improving the efficiency and accuracy of product quality control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of visual recognition technology, and more specifically, to a visual recognition defect filtering and control method and system applied to plastic bottle handles. Background Technology

[0002] In automated production, especially in the assembly of high-volume, high-speed components like plastic bottle handles, visual recognition systems play a crucial role, ensuring quality control before products move to the next stage. However, with increasingly complex production processes and rising consumer demands for product appearance, traditional visual recognition methods often struggle to accurately distinguish between various types of defects with similar visual characteristics. This leads to the misjudgment and rejection of qualified products or the failure to release unqualified ones, resulting in resource waste and damage to product image. Designing an intelligent defect filtering and control method, particularly when simultaneously identifying minor defects affecting function, appearance, and those without impact on function or appearance, has become a pressing technical challenge.

[0003] For example, on large-scale automated production lines for edible oil or bottled water, the installation of plastic bottle handles is a crucial step. The production line transports large-capacity plastic bottles to designated workstations via conveyor belts, while automated handle installation equipment picks up the plastic handles from the material bin and accurately installs them onto the bottle neck. To ensure product quality and production efficiency, the equipment integrates a vision recognition system. Before the robotic arm picks up the handle, an industrial camera photographs it and transmits the image information to a central controller. The controller's image processing program analyzes the integrity of the handle, identifying structural defects that significantly affect its use, such as breakage, severe deformation, or missing material. Once such defective handles are identified, the controller instructs the robotic arm to abandon the grip and relegate them to the waste area, thus preventing problematic handles from being installed on qualified bottles and ensuring the basic functionality of the finished products. This process is continuous and high-speed, a fundamental operation for quality control on modern production lines.

[0004] However, in actual long-term production, the situation became more complex. Firstly, as a mass-produced component using injection molding, handles inherently exhibit a certain range of manufacturing variations. For example, different batches of raw materials might result in slight color differences in the handles, or during demolding, minor burrs that do not affect strength or usability might inevitably appear on the edges of the handles. Initially, the visual recognition system, with its overly strict inspection standards, misclassified even qualified handles with minor burrs or slight color differences as defective, leading to an excessively high scrap rate. This not only wasted materials but also reduced overall production efficiency. To address this issue, technicians adjusted the recognition program, relaxing the thresholds for non-critical features like burrs and color differences, allowing the system to focus on structural defects that truly affect functionality, such as fractures and gaps. This adjustment was highly successful, significantly reducing the scrap rate and effectively improving the production line's operational efficiency.

[0005] However, the production line began receiving feedback from the market, with some consumers complaining that the product handles appeared to have cracks, affecting their purchasing experience and even causing some to doubt the product's quality. After tracing and investigation, the problem was found to lie in a new batch of handle raw materials. The supplier had changed the raw material formula, causing a semi-transparent, hairline flow mark to easily form inside the handle during injection molding. This flow mark is not a crack in terms of physical structure and does not affect the handle's load-bearing capacity or lifespan; it is purely a cosmetic issue. However, visually, this flow mark is very similar to a micro-crack, making it almost indistinguishable to consumers. The problem is that the current optimized visual recognition system, because its judgment criteria have been relaxed to ignore minor burrs and scratches, also judged this internal flow mark, which resembles a burr, as an "acceptable minor defect," thus allowing these handles with serious cosmetic defects to be approved.

[0006] This puts the production line in a dilemma. If the identification system's judgment criteria are adjusted back to their initial strict state, while this effectively filters out handles with flow marks, it also filters out a large number of qualified handles with harmless burrs, causing the scrap rate to soar again, returning to the original problem. Maintaining the status quo will continue to produce products with appearance defects, damaging the brand image and potentially leading to customer loss. Existing control methods can only choose between two extremes: "too strict" and "too lenient." They cannot simultaneously identify internal flow marks that affect appearance while ignoring edge burrs that do not affect appearance or function. These two types of defects share certain similarities in image features, such as contours and grayscale variations, making it impossible for traditional single-logic identification to effectively distinguish them, thus failing to achieve precise defect filtering and control.

[0007] There is currently no effective technical solution to the above problems. Summary of the Invention

[0008] The purpose of this invention is to provide a visual identification defect filtering and control method and system for plastic bottle handles. This system aims to solve the problem that traditional visual identification methods struggle to accurately distinguish between various types of defects with similar visual characteristics on plastic bottle handles, leading to the misjudgment and rejection of qualified products or the missed release of unqualified products, resulting in resource waste and damage to product image. The invention enables accurate identification and classification of defects in plastic bottle handles, effectively distinguishing between serious appearance defects, minor process defects, and other appearance damage, thereby avoiding misjudgments and missed detections, and improving the efficiency and accuracy of product quality control.

[0009] In a first aspect, the present invention provides a visual recognition defect filtering and control method for plastic bottle handles, comprising the following steps: S1. Acquire visual image data of the handle of the plastic bottle to be detected, and extract the visual features of the handle of the plastic bottle from the visual image data; S2. The extracted visual features are compared with a preset set of normal pattern features and the feature deviation is calculated. Image regions with feature deviation exceeding a preset threshold are marked as abnormal pattern candidate regions. S3. Extract the spatial position features of the candidate region of the abnormal pattern relative to the handle of the plastic bottle, and extract the geometric orientation features of the candidate region of the abnormal pattern; S4. Based on the spatial location features and the geometric direction features, determine the defect type of the anomaly pattern candidate region, and generate control instructions based on the defect type to control the automated equipment to perform retention or rejection operations, specifically including: S41. When the spatial location feature shows that the abnormal pattern candidate area is located inside the plastic bottle handle, and the geometric direction feature shows that the abnormal pattern candidate area is consistent with the injection molding flow direction, the defect type is determined to be a serious appearance defect and a rejection instruction is generated. S42. When the spatial location feature indicates that the abnormal pattern candidate area is located at the edge of the plastic bottle handle, the defect type is determined to be a minor process defect and a retention instruction is generated.

[0010] The visual recognition defect filtering and control method for plastic bottle handles provided by this invention can accurately identify and classify defects in plastic bottle handles, effectively distinguishing between serious appearance defects, minor process defects and other appearance damage, thereby avoiding misjudgment and omission, improving the efficiency and accuracy of product quality control, and solving the problem that traditional visual recognition systems cannot effectively distinguish similar defects.

[0011] Secondly, the present invention provides a visual recognition defect filtering control system for plastic bottle handles, comprising: The acquisition module is used to acquire visual image data of the handle of the plastic bottle to be detected, and extract the visual features of the handle of the plastic bottle from the visual image data; The labeling module is used to compare the extracted visual features with a preset set of normal pattern features and calculate the feature deviation, and to label the image regions whose feature deviation exceeds a preset threshold as abnormal pattern candidate regions. The extraction module is used to extract the spatial position features of the abnormal pattern candidate region relative to the handle of the plastic bottle, and to extract the geometric orientation features of the abnormal pattern candidate region. The control module is used to determine the defect type of the anomaly pattern candidate region based on the spatial location features and the geometric orientation features, and to generate control commands based on the defect type to control the automated equipment to perform retention or rejection operations, specifically including: S41. When the spatial location feature shows that the abnormal pattern candidate area is located inside the plastic bottle handle, and the geometric direction feature shows that the abnormal pattern candidate area is consistent with the injection molding flow direction, the defect type is determined to be a serious appearance defect and a rejection instruction is generated. S42. When the spatial location feature indicates that the abnormal pattern candidate area is located at the edge of the plastic bottle handle, the defect type is determined to be a minor process defect and a retention instruction is generated.

[0012] As can be seen from the above, the visual recognition defect filtering and control method for plastic bottle handles provided by this invention effectively solves the problem in the prior art where traditional visual recognition systems struggle to accurately distinguish between various types of defects with similar visual features. Specifically, this application, through comprehensive analysis of the spatial location and geometric direction of defects, can classify abnormal patterns located inside the handle and aligned with the injection molding flow direction as serious appearance defects (such as internal flow marks) and generate rejection instructions; abnormal patterns located at the edge of the handle are classified as minor process defects (such as harmless burrs) and retain instructions are generated; for abnormal patterns located inside the handle but not aligned with the injection molding flow direction, they are classified as other appearance damages and secondary rejection instructions or manual re-inspection instructions are generated. Through this refined defect classification and control strategy, this application overcomes the limitations of the single recognition logic in the prior art, avoiding the problem of qualified products being mistakenly rejected and unqualified products being missed. This not only significantly reduces the scrap rate and improves production efficiency but also ensures product quality and maintains brand image.

[0013] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing embodiments of the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings. Attached Figure Description

[0014] Figure 1 This is a flowchart of a visual recognition defect filtering and control method for plastic bottle handles provided in an embodiment of the present invention.

[0015] Figure 2 This is a schematic diagram of a visual recognition defect filtering control system for plastic bottle handles provided in an embodiment of the present invention.

[0016] Label Explanation: 100. Acquisition module; 200. Marking module; 300. Extraction module; 400. Control module. Detailed Implementation

[0017] 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. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0018] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0019] In automated production processes, visual recognition systems are used for quality inspection of plastic bottle handles. However, existing technologies have inherent limitations when dealing with defect types that have similar visual features but different impacts. Specifically, internal defects affecting appearance and acceptable edge defects exhibit a high degree of overlap in image feature parameters, making it impossible for the system to accurately distinguish between them. This lack of differentiation ability directly leads to the failure of defect filtering control, resulting in the incorrect rejection of qualified products or the incorrect retention of unqualified products, which in turn adversely affects the continuous operation of the production line and the product qualification rate. The misjudgment of defect types stems from the fact that traditional methods rely solely on a single visual feature threshold for judgment, failing to comprehensively consider the spatial location and geometric orientation characteristics of the defect. This leads to a dilemma for the system between strict and lenient judgment criteria.

[0020] For example, in a large-scale edible oil bottling production line, plastic bottle handles are conveyed to a vision inspection station via a conveyor belt. After an industrial camera captures an image of the handle, the central controller executes a defect analysis process. When flow marks are present inside the handle in the same direction as the injection molding, the system misclassifies them as edge burrs due to feature similarity and retains them; however, when there are tiny burrs on the edge of the handle, the system may classify them as structural defects and reject them due to historical parameter adjustments. Furthermore, flow mark defects appear as semi-transparent hairline structures in the image, and their outlines and grayscale variation characteristics are highly similar to edge burrs, causing the system to be unable to distinguish between the two based on existing thresholds. As a result, handles with flow marks are installed on the bottle, causing product appearance defects; at the same time, a large number of qualified handles are discarded due to burrs, increasing material consumption and equipment downtime frequency.

[0021] If the aforementioned problems are not addressed, the production line will remain in a state of logical imbalance in its decision-making process for an extended period. The continuous influx of products with appearance defects into the market will raise consumer concerns about product quality and damage brand reputation; conversely, excessive rejection of qualified products will lead to material supply shortages and production disruptions. This situation further exacerbates the conflict between defect filtering accuracy and production efficiency, making production units unable to adapt to process fluctuations and raw material changes, ultimately reducing the robustness and market competitiveness of the overall production system. Therefore, a technical solution capable of accurate classification based on defect characteristics is urgently needed.

[0022] For reference, see the appendix. Figure 1 This invention provides a visual recognition defect filtering and control method for plastic bottle handles, comprising the following steps: S1. Acquire visual image data of the handle of the plastic bottle to be detected, and extract visual features of the plastic bottle handle from the visual image data; S2. Compare the extracted visual features with the preset normal pattern feature set and calculate the feature deviation. Mark the image regions with feature deviation exceeding the preset threshold as abnormal pattern candidate regions. The normal pattern feature set is trained based on qualified plastic bottle handle samples and contains at least statistical feature parameters that reflect the surface texture and contour of the plastic bottle handle. S3. By performing topological analysis on the candidate regions of abnormal patterns, the spatial position features of the candidate regions of abnormal patterns relative to the handle of the plastic bottle are extracted, as well as the geometric orientation features of the candidate regions of abnormal patterns are extracted. S4. Based on spatial location and geometric orientation characteristics, determine the defect type of the anomaly pattern candidate area, and generate control instructions based on the defect type to control the automated equipment to perform retention or rejection operations, specifically including: S41. When the spatial location feature shows that the candidate area of ​​the abnormal pattern is located inside the handle of the plastic bottle, and the geometric direction feature shows that the candidate area of ​​the abnormal pattern is consistent with the injection flow direction, the defect type is determined to be a serious appearance defect and a rejection instruction is generated. S42. When the spatial location feature shows that the candidate area of ​​the abnormal pattern is located at the edge of the plastic bottle handle, the defect type is determined to be a minor process defect and a retention instruction is generated. S43. When the spatial location feature shows that the candidate area of ​​the abnormal pattern is located inside the handle of the plastic bottle, and the geometric direction feature shows that the candidate area of ​​the abnormal pattern is inconsistent with the injection flow direction, the defect type is determined to be other appearance damage, and a secondary rejection instruction or a manual re-inspection instruction is generated.

[0023] For ease of understanding, the following explains some key terms in this embodiment: Visual image data refers to a collection of images acquired through equipment such as industrial cameras to describe the appearance of plastic bottle handles. This data may include visible light images to capture the color, texture, and macroscopic defects of the handle surface; near-infrared spectral images to reveal anomalies in the material's internal structure or specific chemical composition; and three-dimensional topography data to accurately measure the height, depth, and geometry of the handle surface, thereby identifying defects such as dents, protrusions, or deformations.

[0024] Visual features refer to information extracted from visual image data that quantifies the appearance characteristics of plastic bottle handles. These features can include geometric features (such as contour, area, and aspect ratio), texture features (such as contrast, energy, and entropy), color features (such as average color and color standard deviation), and edge smoothness. The combination of these features is used to construct the "digital fingerprint" of the handle for subsequent defect detection and classification.

[0025] Normal pattern feature set: This refers to a reference dataset representing the appearance characteristics of normal products, trained based on a large number of qualified plastic bottle handle samples. This set contains at least statistical feature parameters reflecting the surface texture and contour of the handle, such as the average texture parameters, contour perimeter, area, etc., of qualified samples, and their corresponding standard deviations. By comparing the handle to be tested with this set, the degree of deviation between it and normal products can be quantified.

[0026] Feature deviation: This refers to the degree of difference between the visual features of the plastic bottle handle to be detected and the feature set of the normal pattern. This deviation can be quantified by calculating the distance between multidimensional feature vectors (such as Euclidean distance or Mahalanobis distance). The greater the deviation, the more significant the difference between the handle to be detected and the normal pattern, and the more likely a defect is to exist.

[0027] Anomaly pattern candidate regions: These refer to image regions where the feature deviation exceeds a preset threshold. These regions are initially marked as potentially defective and require further analysis to determine the specific defect type.

[0028] Spatial location characteristics: These refer to the specific location information of the anomaly pattern candidate area on the handle of the plastic bottle, such as whether it is located in the internal area, edge area, or connecting area of ​​the handle. This feature is crucial for distinguishing different types of defects, such as internal flow marks and edge burrs.

[0029] Geometric orientation features: These refer to the extension direction or principal axis direction of the candidate region for abnormal patterns. This feature can be used to determine whether defects are related to production process parameters such as injection flow direction, thereby more accurately identifying defect types.

[0030] Injection flow direction: refers to the direction in which plastic flows and fills the cavity in the mold. During the injection molding process, the geometric direction of certain defects (such as flow marks) often coincides with the injection flow direction. Therefore, comparing the geometric characteristics with the injection flow direction helps to identify such defects.

[0031] Control instructions: These are instructions generated based on the defect type to control automated equipment to perform corresponding operations. These operations may include retaining qualified products, rejecting non-conforming products, performing secondary rejection, or initiating manual re-inspection.

[0032] This application proposes a visual recognition defect filtering and control method for plastic bottle handles, aiming to solve the problem of traditional visual recognition methods in distinguishing multiple types of defects with similar visual features, thereby achieving precise filtering and control of defects.

[0033] First, the method involves acquiring visual image data of the handle of the plastic bottle to be inspected and extracting visual features from the visual image data. In practical applications, visual image data can be acquired in various ways. For example, an industrial camera equipped with a high-resolution CMOS sensor can be used to photograph the handle, acquiring visible light images. This image data is transmitted to a central controller for processing via an image acquisition card. Extracting visual features from this image data is the foundation for subsequent analysis. Visual feature extraction can include recognizing the overall contour of the handle, such as calculating its perimeter, area, and aspect ratio using the Canny edge detection algorithm. Furthermore, texture parameters such as contrast, energy, and entropy of the image can be calculated using the Gray-Level Co-occurrence Matrix (GLCM) to reflect the uniformity and roughness of the handle surface. Color uniformity can also be evaluated by performing color histogram analysis on the pixels of the handle area, calculating the mean and standard deviation of the color channels. Edge smoothness can be quantified by curve fitting to points on the handle contour and calculating the fitting error or curvature change. The extraction of these features provides a quantitative basis for subsequent defect detection.

[0034] Secondly, the extracted visual features are compared with a pre-defined normal pattern feature set, and the feature deviation is calculated. Image regions with feature deviations exceeding a pre-defined threshold are marked as abnormal pattern candidate regions. The normal pattern feature set is trained based on qualified plastic bottle handle samples and includes at least statistical feature parameters reflecting the surface texture and contour of the plastic bottle handle. In practice, the system continuously collects a large number of confirmed qualified handle images and extracts their visual features. These feature data are stored in a reference database, and their statistical mean and standard deviation are calculated as the initial feature set for the "normal pattern." This learning process is continuous. Whenever a new qualified handle passes the detection, its feature data is updated using a moving average to ensure that the understanding of the "normal pattern" can adapt to minor differences between handle batches and natural fluctuations in production. When a new handle image is captured, the image processing program compares its extracted features with the established "normal pattern" feature space in real time. The comparison method can use distance calculation of multi-dimensional feature vectors, such as Euclidean distance or Mahalanobis distance. If the calculated distance exceeds a preset "abnormal threshold," the system will immediately mark it as an "abnormal pattern," even if these deviations have not yet reached the traditionally defined defect judgment threshold. The purpose of this initial marking is to capture any unusual visual manifestations, rather than immediately judging them as defects.

[0035] Furthermore, by performing topological analysis on the candidate regions of abnormal patterns, the system extracts the spatial positional features of the candidate regions relative to the plastic bottle handle, as well as their geometric orientation features. For handles marked as "abnormal patterns," the system conducts further in-depth feature topological analysis. This involves not only analyzing the local manifestations of the abnormal features themselves, but more importantly, analyzing their spatial relationships and connectivity with the overall structure of the handle and other features. Local manifestation analysis includes extracting the shape, size, grayscale value, contrast, and directionality of the abnormal region. Spatial relationship analysis focuses on the specific location of the abnormal feature on the handle, such as whether it is located in the stress area of ​​the handle, near the injection port, or at the edge of the handle. Connectivity analysis determines whether the abnormal feature is connected to other features or exists independently within the handle. Through a comprehensive evaluation of these features, the system assigns a potential risk level to the abnormal pattern. For example, a thin, linear anomaly, if its directionality aligns with the injection flow direction, its location is inside the handle, and it has a high correlation with the handle's stress area, while its grayscale value change is gentle but continuous, these features highly match known "internal flow mark" patterns. Even if its contrast is not high, the system will assign it a higher potential risk level, initially classifying it as a "serious appearance defect." Conversely, if the anomaly manifests as a minor irregularity on the handle edge, and its topological structure more closely resembles "edge burrs," it will be assigned a lower risk level, initially classifying it as a "minor manufacturing defect." This analysis process can employ a rule-based expert system or train a classifier to determine the risk level based on the extracted topological features.

[0036] Finally, based on spatial location and geometric orientation features, the defect type of the candidate area for abnormal patterns is determined, and control instructions are generated according to the defect type to control the automated equipment to perform retention or rejection operations. Specifically, when the spatial location features indicate that the candidate area for abnormal patterns is located inside the plastic bottle handle, and the geometric orientation features indicate that the candidate area for abnormal patterns is consistent with the injection molding flow direction, the defect type is determined to be a serious appearance defect, and a rejection instruction is generated. When the spatial location features indicate that the candidate area for abnormal patterns is located at the edge of the plastic bottle handle, the defect type is determined to be a minor process defect, and a retention instruction is generated. When the spatial location features indicate that the candidate area for abnormal patterns is located inside the plastic bottle handle, and the geometric orientation features indicate that the candidate area for abnormal patterns is inconsistent with the injection molding flow direction, the defect type is determined to be other appearance damage, and a secondary rejection instruction or a manual re-inspection instruction is generated. The system records the abnormal pattern analysis results and potential risk level of each inspected handle and associates them with the production batch information of that handle. This data is stored in a production database. The system continuously monitors the number and risk level distribution of abnormal handles in each production batch within a short time window. If the system detects multiple handles with similar "abnormal patterns" and high risk levels from the same production batch within a short period, it will immediately trigger a "potential defect batch warning." This warning will send an audible and visual alarm to the operator through the production line control system and display detailed warning information on the human-machine interface, indicating that the batch may have a common defect trend that is difficult to capture by a single threshold. Simultaneously, the system will suggest that the operator perform manual sampling or, through linkage with the production management system, automatically adjust the injection molding machine's process parameters, thereby achieving early intervention for potential problems.

[0037] The following example will provide a more detailed explanation of the above technical solution: Suppose a plastic bottle handle production line requires quality inspection of the handles. Traditional visual recognition systems struggle to distinguish between internal flow marks (serious appearance defects) and edge burrs (minor manufacturing defects), leading to misjudgments. To address this, this application proposes a visual recognition defect filtering and control method.

[0038] First, on the production line, industrial cameras continuously acquire visual image data of the handles of the plastic bottles to be inspected. This data is transmitted to a central controller. The image processing program in the controller extracts visual features of the handles from this image data, such as the overall outline, surface texture, color uniformity, and edge smoothness. For example, the Canny edge detection algorithm can extract the outline of the handle and calculate its perimeter and area; the gray-level co-occurrence matrix can analyze the texture features of the handle surface.

[0039] Next, the system compares the extracted visual features with a preset set of normal pattern features. This set of normal pattern features is trained on a large number of qualified handle samples and includes statistical feature parameters of qualified handles in terms of contour, texture, etc. Through comparison, the system calculates the feature deviation between the current handle and the normal pattern. If the feature deviation of a certain image region exceeds a preset threshold, that region will be marked as an abnormal pattern candidate region. For example, a subtle, low-contrast linear feature, although its grayscale value change is insufficient to be identified as a crack or flow mark by a traditional fixed threshold, will be marked as abnormal if it has never appeared in the "normal pattern" or if its texture parameters are significantly different from those of a normal handle.

[0040] Subsequently, the system performs topological structure analysis on these candidate regions of abnormal patterns. This step is crucial for distinguishing different defects. The system extracts the spatial positional features of the candidate regions of abnormal patterns relative to the plastic bottle handle, such as determining whether it is located inside or at the edge of the handle. Simultaneously, the system also extracts the geometric orientation features of the candidate regions of abnormal patterns, such as calculating their principal extension direction. For example, for a linear region marked as abnormal, the system analyzes its set of pixel coordinates to determine whether it falls entirely within the core area of ​​the handle (inside) or whether it overlaps with the edge contour area of ​​the handle (edge). Simultaneously, the system performs connected component analysis to calculate its principal axis of inertia direction, which serves as its principal extension direction.

[0041] Finally, based on these spatial location and geometric orientation features, the system determines the defect type of the anomaly pattern candidate region and generates corresponding control commands. Specifically: Scenario 1: If the candidate area of ​​the abnormal pattern is located inside the handle of a plastic bottle, and its geometric direction features are consistent with the injection flow direction (for example, by calling the preset injection flow vector diagram, the absolute value of the angle between the main extension direction of the abnormal area and the theoretical injection flow vector is less than the preset angle threshold), the system will determine that the defect type is a serious appearance defect (such as internal flow marks), and generate a rejection instruction to control the automated equipment to reject the handle.

[0042] Scenario 2: If the abnormal pattern candidate area is located on the edge of the plastic bottle handle, the system will determine that the defect type is a minor process defect (such as edge burrs) and generate a retention instruction to control the automated equipment to retain the handle and allow it to enter the next production stage.

[0043] Scenario 3: If the candidate area for the abnormal pattern is located inside the plastic bottle handle, but its geometric orientation is inconsistent with the injection molding flow direction, the system will determine that the defect type is other appearance damage and generate a secondary rejection instruction or a manual re-inspection instruction. For example, this may be caused by foreign object embedding or scratches, requiring further manual judgment or more stringent rejection.

[0044] As can be seen from the above examples, this method achieves accurate differentiation and filtering control of different types of defects by comprehensively considering the spatial location and geometric orientation of the defects.

[0045] The visual recognition defect filtering and control method for plastic bottle handles proposed in this application represents a significant technological contribution compared to traditional methods. Traditional methods often only allow for a choice between "too strict" and "too lenient" inspection standards, failing to effectively distinguish between internal defects affecting appearance and acceptable edge defects, leading to high scrap rates or missed detections. For example, in the above example, if relying solely on feature deviation, both internal flow marks and edge burrs might be flagged as abnormal, but traditional methods struggle to further differentiate their nature.

[0046] This method achieves refined defect classification by introducing topological structure analysis of candidate regions for abnormal patterns, extracting their spatial location and geometric orientation features. For example, by determining that the abnormal area is located inside the handle and combining this with its consistency with the injection molding flow direction, serious appearance defects, such as internal flow marks, can be accurately identified and promptly rejected. This avoids the traditional method's mistaken acceptance of such defects that affect the consumer experience as acceptable defects. Simultaneously, for abnormal areas located at the edge of the handle, this method can classify them as minor process defects and retain them, effectively reducing the false rejection rate of qualified products due to overly stringent standards. This comprehensive judgment based on multi-dimensional features enables the system to filter defects more intelligently, avoiding the dilemma of traditional methods under strict or lenient standards.

[0047] Furthermore, this method achieves continuous optimization of defect early warning and judgment logic through production batch correlation analysis and a closed-loop learning mechanism. The system can monitor the trend of high-risk defects in specific batches and issue timely warnings, even suggesting adjustments to production process parameters, thereby achieving early intervention for potential problems. Once market feedback emerges, the system can trace and re-evaluate the characteristics of released defects, automatically or after manual confirmation, adjusting identification parameters to form a closed loop of continuous learning and self-improvement. This dynamic adaptation and optimization capability is not possessed by traditional fixed threshold or single-feature identification methods, significantly improving the accuracy of defect identification and the overall quality control level of the production line.

[0048] In some embodiments, the normal pattern feature set also includes a standard binarized mask of the plastic bottle handle; In step S3, the specific steps for extracting the spatial location features of the abnormal pattern candidate region relative to the plastic bottle handle include: S3A1. Shrink the standard binary mask to define the core area of ​​the main body, and define the boundary of the original standard binary mask as the edge contour area; S3A2. Map the set of pixel coordinates of the abnormal mode candidate region to the coordinate system of the standard binary mask; S3A3. When the set of pixel coordinates falls completely within the core area of ​​the main body, the spatial location feature is determined to be located inside the handle of the plastic bottle; S3A4. When there are overlapping pixels between the pixel coordinate set and the edge contour region, the spatial location feature is determined to be located at the edge of the plastic bottle handle.

[0049] The standard binarized mask is a binary image used to represent the ideal geometry of a plastic bottle handle. Its function is to provide a stable and invariant reference base for subsequent accurate spatial localization and classification of detected anomalous areas. This mask can be generated based on a computer-aided design (CAD) model of the plastic bottle handle by binarizing the two-dimensional projection of the CAD model; alternatively, it can be constructed by performing image segmentation, morphological processing, and averaging operations on a large number of manually selected qualified plastic bottle handle sample images to capture their typical, defect-free geometric contours.

[0050] In step S3A1, the standard binarized mask is shrunk to define the core region, and the boundary of the original standard binarized mask is defined as the edge contour region. This step aims to divide the standard shape of the plastic bottle handle into clearly defined internal and edge regions. The shrinkage process is typically achieved through morphological erosion, where a predefined structuring element (e.g., a circular or square core) is slid across the standard binarized mask, preserving the area completely covered by the structuring element, thus shrinking the mask boundary inward to form a smaller "core region" than the original mask. The boundary of the original standard binarized mask, i.e., the annular region between the original mask and the shrunk core region, is defined as the "edge contour region." This division provides a clear geometric boundary for subsequent accurate determination of whether anomaly pattern candidate regions are located internally or at the edge.

[0051] In step S3A2, the set of pixel coordinates of the anomalous pattern candidate region is mapped to the coordinate system of the standard binarized mask. The purpose of this step is to eliminate the influence of factors such as translation, rotation, scaling, or even slight deformation of the plastic bottle handle in the actual detection image on the spatial location determination of the anomalous pattern candidate region. This is achieved by transforming the original set of pixel coordinates of the anomalous pattern candidate region into a coordinate system consistent with the standard binarized mask, based on a certain geometric transformation relationship (e.g., an affine transformation matrix calculated based on the alignment of the plastic bottle handle's actual pose in the current image with its standard pose). This ensures that regardless of how the plastic bottle handle is presented in the image, the location of its anomalous region can be evaluated within a unified standard reference framework.

[0052] In step S3A3, when the set of pixel coordinates falls entirely within the core area of ​​the main body, the spatial location feature is determined to be located inside the plastic bottle handle. This step is based on the geometric relationship between the mapped anomaly pattern candidate area and the core area of ​​the main body. When all pixels of the mapped anomaly pattern candidate area are located inside the predefined core area of ​​the main body and do not overlap with any edge contour area, the system can accurately determine that the anomaly pattern candidate area is located inside the plastic bottle handle. This helps to identify anomalies that are far from the handle edge and are usually related to internal defects in the injection molding process (such as flow marks).

[0053] In step S3A4, when there are overlapping pixels between the pixel coordinate set and the edge contour region, the spatial location feature is determined to be located at the edge of the plastic bottle handle. This step is also based on the geometric relationship between the mapped anomaly pattern candidate area and the edge contour region. When any pixel in the mapped anomaly pattern candidate area overlaps with the predefined edge contour region, the system can determine that the anomaly pattern candidate area is located at the edge of the plastic bottle handle. This helps to identify anomalies located at the handle edge, which are usually related to demolding or trimming process defects (such as burrs, flash).

[0054] This application solves the problem of inaccurate defect location determination caused by elastic deformation of plastic bottle handles during transportation by introducing a standard binarized mask and refining the extraction process of spatial location features. Specifically, after acquiring the visual image data of the plastic bottle handle to be inspected and extracting its visual features, the system compares it with a normal pattern feature set trained based on qualified samples and marks abnormal pattern candidate areas whose feature deviation exceeds a preset threshold. Based on this, to accurately determine the location of these abnormal pattern candidate areas, this application expands the normal pattern feature set to include the standard binarized mask of the plastic bottle handle. This standard binarized mask, serving as an ideal geometric reference, is first shrunk to clearly delineate the "core body region" and the "edge contour region." Subsequently, the key is to transform the set of pixel coordinates of the detected abnormal pattern candidate areas into a coordinate system consistent with the standard binarized mask through precise geometric mapping. This mapping process effectively corrects for possible posture changes or elastic deformations of the plastic bottle handle during actual inspection, ensuring that the relative positions of abnormal areas are accurately standardized. Once the candidate region of an anomaly pattern is mapped to the standard coordinate system, the system can accurately determine whether its spatial location features are inside or at the edge of the plastic bottle handle, based on whether its pixel set falls entirely within the core area of ​​the main body or whether it overlaps with pixels in the edge contour area. This refined positioning based on standard reference and coordinate mapping enables reliable differentiation between internal and edge defects even when the plastic bottle handle undergoes slight deformation, providing a solid foundation for subsequent defect type determination.

[0055] The following is a concrete example. Suppose that on a production line, an industrial camera captures an image of a plastic bottle handle on a conveyor belt. The system first identifies an anomalous pattern candidate region, such as a thin, elongated region with an abnormal grayscale value, according to steps S1 and S2. To determine whether this anomalous region is located inside the handle or at the edge, the system calls a pre-stored standard binarization mask. This standard binarization mask can be a 1000x500 pixel binary image exported from the CAD model of the plastic bottle handle, where the handle area is white (pixel value 1) and the background is black (pixel value 0). As a specific implementation, in step S3A1, the system can perform a morphological erosion operation on the standard binarization mask using a circular structuring element with a radius of 5 pixels. The eroded region is the "core area of ​​the main body." The difference between the original standard binarization mask and the eroded region, i.e., a ring-shaped region with a width of approximately 5 pixels, is defined as the "edge contour region." In step S3A2, to map the set of pixel coordinates of the detected anomalous pattern candidate region to the coordinate system of the standard binary mask, the system first extracts the contour of the plastic bottle handle from the currently captured image and calculates the geometric center and principal axis direction of the contour. Then, the actual contour is aligned with the theoretical contour of the standard binary mask, and an affine transformation matrix containing translation, rotation, and scaling is calculated. Subsequently, the original set of pixel coordinates of the anomalous pattern candidate region is transformed using this affine transformation matrix to obtain the corrected set of pixel coordinates. Next, in step S3A3, the system checks all pixels in the corrected anomalous pattern candidate region. If all these pixels fall within the "core body region" and none overlap with the "edge contour region," the anomalous pattern candidate region is determined to be inside the plastic bottle handle. For example, this could be an internal flow mark. In step S3A4, if any pixel in the corrected anomalous pattern candidate region overlaps with the "edge contour region," the anomalous pattern candidate region is determined to be on the edge of the plastic bottle handle. For example, this could be an edge burr. In this way, even if the plastic bottle handle undergoes slight changes in posture or elastic deformation during transport, the precise spatial location of its defects can be accurately identified.

[0056] Through the above technical solution, this application effectively solves the problem of inaccurate spatial location feature extraction caused by elastic deformation of plastic bottle handles during transportation. By introducing a standard binary mask as a stable reference benchmark and shrinking it to clearly delineate the core area and edge contour area, a clear geometric definition is provided for the precise spatial location of defects. More importantly, by mapping the pixel coordinate set of the abnormal pattern candidate area to the coordinate system of the standard binary mask, this application can effectively eliminate the positional errors caused by posture changes and elastic deformation that may exist in the actual inspection of the plastic bottle handle. This enables the system to accurately distinguish whether the abnormal pattern candidate area is located inside or at the edge of the plastic bottle handle, thereby significantly improving the accuracy of defect spatial location determination. This precise spatial positioning capability, combined with the aforementioned visual feature extraction and feature deviation comparison, enables the system to more reliably distinguish different types of defects, such as effectively distinguishing serious internal appearance defects (such as flow marks) from minor edge process defects (such as burrs), avoiding misjudgments and omissions caused by ambiguous position judgment in traditional methods, thereby improving the intelligence level and production efficiency of defect filtering control.

[0057] In some embodiments, step S3A1, before shrinking the standard binary mask to define the core area of ​​the subject, further includes the following step: A1. Extract the morphological centerline of the plastic bottle handle from the visual image data and define it as a real-time skeleton; A2. Obtain the theoretical central axis of the standard binary mask and define it as the standard skeleton; A3. Calculate the curvature deviation and displacement vector of the real-time skeleton relative to the standard skeleton, and construct a non-rigid deformation mapping matrix; The specific steps in step S3A2 include: S3A21. The original pixel coordinate set of the abnormal mode candidate region is reverse-corrected using a non-rigid deformation mapping matrix to obtain the corrected pixel coordinate set. S3A22. Map the corrected set of pixel coordinates to the coordinate system of the standard binary mask to eliminate the region determination error caused by elastic deformation of the plastic bottle handle during transportation.

[0058] The process involves extracting the morphological central axis of the plastic bottle handle from visual image data and defining it as a real-time skeleton. This aims to obtain the actual geometric center line or skeleton line of the plastic bottle handle being detected, reflecting its true shape in the current visual image. This real-time skeleton extraction can be achieved in various ways. For example, image thinning algorithms, such as the Zhang-Suen algorithm or morphological skeleton extraction algorithms, can be used to process the binarized handle image to obtain a skeleton line with a single pixel width. Alternatively, distance transform combined with a local maximum algorithm can be used to determine the center path of the handle region, thereby extracting its morphological central axis. The theoretical central axis of a standard binarized mask is obtained and defined as a standard skeleton. Its purpose is to establish a reference benchmark based on an ideal, deformation-free standard plastic bottle handle model (represented by a standard binarized mask). The standard skeleton can be pre-calculated and stored. For example, its theoretical skeleton lines can be obtained by performing similar processing (such as thinning algorithms or distance transformations) on a pre-stored standard binary mask as in real-time skeleton extraction. Alternatively, during the product design phase, the central axis can be directly extracted from the CAD model or design drawings of the plastic bottle handle and digitized into a pixel coordinate sequence as the standard skeleton. The core of this step is to calculate the curvature deviation and displacement vector of the real-time skeleton relative to the standard skeleton, and construct a non-rigid deformation mapping matrix. This step quantifies the non-rigid deformation between the real-time and standard plastic bottle handles and establishes a mathematical model to describe this deformation. The curvature deviation reflects the change in the local bending degree of the handle, while the displacement vector reflects the positional offset between skeleton points. A non-rigid deformation mapping matrix is ​​a mathematical tool used to map deformed coordinates back to a standard coordinate system. Its construction can involve matching keypoints on the real-time skeleton with corresponding points on the standard skeleton, then using Thin-Plate Spline (TPS) interpolation or Radial Basis Function (RBF) interpolation. Alternatively, it can employ methods based on local affine transformation or B-spline free-form deformation (FFD), using optimization algorithms to calculate the deformation parameters that best fit the real-time skeleton to the standard skeleton, and then constructing the mapping matrix. The non-rigid deformation mapping matrix is ​​used to inversely correct the original pixel coordinate set of the anomaly pattern candidate region, resulting in a corrected pixel coordinate set. Its function is to apply the previously constructed non-rigid deformation mapping matrix to the original pixel coordinates of the anomaly pattern candidate region to eliminate the influence of the elastic deformation of the plastic bottle handle on these coordinates, aligning them spatially with the standard state.This can be achieved by inputting the original coordinates of each pixel in the anomaly pattern candidate region into a non-rigid deformation mapping matrix, and calculating its corrected coordinates in the standard coordinate system through matrix operations or interpolation functions; alternatively, an iterative optimization method can be used to gradually adjust the mapping matrix by minimizing the error between the corrected coordinates and the standard mask, and then applying it to the anomaly pattern candidate region. Mapping the corrected pixel coordinate set to the coordinate system of the standard binary mask eliminates the region determination error caused by the elastic deformation of the plastic bottle handle during transportation. This step is the final coordinate alignment, ensuring that the position determination of the anomaly region is performed in a unified, deformation-free reference system, thereby improving the accuracy of the determination. The corrected pixel coordinate set itself is already the coordinate in the coordinate system of the standard binary mask. This step confirms and applies this result, ensuring that subsequent spatial position determination is based on these corrected coordinates; alternatively, it can be understood as superimposing or comparing the corrected pixel coordinate set with the standard binary mask to visually verify its alignment effect and provide accurate input for subsequent region determination.

[0059] This application's solution extracts the central axis of the current plastic bottle handle from visual image data and defines it as a real-time skeleton, enabling real-time capture of the handle's actual shape changes. Simultaneously, by obtaining the theoretical central axis of a standard binary mask and defining it as a standard skeleton, a reference benchmark for the ideal shape is established. Based on the curvature deviation and displacement vector between the real-time skeleton and the standard skeleton, a non-rigid deformation mapping matrix is ​​constructed, thereby quantifying the deformation differences of the handle and creating a compensation model for elastic deformation. In the subsequent defect detection process, the constructed non-rigid deformation mapping matrix is ​​used to inversely correct the original pixel coordinate set of the abnormal pattern candidate area, obtaining a corrected pixel coordinate set. This process directly applies the mapping matrix to reverse the deformation effect, making the coordinate data of the abnormal area closer to the real state. Finally, the corrected pixel coordinate set is mapped to the coordinate system of the standard binary mask, ensuring that the location determination of the abnormal area is performed under a unified, deformation-free reference. This scheme works in conjunction with steps such as acquiring visual image data of the plastic bottle handle to be inspected, extracting visual features, comparing the visual features with a preset set of normal pattern features and calculating the feature deviation, marking image areas with feature deviation exceeding a preset threshold as abnormal pattern candidate areas, and extracting spatial location and geometric orientation features by performing topological structure analysis on the abnormal pattern candidate areas. This allows for the accurate determination of the spatial location features of the abnormal pattern candidate areas relative to the plastic bottle handle even when the plastic bottle handle undergoes elastic deformation, thus providing reliable input for subsequent defect type determination.

[0060] The following is a concrete example. Suppose a plastic bottle handle moves on a conveyor belt, and its shape slightly bends due to slight compression or the elasticity of the material itself. First, an industrial camera captures visual image data of the handle. The system preprocesses this image, such as binarizing it, and then applies a skeleton extraction algorithm (such as the `cv2.ximgproc.thinning` function in the OpenCV library) to extract the handle's morphological centerline, defining it as the real-time skeleton. Simultaneously, the system obtains the theoretical centerline from a pre-stored standard binarized mask generated based on an ideal CAD model, defining it as the standard skeleton. Next, the system automatically detects and matches a series of key points on the real-time skeleton and the standard skeleton, such as skeleton endpoints and bending points. Using these matched points, the system calculates a Thin-Plate Spline (TPS) transformation. This TPS function is a non-rigid deformation mapping matrix that describes how points on the real-time skeleton are mapped to corresponding points on the standard skeleton. When the system detects an anomalous pattern candidate region in a visual image, its original set of pixel coordinates is first inversely corrected using the inverse transformation of the non-rigid deformation mapping matrix. For example, if the original pixel coordinates are (x0, y0), after inverse correction, the corrected pixel coordinates are (x1, y1). These corrected coordinates represent the theoretical position of the anomalous region when the handle is not deformed. Finally, this corrected set of pixel coordinates is directly compared with a standard binary mask. For example, if the coordinate system of the standard binary mask has its origin (0, 0) at its upper left corner, then the corrected set of pixel coordinates will also be in this coordinate system. This allows for accurate determination of whether the anomalous region falls entirely within the core area of ​​the standard binary mask or overlaps with pixels in the edge contour area.

[0061] Through the above technical solution, this application effectively solves the problem of inaccurate coordinate mapping caused by elastic deformation of plastic bottle handles during transportation, thereby eliminating region determination errors. This ensures that the spatial position characteristics of the abnormal mode candidate area relative to the plastic bottle handle can be accurately determined, and even if the handle undergoes non-rigid deformation, it can accurately distinguish whether the defect is located inside the handle or at the edge. Therefore, this solution significantly improves the accuracy and reliability of defect type determination, avoids misjudgments caused by deformation, thereby reducing the rejection rate of qualified products and the release rate of unqualified products, and improving the efficiency and accuracy of product quality control.

[0062] In some embodiments, step S3, specifically the steps of extracting the geometric orientation features of the abnormal pattern candidate region, include: S3B1. Perform connected component analysis on the candidate regions of anomalous modes, calculate the principal axis of inertia or the major axis direction of the minimum bounding rectangle of the candidate regions of anomalous modes, and define it as the main extension direction of the candidate regions of anomalous modes. In step S4, the following steps are included before step S41: B1. Call the preset injection flow vector diagram. The injection flow vector diagram is generated based on the mold structure of the plastic bottle handle and defines the theoretical injection flow vector of the plastic bottle handle at different pixel coordinate positions. B2. Calculate the absolute value of the angle between the main extension direction and the theoretical injection flow vector corresponding to the center coordinates of the candidate region of the abnormal mode; B3. When the absolute value of the included angle is less than the preset angle threshold, the geometric direction feature is determined to be consistent with the injection flow direction.

[0063] Specifically, connected component analysis is performed on candidate regions of anomalous patterns. The principal axis of inertia or the major axis of the minimum bounding rectangle of the candidate region is calculated and defined as the main extension direction of the candidate region. Connected component analysis is a technique in image processing used to identify interconnected pixel regions in an image. Its function is to aggregate discrete pixels marked as anomalous into one or more independent regions, so that holistic feature extraction can be performed on these regions later. The principal axis of inertia or the major axis of the minimum bounding rectangle is a geometric feature describing the main extension direction of the region. Its function is to directly extract the geometric morphological features of the anomalous region and provide basic data for subsequent direction comparison. In practice, the connected componentsWithStats function based on the OpenCV library can be used to identify connected regions, and the direction of its principal axis of inertia can be determined by calculating the second moment of the connected region, or the smallest area rectangle enclosing the connected region can be found using a rotating caliper algorithm, and the direction of its long side is the main extension direction.

[0064] Furthermore, a preset injection flow vector diagram is invoked. This vector diagram is generated based on the mold structure of the plastic bottle handle and defines the theoretical injection flow vector of the plastic bottle handle at different pixel coordinate positions. The injection flow vector diagram is a two-dimensional or three-dimensional vector field reflecting the flow direction of the plastic melt within the mold cavity, while the theoretical injection flow vector is the direction vector of this vector diagram at a specific pixel position. Its function is to provide a scientific and consistent reference direction, accurately reflecting the actual production process characteristics of the plastic bottle handle. This vector diagram can be used to simulate the mold structure of the plastic bottle handle using professional injection molding simulation software (such as Moldflow or CADMOULD), export the flow direction data during the melt filling process, and discretize it into a vector diagram on pixel coordinates. The generated vector diagram can be stored as an image file (where pixel values ​​encode direction information) or a data file (storing vector information for each pixel point) and loaded into memory when needed.

[0065] Based on this, the absolute value of the angle between the main extension direction and the theoretical injection flow vector corresponding to the center coordinates of the anomaly pattern candidate region is calculated. This step quantifies the deviation between the main extension direction of the anomaly pattern candidate region and the theoretical injection flow direction, shifting the direction consistency judgment from qualitative to quantitative, thereby reducing subjective errors. Specifically, the two directions can be represented as two-dimensional vectors, and the angle can be calculated using the vector dot product formula, then its absolute value can be taken; alternatively, the angles between the two direction vectors and the X-axis of the image coordinate system can be calculated separately, and then the absolute value of the difference between the two angles can be obtained.

[0066] Finally, when the absolute value of the included angle is less than a preset angle threshold, the geometric direction is determined to be consistent with the injection flow direction. The preset angle threshold is an empirical value or a critical angle determined experimentally, used to determine whether the two directions are sufficiently close. The purpose of this step is to achieve automated and accurate determination through the preset threshold, which is particularly suitable for distinguishing between internal flow marks (consistent direction) and edge burrs (inconsistent direction). This threshold can be determined by analyzing a large number of known defect samples (such as internal flow marks and edge burrs), statistically analyzing the angle distribution between their main extension direction and the injection flow direction, and selecting an angle value that can effectively distinguish between the two as the threshold, such as 5 degrees, 10 degrees, or 15 degrees.

[0067] This application's solution performs connected component analysis on the candidate regions of abnormal patterns to accurately calculate their main extension direction, thereby obtaining the actual geometric morphological characteristics of the abnormal regions. Simultaneously, by calling the injection flow vector map generated based on the plastic bottle handle mold structure, theoretical injection flow vectors at different pixel coordinate positions are obtained, providing a reliable process reference for determining the defect direction. Subsequently, by calculating the absolute value of the angle between the main extension direction of the candidate region of the abnormal pattern and the corresponding theoretical injection flow vector, a quantitative assessment of directional consistency is achieved. Finally, by comparing this absolute value of the angle with a preset angle threshold, it is possible to automatically and accurately determine whether the geometric direction characteristics of the candidate region of the abnormal pattern are consistent with the injection flow direction. This method effectively solves the problem in traditional solutions of lacking specific methods to accurately determine the consistency between the direction of the candidate region of the abnormal pattern and the injection flow direction. By introducing process information of the injection flow direction and combining it with the geometric direction characteristics of the abnormal region for quantitative comparison, this solution can more accurately distinguish between internal flow marks (usually serious appearance defects) consistent with the injection flow direction and edge burrs (usually minor process defects) inconsistent with the injection flow direction. This enables more intelligent and detailed defect classification and filtering control decisions to be made in subsequent defect type determinations (such as S41, S42, and S43) based on more precise geometric orientation features combined with spatial location features.

[0068] In some embodiments, the visual image data includes visible light and near-infrared spectral images of the plastic bottle handle, as well as three-dimensional topographic data of the surface of the plastic bottle handle. In step S4, the following steps are included before step S42: C1. Extract near-infrared contrast features of candidate regions for abnormal patterns in near-infrared spectral images, and depth variation features in three-dimensional topographic data; C2. When the near-infrared contrast feature is higher than the preset infrared threshold, and the depth change feature is displayed as a concave shape and the depth value is within the preset flow mark depth range, the abnormal mode candidate area is determined to be a micro edge flow mark, the defect type is corrected to a serious appearance defect and a rejection instruction is generated. C3. When the depth change feature is displayed as a raised shape, continue to execute the step of determining the defect type as a minor process defect and generating a retain instruction.

[0069] Visual image data refers to digital information acquired through optical imaging equipment that describes the appearance and physical properties of an object, serving as the foundational input for subsequent defect identification and analysis. This data can be acquired using industrial cameras or scanning equipment. Visible light images refer to image data acquired within the visible spectrum (typically approximately 400-700 nanometers), primarily providing intuitive visual information such as the color, texture, and shape of the surface of plastic bottle handles. Visible light images can be obtained using standard RGB industrial cameras or monochrome cameras with visible light sources. Near-infrared spectral images refer to image data acquired within the near-infrared spectral range (typically approximately 700-2500 nanometers), reflecting the absorption and reflection characteristics of materials to near-infrared light. Near-infrared spectral images can reveal the internal composition, structure, or molecular vibrational information of materials, helping to distinguish defects that appear similar but are fundamentally different under visible light. Near-infrared spectral images can be acquired using industrial cameras equipped with near-infrared filters or sensors, or by scanning in the near-infrared band using a hyperspectral imager. Three-dimensional topography data refers to digital data describing the geometric shape and height information of an object's surface. Its purpose is to provide physical structural information such as depth, undulation, and unevenness of the surface of a plastic bottle handle, used to identify the three-dimensional features of defects. Three-dimensional topography data can be acquired through laser triangulation sensors or through structured light projection technology (such as stripe projection) combined with stereo vision.

[0070] Extracting near-infrared contrast features of candidate regions for anomalous patterns in near-infrared spectral images refers to quantifying the degree of difference between the pixel values ​​of the candidate region and the surrounding pixel values ​​in the near-infrared spectral image. Near-infrared light is highly sensitive to variations in material composition, density, or internal structure. Therefore, internal defects (such as flow marks) may exhibit different absorption or reflection characteristics in near-infrared images compared to the surrounding normal areas, resulting in contrast differences used to identify anomalies within or beneath the material surface. This feature can be quantified by calculating the standard deviation of pixel grayscale values ​​within the candidate region, local entropy, or texture analysis methods based on Gabor filters. It can also be extracted by analyzing the average grayscale difference or histogram distribution differences between the candidate region and the surrounding background area. Extracting depth variation features of candidate regions for anomalous patterns in 3D topographic data refers to quantifying the variation in surface height of the candidate region relative to the surrounding area in 3D topographic data, including whether it is concave or convex, and the degree of variation (depth value), used to accurately distinguish the physical morphology of surface defects. This feature can be obtained by performing local curvature analysis, normal vector analysis, or height difference calculation on 3D point cloud data or depth maps, or it can be determined by constructing a local surface model of the candidate region of the abnormal pattern and calculating its deviation from the average height of the fitted plane or the surrounding area.

[0071] The preset infrared threshold is a pre-defined value used to determine whether the near-infrared contrast characteristics are sufficiently significant to indicate potential internal material anomalies, serving as a boundary to distinguish between normal material fluctuations and defective internal anomalies. This threshold can be obtained by statistically analyzing the near-infrared contrast characteristics of a large number of known qualified products and samples containing flow mark defects, selecting an empirical value that can effectively distinguish between the two, or optimizing it through machine learning methods. Alternatively, it can be determined through experimental calibration based on the near-infrared absorption characteristics of the plastic material and the noise level of the imaging system. A depression morphology refers to the morphology of the anomaly pattern candidate region in three-dimensional topography, which is lower than the surrounding normal surface. This is used to clarify the physical properties of the defect and distinguish it from convex defects. This can be achieved by comparing the depth value of pixels within the anomaly pattern candidate region with the average depth value of the surrounding area; if the former is significantly lower than the latter, it is determined to be a depression. Alternatively, local gradient or curvature information from the three-dimensional topography data can be used to identify the surface depression area. The preset flow mark depth range is a pre-defined depth value range used to limit whether the defects with depression morphology conform to the typical depth characteristics of flow marks, further refining the classification of depression defects. This range can be determined by performing 3D scanning and depth measurement on actual flow mark samples, statistically analyzing their depth distribution, and thus establishing a reasonable depth range. Alternatively, it can be determined through simulation or experimentation by combining injection molding process parameters and material properties to identify the possible depth range of flow marks. When all the above conditions are met, the system determines the abnormal pattern candidate area as a micro-edge flow mark, corrects the defect type to a serious appearance defect, and generates a rejection instruction. This is a precise defect classification and decision-making process based on multimodal feature fusion, aiming to correct the misjudgment of flow marks by traditional methods and ensure that serious defects affecting appearance are identified and rejected. Generating rejection instructions is usually achieved by sending specific digital signals or communication protocol instructions to automated equipment. A raised morphology refers to the abnormal pattern candidate area appearing higher than its surrounding normal surface in 3D topography. It is used to clarify the physical properties of the defect and distinguish it from concave defects, typically corresponding to burrs, flash, etc. This can be achieved by comparing the depth value of pixels within the abnormal pattern candidate area with the average depth value of the surrounding area; if the former is significantly higher than the latter, it is determined to be a raised area. Alternatively, the local gradient or curvature information of the 3D topography data can be used to identify the raised areas on the surface. When the depth variation feature displays a raised shape, the system continues with the step of determining the defect type as a minor manufacturing defect and generating a retain instruction. This ensures that for raised defects that do not affect functionality or appearance, the system can correctly classify them as acceptable minor manufacturing defects and allow the product to be retained, avoiding unnecessary rejection. Retention instructions are typically implemented by either not sending a rejection signal or sending an explicit retain signal to the automated equipment.

[0072] This application's solution introduces multimodal visual data, combining near-infrared spectral images and three-dimensional topography data with visible light images to perform deeper feature analysis on candidate regions of abnormal patterns, thereby achieving accurate classification of defect types. In traditional visual recognition methods, the determination of defect types in candidate regions of abnormal patterns mainly relies on their spatial location and geometric orientation features. However, for some defects that are similar in features under visible light but fundamentally different, such as internal flow marks and surface burrs, these features alone are insufficient for effective differentiation, leading to misjudgments. To address this, this application's solution inserts an additional refined discrimination step before step S42, i.e., before initially determining it as a minor process defect and generating a retain instruction. Specifically, the system first extracts the near-infrared contrast features from the near-infrared spectral image for the identified candidate regions of abnormal patterns, and simultaneously extracts their depth variation features from the three-dimensional topography data. Near-infrared contrast features can reveal microstructural or compositional anomalies within materials because near-infrared light is sensitive to the absorption and scattering characteristics of plastic materials. Defects such as internal flow marks may cause changes in local optical properties, thus presenting a unique contrast pattern in the near-infrared image. The depth variation feature directly reflects the surface geometry of the abnormal area, clearly distinguishing between depressions (such as flow marks and scratches) and protrusions (such as burrs and foreign objects). The system then comprehensively judges these multimodal features. When the near-infrared contrast feature is higher than a preset infrared threshold, indicating a significant internal material anomaly, and the depth variation feature simultaneously shows a depression with its depth value precisely falling within a preset flow mark depth range, the system accurately identifies the candidate area of ​​this abnormal pattern as a micro-edge flow mark. While such flow marks may not affect the handle's function, they severely impact the product's appearance. Therefore, the system corrects its defect type to a serious appearance defect and immediately generates a rejection instruction. This mechanism effectively solves the problem of traditional methods misclassifying internal flow marks as minor, retainable manufacturing defects. Conversely, if the depth variation feature shows a protrusion, it indicates that the anomaly is a surface bulge rather than a depression. In this case, the system continues to execute the original judgment logic, classifying it as a minor manufacturing defect and generating a retain instruction. This ensures that minor burrs and other protruding defects that do not affect function or appearance can be correctly approved, avoiding unnecessary waste of resources. In this way, the proposed solution cleverly utilizes the sensitivity of near-infrared spectroscopy to internal material anomalies and the ability of three-dimensional morphology data to accurately describe surface geometry, achieving refined differentiation of different types of defects. Compared to traditional methods that rely solely on visible light images and macroscopic geometric features, this significantly improves the accuracy of defect identification and the reliability of filtering control.Based on the aforementioned visual image data acquisition, feature extraction, abnormal pattern marking, and preliminary defect type determination, the solution of this application introduces in-depth analysis of multimodal features, enabling the system to more intelligently identify defects that are easily confused in traditional methods. In particular, it distinguishes between internal flow marks that affect appearance and surface burrs that do not affect functional appearance, thereby avoiding the problem of qualified products being mistakenly rejected and unqualified products being missed, and achieving more refined quality control.

[0073] As a specific implementation method, when acquiring visual image data of the handle of the plastic bottle to be inspected, in addition to the visible light image, near-infrared spectral images and three-dimensional topographic data are also acquired simultaneously. For example, a multispectral camera equipped with a visible light sensor and a near-infrared sensor, as well as a laser triangulation sensor or a structured light scanner, can be used to acquire this data. After the system identifies an abnormal pattern candidate region in step S2, and before executing S42 (i.e., determining the defect type as a minor process defect and generating a retain instruction) in step S4, a refined analysis will be initiated. First, in step C1, the system will perform feature extraction on the abnormal pattern candidate region. For example, for the near-infrared spectral image, gray-level co-occurrence matrix (GLCM) analysis can be performed on the pixels within the abnormal pattern candidate region to calculate its contrast, energy, entropy, and other texture parameters, where the contrast parameter is the near-infrared contrast feature. Simultaneously, for 3D topographic data, the system can perform local surface fitting on the point cloud data within the candidate region of anomaly patterns, then calculate the distance from each point to the fitted plane and analyze the distribution of these distances to determine whether it is a depression or a convexity, and the depth value of the depression or convexity, which is the depth variation feature. Next, in step C2, the system will make a judgment. Assuming the preset infrared threshold is 0.5 (e.g., the normalized GLCM contrast value), and the preset flow mark depth range is 0.05mm to 0.2mm. If the calculated near-infrared contrast feature is 0.7, which is higher than 0.5, and the depth variation feature shows a depression shape with a depth value of 0.1mm, which falls exactly within the flow mark depth range of 0.05mm to 0.2mm, then the system will determine that the candidate region of anomaly patterns is a micro-edge flow mark. At this time, the system will correct the defect type that might have been judged as a minor process defect to a serious appearance defect, and immediately generate a rejection instruction, sending it to the automated sorting equipment to instruct it to remove the handle from the production line. On the other hand, in step C3, if the depth change feature analysis result shows a raised shape, for example, the surface height of the detected abnormal area is significantly higher than the surrounding area, and its shape characteristics are consistent with burrs or flash, then the system will no longer execute the flow mark judgment logic of C2, but will directly continue to execute the judgment process of step S42. This means that the abnormality of the raised shape will be classified as a minor process defect, and a retention instruction will be generated, allowing the handle to continue to flow to the next production stage. Through this comprehensive analysis of multimodal features, the system can effectively distinguish those defects that are difficult to distinguish under visible light, such as accurately distinguishing internal flow marks that affect appearance from surface burrs that do not affect function and appearance, thereby avoiding misjudgment.

[0074] Through the above technical solution, this application effectively solves the misjudgment problem of traditional visual recognition methods when distinguishing defects with similar visual features but different essential characteristics. Specifically, by introducing the extraction and comprehensive judgment of near-infrared contrast features in near-infrared spectral images and depth change features in three-dimensional topography data for abnormal pattern candidate areas, this application can accurately identify micro-edge flow marks that affect the product appearance and correct them as serious appearance defects, thereby ensuring that such defective products are promptly rejected, preventing unqualified products from entering the market and damaging the brand image. At the same time, for raised morphological defects (such as micro-burrs) that do not affect function and appearance, this application can accurately classify them as minor process defects and generate retention instructions, effectively preventing qualified products from being misjudged and rejected, thereby reducing the scrap rate and improving production efficiency and resource utilization. This multi-modal feature fusion defect filtering and control method significantly improves the accuracy of defect identification and the reliability of filtering and control, realizing more refined and intelligent quality management.

[0075] Reference Appendix Figure 2 This invention provides a visual recognition defect filtering control system for plastic bottle handles (this visual recognition defect filtering control system for plastic bottle handles adopts the visual recognition defect filtering control method for plastic bottle handles described above, and the specific process is described in the corresponding steps above), including: The acquisition module 100 is used to acquire visual image data of the handle of the plastic bottle to be detected, and extract visual features of the handle of the plastic bottle from the visual image data. The labeling module 200 is used to compare the extracted visual features with a preset normal pattern feature set and calculate the feature deviation, and to label image regions with feature deviation exceeding a preset threshold as abnormal pattern candidate regions. The extraction module 300 is used to extract the spatial position features of the abnormal pattern candidate region relative to the handle of the plastic bottle, and to extract the geometric orientation features of the abnormal pattern candidate region. The control module 400 is used to determine the defect type of the anomaly pattern candidate area based on spatial location and geometric orientation features, and to generate control commands based on the defect type to control the automated equipment to perform retention or rejection operations. Specifically, it includes: S41. When the spatial location feature shows that the candidate area of ​​the abnormal pattern is located inside the handle of the plastic bottle, and the geometric direction feature shows that the candidate area of ​​the abnormal pattern is consistent with the injection flow direction, the defect type is determined to be a serious appearance defect and a rejection instruction is generated. S42. When the spatial location feature shows that the candidate area of ​​the abnormal pattern is located at the edge of the plastic bottle handle, the defect type is determined to be a minor process defect and a retention instruction is generated.

[0076] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0077] The above description is merely an embodiment of the present invention and is not intended to limit the scope of protection of the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A visual recognition defect filtering and control method applied to plastic bottle handles, characterized in that, Includes the following steps: S1. Acquire visual image data of the handle of the plastic bottle to be detected, and extract the visual features of the handle of the plastic bottle from the visual image data; S2. The extracted visual features are compared with a preset set of normal pattern features and the feature deviation is calculated. Image regions with feature deviation exceeding a preset threshold are marked as abnormal pattern candidate regions. S3. Extract the spatial position features of the candidate region of the abnormal pattern relative to the handle of the plastic bottle, and extract the geometric orientation features of the candidate region of the abnormal pattern; S4. Based on the spatial location features and the geometric direction features, determine the defect type of the anomaly pattern candidate region, and generate control instructions based on the defect type to control the automated equipment to perform retention or rejection operations, specifically including: S41. When the spatial location feature shows that the abnormal pattern candidate area is located inside the plastic bottle handle, and the geometric direction feature shows that the abnormal pattern candidate area is consistent with the injection molding flow direction, the defect type is determined to be a serious appearance defect and a rejection instruction is generated. S42. When the spatial location feature indicates that the abnormal pattern candidate area is located at the edge of the plastic bottle handle, the defect type is determined to be a minor process defect and a retention instruction is generated.

2. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 1, characterized in that, The normal pattern feature set is obtained by training on qualified plastic bottle handle samples, and includes at least statistical feature parameters that reflect the surface texture and contour of the plastic bottle handle.

3. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 2, characterized in that, The normal pattern feature set also includes the standard binarized mask of the plastic bottle handle; Step S3, specifically the steps for extracting the spatial position features of the abnormal pattern candidate region relative to the plastic bottle handle, include: S3A1. The standard binary mask is shrunk to define the main core region, and the boundary of the original standard binary mask is defined as the edge contour region; S3A2. Map the set of pixel coordinates of the abnormal mode candidate region to the coordinate system of the standard binary mask; S3A3. When the set of pixel coordinates falls completely within the core area of ​​the main body, it is determined that the spatial position feature is located inside the handle of the plastic bottle; S3A4. When there are overlapping pixels between the pixel coordinate set and the edge contour region, the spatial position feature is determined to be located at the edge of the plastic bottle handle.

4. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 3, characterized in that, In step S3A1, before shrinking the standard binary mask to define the main core region, the following steps are also included: A1. Extract the morphological centerline of the plastic bottle handle from the visual image data and define it as a real-time skeleton; A2. Obtain the theoretical central axis of the standard binary mask and define it as the standard skeleton; A3. Calculate the curvature deviation and displacement vector of the real-time skeleton relative to the standard skeleton, and construct a non-rigid deformation mapping matrix.

5. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 4, characterized in that, The specific steps in step S3A2 include: S3A21. The original pixel coordinate set of the abnormal mode candidate region is reverse-corrected using the non-rigid deformation mapping matrix to obtain the corrected pixel coordinate set; S3A22. Map the corrected set of pixel coordinates to the coordinate system of the standard binary mask to eliminate the region determination error caused by elastic deformation of the plastic bottle handle during transportation.

6. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 1, characterized in that, In step S3, the specific steps for extracting the geometric orientation features of the abnormal pattern candidate region include: S3B1. Perform connected component analysis on the candidate region of the abnormal mode, calculate the direction of the principal axis of inertia or the major axis of the minimum bounding rectangle of the candidate region of the abnormal mode, and define it as the main extension direction of the candidate region of the abnormal mode.

7. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 6, characterized in that, In step S4, the following steps are included before step S41: B1. Call the preset injection flow vector diagram, which is generated based on the mold structure of the plastic bottle handle and defines the theoretical injection flow vector of the plastic bottle handle at different pixel coordinate positions; B2. Calculate the absolute value of the angle between the main extension direction and the theoretical injection flow vector corresponding to the center coordinates of the abnormal mode candidate area; B3. When the absolute value of the included angle is less than a preset angle threshold, it is determined that the geometric direction feature is consistent with the injection flow direction.

8. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 1, characterized in that, The visual image data includes visible light and near-infrared spectral images of the plastic bottle handle, as well as three-dimensional topographic data of the surface of the plastic bottle handle.

9. The visual recognition defect filtering and control method applied to plastic bottle handles according to claim 8, characterized in that, In step S4, the following steps are included before step S42: C1. Extract the near-infrared contrast features of the candidate region of the abnormal pattern in the near-infrared spectral image, and the depth variation features in the three-dimensional topography data; C2. When the near-infrared contrast feature is higher than the preset infrared threshold, and the depth change feature is displayed as a concave shape and the depth value is within the preset flow mark depth range, the abnormal mode candidate area is determined to be a micro edge flow mark, the defect type is corrected to a serious appearance defect and a rejection instruction is generated. C3. When the depth change feature is displayed as a raised shape, continue to execute the step of determining the defect type as a minor process defect and generating a retain instruction.

10. A visual recognition defect filtering control system applied to plastic bottle handles, characterized in that, include: The acquisition module is used to acquire visual image data of the handle of the plastic bottle to be detected, and extract the visual features of the handle of the plastic bottle from the visual image data; The labeling module is used to compare the extracted visual features with a preset set of normal pattern features and calculate the feature deviation, and to label the image regions whose feature deviation exceeds a preset threshold as abnormal pattern candidate regions. The extraction module is used to extract the spatial position features of the abnormal pattern candidate region relative to the handle of the plastic bottle, and to extract the geometric orientation features of the abnormal pattern candidate region. The control module is used to determine the defect type of the anomaly pattern candidate region based on the spatial location features and the geometric orientation features, and to generate control commands based on the defect type to control the automated equipment to perform retention or rejection operations, specifically including: S41. When the spatial location feature shows that the abnormal pattern candidate area is located inside the plastic bottle handle, and the geometric direction feature shows that the abnormal pattern candidate area is consistent with the injection molding flow direction, the defect type is determined to be a serious appearance defect and a rejection instruction is generated. S42. When the spatial location feature indicates that the abnormal pattern candidate area is located at the edge of the plastic bottle handle, the defect type is determined to be a minor process defect and a retention instruction is generated.