Image out-of-focus-based industrial defect detection batch early warning method and device, storage medium and computer equipment
By identifying the reference region and determining the target detection region in the image, defocus quantification information is generated, which solves the problem of missed detection and misjudgment caused by defocus in visual inspection, realizes real-time monitoring and early warning of image quality degradation, and improves the accuracy and intelligence level of the detection system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CASI VISION TECH (BEIJING) CO LTD
- Filing Date
- 2026-02-02
- Publication Date
- 2026-06-23
AI Technical Summary
Existing visual inspection solutions are prone to image defocusing when faced with mechanical vibration, focus deviation, or product surface undulations, resulting in blurred crack features. Traditional fixed threshold methods cannot effectively identify clarity defects and lack monitoring of process quality degradation, leading to missed detections or misjudgments and failing to trigger timely warnings.
By identifying the reference region from each image, the target detection region is determined, image sharpness is evaluated to generate defocus quantification information, and the defocus quantification information of multiple images is comprehensively analyzed to determine the batch warning conditions and trigger the warning signal to achieve real-time monitoring and proactive intervention.
It effectively identifies key defect detection areas, solves the problems of missed and false detection in traditional methods, enables real-time monitoring and early warning of image quality degradation, prevents batch quality accidents, and improves the accuracy and intelligence level of the detection system.
Smart Images

