Visual detection and sorting method for pinhole of aluminum electrolytic capacitor
By integrating a visual inspection system and deep learning algorithms, high-precision, non-destructive, and fully automated inspection of nail marks on aluminum electrolytic capacitors has been achieved. This solves the problems of low efficiency, high false detection rate, and poor adaptability in existing methods, and improves the inspection accuracy and stability.
Patent Information
- Application Number
- CN202610324401.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-17
- Publication Date
- 2026-06-16
AI Technical Summary
Existing methods for detecting nail marks on aluminum electrolytic capacitors are inefficient, have a high false detection rate, and poor adaptability. They cannot fully assess the structural integrity and internal quality of the nail marks and pose a risk of damage.
An integrated vision inspection system is adopted, which combines an industrial camera, a composite lighting source, a photoelectric sensor, an industrial computer, and a sorting actuator. It achieves high-precision non-contact inspection of nail flowers through image processing and deep learning algorithms, including sub-pixel edge extraction and convolutional neural network analysis.
It achieves efficient, non-destructive, fully automated inspection, improves inspection accuracy and stability, can identify minute defects, adapts to different product models, and meets the needs of modern high-speed production lines.
Smart Images

Figure CN122222965A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation visual inspection technology, and in particular to a visual inspection and sorting method for nailing defects on aluminum electrolytic capacitors. Background Technology
[0002] Aluminum electrolytic capacitors are indispensable basic components in modern electronic devices, and their manufacturing reliability directly affects the stability and lifespan of the entire electronic system. In the manufacturing process of aluminum electrolytic capacitors, the riveting process between the leads and the core, known as "riveting," is a crucial step. The quality of this process directly determines the internal electrical connection performance, contact resistance, shock resistance, and long-term reliability of the capacitor. Currently, the industry mainly relies on the following methods for inspecting the quality of nail-stitched products: First, manual visual inspection. This method relies entirely on the quality inspector's experience and subjective judgment, using a magnifying glass or microscope to observe the nail patterns. Its problems are particularly prominent: extremely low inspection efficiency, unable to match the high-speed cycle of modern automated production lines; inspection standards vary from person to person, making standardization impossible, resulting in high false positive and false negative rates; and prolonged work can easily lead to visual fatigue, further reducing the stability and reliability of the inspection. Second, there are general machine vision inspection solutions. This method uses an industrial camera to capture images of the nail pattern and then measures its dimensions using simple image processing algorithms (such as thresholding and edge detection). However, the surface of the nail pattern is made of metal, which has strong reflective properties, and it is itself a three-dimensional microstructure with complex contours and textures. General vision solutions struggle to overcome strong reflective interference, resulting in unclear and unstable image feature extraction. This makes it prone to misjudgment and missed detection when lighting conditions or product models change slightly, demonstrating poor adaptability. Third, dedicated physical contact inspection devices. These devices measure the height or pressure of the riveting through physical contact methods such as mechanical probes. However, their inspection scope is limited, typically only acquiring a few parameters such as height, and they cannot comprehensively assess the shape integrity, symmetry, positional misalignment, or inherent quality of the riveting (such as loose connections or overpressure damage). Furthermore, contact measurement carries the risk of scratching the product surface, and the devices are complex in structure, have high maintenance costs, and are difficult to integrate into high-speed production lines for full inspection. In summary, existing technologies all have significant drawbacks: manual inspection is inefficient and highly subjective; general machine vision solutions are limited by reflective interference and lack robustness; and dedicated physical devices have a narrow detection range and pose a risk of damage. More critically, existing methods focus on judging the conformity of external dimensions, lacking effective means to assess the health of the internal structure of the riveting (such as potential defects like microscopic deformation due to insufficient riveting force or material crushing). While these potential defects may not lead to dimensional deviations, they can severely compromise the long-term reliability of the product. Therefore, the industry urgently needs a non-contact, fully automated inspection method that can simultaneously achieve high-precision dimensional measurement, strong anti-interference capabilities, and in-depth intelligent judgment of the integrity of nail-stitch structures, in order to fundamentally improve product quality and production automation levels. Summary of the Invention
[0003] To achieve the above objectives, this invention provides a visual inspection and sorting method for nailing defects in aluminum electrolytic capacitors. The method is based on an integrated visual inspection system, which includes an industrial camera, a composite lighting source, a photoelectric sensor, an industrial computer, a programmable logic controller, and a sorting execution mechanism. The method includes the following steps: Step S1, System Calibration and Parameter Preset: The visual inspection system is spatially calibrated using standard gauge blocks to obtain the conversion relationship between pixels and physical dimensions, and preset geometric tolerance thresholds and deep learning model configuration files are loaded for the currently inspected capacitor model. Step S2, workpiece triggering and image synchronous acquisition: A photoelectric sensor detects the capacitor's position and generates a trigger signal; an industrial computer controls the composite lighting source, including a ring light source and a dome light source, to be synchronously lit according to a preset brightness ratio based on the trigger signal; after the light source stabilizes, an industrial camera is synchronously controlled to capture digital images of the nail flower. Step S3, Image preprocessing and feature region localization: The digital image is preprocessed with noise reduction and contrast enhancement. Then, the capacitive guide pin is located in the image and the region of interest containing only the nail flower structure is extracted based on the position of the guide pin. Step S4, Two-stream parallel analysis and feature extraction: Parallel processing of the region of interest image; In the first stream, the geometric parameters of the nail flower, including at least the height, diameter, center offset, and symmetry, are calculated using sub-pixel edge extraction technology. In the second stream, the region of interest image is input into a pre-trained convolutional neural network model to obtain the probability vector of the input image belonging to each preset defect category; Step S5, Weighted Decision Fusion and Comprehensive Judgment: The geometric dimension parameters calculated in the first flow are compared with the preset tolerance threshold to obtain the dimension Boolean judgment result; Simultaneously, the probability vector of the second-stream output is analyzed, the category with the highest probability value is taken as the main predicted defect type, and the confidence level is recorded; When the main predicted defect type is a deformation feature that characterizes insufficient riveting force and the confidence level exceeds a preset confidence threshold, the internal control tolerance threshold is enabled to perform a secondary comparison of the key geometric dimension parameters. The internal control tolerance threshold is greater than the preset tolerance threshold. The internal control tolerance threshold is determined based on the statistical distribution of the corresponding geometric dimension parameters of qualified products in historical production data. Finally, when all geometric dimensional parameters are within the dynamically selected tolerance threshold range and the main predicted defect type is "qualified", the product is judged as qualified; otherwise, it is judged as unqualified. Step S6, Sorting Execution and Data Closed-Loop Management: The industrial computer converts the comprehensive judgment results into control instructions. If a product is found to be defective, the programmable logic controller drives the sorting mechanism to remove it. At the same time, the entire chain of data from this inspection is stored in the data management platform. Preferably, in step S2, the preset brightness ratio combination specifically means: controlling the dome light source to light up at a first brightness value, and controlling the ring light source to light up at a second brightness value, wherein the first brightness value is higher than the second brightness value; The dome light source has a bowl-shaped structure and is placed above the detection station, with a diffuse reflection coating inside; The ring light source is mounted outside the lens of the industrial camera. Preferably, the composite lighting source further includes a coaxial light source; In step S2, when the surface roughness requirement is lower than Ra0.1μm for a capacitor model, the industrial computer controls the coaxial light source to be lit at the third brightness value. The coaxial light is used to detect small dents or scratches on the nail flower surface. Preferably, in step S3, the noise reduction process uses a Gaussian filtering algorithm, and the contrast enhancement process uses a contrast-limited adaptive histogram equalization algorithm. The positioning capacitor guide pin uses a template matching algorithm based on grayscale values to search and match in the entire digital image using the standard image of the guide pin as a template. Preferably, in the first flow of step S4, the subpixel edge extraction technique specifically involves: firstly, using the Canny edge detection operator to obtain a nail flower contour with pixel-level precision; then, performing interpolation operations on the edge pixels based on the image grayscale gradient to obtain subpixel-level contour coordinates with a resolution higher than that of a single pixel; and finally, calculating geometric dimension parameters based on the subpixel-level contour coordinates. Preferably, in the second flow of step S4, the pre-trained convolutional neural network model can identify the following preset defect categories: skewed shape, incomplete shape, misaligned nail hole center, presence of burrs and flash, and deformation features indicating insufficient riveting force. The deformation features characterizing insufficient riveting force are feature categories extracted autonomously by the model after training and learning from the microscopic deformation images of a large number of known poor riveting samples. Preferably, in step S5, the preset confidence threshold is 60%; The internal control tolerance threshold is determined by statistically analyzing the corresponding geometric dimension parameters of qualified products in historical production data and taking a range of 1.5 times the standard deviation σ of its statistical distribution. This range is stricter than the range of 3 times the standard deviation σ corresponding to the conventional preset tolerance threshold. Preferably, after step S6, step S700 is also included: process monitoring and early warning: the data management platform automatically calculates the process capability index of key dimensions and draws statistical process control charts based on the stored nailing geometric dimension data of all products in the continuous production batch. When the process capability index shows a continuous downward trend or the data point exceeds the control limit of the control chart, a process early warning message is automatically generated and sent to the production management system. Preferably, the pre-trained convolutional neural network model is deployed on an industrial computer, and the method further includes an online model update step: the data management platform regularly collects low-confidence judgment samples and newly added defect samples uploaded by each visual inspection terminal, performs incremental training on the convolutional neural network model on the server side, generates a new version of the model file, and distributes the new version of the model file to the designated visual inspection terminal to replace the old model. Preferably, the sorting actuator is a pneumatic nozzle controlled by a solenoid valve; In step S6, the programmable logic controller responds to the non-conforming product instruction in less than 10 milliseconds and drives the solenoid valve to generate a compressed air pulse with a duration of 20 to 100 milliseconds to blow the non-conforming product away from the main conveyor line. The beneficial effects of this invention are: 1. This invention employs an integrated visual inspection system that utilizes an industrial camera and a composite lighting source, combined with deep learning algorithms, to achieve fully automated inspection. While efficiently acquiring nail clipping images, the system avoids the false positives and false negatives caused by experience differences and fatigue in manual inspection, fundamentally improving inspection efficiency and reliability. Furthermore, the automated judgment method ensures standardized inspection criteria, effectively eliminating interference from human factors and guaranteeing consistent inspection results. 2. This invention effectively overcomes the interference problem of strong reflections from metal surfaces by designing a composite illumination source, ensuring stable extraction of image features. Especially for capacitor models with high surface requirements, a coaxial light source is used to detect minute surface defects, improving image quality and the accuracy of defect identification, and enhancing the system's adaptability to different product models. 3. The visual inspection method of this invention adopts a non-contact inspection approach, achieving high-precision dimensional measurement through image processing technology, and can assess multi-dimensional information such as the shape integrity, symmetry, and internal quality of the riveting. This method can comprehensively analyze the geometric dimensions, defect types, and structural health status of the riveting, avoiding the product surface scratches and high equipment maintenance costs that may result from contact inspection, while significantly improving inspection efficiency. 4. The dual-stream parallel analysis method of this invention combines sub-pixel-level edge extraction technology and deep learning identification of defects using convolutional neural networks. It can not only accurately measure the geometric dimensions of the riveting pattern but also identify potential defects such as deformation, loose connections, and overvoltage damage caused by insufficient riveting force. While these potential defects may not affect the appearance of the riveting pattern, they can seriously impact the long-term reliability of the capacitor. Traditional methods cannot effectively detect these defects, but the intelligent detection system of this invention can delve deeper into these potential problems, providing more comprehensive quality control. 5. This invention combines an industrial computer and a programmable logic controller (PLC) to drive the sorting actuator, achieving fast and efficient automatic sorting. The PLC's response time is less than 10 milliseconds, enabling defective products to be quickly rejected, and the entire process requires no manual intervention, meeting the needs of modern high-speed automated production lines. 6. The data management platform regularly collects testing data, automatically calculates and generates statistical process control charts. Once a decline in process capability indices or exceeding limits is detected, the system automatically issues early warnings, allowing for timely adjustments to the production process. This function effectively avoids potential production problems, provides early warnings, and ensures that product quality consistently meets standards. Attached Figure Description To more clearly illustrate the technical solutions in this invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort. Figure 1 This is a flowchart of the steps of the method of the present invention. Detailed Implementation The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. It should also be noted that, to make the embodiments more comprehensive, the following embodiments are the best and preferred embodiments, and those skilled in the art can use other alternative methods to implement some well-known technologies; moreover, the accompanying drawings are only for more specific description of the embodiments and are not intended to specifically limit the present invention. Please see Figure 1This invention provides a visual inspection and sorting method for nail patterns on aluminum electrolytic capacitors. By integrating an advanced visual inspection system, it achieves efficient, accurate, and stable fully automated inspection. First, the system is calibrated using standard gauge blocks to ensure accurate conversion between image and physical dimensions. Geometric tolerances for different capacitor models and a deep learning model are then applied to ensure the system can automatically adapt to different models. After the workpiece is in place, a photoelectric sensor sends a trigger signal. Based on this signal, an industrial computer synchronously controls the illumination of a composite lighting source. Once the light source stabilizes, an industrial camera captures a clear image of the nail pattern. After image acquisition, noise reduction and contrast enhancement processes are applied to improve image quality, making subsequent feature extraction more accurate. In the image feature extraction stage, a dual-stream parallel analysis technique is employed. In the first stream, sub-pixel edge extraction technology is used to accurately calculate geometric dimensional parameters such as the height, diameter, center offset, and symmetry of the nail pattern, ensuring precise measurement of the nail pattern dimensions. In the second stream, a pre-trained convolutional neural network analyzes the image to obtain probability vectors of various defects in the image. Deep learning is then used to identify potential inherent defects in the nail pattern, such as poor riveting or microscopic deformation. Next, the system uses weighted decision fusion to comprehensively judge the first-order geometric dimensional parameters and the second-order defect prediction results. When all geometric dimensions meet the tolerance standards and the defect prediction results are qualified, the product is judged as qualified. If an inherent defect is found and the confidence level exceeds the threshold, the system will use a stricter tolerance threshold for a second comparison to ensure high-precision judgment. Based on this, the industrial computer converts the judgment results into control instructions, which drive the sorting actuator through a programmable logic controller to remove unqualified products. At the same time, it records and stores the end-to-end data of each inspection for subsequent analysis and optimization. This invention enables high-precision, non-destructive, and fully automated inspection of nail defects in aluminum electrolytic capacitors. It not only improves inspection efficiency and reduces human error but also allows for in-depth analysis of the inherent quality of the defects, ensuring long-term reliability. By introducing deep learning and multi-dimensional inspection, it overcomes the limitations of traditional inspection methods, significantly improving the accuracy and stability of product quality control and meeting the demands of modern high-speed production lines. In one possible implementation, the preset brightness ratio combination described in step S2 is to optimize the image acquisition effect, ensuring that the structure and defects of the nail patterns in the image are clearly presented. In this step, the brightness combination of the dome light source and the ring light source plays a crucial role in image quality. The dome light source adopts a bowl-shaped structure, positioned above the inspection station, and its interior is coated with a diffuse reflection coating. This design ensures that the light from the light source is evenly distributed, avoiding localized over-brightness or under-brightness, and reducing the impact of light and shadow on the details of the nail patterns. Because the light becomes softer after diffuse reflection, it provides a more uniform illumination effect, making it particularly suitable for detecting minute details requiring high precision. Meanwhile, a ring light source is mounted outside the industrial camera lens and illuminates at a lower brightness level than the dome light source. The main function of the ring light source is to supplement the lighting, enhance the edge details of the nail patterns, and make subtle dimensional features and potential defects clearer. This lower brightness setting avoids reflections or glare caused by excessively strong lighting, ensuring that image details are not overexposed or obscured. The design of this brightness ratio combination ensures a more uniform light distribution throughout the inspection process, improving image quality and reducing interference from uneven light sources on nail detail. This not only enhances the accuracy of nail defect identification but also strengthens the system's adaptability to different capacitor models, especially in complex lighting environments, enabling better acquisition of standard-compliant image data. This invention improves the robustness and accuracy of the inspection system, ensuring the reliability and stability of the inspection results. In one possible implementation, the composite lighting source also includes a coaxial light source to further improve the detection accuracy of surface defects on capacitor nails. In step S2, when the detected capacitor model has extremely high requirements for surface quality, the industrial computer controls the coaxial light source to illuminate at a preset third brightness value. This coaxial light source is aligned with the axis of the industrial camera lens, and its light directly illuminates the surface of the capacitor nails. Through this design, the light can be reflected parallel to the surface, making even minor dents or scratches on the nail surface more prominent. The use of coaxial lighting differs from traditional diffuse or ring light sources in that its light is not obscured by minute surface imperfections due to changes in angle. Therefore, extremely subtle defects on the nail art surface, such as shallow scratches or tiny dents, can be clearly identified and extracted. The use of a coaxial light source enhances the sensitivity and accuracy of defect detection, ensuring that even the smallest defects are detected, thus guaranteeing overall product quality. This illumination method effectively avoids surface defects that other light sources cannot accurately reveal, improving the detection range and reliability of the vision inspection system. It is particularly suitable for aluminum electrolytic capacitors that require extremely high surface finish. In one possible implementation, the noise reduction and contrast enhancement processes used in step S3 employ Gaussian filtering and contrast-limited adaptive histogram equalization algorithms, respectively, which can significantly improve image quality and detection accuracy. First, Gaussian filtering is used for noise reduction. Gaussian filtering is a technique that smooths data and removes noise by blurring the image, effectively reducing random noise in the image, especially suitable for noise caused by sensors or environmental factors. By applying Gaussian filtering, high-frequency noise in the image is smoothed out, making subsequent image processing and defect detection more accurate, especially when high image clarity is required. Secondly, the contrast enhancement process employs the Limiting Contrast Adaptive Histogram Equalization (CLAHE) algorithm. This algorithm enhances image contrast through adaptive adjustments to local regions, effectively improving the visibility of details, especially in images with uneven lighting or complex backgrounds. The CLAHE algorithm avoids the over-enhancement that can occur with traditional histogram equalization, preserving local image details and preventing overexposure or shadow problems. It is particularly suitable for detecting nail marks on aluminum electrolytic capacitors with complex textures or small-sized features. Finally, a template matching algorithm based on grayscale values is used to locate the capacitor's guide pin. In this step, a standard guide pin image is used as a template. The template matching algorithm searches and matches the entire digital image to find the precise location of the capacitor's guide pin. By calculating the similarity of grayscale values in the image, the template matching algorithm can efficiently locate the precise position of the capacitor's guide pin. This plays a crucial role in improving detection accuracy and efficiency, especially when processing multiple targets or similar structures in an image, ensuring accurate identification of the guide pin's position. The embodiments of the present invention not only improve the quality of image processing, but also enhance the accuracy and stability of the detection system. In particular, in the detection of nail marks on aluminum electrolytic capacitors with complex backgrounds or high precision requirements, the overall performance of the system can be significantly improved. In one possible implementation, the sub-pixel edge extraction technique mentioned in the first stream of step S4 plays a crucial role in accurately detecting the surface contour of the nail pattern and calculating its geometric parameters. The specific implementation steps are as follows: First, the Canny edge detection operator is used to obtain the nail flower outline with pixel-level accuracy. The Canny operator is a commonly used edge detection algorithm that can effectively identify edge information in images and has good noise suppression and edge localization accuracy. This algorithm can obtain the basic edge information of the nail flower outline, but its accuracy is limited to the pixel level, which is insufficient for high-precision detection. Next, interpolation is performed on the edge pixels based on the image's grayscale gradient. The grayscale gradient provides information on grayscale changes in the edge region, while interpolation improves edge accuracy. Through interpolation, more computation points can be generated between edge pixels, thus achieving sub-pixel-level edge localization. The core of this process lies in refining the edge position through mathematical methods, breaking through the limitations of pixel accuracy and obtaining higher-resolution contour coordinates. Finally, based on sub-pixel contour coordinates, the geometric dimensions of the nail pattern are calculated. This step combines the precise edge information obtained earlier with geometric algorithms to extract the specific dimensions of the nail pattern, such as diameter and depth, ensuring the accuracy of dimensional measurements. This is particularly suitable for scenarios with extremely high requirements for the appearance quality of capacitors. By extracting precise contours at the sub-pixel level, the accuracy bottleneck of traditional pixel-level edge detection can be overcome, significantly improving the recognition accuracy of nail-marked surfaces and providing more reliable data support for subsequent defect detection and sorting. Especially in the high-precision inspection of nail-marked surfaces in aluminum electrolytic capacitors, it can effectively improve the detection accuracy and stability of the inspection system, ensuring high product quality standards. In one possible implementation, the second stream of step S4 involves a pre-trained convolutional neural network (CNN) model capable of recognizing multiple pre-defined defect categories. Specific implementation steps include the following: First, the convolutional neural network model is pre-trained using a large amount of image data containing different defect categories to ensure that the model has the ability to identify specific defects. These defect categories include skewed shapes, incomplete shapes, misaligned nail holes, burrs, and deformation features indicating insufficient riveting force. These defects can affect the performance and appearance quality of aluminum electrolytic capacitors, therefore accurate identification and classification are essential. It is particularly important to note that the deformation features characterizing insufficient riveting force are feature categories autonomously extracted by the model after training and learning from a large number of known riveting defect samples with microscopic deformation images. During training, the model learns features from a large number of sample images containing riveting defects, enabling it to automatically identify and distinguish the minute deformation features caused by insufficient riveting force. These deformation features typically manifest as surface irregularities or tiny indentations, and their causes are complex; therefore, the model's autonomous learning ability is especially important here. Pre-trained convolutional neural networks can automatically identify and classify various defects, including minute deformations that are difficult to extract manually using traditional methods. Through adaptive learning, the workload of manual annotation can be reduced, and the automation level of inspection can be improved. In particular, for deformations caused by insufficient riveting force, traditional visual inspection methods may struggle to identify them, while deep learning models can accurately capture these subtle defects, significantly improving the accuracy and efficiency of product inspection. Furthermore, convolutional neural networks have strong generalization capabilities when processing large-scale sample data, adapting to the inspection needs of different capacitor models and providing reliable support for subsequent sorting and quality control. In one possible implementation, step S5 involves detecting a specific intrinsic defect, wherein "deformation characteristics indicating insufficient riveting force" is considered an intrinsic defect, and the specific implementation steps are as follows: First, the internal control tolerance threshold is derived through statistical analysis of the geometric dimensional parameters of qualified products from historical production data. This step begins by collecting data on aluminum electrolytic capacitors that meet quality standards from historical production, particularly the geometric dimensional parameters of the studs, such as stud diameter, depth, and edge smoothness. Statistical analysis of this data determines the statistical distribution of each dimensional parameter, with particular attention paid to the smaller intervals within this distribution. These smaller intervals represent the stricter dimensional requirements for qualified products, ensuring that the geometric dimensions of each capacitor meet higher quality standards during production. Secondly, the smaller range obtained through statistical analysis is used as the internal control tolerance threshold, which is more stringent than the conventional preset tolerance threshold. Traditional tolerance thresholds are usually set based on experience or conventional quality control standards, while the internal control tolerance threshold is refined through more rigorous data analysis and actual production processes. This tolerance threshold ensures that minor defects caused by insufficient riveting force can be identified in the early detection stage, thereby preventing defective products from entering subsequent production stages. By statistically analyzing historical production data and establishing internal control tolerance thresholds, more refined and personalized quality control can be ensured. Compared to conventional tolerance requirements, these internal control tolerance thresholds are more stringent, enabling the identification of extremely subtle defects, especially deformation characteristics caused by insufficient riveting force, in the early stages of production. This not only improves product reliability and consistency but also effectively prevents potentially defective products from entering the market, thereby enhancing overall production efficiency and product quality. Furthermore, this method can be dynamically adjusted according to changes in actual production, allowing quality control to flexibly respond to the requirements of different production conditions. In one possible implementation, the data management platform is first responsible for storing and managing the geometric dimensions of the nailing patterns in all consecutive production batches. The platform continuously monitors the geometric dimensions of each batch of products, including key dimensional parameters such as the diameter and depth of the nailing patterns. This data is periodically updated through an automated acquisition system and stored on the platform, ensuring sufficient sample data is available in real time during production for subsequent analysis. Next, the platform automatically calculates the process capability indices (Cp, Cpk, etc.) for these nailing geometric dimensions. Process capability indices are key indicators for assessing the stability and capability of a production process, reflecting its ability to maintain consistency and meet quality standards within a controlled range. After calculating these capability indices, the platform compares them against preset standards to ensure that the production process meets established quality standards. If the process capability index is lower than a set threshold, it indicates a potential deviation in the production process, leading to increased quality fluctuations and consequently affecting product consistency and reliability. Subsequently, the platform will generate a Statistical Process Control Chart (SPC) based on the calculation results. An SPC chart is a graphical tool used to display the trends and fluctuations of key parameters during production. By generating and updating the SPC chart in real time, it is possible to visually observe whether there are abnormal fluctuations in the production process. If the process capability index shows a continuous downward trend, or if data points exceed the control limits of the control chart, it indicates that there may be problems in the production process, unstable production quality, and the potential for defective products. Finally, when the aforementioned anomalies occur, the platform automatically generates process warning information and sends it to the production management system. Through this warning mechanism, production managers can receive timely alerts and adjust production processes or take appropriate measures to prevent the problem from escalating. This warning mechanism effectively improves the responsiveness of the production process and reduces quality risks during production. Automated process monitoring and early warning systems enable real-time monitoring of quality changes during production, allowing for the timely detection of potential quality issues. The combination of statistical process control charts and process capability indices provides a scientific and intuitive assessment of production process stability, offering data support for quality control. Automatically generated early warning messages quickly notify relevant personnel to take corrective action, thereby reducing non-conforming products and improving production efficiency and product quality consistency. Furthermore, the system's high efficiency and real-time nature effectively optimize production processes, ensuring that final products meet higher quality requirements. In one possible implementation, the pre-trained convolutional neural network (CNN) model is deployed on an industrial computer to perform visual inspection tasks. To improve the accuracy and adaptability of the inspection system, the method further includes an online model update step to adapt to changing production environments and emerging defect types. In practice, the data management platform regularly collects samples with low confidence levels and newly added defect samples from various visual inspection terminals. These low-confidence samples are typically those whose model judgments are uncertain or have low accuracy after visual inspection, while newly added defect samples refer to new types of defects or updated defect data discovered during production. The collection of these samples aims to continuously improve the accuracy and generalization ability of the model. The collected samples are then transmitted to the server for incremental training of the convolutional neural network model. Incremental training means optimizing the model using new samples, rather than training it from scratch. Through incremental training, the convolutional neural network model can gradually learn new features, improving its ability to identify different types of defects. After training is complete, the server generates a new version of the model file and distributes it over the network to designated visual inspection terminals, replacing the old model. The visual inspection system on the terminal will then perform image processing and judgment based on the new model, ensuring that each detection result is based on the latest and most accurate model. Through incremental training, convolutional neural network models can continuously evolve in constantly changing production environments, adapting to newly emerging defect types without having to train from scratch each time, thus improving efficiency and the utilization of computing resources. Secondly, regularly updating the model can significantly improve the accuracy of visual inspection, reduce the false positive rate, and ensure that defective products are identified and removed promptly during the production process, thereby improving overall product quality. Finally, the online update mechanism ensures that the visual inspection terminal always uses the latest model, avoiding a decrease in detection accuracy due to model obsolescence, and enhancing the long-term stability and reliability of the system. In one possible implementation, the sorting actuator employs a solenoid valve-controlled pneumatic nozzle, designed to efficiently and accurately separate defective products from the main conveyor line. The implementation steps of this method mainly include the programmable logic controller (PLC) responding to defective product commands, operating the pneumatic nozzle, and rapidly rejecting the defective products. In step S6, the system uses a visual inspection device to identify and determine whether there are defects in the nail patterns. When a defective product is detected, the PLC receives the defective product instruction and responds quickly according to the preset control program. The PLC's response time is less than 10 milliseconds, ensuring that it can process the detected defective product information in real time and immediately issue a control signal. Next, the PLC drives the solenoid valve to operate, controlling the pneumatic nozzle to blow defective products away from the main conveyor line using compressed air pulses. The duration of this pneumatic pulse is set between 20 and 100 milliseconds. This time range effectively ensures that defective products are separated quickly and accurately, while avoiding affecting other qualified products. The pneumatic nozzle, through the action of high-pressure airflow, quickly blows defective products away from the production line, ensuring that they do not enter subsequent processes and preventing the spread of quality problems. The PLC's rapid response ensures that defective products can be identified and removed in a very short time, thereby improving the overall efficiency and accuracy of the production line. Secondly, the pneumatic nozzles reliably separate defective products through efficient and precise air pulses, avoiding the risk of rework or quality defects caused by inaccurate sorting. Ultimately, this design not only increases the automation level of the production line but also reduces the need for manual intervention, making the production process more stable and efficient, and continuously ensuring that product quality meets requirements. Example: This embodiment is applied to the online full inspection station after the guide pins are riveted at an aluminum electrolytic capacitor manufacturer. The capacitor being inspected is a general-purpose product with a diameter of 8 mm and a height of 12 mm. The visual inspection system used in this embodiment includes the following physical components: a 5-megapixel monochrome CCD industrial camera equipped with a telecentric lens with a magnification of 0.5x; and a composite lighting source assembly consisting of a ring light source, a dome light source, and a coaxial light source. The system comprises a fiber optic photoelectric sensor; an industrial computer equipped with a high-performance CPU and GPU; a programmable logic controller (PLC); and a sorting actuator consisting of a solenoid valve and a pneumatic nozzle. An industrial camera is vertically mounted above the conveyor line via a gantry crane, with its lens optical axis facing the inspection station below. A ring light source is fitted around the lens, a dome light source covers the entire station, and a coaxial light source is integrated into the system as an optional light source. The photoelectric sensor is installed at the inlet of the positioning fixture. The industrial computer connects to the camera via Ethernet and to the photoelectric sensor, PLC, and light source controller via digital I / O cards. Detailed steps of the embodiment: Step S1: System calibration and parameter preset. First, perform system spatial calibration. Place a standard glass ruler with a graduation of 0.01 mm and a total length of 10 mm on the same horizontal plane as the positioning fixture where the rivet is located. Control an industrial camera to take a picture of the ruler and obtain an image of it. In the image processing software of the industrial computer, manually select the two farthest, clear graduation lines of the ruler in the image and input the known actual physical distance between these two graduation lines, for example, 9.00 mm. The software automatically calculates the pixel distance between these two scale lines in the image, for example, 1800 pixels. Therefore, the scaling factor for this calibration is calculated as: 9.00 mm / 1800 pixels = 0.005 mm / pixel. This factor will be used for all subsequent conversions of dimensional measurements from pixel units to physical units. Next, for the 8mm diameter capacitor model to be tested, a preset testing program is loaded. The preset geometric tolerance thresholds in this program are: standard value for nail head height 1.20mm, with an allowable deviation of ±0.05mm; standard value for nail head diameter 2.00mm, with an allowable deviation of ±0.03mm; allowable deviation for the offset of the nail head center relative to the theoretical center of the guide pin 0.03mm; and allowable deviation for nail head contour symmetry 0.02mm. Simultaneously, a pre-trained convolutional neural network model file "Model_V2.1.caffemodel" and its corresponding network structure description file are loaded. Step S2: Workpiece triggering and image synchronous acquisition. After being sorted by a vibratory feeder, the bulk capacitor components are fed into the V-shaped positioning fixture at the detection station via a linear feeder at a rate of 90 capacitors per minute. When the capacitors completely enter and block the light beam of the photoelectric sensor, the photoelectric sensor generates a 24V TTL high-level signal within 1 millisecond and transmits it to the trigger input port of the industrial computer via a cable. Upon receiving the rising edge of the trigger signal, the industrial computer's dedicated acquisition software immediately executes the pre-programmed acquisition sequence. First, the software sends instructions to the light source controller via a serial port. Based on these instructions, the light source controller illuminates the LEDs in the dome light source at 70% of their rated current brightness, while simultaneously illuminating the LED strips in the ring light source at 30% of their rated current brightness. The combined lighting strategy of these two light sources was determined through extensive experimentation: the dome light serves as the main light source, generating uniform and soft diffused light through the diffuse coating inside the bowl-shaped dome, which can greatly suppress the specular highlights on the studded metal surface and optimize the shadow contrast of its three-dimensional contours; the ring light serves as an auxiliary light source, providing supplementary front lighting, aiming to further homogenize the lighting on the top plane of the studded surface and reduce unevenness in brightness caused by slight differences in material properties. After the lighting is turned on, the system waits 5 milliseconds to ensure the light intensity output is completely stable. Then, the software triggers the industrial camera to perform an exposure via the camera SDK, with the exposure time set to 2 milliseconds to freeze the moment of motion and prevent motion blur. Finally, an 8-bit grayscale digital image of 640 pixels by 480 pixels is acquired. For certain military-grade capacitors that require extremely high surface finish, the illumination strategy includes a coaxial light source when loading their dedicated testing program. During the same acquisition trigger, the dome light and ring light are illuminated in the aforementioned proportions, while the coaxial light source is simultaneously illuminated at a lower 10% brightness. The parallel light produced helps to highlight minute dents or scratches on smooth surfaces. Step S3: Image preprocessing and feature region localization. The industrial computer reads the raw grayscale image acquired in step S2. Image preprocessing is performed first: Noise Reduction: A Gaussian filtering algorithm is used to smooth the image. A 3-pixel multi-pixel two-dimensional Gaussian convolution kernel is used. The weight coefficient matrix of this kernel is obtained by discretizing a two-dimensional Gaussian function, with the highest weight at the center point and decreasing towards the edges. This convolution kernel is then used to perform a sliding window convolution operation on the original image, which effectively suppresses high-frequency random noise in the image while preserving the edge information of the nail pattern relatively well. Contrast Enhancement: The filtered image is processed using a contrast-limited adaptive histogram equalization algorithm. This algorithm divides the image into multiple 8-pixel multi-8-pixel local regions, calculates the grayscale histogram for each region individually, and crops the histogram according to a preset contrast limit threshold to prevent local over-enhancement and noise. Then, the cropped histograms are equalized. Finally, the results from each region are merged using bilinear interpolation to obtain an output image that is globally natural and has significantly enhanced local contrast. After this step, the texture differences between the nail art and the black background, as well as between different areas of the nail art, become clearer. After preprocessing, feature region localization is performed: Guide pin localization: A template matching algorithm based on grayscale values is employed. The software pre-stores a template image (100 pixels x 30 pixels) captured under standard lighting, containing only the qualified capacitor guide pin. During localization, the algorithm slides this template image across the preprocessed image from left to right and top to bottom, calculating the normalized cross-correlation coefficient between the template and the corresponding region in the image at each location. This coefficient ranges from -1 to 1, with values closer to 1 indicating higher similarity. When the maximum correlation coefficient is found and exceeds the preset similarity threshold of 0.85, a guide pin is considered successfully matched at that location. The algorithm records the center point coordinates and angle of the matching location. Region of Interest (ROI) Extraction for Nail Emblems: Based on the product design drawings, it is known that the center of the nail emblem is located on the center line of the guide pin, at a fixed distance from a specific end of the guide pin. Using this prior knowledge, the software automatically calculates the approximate theoretical coordinates of the nail emblem's center based on the located guide pin position and angle. Then, using these coordinates as the center, it extracts a square region with sides of 150 pixels, which serves as the "ROI image" for subsequent analysis. This focuses the analysis on the target, eliminates background interference, and significantly reduces the amount of subsequent calculations. Step S4: Two-stream parallel analysis and feature extraction. This step opens up two independent processing threads to perform parallel analysis on the same image of the region of interest for nail art. First Stream: High-Precision Dimensional Measurement Stream. The goal of this stream is to obtain geometric dimensions with sub-pixel precision. The specific steps are as follows: Sub-pixel edge extraction: First, the Canny edge detection operator is used to perform preliminary coarse edge localization of the region of interest image. The ratio of high to low thresholds is set to approximately 3:1, initially obtaining a set of pixel-level edge points for the nail-shaped outline. Then, crucial sub-pixel refinement is performed. For each pixel-level edge point, the gray-level distribution within its surrounding 3x3 neighborhood is examined. A gray-moment-based method is employed to estimate the true edge location by calculating the first and zeroth moments of the gray levels of neighboring pixels. This location can be accurate to the decimal point within a pixel, i.e., at the sub-pixel level. By processing all edge points, a smoother and more precise nail-pattern outline is obtained, formed by connecting sub-pixel coordinates. Size calculation: Based on the above sub-pixel contours, the following calculations are performed: Height: The difference between the maximum and minimum values of all y-coordinates on the contour, multiplied by the scaling factor specified in step S1. Diameter: Approximate the profile to a circle, and use the least squares method to find the optimal center and radius. The diameter is equal to the radius multiplied by 2, and then multiplied by the scaling factor. Center offset: Compare the physical coordinates of the center obtained from the previous step with the theoretical center coordinates of the nail flower calculated based on the guide pin positioning results, and calculate the Euclidean distance between the two on the two-dimensional plane. Symmetry: Draw a straight line through the center of the fitted circle and passing through the center line of the guide needle, dividing the contour into left and right parts. Calculate the distance sets from points on the left and right contours to this straight line, and then calculate the correlation coefficient between these two distance sets. The closer the correlation coefficient is to 1, the more symmetrical the left and right sides are. Second stream: Deep feature analysis and defect identification stream; The goal of this approach is to identify complex defects and inherent structural risks that are difficult to detect with the naked eye. The specific steps are as follows: Image normalization: The region of interest image of the nail flower is scaled to a size of 224 pixels by 224 pixels. Then, grayscale normalization is performed, linearly transforming the pixel values from 0-255 to the floating-point range of 0-1 to meet the model input requirements. Model Inference: The normalized image matrix is input into a pre-trained convolutional neural network model. The model used in this embodiment is a deep learning model trained on the Caffe framework, with a modified ResNet-18 backbone. During training, the model used over 50,000 expert-annotated images of nail holes, categorized as "acceptable," "skewed shape," "incomplete shape (missing corner)," "misaligned nail hole center," "presence of burrs and flash," and "deformation features indicating insufficient riveting force." The "deformation features indicating insufficient riveting force" category was obtained by taking macro photographs of capacitors known to have failed electrical tests but whose dimensions might still be within tolerance, and then confirming microscopic material crushing or cracking in the riveting area through metallographic analysis. By learning from these images, the model autonomously extracted deep features associated with various defects. Obtaining the probability vector: After the image undergoes forward propagation calculation by the model, a probability vector containing 6 elements is obtained at the output layer, for example, [0.02, 0.85, 0.01, 0.05, 0.06, 0.01]. This vector corresponds to the predicted probabilities of the above 6 categories, and their sum is 1. Among them, the second element, 0.85, has the largest value, indicating that the model considers the nail to belong to the "skewed shape" category with an 85% confidence level. Step S5: Weighted decision fusion and comprehensive judgment. This is the core decision-making step of the present invention, responsible for the intelligent fusion of dual-stream information. The specific process is as follows: Dimensional result comparison: The height (1.18 mm), diameter (1.99 mm), center offset (0.02 mm), and symmetry (0.98) output from the first stream are compared one by one with the conventional tolerance thresholds preset in step S1. Assuming that all results are within the conventional thresholds, the initial Boolean judgment result for the dimensions is "qualified". Deep learning result analysis: Analyze the probability vector of the second-stream output. Find the maximum probability value of 0.85 and its corresponding category "Shape Skew". Record this "primary predicted defect type" and its "confidence". Dynamic threshold adjustment and fusion judgment: The system has a built-in rule base. One key rule is: if the "main predicted defect type" is an inherent defect highly related to structural strength or connection reliability, such as "shape distortion," "incomplete shape," or "deformation characteristics indicating insufficient riveting force," and its "confidence level" exceeds the 60% threshold, then a secondary review of the key dimensions is automatically triggered, and a more stringent "internal control tolerance threshold" is activated. The "internal control tolerance threshold" is determined based on statistical process control data of qualified product dimensions from the past year's production data for this type of capacitor. For example, the height tolerance is tightened from the usual ±0.05 mm to ±0.03 mm, and the symmetry tolerance is tightened from 0.02 to 0.015. Final ruling: In this case, due to the detection of "shape misalignment" with a confidence level as high as 85%, the system automatically switched to the internal control threshold. The dimensional data was re-examined using the internal control threshold. Assuming the symmetry of the nail is 0.98 (correlation coefficient), although it meets the conventional threshold (e.g., the conventional threshold is 0.98), it does not meet the internal control threshold (e.g., the internal control threshold is 0.985), therefore the final result of the dimensional review is "unacceptable". Finally, the dimensional review failure is logically ANDed with the deep learning classification of "shape misalignment" (if either condition is not met, the final failure is determined), and the product is judged as "non-conforming". This mechanism ensures that even if the dimensions are on the edge of the conventional tolerance, products with high-risk structural defects can be effectively intercepted. Step S6: Sorting execution and data closed-loop management. Based on the "non-conforming product" determination result in step S5, the industrial computer generates a 24V high-level signal (NG signal) lasting 50 milliseconds within 2 milliseconds after program execution via an output channel of the digital I / O card. This signal is transmitted to the input module of the programmable logic controller (PLC) via a cable. Upon detecting the activation of this input point, the preset program within the PLC immediately energizes the solenoid valve coil controlling the pneumatic nozzle within the next scan cycle (approximately 1 millisecond). The solenoid valve opens, and compressed air from the factory air source (0.6 MPa) forms a brief but strong airflow through the nozzle, with a pulse duration of approximately 50 milliseconds, accurately blowing the non-conforming capacitor from the main conveyor line into the waste collection box on the side. Meanwhile, all data from this inspection was packaged into a single data record and uploaded to the company's Manufacturing Execution System (MES) database via the local area network. The data record includes: timestamp, product batch number, original image pointer, all dimensional measurements, deep learning probability vector, type of judgment threshold used (routine / internal control), final judgment result, and the record that triggered the sorting process. Step S700, Process monitoring and early warning (extended steps). The Manufacturing Execution System (MES) continuously runs a data analysis service in the background. Every hour, this service automatically calculates the process capability index (CpK) value for the stitch height of the most recent 500 products on the current production line and updates the individual value-moving range control chart. One day, the data analysis service discovered that the CpK value for stitch height had been slowly but steadily decreasing from 1.5 to 1.2 over eight consecutive hours, even though all individual data points remained within specification limits. Based on preset rules (trend rules), the system automatically generates a "negative drift warning for riveting process height parameters" message, which is pushed to the process engineer via email and dashboard. The engineer can then intervene proactively, checking the wear of the riveting machine's pressure head, thus preventing a large number of defective products from being produced subsequently, achieving a leap from "detection" to "prevention." Detailed description of key features and effects: Regarding "deformation features representing insufficient riveting force": This is an abstract feature learned autonomously by a deep learning model, but it has concrete physical manifestations. For example, in an image, it might appear as an abnormal grayscale transition in a local area at the edge of the riveting, no longer a sharp distinction between light and dark; or as subtle, irregular texture distortions appearing on the top plane of the riveting, corresponding to microscopic wrinkles or crushing of actual metal materials due to insufficient riveting force. Traditional algorithms cannot define such complex texture features, while deep learning models can effectively capture this pattern, which is strongly correlated with poor results, through comparison of a large number of positive and negative samples. Regarding the determination of the "internal control tolerance threshold": it is not an arbitrarily set smaller tolerance. The method for determining it is to statistically analyze the dimensional data of "good products" that have passed all electrical performance tests under long-term stable production conditions. For example, data on the nail height of 10,000 good products are collected, and their mean μ and standard deviation σ are calculated. A conventional tolerance threshold might be set at μ±3σ. However, the internal control tolerance threshold might be set at μ±2σ, or even narrower at μ±1.5σ. This narrower range represents the core area where the process is most stable and the quality is most guaranteed. When the system suspects a product has an inherent defect risk, it uses the standard of this core area to measure it, thereby filtering out products that, although in the "marginal acceptable zone," have a higher risk. Comparative experiments and effect verification: To demonstrate the technical effectiveness of this invention, a comparative test was conducted on the production line used in this embodiment. The test sample consisted of 3,000 aluminum electrolytic capacitors produced by the same riveting machine, including 200 known defective products (including dimensional deviations and appearance defects) that were pre-mixed in by human intervention. Comparison Projects Comparative Example 1: Traditional manual visual inspection Comparative Example 2: Traditional Machine Vision (Single-Stream Dimension Measurement) Methods of this invention Description of detection method An experienced quality inspector visually inspects and records each nail flower according to the paper inspection standards, using fluorescent lights and a magnifying glass. Using the same hardware, but the software only executes steps S3 and S4 (first flow, dimensional measurement), and the judgment logic is simply that if all dimensions are within the normal tolerance, it is judged as qualified. Perform steps S1 to S6 in their entirety. Detection efficiency Each product takes about 5 seconds on average, and it takes about 4.2 hours to test all 3,000 products. On average, each product takes about 80 milliseconds to process (without deep learning inference), which is theoretically efficient, but in practice, suspected products need to be manually re-inspected. On average, each product takes about 120 milliseconds to process (including deep learning inference), which can seamlessly match the production line's cycle of 90 products per minute (about 667 milliseconds per product) to achieve 100% full inspection. Detection results 150 defective products were detected due to pre-mixing, and 50 were missed. Additionally, 20 qualified products were mistakenly judged as unqualified (mainly due to subjective judgment of edge burrs). Accuracy rate: (3000-50-20) / 3000=97.7%. Eighty items with dimensional defects were detected, but the remaining 120 items with appearance defects (such as misalignment and minor incompleteness) and internal deformation defects were completely missed. Accuracy: (3000-120) / 3000=96.0%. All 200 pre-mixed defective items (including all dimensional and appearance defects) were detected. Five qualified items were mistakenly judged as unqualified (due to high model confidence triggering the internal control threshold). Accuracy: (3000-5) / 3000=99.83%. Key advantages It is extremely inefficient, relies on manual labor, has poor consistency, and cannot be quantified. It is efficient, but its detection capabilities are limited. It cannot identify appearance and internal defects that are crucial to reliability, and therefore cannot detect potential risks. While ensuring extremely high efficiency, it achieves the most comprehensive identification of defects (especially intrinsic deformation defects) and can proactively intercept high-risk edge products through a weighted fusion mechanism, greatly improving product reliability. As can be seen from the above embodiments and comparative experiments, the technical solution provided by the present invention systematically solves the problems existing in the prior art through the three-in-one design of composite lighting, dual-stream parallel analysis, and weighted decision fusion. It produces technical effects that are significantly better than the prior art in terms of detection efficiency, accuracy, and especially the ability to ensure the inherent reliability of products. This invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of this invention. To provide the public with a thorough understanding of this invention, specific details are described in detail in the following preferred embodiments; however, those skilled in the art will fully understand the invention even without these details. Furthermore, to avoid unnecessary misunderstanding of the essence of this invention, well-known methods, processes, procedures, components, and circuits are not described in detail. The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A visual inspection and sorting method for pinholes of aluminum electrolytic capacitors, characterized by, The method is executed based on an integrated visual inspection system including an industrial camera, a composite illumination light source, a photoelectric sensor, an industrial computer, a programmable logic controller, and a sorting execution mechanism, and includes the following steps: Step S1, system calibration and parameter presetting: A standard gauge block is used to calibrate the space of the visual inspection system, the conversion relationship between pixels and physical size is obtained, and the preset geometric size tolerance threshold and deep learning model configuration file are loaded for the current detection capacitor model; Step S2, workpiece triggering and image synchronous acquisition: The photoelectric sensor detects the arrival of the capacitor and generates a trigger signal; the industrial computer controls the composite illumination light source to be combined with synchronous lighting according to the preset brightness ratio, the composite illumination light source includes a ring light source and a dome light source; after the light source is stable, the industrial camera is controlled to acquire the digital image of the stud; Step S3, image preprocessing and feature region positioning: The digital image is preprocessed by noise reduction and contrast enhancement, and then the capacitor guide needle is positioned in the image and the region of interest image containing only the stud structure is cut out based on the guide needle position; Step S4, double-flow parallel analysis and feature extraction: The region of interest image is processed in parallel; In the first flow, the geometric size parameters of at least the height, diameter, center offset and symmetry of the stud are calculated by sub-pixel edge extraction technology; In the second flow, the region of interest image is input into the pre-trained convolutional neural network model to obtain the probability vector of the input image belonging to each preset defect category; Step S5, weighted decision fusion and comprehensive judgment: The geometric size parameters calculated in the first flow are compared with the preset tolerance threshold to obtain the size Boolean judgment result; Meanwhile, the probability vector output by the second flow is analyzed, and the category with the highest probability value is taken as the main predicted defect type and the confidence is recorded; When the main predicted defect type is a deformation feature representing insufficient riveting force and the confidence exceeds a preset confidence threshold, the key geometric size parameters are compared again using an internal control tolerance threshold, the internal control tolerance threshold is greater than the preset tolerance threshold, and the internal control tolerance threshold is determined based on the statistical distribution of the corresponding geometric size parameters of qualified products in historical production data; Finally, when all geometric size parameters are within the tolerance threshold range selected dynamically and the main predicted defect type is "qualified", the product is determined to be a qualified product, otherwise it is a unqualified product; Step S6, sorting execution and data closed-loop management: The industrial computer converts the comprehensive judgment result into a control instruction, and if it is unqualified, it drives the sorting execution mechanism to remove it through the programmable logic controller, and at the same time, the full-link data of this detection is stored to the data management platform.
2. The visual inspection and sorting method of pinhole of aluminum electrolytic capacitor according to claim 1, characterized in that, In step S2, the preset brightness ratio combination is: controlling the dome light source to light up at a first brightness value, and controlling the ring light source to light up at a second brightness value, the first brightness value is higher than the second brightness value; The dome light source is a bowl-shaped structure and is arranged above the detection station, and the inside is provided with a diffuse reflection coating; The ring light source is arranged outside the industrial camera lens.
3. The visual inspection and sorting method of pinhole of aluminum electrolytic capacitor according to claim 2, characterized in that, The composite illumination light source further includes a coaxial light source; In step S2, when the surface roughness requirement is lower than Ra0.1 μm for the capacitor type, the industrial computer controls the coaxial light source to light up at a third brightness value, and the coaxial light is used to detect the small recess or scratch defects of the pin surface.
4. The visual inspection and sorting method of pinhole of aluminum electrolytic capacitor according to claim 1, characterized in that, In step S3, the noise reduction processing adopts a Gaussian filtering algorithm, and the contrast enhancement processing adopts a limited contrast adaptive histogram equalization algorithm. The positioning capacitor guide needle adopts a template matching algorithm based on grayscale values, and a standard image of the guide needle is used as a template to search and match in the entire digital image.
5. The visual inspection and sorting method of pinholes of aluminum electrolytic capacitors according to claim 1, wherein In the first stream of step S4, the sub-pixel edge extraction technology specifically includes: first, using a Canny edge detection operator to obtain a pixel-level precision pin surface profile, then performing interpolation operation on the edge pixel points based on image grayscale gradient to obtain sub-pixel level profile coordinates higher than single pixel resolution, and finally calculating geometric size parameters based on the sub-pixel level profile coordinates.
6. The visual inspection and sorting method of pinholes of aluminum electrolytic capacitors according to claim 1, wherein In the second stream of step S4, the pre-trained convolutional neural network model can identify the following preset defect categories: shape skew, shape incompleteness, pin hole center misplacement, presence of flash burr, and deformation feature representing insufficient riveting force. The deformation feature representing insufficient riveting force is a feature category autonomously extracted by the model after training and learning a large number of known poor riveting sample micro-deformation images.
7. The visual inspection and sorting method of pinholes of aluminum electrolytic capacitors according to claim 1, wherein In step S5, the preset confidence threshold is 60%. The internal control tolerance threshold is determined by taking 1.5 times the range of the standard deviation σ of the statistical distribution of the corresponding geometric size parameters of the qualified products in the historical production data, which is more stringent than the range of 3 times the standard deviation σ corresponding to the conventional preset tolerance threshold.
8. The visual inspection and sorting method of pinholes of aluminum electrolytic capacitors according to claim 1, wherein After step S6, step S700 of process monitoring and early warning is further included: the data management platform automatically calculates the process capability index of the key size and draws a statistical process control chart based on the stored pin surface geometric size data of all products in the continuous production batch. When the process capability index presents a continuous downward trend or the data points exceed the control limits of the control chart, process early warning information is automatically generated and sent to the production management system.
9. The visual inspection and sorting method of pinholes of aluminum electrolytic capacitors according to claim 1, wherein, The pre-trained convolutional neural network model is deployed on an industrial computer, and the method further includes an online updating step of the model: the data management platform periodically collects low-confidence judgment samples uploaded by each vision detection terminal and newly added defect samples, performs incremental training of the convolutional neural network model on the server side, generates a new version of the model file, and distributes the new version of the model file to the designated vision detection terminal to replace the old model.
10. The visual inspection and sorting method of pinholes of aluminum electrolytic capacitors according to claim 1, wherein The sorting execution mechanism is a pneumatic blow nozzle controlled by a solenoid valve. In step S6, the response time of the programmable logic controller after receiving the unqualified product instruction is less than 10 milliseconds, the solenoid valve is driven to generate a compressed air pulse with a duration of 20 milliseconds to 100 milliseconds, and the unqualified product is blown away from the main conveying line.