Figure CN122265149A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial visual intelligent inspection technology, and in particular to a batch early warning method and device for industrial defect detection based on image defocus, storage medium, and computer equipment. Background Technology
[0002] In the wave of automation and intelligent upgrading in industrial manufacturing, machine vision technology, with its non-contact, high efficiency, and high consistency characteristics, has become a core means of product quality inspection, playing an irreplaceable role, especially in the identification of minute defects such as cracks. Traditional automated optical inspection systems capture images of product surfaces using high-resolution cameras and analyze them using computer algorithms, aiming to replace the human eye in performing highly repetitive and precision-critical inspection tasks, thereby significantly improving the inspection efficiency of production lines and the level of product quality control.
[0003] However, existing visual inspection solutions still have significant limitations when facing the complex and ever-changing conditions of industrial sites. During visual inspection, mechanical vibration, focusing deviation, or uneven product surfaces often cause image defocusing in the inspection area, resulting in blurred key crack features. Traditional defect judgment methods based on fixed thresholds are ineffective for such clarity defects, directly leading to missed detections or misjudgments. More critically, most existing systems lack monitoring for this type of process-related quality degradation. When multiple defects caused by defocusing occur consecutively on the production line, timely warnings cannot be triggered to prompt equipment maintenance or process adjustments, causing quality problems to only surface after mass production, significantly reducing defect detection accuracy. Furthermore, when detecting crack defects, precise positioning of the crack detection area is difficult. Factors such as differences in the shape of the product being tested and complex surface conditions can easily lead to positioning errors, resulting in poor detection results. Summary of the Invention
[0004] In view of this, this application provides a batch early warning method and device, storage medium, and computer equipment for industrial defect detection based on image defocus. By intelligently identifying the reference area from each image and determining the precise target detection area accordingly, the key parts to be analyzed for defocus and used for defect detection are effectively located. Image sharpness assessment is performed on the target detection area to generate defocus quantification information, thereby transforming the defocus phenomenon into objective and measurable data, solving the problem of missed or false judgments caused by the ineffectiveness of traditional fixed threshold methods for sharpness defects. By comprehensively analyzing the defocus quantification information of multiple images in continuous production, it is determined whether the batch early warning conditions are met, and an early warning signal is triggered accordingly. This enables real-time monitoring and proactive intervention for continuous image quality degradation caused by mechanical vibration, focusing deviation, etc., breaking the limitation of traditional systems that only passively identify defects after they occur. This allows for the prevention of batch quality accidents at the process level, significantly improving the accuracy, intelligence level, and early warning capability of the detection system.
[0005] According to one aspect of this application, a batch early warning method for industrial defect detection based on image defocus is provided, comprising: Acquire images of multiple identical products to be tested sequentially passing through the production line; For each image, a reference region is identified from the image, a target detection region is determined based on the reference region, and the image sharpness of the target detection region is evaluated to obtain defocus quantification information that characterizes the degree of defocus in the target detection region. Based on the defocus quantization information of each image, determine whether the batch warning conditions are met, and trigger the batch warning signal when the batch warning conditions are met.
[0006] According to another aspect of this application, a batch early warning device for industrial defect detection based on image defocus is provided, comprising: The image acquisition module is used to acquire images of multiple identical products to be tested that pass sequentially through the production line; The sharpness assessment module is used to identify a reference region from each image, determine a target detection region based on the reference region, and perform image sharpness assessment on the target detection region to obtain defocus quantification information that characterizes the degree of defocus in the target detection region. The judgment module is used to determine whether the batch warning conditions are met based on the defocus quantization information of each image, and to trigger the batch warning signal when the batch warning conditions are met.
[0007] According to another aspect of this application, a storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described batch early warning method for industrial defect detection based on image defocus.
[0008] According to another aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described batch early warning method for industrial defect detection based on image defocus.
[0009] By employing the above technical solutions, this application provides a batch early warning method and device, storage medium, and computer equipment for industrial defect detection based on image defocus. By intelligently identifying a reference area from each image and determining the precise target detection area accordingly, it effectively locks down the key parts to be analyzed for defocus and used for defect detection. Image sharpness assessment is performed on the target detection area to generate defocus quantification information, thereby transforming the defocus phenomenon into objective and measurable data. This solves the problem of missed or false detections caused by the ineffectiveness of traditional fixed threshold methods for sharpness defects. By comprehensively analyzing the defocus quantification information of multiple images during continuous production, it determines whether the batch early warning conditions are met and triggers an early warning signal accordingly. This enables real-time monitoring and proactive intervention for continuous image quality degradation caused by mechanical vibration, focusing deviation, etc., breaking the limitation of traditional systems that only passively identify defects after they occur. This allows for the prevention of batch quality accidents at the process level, significantly improving the accuracy, intelligence level, and early warning capability of the detection system.
[0010] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0011] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating a batch early warning method for industrial defect detection based on image defocus provided in an embodiment of this application is shown. Figure 2 A schematic diagram of an imaging system provided in an embodiment of this application is shown; Figure 3 This application provides an embodiment of a product under test, which is illustrated in the image diagram. Figure 4 This illustration shows a schematic diagram of a target detection area provided in an embodiment of this application; Figure 5 A schematic diagram of the structure of a batch early warning device for industrial defect detection based on image defocus provided in an embodiment of this application is shown; Figure 6 A schematic diagram of the device structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0012] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0013] This embodiment provides a batch early warning method for industrial defect detection based on image defocus, such as... Figure 1 As shown, the method includes: Step 101: Obtain images of multiple identical products to be tested that pass through the production line in sequence.
[0014] Step 102: For each image, identify a reference region from the image, determine a target detection region based on the reference region, and evaluate the image sharpness of the target detection region to obtain defocus quantification information that characterizes the degree of defocus in the target detection region.
[0015] Step 103: Based on the defocus quantization information of each image, determine whether the batch warning conditions are met, and trigger the batch warning signal when the batch warning conditions are met.
[0016] This application provides a batch early warning method for industrial defect detection based on image defocus. First, multiple images of the same product under test are acquired consecutively. In a specific embodiment, it can be based on, as shown in... Figure 2 The imaging system shown acquires data as follows: Figure 3 The images shown are examples of this. Next, a reference region can be identified from each image. Here, the reference region refers to a reference area in the image that is closely related to the target being detected, such as the area within the image containing a specific hole or mark on the surface of the product under test.
[0017] After successfully identifying the baseline region, it is used as a reference to define the precise area where sharpness assessment needs to be performed, i.e., the target detection region, through geometric derivation or morphological operations. For example, if the baseline region is a hole in the phone's frame, then the target detection region could be a crack-prone area such as the annular band around the inner edge of the hole. In a specific embodiment, such as... Figure 4 As shown in the figure, the area within the red line is the target detection area. Subsequently, image sharpness is evaluated on the target detection area to generate defocus quantification information. The defocus quantification information can be used to objectively characterize the defocus severity of the target detection area, such as the proportion of sharp sub-regions and the average gradient value.
[0018] Furthermore, the multiple sets of defocus quantification information corresponding to the aforementioned images are statistically analyzed to determine whether they meet the preset batch warning conditions. This condition can be defined as the cumulative number or frequency of defocus defects exceeding a safety threshold within a certain time or number of images. Once this condition is met, a batch warning signal will be automatically triggered. This signal can manifest as an audible and visual alarm, log recording, or sending a stop command to the host computer to indicate the abnormal defocus state.
[0019] By applying the technical solution of this embodiment, a reference area is intelligently identified from each image, and a precise target detection area is determined accordingly. This effectively locks the key parts to be analyzed for defocus and are mainly used for defect detection. Image sharpness assessment is performed on the target detection area to generate defocus quantification information, thereby transforming the defocus phenomenon into objective and measurable data. This solves the problem of missed or false judgments caused by the ineffectiveness of traditional fixed threshold methods for sharpness defects. By comprehensively analyzing the defocus quantification information of multiple images in continuous production, it is determined whether the batch early warning conditions are met, and an early warning signal is triggered accordingly. This enables real-time monitoring and proactive intervention for continuous image quality degradation caused by mechanical vibration, focusing deviation, etc. This breaks the limitation of traditional systems that only passively identify defects after they occur. As a result, batch quality accidents can be prevented at the process level, and the accuracy, intelligence level, and early warning capability of the detection system are greatly improved.
[0020] Optionally, in this embodiment of the application, step 102, "evaluating the image sharpness of the target detection region to obtain defocus quantification information for characterizing the degree of defocus in the target detection region," includes: performing spatial pose calibration and dynamic partitioning on the target detection region to obtain multiple sub-regions; determining a first number of the multiple sub-regions; and extracting the average image gradient of each sub-region; comparing the average image gradient of each sub-region with a preset sharpness threshold; selecting defocused sub-regions from the multiple sub-regions whose average image gradient is less than the preset sharpness threshold; and counting a second number of the defocused sub-regions; and generating defocus quantification information for characterizing the degree of defocus in the target detection region based on the ratio between the first number and the second number, and the average image gradient of all sub-regions.
[0021] In this embodiment, firstly, the spatial pose calibration of the located target detection region can be performed, as this region may exhibit a certain angular deflection in the actual image. In a specific embodiment, the calibration process can be achieved by calculating the minimum bounding rectangle of the target detection region and obtaining its deflection angle, followed by performing an affine transformation to align the principal axis of the target detection region with the coordinate axes. Based on this, according to a preset partitioning rule, the calibrated region is dynamically meshed, dividing it into a series of continuous strip-shaped or block-shaped sub-regions, and the total number of sub-regions is counted, i.e., the first quantity.
[0022] Next, for each defined sub-region, its mean image gradient is calculated. The mean image gradient reflects the intensity of brightness variation within that local area and is a key indicator of image sharpness; a higher mean image gradient indicates sharper edges and a clearer image. Then, the mean image gradient of each sub-region can be compared to a preset sharpness threshold. Sub-regions with mean image gradients below the preset sharpness threshold are identified as defocused sub-regions, indicating blurring in these local areas. Furthermore, the number of these defocused sub-regions can be precisely counted, i.e., the second quantity, thereby achieving localized and quantitative identification of defocusing phenomena.
[0023] Finally, the above data can be used to generate comprehensive defocus quantification information. In a specific embodiment, on the one hand, the ratio of the number of defocused sub-regions (i.e., the second number) to the total number of sub-regions (i.e., the first number) can be calculated to obtain the defocused region proportion, thus reflecting the degree of defocus spread in spatial terms. On the other hand, the statistical average of the image gradient mean of all sub-regions can be calculated to obtain the regional average gradient, thus characterizing the overall sharpness level of the target detection region. Combining the information from these two dimensions (defocused region proportion and regional average gradient) constitutes a set of quantitative data that can comprehensively and objectively characterize the overall defocus degree and distribution characteristics of the target detection region, providing a precise basis for subsequent decision-making.
[0024] The embodiments of this application transform complex overall evaluation into a series of local judgments through dynamic partitioning, which significantly improves the granularity and accuracy of the evaluation. At the same time, the output defocus quantification information has both overall generality and local differences, which can not only determine whether a single image is qualified, but also provide detailed data support for analyzing the degradation trend of imaging quality.
[0025] Optionally, in this embodiment, the step of "performing spatial pose calibration and dynamic partitioning of the target detection region to obtain multiple sub-regions" includes: obtaining the minimum bounding rectangle of the target detection region and extracting the major axis deflection angle of the minimum bounding rectangle as the pose deflection angle of the target detection region; performing an affine transformation on the target detection region according to the pose deflection angle to make the major axis direction of the target detection region parallel to the direction of the image coordinate axis, thereby obtaining a calibration region corresponding to the target detection region; dividing the calibration region into grids according to preset partitioning parameters to obtain multiple initial sub-regions; performing an inverse spatial transformation on the multiple initial sub-regions according to the pose deflection angle to obtain partitioned regions consistent with the original pose of the target detection region; performing an intersection operation on the effective domain of the partitioned regions and the target detection region to obtain the intersection region corresponding to each partitioned region, and using each intersection region as the multiple sub-regions, wherein the effective domain is obtained by performing morphological erosion processing on the target detection region or a local image extracted from the target detection region.
[0026] In this embodiment, the precise orientation of the target detection region in the image is first determined. Specifically, the smallest bounding rectangle that can completely enclose the target detection region can be calculated, which can frame all pixels with the smallest area. Then, the major axis deflection angle of this rectangle is extracted and defined as the pose deflection angle of the target detection region. This step provides accurate rotation parameters for subsequent geometric correction, ensuring that the orientation of the product under test can be accurately determined regardless of its placement during imaging.
[0027] Next, using the obtained attitude deflection angle, an affine transformation is performed on the original target detection region. An affine transformation is a geometric transformation that preserves the flatness and parallelism of the image; here, it functions similarly to rotating and straightening a tilted target detection region. Through this transformation, the major axis of the target detection region is adjusted to be parallel to the horizontal or vertical axis of the image coordinate system, thus obtaining a calibrated region with standardized orientation. This lays the foundation for subsequent uniform and regular division.
[0028] Under the calibrated standard pose, the calibration region is divided into a grid according to pre-set partitioning parameters (such as partition width and height), systematically dividing the calibration region into a series of continuous, regularly shaped initial sub-regions. This partitioning method ensures that each sub-region has a consistent scale in space, thereby guaranteeing the fairness and comparability of subsequent gradient feature extraction.
[0029] It is important to note that the above division was performed in the aligned coordinate system. In order to accurately correspond with the features in the original image, these initial sub-regions must be remapped back to the original image pose. Therefore, based on the previously recorded pose deflection angle, an inverse affine transformation is performed to rotate all the initial sub-regions back to their original angles, so that the final partitioned regions perfectly match the orientation of the initial target detection regions.
[0030] Finally, to ensure that each partition region accurately falls within the effective detection range and eliminates edge interference, fine-grained cropping can be performed. Specifically, firstly, a slightly reduced effective domain is obtained by performing a slight morphological erosion on the original target detection region, thereby eliminating potentially unstable edge pixels on the outermost edge. Subsequently, the partition regions obtained by the inverse transformation are intersected with this effective domain one by one. Only the overlapping parts are retained as the final sub-regions used for calculation, thus ensuring that all analyses are based on stable and effective pixel regions, improving the robustness of the evaluation. Finally, all intersection regions are used as multiple sub-regions for calculating the average gradient of the image.
[0031] This application's embodiments, through precise geometric calibration and standardized partitioning, transform actual target detection areas with varying shapes and postures into a series of analysis units with a unified mathematical basis and conforming to the true shape of the area. This not only solves the analysis problem caused by the randomness of the placement of the product under test, but also lays a solid foundation for subsequent accurate gradient calculation and sharpness comparison under a unified scale, greatly enhancing the adaptability and accuracy of the entire evaluation process.
[0032] Optionally, in this embodiment, the step of "generating defocus quantification information to characterize the degree of defocus in the target detection region based on the ratio between the first quantity and the second quantity, and the average image gradient of all sub-regions" includes: calculating the ratio of the second quantity to the first quantity to obtain the defocus region proportion characterizing the overall defocus coverage of the target detection region; calculating the statistical average of the average image gradient of all sub-regions to obtain the regional average gradient characterizing the overall image clarity of the target detection region; extracting the geometric morphology parameters of the target detection region, wherein the geometric morphology parameters include at least one of the area, center coordinates, contour point set, and minimum bounding rectangle vertex coordinate set of the target detection region; and generating defocus quantification information to characterize the degree of defocus in the target detection region based on the defocus region proportion, the regional average gradient, and the geometric morphology parameters.
[0033] In this embodiment, firstly, the number of defocused sub-regions obtained in the previous steps (i.e., the second number) is divided by the total number of all sub-regions (i.e., the first number) to obtain a ratio, called the defocused region percentage. This percentage directly reflects what proportion of the entire target detection area has experienced a decrease in sharpness. This is more accurate than a single overall judgment because it reveals whether the defocus defect is localized or widely distributed, providing spatial data for assessing the severity of the problem.
[0034] Simultaneously, the arithmetic mean of the image gradients of all sub-regions is calculated to obtain the region-average gradient. Image gradient essentially describes the drastic change in pixel values; sharp images have distinct edges and drastic changes, corresponding to higher image gradients; while blurry images show gradual changes and lower image gradients. Therefore, the region-average gradient can effectively characterize the average sharpness or clarity of the entire target detection area; the lower the value, the more severe the overall defocusing.
[0035] In addition to reflecting image state features, the basic geometric attributes of the target detection area itself, i.e., geometric morphological parameters, can also be recorded simultaneously. These geometric morphological parameters include, but are not limited to: area of the region, coordinates of the region center, set of contour points, and the set of vertex coordinates of its smallest bounding rectangle. Extracting this information allows the defocus assessment results to be bound to specific physical locations and shapes, ensuring that each piece of defocus quantification information accurately corresponds to a specific location on the product under test. This is crucial for subsequent defect localization, process traceability, and machine adjustment.
[0036] Finally, the proportion of out-of-focus areas reflecting the overall out-of-focus coverage, the average gradient of the region reflecting the overall image sharpness, and the geometric morphological parameters used for positioning and description are integrated to form a structured out-of-focus quantification information.
[0037] The information integration method of this application embodiment can not only accurately diagnose the out-of-focus state of the current target detection area (overall blur level, where blur is), but also provide a solid data foundation for long-term trend analysis, equipment health prediction and root cause tracing on the production line, thereby elevating quality control from passive judgment to the level of proactive perception and early warning.
[0038] In this embodiment of the application, optionally, the step of "extracting the geometric morphological parameters of the target detection region" includes: counting the third number of all pixels constituting the target detection region, and determining the area of the target detection region based on the third number; and / or, calculating the average value of the horizontal coordinates and the average value of the vertical coordinates of all pixels in the target detection region, and determining the center coordinates of the target detection region based on the average value of the horizontal coordinates and the average value of the vertical coordinates; and / or, performing polygon approximation operation on the binarized image representation of the target detection region, extracting the outer contour of the target detection region, and determining the contour point set of the target detection region based on each pixel point on the outer contour; and / or, calculating the minimum rotation rectangle that completely surrounds the target detection region, obtaining the center coordinates, deflection angle, and length and width semi-axis length of the minimum rotation rectangle, determining the coordinates of the four vertices of the minimum rotation rectangle based on the center coordinates, deflection angle, and length and width semi-axis length of the minimum rotation rectangle, and determining the vertex coordinate set of the minimum rotation rectangle based on the four vertex coordinates.
[0039] In this embodiment, the area of the target detection region can be determined by counting the total number of pixels constituting the target detection region, i.e., the third quantity. In a digital image where pixels are the basic unit, the area of a region is the total number of pixels it covers. This fundamental parameter intuitively quantifies the size of the target detection region.
[0040] The center coordinates of the target detection region can be determined as follows: calculate the average of the x-coordinates and y-coordinates of all pixels within the target detection region to obtain the center coordinates. These center coordinates are essentially the centroid of the pixel distribution within the target detection region, providing precise location information of the target detection region in the image plane.
[0041] The contour point set of the target detection region can be determined as follows: To accurately describe the complex shape of the target detection region, a polygon approximation operation is performed on its binarized image representation. This operation aims to fit the potentially irregular external contour of the target detection region with a series of connected straight line segments, significantly simplifying the data volume while maintaining a certain level of accuracy. Based on this simplified polygon, the coordinates of all its vertices are extracted to form an ordered contour point set. This set of points efficiently records the precise geometric shape and boundary of the target detection region, and is key data for reconstructing the true form of defects.
[0042] The set of vertex coordinates for the minimum rotation rectangle of the target detection region can be determined as follows: To grasp the overall direction and approximate extent of the target detection region, a minimum rotation rectangle that completely encloses the region is first calculated. This rectangle can be rotated at any angle to achieve the minimum enclosing area. Then, the center coordinates, rotation angle, and semi-length and width axes of this rectangle are obtained. Based on these parameters, the coordinates of the four vertices of the minimum rotation rectangle are derived through geometric calculations, thus forming the vertex coordinate set. This rectangle and its parameters provide macroscopic morphological features of the target detection region, such as its direction, aspect ratio, and outer envelope. It should be noted that the minimum rotation rectangle here can be directly determined based on the aforementioned minimum bounding rectangle.
[0043] Optionally, in this embodiment of the application, the step 103, "determining whether the batch warning condition is met based on the defocus quantization information of each image", includes: calculating the cumulative index value of the target defocus index based on the defocus quantization information corresponding to each image; comparing the cumulative index value with a preset index threshold; and determining that the batch warning condition is met if the cumulative index value exceeds the preset index threshold.
[0044] In this embodiment, one or more key target defocus indicators can be predetermined (such as the number of images where the proportion of defocused areas exceeds a certain threshold, or the total average gradient value calculated based on the average gradient of regions across all images). Based on the defocus quantization information of each image, the indicator value required for calculating each target defocus indicator can be extracted, and these indicator values can be accumulated to obtain the cumulative indicator value for each target defocus indicator.
[0045] Next, the calculated cumulative index value is compared with a predefined preset index threshold. This preset index threshold can be a safety boundary set based on production process requirements, historical quality data, or equipment performance limits, defining the upper limit of the total number of defocusing issues that is acceptable within the statistical period.
[0046] When the comparison results show that the cumulative indicator value exceeds the preset indicator threshold, the system automatically determines that the current production process meets the batch warning conditions. This determination indicates that the problem of false focus is not an isolated phenomenon, but rather presents a statistically significant and continuously occurring abnormal trend, suggesting a potential risk of missed batch defects. Once the determination is established, subsequent batch warning signals will be immediately triggered, thereby transforming the information into timely action instructions.
[0047] This application embodiment can effectively filter out unavoidable random fluctuations and isolated anomalies in the production process by statistically accumulating index values, and accurately capture the truly risky and continuous quality degradation signals. This enables production line managers to obtain clear warnings that equipment needs maintenance and processes need adjustment before batch missed inspections occur, changing from passive response to proactive intervention, effectively reducing the defect misjudgment rate, and thus greatly improving the reliability of the production process and the level of intelligence in quality control.
[0048] Optionally, in this embodiment, the target defocus index includes the number of defocus defects identified based on the defocus quantification information of each image, and the cumulative index value is the sum of the number of defocus defects identified in all images within a preset statistical period.
[0049] In this embodiment, the target defocus index may include the number of defocus defects. The number of defocus defects comes from the corresponding defocus quantification information. Its specific determination can be based on various logics, such as directly counting an image with a defocused area ratio exceeding a certain threshold as a defocus defect, or directly counting an image with an average gradient of a region exceeding a certain threshold as a defocus defect, etc.
[0050] Furthermore, a preset statistical period can be set. This period can be a fixed time window (such as the past hour) or a fixed product quantity unit (such as 100 continuously produced products to be tested). Within this period, the focus shifts from the individual cases of each image to the continuous algebraic summation of the number of out-of-focus defects identified in each image. The sum obtained from this accumulation process is the cumulative index value, which characterizes the situation of out-of-focus images produced in the production process within a specified time or production range, thus transforming production quality from a static snapshot description into a dynamic trend indicator.
[0051] In this embodiment of the application, optionally, the step 102 of "identifying the reference region from the image" includes: downsampling the image to obtain a preprocessed image with reduced resolution; performing morphological erosion on the preprocessed image to remove edge interference regions from the preprocessed image to obtain a core effective region; within the core effective region, determining pixels with gray values within a preset threshold range as target pixels, and determining at least one initial candidate region based on the target pixels, wherein each initial candidate region includes connected target pixels; performing intersection operations on each initial candidate region and the core effective region to obtain at least one target candidate region; performing connected component analysis on the at least one target candidate region to identify multiple independent region objects, and selecting the reference region from the multiple independent region objects according to preset filtering conditions, wherein the preset filtering conditions include shape conditions and / or area conditions.
[0052] In this embodiment, the acquired original image is first downsampled, that is, the size and resolution of the image are reduced proportionally. This reduces the amount of computational data in subsequent image processing, improves the overall analysis efficiency, and at the same time, by preserving the main structural features of the image, provides a more compact and representative analytical basis for subsequent analysis.
[0053] Next, morphological erosion is performed on the downsampled preprocessed image. Morphological erosion is an image processing operation that works similarly to uniformly eroding the edges of bright areas in an image. In this embodiment, morphological erosion can remove interfering areas located at the image edges, such as reflections, scratches, or incomplete structures, thereby obtaining a more stable and reliable core effective region, ensuring that subsequent analysis focuses on the consistent portion in the center of the image.
[0054] Within the defined core effective area, pixels are filtered according to a preset threshold range. Specifically, all pixels whose grayscale values fall within this preset threshold range are identified as target pixels. These target pixels typically correspond to target features with specific grayscale values in the image, such as dark holes on the product under test. Subsequently, spatially connected target pixels are grouped together to form one or more initial candidate regions.
[0055] Furthermore, each initial candidate region is intersected with the previously obtained core effective region. This removes any portion of the initial candidate region that might overflow into the core effective region, resulting in one or more target candidate regions entirely within the core effective region. In reality, when the algorithm aggregates target pixels into initial candidate regions based on connectivity, the mathematical representation of these initial candidate regions in the computer (e.g., their circumscribed rectangle or contour polygon) may have its boundary precisely located on the edge pixels of the core effective region to completely encompass all target pixels, or even slightly exceeding it due to computational precision or contour fitting algorithms (such as polygon approximation). That is, the theoretical range of the initial candidate region may not be strictly equal to the exact set of target pixels within it. Therefore, this embodiment of the application, through intersection operations, ensures that the final target candidate regions used for subsequent filtering are absolutely pure and completely located within the core effective region.
[0056] Finally, connected component analysis is performed on these candidate regions to accurately identify multiple independent region objects within them. Then, based on preset filtering criteria, such as area-based filtering (retaining only the largest area) or shape-based filtering (e.g., roundness), a baseline region is ultimately selected from these independent region objects. This step ensures that regardless of the amount of interference in the image, the most critical and stable feature region can be identified as the baseline region.
[0057] In a specific embodiment, for example, in a top view of an industrial part, after preprocessing, several white target candidate blocks are obtained, representing a complete screw hole, a bright spot caused by reflection, and two white spots caused by noise. Connected component analysis can accurately identify these four unconnected white blocks as four independent region objects. Then, based on preset filtering conditions, the truly needed one, i.e., the reference region, is intelligently filtered from these independent region objects. The preset filtering conditions can include shape and area. If the preset filtering condition is "find an approximately circular region with a large area", then each region can be checked one by one: the first region (screw hole) has a regular shape and a moderate area, meeting the condition; the second region (reflective bright spot), although its area may be large, has a very irregular shape, not meeting the shape condition; the third and fourth regions (noise points) have too small an area, not meeting the area condition. Through such filtering, interference can be eliminated, and the screw hole region can be uniquely and accurately identified as the reference region.
[0058] This application's embodiments start with downsampling and erosion denoising, and use a preset threshold range to initially screen target pixels. Then, intersection operations and morphological screening are used to gradually purify the target. This enables stable and accurate positioning of the reference region, which serves as the benchmark for all subsequent detections, even in complex industrial image backgrounds and interference, thereby improving the accuracy of subsequent analysis.
[0059] Optionally, in this embodiment, step 102, "determining the target detection region based on the reference region," includes: generating an edge search region surrounding the reference region; performing image feature enhancement processing on the edge search region to obtain a feature-enhanced image; performing edge extraction on the feature-enhanced image to obtain at least one continuous candidate edge; filtering out reference edges constituting the boundary of the target detection region based on the geometric parameters and orientation information of the at least one continuous candidate edge; obtaining peripheral edges based on the reference edges through morphological dilation operations, and using the region between the reference edges and the peripheral edges as the target detection region, and restoring the coordinates of the target detection region to the original image resolution.
[0060] In this embodiment, firstly, a larger edge search region is generated around the identified reference region. This edge search region ensures that edge features related to the reference region are not missed, while avoiding the huge computational overhead and interference risk caused by blindly searching the entire image. In a specific embodiment, the reference region is the black hole in the middle frame of the phone, so the edge search region can be the annular region surrounding the black hole.
[0061] Next, image feature enhancement processing is performed on the edge search region. This image feature enhancement processing can include filtering to suppress noise, contrast stretching to highlight the boundary between light and dark areas, and histogram equalization to optimize grayscale distribution. The aim is to strengthen the difference between potential edges and the background within the edge search region, making lines representing the physical boundaries of the product under test (such as the edges of holes) clearer and more prominent in the image. In a specific embodiment, the image feature enhancement processing can include the following steps: Step 1, mean filtering, using a 3×3 kernel size mean filter to remove noise from the edge search region; Step 2, contrast enhancement, using a 15×15 kernel size and an enhancement coefficient of 4 to enhance the contrast between the edges and the background in the edge search region; Step 3, histogram equalization, performing histogram equalization to optimize the image grayscale distribution in the edge search region and further enhance edge features.
[0062] After obtaining the feature-enhanced image, edge detection algorithms (such as the Canny operator) are used to process it, extracting all salient edges in the feature-enhanced image. These edges are then connected and cleaned to form one or more continuous lines, i.e., continuous candidate edges. Each continuous candidate edge may be the target boundary being sought, but it may also contain false edges caused by textures, scratches, or noise.
[0063] Subsequently, all extracted continuous candidate edges are analyzed to calculate their geometric parameters (such as length, curvature, and closure) and orientation information (angle relative to the reference region). Based on preset rules (such as "selecting the longest closed edge that is closest to a circle and runs from the outside in"), the most suitable edge is selected from multiple continuous candidate edges as the reference edge, which can be regarded as the inner boundary of the target detection area.
[0064] After determining the baseline edge, it is processed using a morphological dilation operation to obtain the outer edge. Dilation is an operation that expands a selected region in an image outward. Here, it pushes the baseline edge outward by a predetermined distance (e.g., 260 pixels) along its normal direction, thus generating a new, concentric outer edge. At this point, a ring-shaped target detection region is defined between the original baseline edge (inner boundary) and the dilated outer edge (outer boundary). Finally, the target detection region is mapped back to the coordinate system of the initially acquired high-resolution image to ensure that all subsequent measurements and evaluations are performed at the correct pixel scale.
[0065] This application's embodiments effectively shield global background interference by enhancing and extracting edges within the edge search area; accurately identifying the true structural boundaries through geometric and directional rule filtering; and finally, deriving a uniformly wide annular detection area through simple morphological operations. The entire process is highly automated and can adapt to product size and posture variations within a certain range, providing a stable and accurate basis for subsequent defocus evaluation.
[0066] Optionally, in an embodiment of this application, if a reference edge cannot be selected from the at least one continuous candidate edge, the method further includes: generating a secondary positioning region based on the reference region through morphological operations; performing target shape dilation on the secondary positioning region with the secondary positioning region as the center, respectively, by a first distance and a second distance, to obtain a first dilated region and a second dilated region, wherein the second distance is greater than the first distance; calculating the difference between the second dilated region and the first dilated region to obtain a ring-shaped default detection region; performing an intersection operation between the default detection region and a preset spatial constraint domain for removing image edge interference to obtain the target detection region, and restoring the coordinates of the target detection region to the original image resolution.
[0067] In this embodiment, if anomalies in the baseline edge cannot be accurately screened out through edge analysis, a robust backup process can be initiated. Specifically, based on the successfully identified baseline region, a more regular and concentrated secondary positioning region is generated through a series of morphological operations (such as opening operations that involve erosion followed by dilation), thereby obtaining a cleaner and more stable core region as a reliable starting point for all subsequent geometric derivations. This ensures that the process can continue even if the baseline edge extraction is not ideal.
[0068] Next, using this secondary positioning region as the center, two morphological dilation operations of a specific shape (such as a circle) are performed sequentially, but using two different distance parameters: a first distance and a larger second distance. Through these two dilations of different degrees, two concentric regions of different sizes are obtained: a smaller first dilated region and a larger second dilated region. The spatial relationship between these two regions forms the basis for defining the annular region.
[0069] Subsequently, the default detection region is directly synthesized by calculating the difference between the two inflated regions. Specifically, it can be obtained by subtracting the smaller first inflated region from the larger second inflated region. This completely avoids dependence on specific edges and instead constructs the default detection region directly based on the geometric relationships between regions.
[0070] Then, to ensure the validity of the generated default detection region and exclude invalid parts that may appear at image edges, the default detection region is intersected with a preset spatial constraint domain. This spatial constraint domain can be obtained by eroding the effective area of the image inward, and its purpose is to ensure that the final target detection region does not touch unstable locations such as image boundaries. After this intersection and cropping, the final usable target detection region is obtained. Finally, the coordinates of this target detection region also need to be mapped back to the coordinate system of the original high-resolution image for subsequent accurate sharpness evaluation.
[0071] This application provides a degradation path that does not rely on precise edge extraction. When the main technical path is blocked by accidental factors such as image quality and lighting, it can automatically switch to a geometric construction method based on region morphology, which can still generate a reasonable default detection area, thereby ensuring the continuity and availability of the entire detection process.
[0072] Furthermore, as Figure 1 In terms of specific implementation, this application provides a batch early warning device for industrial defect detection based on image defocus, such as... Figure 5 As shown, the device includes: The image acquisition module is used to acquire images of multiple identical products to be tested that pass sequentially through the production line; The sharpness assessment module is used to identify a reference region from each image, determine a target detection region based on the reference region, and perform image sharpness assessment on the target detection region to obtain defocus quantification information that characterizes the degree of defocus in the target detection region. The judgment module is used to determine whether the batch warning conditions are met based on the defocus quantization information of each image, and to trigger the batch warning signal when the batch warning conditions are met.
[0073] Optionally, the sharpness assessment module is used to: Spatial pose calibration and dynamic partitioning are performed on the target detection region to obtain multiple sub-regions. A first number of the multiple sub-regions is determined, and the mean image gradient of each sub-region is extracted. The average image gradient of each sub-region is compared with a preset sharpness threshold. Defocused sub-regions with an average image gradient less than the preset sharpness threshold are selected from the multiple sub-regions, and the second number of the defocused sub-regions is counted. Based on the ratio between the first quantity and the second quantity, and the mean image gradient of all sub-regions, defocus quantization information is generated to characterize the degree of defocus in the target detection region.
[0074] Optionally, the sharpness assessment module is further configured to: Obtain the minimum bounding rectangle of the target detection region, and extract the major axis deflection angle of the minimum bounding rectangle as the attitude deflection angle of the target detection region; Based on the attitude deflection angle, an affine transformation is performed on the target detection region to make the major axis of the target detection region parallel to the image coordinate axis, thereby obtaining the calibration region corresponding to the target detection region. The calibration area is divided into grids according to preset partitioning parameters to obtain multiple initial sub-regions; The multiple initial sub-regions are subjected to inverse spatial transformation according to the attitude deflection angle to obtain partitioned regions that are consistent with the original attitude of the target detection region; The intersection of the effective domains of the partitioned regions and the target detection regions is performed to obtain the intersection regions corresponding to each partitioned region. Each intersection region is used as the multiple sub-regions. The effective domain is obtained by performing morphological erosion processing on the target detection region or the local image extracted from the target detection region.
[0075] Optionally, the sharpness assessment module is further configured to: Calculate the ratio of the second quantity to the first quantity to obtain the defocused area ratio, which characterizes the overall defocused coverage of the target detection area; Calculate the statistical average of the image gradient mean of all sub-regions to obtain the region average gradient that characterizes the overall image sharpness of the target detection region. Extract the geometric morphological parameters of the target detection region, wherein the geometric morphological parameters include at least one of the area, center coordinates, contour point set, and minimum bounding rectangle vertex coordinate set of the target detection region; Based on the proportion of the defocused area, the average gradient of the area, and the geometric morphology parameters, defocus quantification information is generated to characterize the degree of defocus in the target detection area.
[0076] Optionally, the sharpness assessment module is further configured to: A third number of all pixels constituting the target detection region is counted, and the area of the target detection region is determined based on the third number; and / or, Calculate the average of the x-coordinates and the average of the y-coordinates of all pixels in the target detection region, and determine the center coordinates of the target detection region based on the average of the x-coordinates and the average of the y-coordinates; and / or, A polygon approximation operation is performed on the binarized image representation of the target detection region to extract the outer contour of the target detection region, and the contour point set of the target detection region is determined based on each pixel on the outer contour; and / or, Calculate the minimum rotation rectangle that completely surrounds the target detection region, obtain the center coordinates, deflection angle, and length and width semi-axis length of the minimum rotation rectangle, determine the coordinates of the four vertices of the minimum rotation rectangle based on the center coordinates, deflection angle, and length and width semi-axis length of the minimum rotation rectangle, and determine the vertex coordinate set of the minimum rotation rectangle based on the four vertex coordinates.
[0077] Optionally, the determination module is used to: Based on the defocus quantization information corresponding to each image, the cumulative index value of the target defocus index is calculated. The cumulative indicator value is compared with the preset indicator threshold. If the cumulative indicator value exceeds the preset indicator threshold, then the batch warning condition is determined to be met.
[0078] Optionally, the target defocus index includes the number of defocus defects identified based on the defocus quantification information of each image, and the cumulative index value is the sum of the number of defocus defects identified in all images within a preset statistical period.
[0079] Optionally, the sharpness assessment module is further configured to: The image is downsampled to obtain a preprocessed image with reduced resolution; The preprocessed image is subjected to morphological erosion to remove edge interference areas and obtain the core effective area. Within the core effective area, pixels with grayscale values within a preset threshold range are identified as target pixels, and at least one initial candidate region is determined based on the target pixels, wherein each initial candidate region includes connected target pixels; Each initial candidate region is intersected with the core effective region to obtain at least one target candidate region. Connectivity analysis is performed on the at least one target candidate region to identify multiple independent region objects, and a benchmark region is selected from the multiple independent region objects according to preset filtering conditions, wherein the preset filtering conditions include shape conditions and / or area conditions.
[0080] Optionally, the sharpness assessment module is further configured to: Based on the reference region, an edge search region surrounding the reference region is generated; The edge search region is subjected to image feature enhancement processing to obtain a feature-enhanced image; Edge extraction is performed on the feature-enhanced image to obtain at least one continuous candidate edge; Based on the geometric parameters and orientation information of the at least one continuous candidate edge, the reference edge constituting the boundary of the target detection area is selected; Based on the reference edge, the outer edge is obtained through morphological dilation, and the area between the reference edge and the outer edge is taken as the target detection area. The coordinates of the target detection area are restored to the original image resolution.
[0081] Optionally, if a reference edge cannot be selected from the at least one consecutive candidate edge, the sharpness evaluation module is further configured to: Based on the reference region, a secondary positioning region is generated through morphological operations; Centered on the secondary positioning region, the target shape of the secondary positioning region is expanded by a first distance and a second distance respectively to obtain a first expanded region and a second expanded region, wherein the second distance is greater than the first distance; Calculate the difference between the second expansion region and the first expansion region to obtain the ring-shaped default detection region; The default detection region is intersected with a preset spatial constraint domain for removing image edge interference to obtain the target detection region, and the coordinates of the target detection region are restored to the original image resolution.
[0082] It should be noted that other corresponding descriptions of the functional units involved in the batch early warning device for industrial defect detection based on image defocus provided in this application embodiment can be found in the following references. Figures 1 to 4 The corresponding descriptions in the method will not be repeated here.
[0083] This application also provides a computer device, which may specifically be a personal computer, a server, a network device, etc. Figure 6 As shown, the computer device includes a bus, a processor, memory, and a communication interface, and may also include an input / output interface and a display device. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores location information. The network interface allows communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the various method embodiments.
[0084] Those skilled in the art will understand that Figure 6The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0085] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, having stored thereon a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0086] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0087] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0088] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0089] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0090] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A batch early warning method for industrial defect detection based on image defocus, characterized in that, include: Acquire images of multiple identical products to be tested sequentially passing through the production line; For each image, a reference region is identified from the image, a target detection region is determined based on the reference region, and the image sharpness of the target detection region is evaluated to obtain defocus quantification information that characterizes the degree of defocus in the target detection region. Based on the defocus quantization information of each image, determine whether the batch warning conditions are met, and trigger the batch warning signal when the batch warning conditions are met.
2. The method according to claim 1, characterized in that, The step of evaluating the image sharpness of the target detection region to obtain defocus quantification information characterizing the degree of defocus in the target detection region includes: Spatial pose calibration and dynamic partitioning are performed on the target detection region to obtain multiple sub-regions. A first number of the multiple sub-regions is determined, and the mean image gradient of each sub-region is extracted. The average image gradient of each sub-region is compared with a preset sharpness threshold. Defocused sub-regions with an average image gradient less than the preset sharpness threshold are selected from the multiple sub-regions, and the second number of the defocused sub-regions is counted. Based on the ratio between the first quantity and the second quantity, and the mean image gradient of all sub-regions, defocus quantization information is generated to characterize the degree of defocus in the target detection region.
3. The method according to claim 2, characterized in that, The target detection region is subjected to spatial attitude calibration and dynamic partitioning to obtain multiple sub-regions, including: Obtain the minimum bounding rectangle of the target detection region, and extract the major axis deflection angle of the minimum bounding rectangle as the attitude deflection angle of the target detection region; Based on the attitude deflection angle, an affine transformation is performed on the target detection region to make the major axis of the target detection region parallel to the image coordinate axis, thereby obtaining the calibration region corresponding to the target detection region. The calibration area is divided into grids according to preset partitioning parameters to obtain multiple initial sub-regions; The multiple initial sub-regions are subjected to inverse spatial transformation according to the attitude deflection angle to obtain partitioned regions that are consistent with the original attitude of the target detection region; The intersection of the effective domains of the partitioned regions and the target detection regions is performed to obtain the intersection regions corresponding to each partitioned region. Each intersection region is used as the multiple sub-regions. The effective domain is obtained by performing morphological erosion processing on the target detection region or the local image extracted from the target detection region.
4. The method according to claim 2 or 3, characterized in that, The step of generating defocus quantification information to characterize the defocusing degree of the target detection region based on the proportional relationship between the first quantity and the second quantity, and the average image gradient of all sub-regions, includes: Calculate the ratio of the second quantity to the first quantity to obtain the defocused area ratio, which characterizes the overall defocused coverage of the target detection area; Calculate the statistical average of the image gradient mean of all sub-regions to obtain the region average gradient that characterizes the overall image sharpness of the target detection region. Extract the geometric morphological parameters of the target detection region, wherein the geometric morphological parameters include at least one of the area, center coordinates, contour point set, and minimum bounding rectangle vertex coordinate set of the target detection region; Based on the proportion of the defocused area, the average gradient of the area, and the geometric morphology parameters, defocus quantification information is generated to characterize the degree of defocus in the target detection area.
5. The method according to claim 4, characterized in that, The extraction of geometric parameters of the target detection region includes: A third number of all pixels constituting the target detection region is counted, and the area of the target detection region is determined based on the third number; and / or, Calculate the average of the x-coordinates and the average of the y-coordinates of all pixels in the target detection region, and determine the center coordinates of the target detection region based on the average of the x-coordinates and the average of the y-coordinates; and / or, A polygon approximation operation is performed on the binarized image representation of the target detection region to extract the outer contour of the target detection region, and the contour point set of the target detection region is determined based on each pixel on the outer contour; and / or, Calculate the minimum rotation rectangle that completely surrounds the target detection region, obtain the center coordinates, deflection angle, and length and width semi-axis length of the minimum rotation rectangle, determine the coordinates of the four vertices of the minimum rotation rectangle based on the center coordinates, deflection angle, and length and width semi-axis length of the minimum rotation rectangle, and determine the vertex coordinate set of the minimum rotation rectangle based on the four vertex coordinates.
6. The method according to claim 1, characterized in that, The step of determining whether the batch warning conditions are met based on the defocus quantization information of each image includes: Based on the defocus quantization information corresponding to each image, the cumulative index value of the target defocus index is calculated. The cumulative indicator value is compared with the preset indicator threshold. If the cumulative indicator value exceeds the preset indicator threshold, then the batch warning condition is determined to be met.
7. The method according to claim 6, characterized in that, The target defocus index includes the number of defocus defects identified based on the defocus quantification information of each image, and the cumulative index value is the sum of the number of defocus defects identified in all images within a preset statistical period.
8. A batch early warning device for industrial defect detection based on image defocus, characterized in that, include: The image acquisition module is used to acquire images of multiple identical products to be tested that pass sequentially through the production line; The sharpness assessment module is used to identify a reference region from each image, determine a target detection region based on the reference region, and perform image sharpness assessment on the target detection region to obtain defocus quantification information that characterizes the degree of defocus in the target detection region. The judgment module is used to determine whether the batch warning conditions are met based on the defocus quantization information of each image, and to trigger the batch warning signal when the batch warning conditions are met.
9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.
10. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.