Appearance detection method and device for multi-model capacitors, storage medium and processor
By using methods for extracting capacitor image parameters and template matching, the flexibility and adaptability issues of the capacitor appearance inspection system were solved, enabling rapid and accurate inspection of multiple capacitor models and improving production efficiency and inspection quality.
Patent Information
- Application Number
- CN202511004361.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-12-12
AI Technical Summary
Existing capacitor appearance inspection systems lack flexibility, making it difficult to quickly switch between different models, resulting in low production efficiency, high error rate, and insufficient inspection coverage, making them unable to adapt to diverse capacitor types.
By acquiring capacitance images, extracting appearance parameters, and matching them with detection templates in the template library, automated evaluation, generation, and updating of detection templates can be achieved, reducing manual adjustments and improving the flexibility and efficiency of the production line.
It enables rapid adaptation to the testing of different capacitor models, reduces the false judgment rate, improves the response speed and testing comprehensiveness of the production line, and reduces the complexity and cost of manual adjustment.
Smart Images

Figure CN121120481A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of capacitor manufacturing technology, and in particular to a method and apparatus for visual inspection of various capacitor models, a storage medium, and a processor. Background Technology
[0002] In the manufacturing process of modern electronic products, capacitors, as widely used electronic components, undertake multiple important functions such as energy storage, filtering, coupling, and decoupling. The quality of capacitors directly affects the performance and stability of circuits; therefore, strict control over their appearance and performance during the production process is crucial. With the diversification of capacitor types and changes in market demand, production lines need to frequently switch between different capacitor models, which places higher demands on the flexibility and response speed of appearance inspection systems.
[0003] Although some technical means have been used for visual inspection of capacitors, current solutions still have some problems. Due to the complexity of appearance inspection, manual visual inspection remains the primary method. This method is not only time-consuming but also susceptible to factors such as fatigue and lack of experience, leading to missed or incorrect inspections and affecting product quality. Furthermore, the increased need for manual adjustments and inspections when switching between different product models impacts production efficiency. When switching between different capacitor models on the production line, existing visual inspection systems lack flexibility and have cumbersome parameter settings, requiring reconfiguration of inspection standards and methods, as well as manual adjustments to specific parameters, including polarity identification methods and inspection standards, pin size tolerances, and sleeve integrity checks. This increases production line downtime, prolongs the inspection process, further extends production costs, and results in slow response to market changes and insufficient adaptability. Existing visual inspection systems lack sensitivity and adaptability, and their inspection is not comprehensive enough, potentially failing to capture all possible appearance defects, such as damaged sleeves, bent pins, and incorrect polarity, leading to increased customer complaints and rework rates. Additionally, the significant differences in appearance characteristics between different capacitor models make standardization difficult with existing methods, hindering efficient and uniform inspection of the conformity of various capacitor models. Summary of the Invention
[0004] The main objective of this invention is to provide a method and apparatus for visual inspection of various types of capacitors, as well as a storage medium and processor, in order to solve the technical problems described in the background art.
[0005] In a first aspect, the present invention provides a method for visual inspection of multiple types of capacitors, including:
[0006] Acquire a first image of the capacitor to be tested, the first image including a required view of the capacitor to be tested;
[0007] Parameters are extracted from the first image to obtain the appearance parameters of the capacitor to be detected;
[0008] The appearance parameters are matched in the template library to obtain the capacitance detection template corresponding to the appearance parameters;
[0009] Based on the capacitance detection template, the capacitor to be tested is evaluated to obtain the detection result of the capacitor to be tested.
[0010] In one embodiment, after the step of extracting parameters from the first image to obtain the appearance parameters of the capacitor to be detected, the method further includes:
[0011] Match the appearance parameters in the template library;
[0012] If a capacitance detection template corresponding to the appearance parameters is not obtained, a second image of the capacitor to be tested is obtained. The second image includes a required view of a standard capacitor with the capacitor to be tested placed manually.
[0013] Parameters are extracted from the second image to obtain the standard appearance parameters of the capacitor to be detected;
[0014] The steps of generating a capacitance detection template for the capacitor to be tested based on the standard appearance parameters, recording the capacitance detection template into the template library, and returning to obtain a first image of the capacitor to be tested, wherein the first image includes a required view of the capacitor to be tested.
[0015] In one embodiment, the step of evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested includes:
[0016] Based on the capacitance detection template, the appearance parameters of the capacitor to be tested are evaluated to obtain a first detection result of the capacitor to be tested. The first detection result includes those that meet the requirements of the capacitance detection template and those that do not meet the requirements of the capacitance detection template.
[0017] The capacitor to be tested is subjected to damage identification to obtain a second detection result of the capacitor to be tested, the second detection result including damaged and undamaged;
[0018] When the first test result meets the requirements of the capacitor test template and the second test result is undamaged, the test result of the capacitor to be tested is good.
[0019] When the first test result does not meet the requirements of the capacitor test template, or the second test result is that the capacitor to be tested is damaged, the test result of the capacitor to be tested is a defective product.
[0020] In one embodiment, after evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested, the process includes:
[0021] Calculate the defect rate of the test results. When the defect rate does not exceed a preset ratio, return to the step of obtaining the first image of the capacitor to be tested. The defect rate is equal to the proportion of the capacitor to be tested that is defective in the total number of capacitors to be tested.
[0022] When the defect rate exceeds a preset ratio, an early warning is triggered, and the process returns to the step of obtaining the first image of the capacitor to be tested.
[0023] In one embodiment, after evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested, the process includes:
[0024] When the number of consecutive defective products detected is not less than a preset number, return to the step of obtaining the first image of the capacitor to be tested;
[0025] When the number of consecutive defective products detected is not less than a preset number, the step of returning to obtain the first image of the capacitor to be tested is stopped, and an alarm is triggered.
[0026] In one embodiment, after evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested, the process includes:
[0027] When the capacitance detection template is matched a preset number of times, a better capacitance detection template is generated for the capacitor to be tested based on the appearance parameters in the preset number of times, and the better capacitance detection template is used to replace the capacitance detection template in the template library.
[0028] In one embodiment, the step of extracting parameters from the second image to obtain the standard appearance parameters of the capacitor to be detected includes:
[0029] The second image is preprocessed to obtain the third image;
[0030] The key parts of the third image are located, the position and outline of the key parts are determined and measured, and the size data of the key parts are obtained. The key parts include positive and negative electrodes, pins and sleeves, etc.
[0031] The maximum and minimum values of the dimensional data of each key part are taken as the maximum and minimum values of the dimensional range of the key part, and the standard dimensional parameters of each key part are obtained.
[0032] The standard appearance parameters of the capacitor to be tested are obtained based on the standard size parameters.
[0033] Secondly, the present invention provides an appearance inspection device for multiple types of capacitors, the appearance inspection device for multiple types of capacitors comprising:
[0034] An acquisition unit is used to acquire a first image of the capacitor to be detected, the first image including a required view of the capacitor to be detected.
[0035] An extraction unit is used to extract parameters from the first image to obtain the appearance parameters of the capacitor to be detected.
[0036] A matching unit is used to match the appearance parameters in the template library to obtain a capacitance detection template corresponding to the appearance parameters;
[0037] An evaluation unit is used to evaluate the capacitor to be tested based on the capacitor detection template to obtain the detection result of the capacitor to be tested.
[0038] Thirdly, the present invention provides a storage medium including a stored program, wherein the program executes the appearance inspection method for multi-type capacitors as described in any one of the first aspects.
[0039] Fourthly, the present invention provides a processor for running a program, wherein the program executes the appearance detection method for multiple capacitor models as described in any one of the first aspects.
[0040] This invention extracts the parameters of the capacitor to be tested and automatically switches to the corresponding test template to evaluate it. This avoids the problems of operational complexity and low efficiency caused by manual parameter adjustment, enhances the flexibility of the production line, greatly simplifies the parameter setting process on the production line, significantly reduces the test preparation work when switching between different capacitor models, and improves the response speed. Attached Figure Description
[0041] Figure 1 This is a flowchart illustrating a method for detecting multiple capacitor types in one embodiment of the present invention.
[0042] Figure 2 This is a flowchart illustrating a method for detecting multiple capacitor types in one embodiment of the present invention.
[0043] Figure 3 This is a flowchart illustrating a method for detecting multiple capacitor types in one embodiment of the present invention.
[0044] Figure 4 This is a flowchart illustrating a method for detecting multiple capacitor types in one embodiment of the present invention.
[0045] Figure 5This is a schematic diagram of an appearance inspection device for multiple capacitor models in one embodiment of the present invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0047] Firstly, referring to Figure 1 The present invention provides a method for visually inspecting a capacitor, the method comprising:
[0048] S110, Obtain a first image of the capacitor to be tested, the first image including a required view of the capacitor to be tested;
[0049] Among them, the required view diagram refers to the different views that the capacitor under test needs to be inspected and evaluated, including the front view (main view), side view, pin / electrode view (or bottom view), or special view (for special capacitor types, such as feedthrough capacitors, film capacitors, etc.: if there is a metal shell or sealed structure, a "sealed surface view" must be included to check whether the seal is intact (to prevent moisture and impurities from entering and affecting performance)). The essence of the "required view diagram" is to cover all the key areas of the capacitor that "affect performance, parameters, installation, or safety". Whether it is information identification, structural integrity, defect risk points, or special function-related parts (such as polarity, pins), they all need to be inspected through the corresponding view. The specific views included need to be further clarified according to the testing standards (such as industry specifications, enterprise quality inspection requirements). S120, extract parameters from the first image to obtain the appearance parameters of the capacitor under test;
[0050] The parameter extraction of the first image refers to the size parameters of the capacitor to be tested, rather than directly obtaining the model identification on the capacitor. In some cases, capacitors with the same model may have subtle differences. These differences are caused by production batches, customization requirements, or model simplification, which may affect the applicability of specific scenarios. Only identifying the model of the capacitor to be tested will lead to insufficient accuracy of the identification results.
[0051] Specifically, appearance parameters include appearance condition parameters (reflecting surface integrity and physical characteristics): surface defect parameters (such as the length of scratches on the side of aluminum electrolytic capacitors and the area of chipped edges of surface-mount ceramic capacitors), morphological integrity parameters (such as the perpendicularity deviation of the axis of cylindrical capacitors, the height of the top plane bulge of electrolytic capacitors, and the bending angle of the leads of plug-in capacitors), and material condition parameters (such as the RGB values of the lead surface); identification information parameters (reflecting parameter identifiability and standardization): identification integrity parameters (such as the color contrast of the negative electrode color band of aluminum electrolytic capacitors) and identification standardization parameters (such as the blur width of character edges, the printing misalignment distance, and the deviation value of the polarity color band from the left side of the sleeve); structural correlation parameters (reflecting the matching between components and the rationality of assembly): component relative position parameters (such as the parameters of the relative position of leads, sleeves, etc., to the overall structure) and packaging integrity parameters (such as the gap of the splicing seam of square capacitor shells); the essence of appearance parameters is to determine whether the capacitor under test is visually qualified and potentially reliable through quantifiable feature descriptions. At the same time, the testing standards are different for each type of capacitor, and the extracted parameters can be determined according to different capacitors under test.
[0052] S130, Match the appearance parameters in the template library to obtain a capacitance detection template corresponding to the appearance parameters;
[0053] The matched capacitor detection template contains the standard appearance parameters of the capacitor to be tested, as shown in the appearance parameters above. The capacitor detection template corresponds to each parameter extracted from the first image. For example, if the extracted appearance data of the capacitor to be tested includes the pin spacing value, then the capacitor detection template contains a flag value / range for the pin spacing.
[0054] Specifically, the matching process involves identifying the capacitor type based on physical characteristics, and then matching a specific template based on structural features. Different types of capacitors have unique physical forms. For example, the core physical form of an aluminum electrolytic capacitor is a cylindrical metal casing with a top explosion-proof texture and polarity (e.g., long leads), while the core physical form of a surface-mount ceramic capacitor is a square / rectangular thin sheet with no leads (only bottom electrodes) and no polarity. If the characteristics of "cylindrical metal casing with a grid-like explosion-proof texture on top and one long and one short lead" are extracted, it is directly identified as an "aluminum electrolytic capacitor" and enters the aluminum electrolytic capacitor template pool. After identifying the type through physical form, interference from "different types of capacitors having the same parameters in the same part" can be eliminated (e.g., through-hole ceramic and aluminum electrolytic capacitors). All capacitors have pins, but belong to different template pools, and their parameter ranges are defined within their respective pools. Capacitors of the same type (such as aluminum electrolytic capacitors) can be further matched to specific templates through structural parameters such as "size combination" and "component shape" (even without identification markings, structural features remain unique). Taking aluminum electrolytic capacitors as an example, their core matching parameters are: main body size combination: diameter × length (e.g., φ8mm × 12mm, φ10mm × 16mm) – different sizes correspond to different templates; pin structure: number of pins (usually 2 pins), pin diameter (e.g., 0.8mm, 1.0mm), pin spacing (e.g., 2.5mm, 5mm); casing details: explosion-proof texture shape (grid, cross shape). 1. Presence or absence of sheathing (some have insulating sheathing, some have exposed aluminum shell). In the aluminum electrolytic capacitor template pool, there are two templates: Template A: φ10mm×16mm, lead diameter 0.8mm, spacing 5mm, grid-like explosion-proof texture; Template B: φ8mm×12mm, lead diameter 1.0mm, spacing 2.5mm, cross-shaped explosion-proof texture. If the extracted parameters are "φ10mm×16mm + lead diameter 0.8mm + spacing 5mm + grid-like explosion-proof texture", then directly match Template A. When different capacitors have the same parameter requirements for the same part, such as different ranges of lead bending angle in different appearance inspection templates, they can be distinguished by locking the capacitor type. When the structural features are ambiguous... For example, if the capacitor structure has worn and blurred explosion-proof lines, the closest appearance inspection template can be matched by using the core dimensions (the key dimensional parameters that directly determine the type and specifications of the capacitor; the core dimensions are the most stable structural parameters that are least likely to become blurred due to wear or deformation) and the majority feature matching principle (which means counting the number of features that are "clearly identifiable and consistent with the template" among the non-core features of the capacitor (such as the shape of the explosion-proof lines, the diameter of the leads, and the presence or absence of the sleeve); the template with the most features is the matching result). For example, if "φ10mm×16mm (clear dimensions) + lead diameter 0.8mm (clear) + blurred explosion-proof lines" is extracted, then "φ10mm×16mm + 0.8mm" will be matched first.For templates with "8mm pins" (ignoring ambiguous features), mark them as "partially ambiguous structural features" (this does not affect template matching, only prompts for manual review); when matching existing unqualified capacitors, even if the capacitor has serious defects (such as a cracked casing), as long as the structural features are identifiable (e.g., φ10mm×16mm can still be measured), match the corresponding template according to the structure, and only mark it as "unqualified" during the pass / fail judgment (see the evaluation section below). The core principle is "core dimensions define the range, most features define the specifics."
[0055] S140, Based on the capacitance detection template, the capacitor to be tested is evaluated to obtain the detection result of the capacitor to be tested.
[0056] The test results include good products and defective products. If the test is passed, the product is considered good; if the test is failed, the product is considered defective.
[0057] Specifically, the capacitor to be tested is evaluated using the capacitor test template matched in step S130. If the evaluation passes, the capacitor to be tested is a good product; if it fails, it is a defective product.
[0058] In this embodiment, by extracting parameters from the capacitor to be tested and then matching them with a template for testing, the testing template can be quickly adjusted according to the real-time production environment, adapting to changes in different market demands, improving production flexibility and responsiveness, avoiding manual adjustment of testing parameters, simplifying the parameter setting process on the production line, significantly reducing preparation work when switching between different capacitors, improving response speed, reducing reliance on manual labor, and significantly reducing the company's expenditure on training and human resources costs.
[0059] In one embodiment, reference Figure 2 and 3 S120, after the step of extracting parameters from the first image to obtain the appearance parameters of the capacitor to be detected, the method further includes:
[0060] S130, Match the appearance parameters in the template library;
[0061] The template library stores standard test templates for various known capacitors (including appearance parameter thresholds, feature comparison benchmarks, etc.). "Appearance parameter matching" here refers to comparing the extracted parameters of the capacitor to be tested (such as size, surface marking layout, pin spacing, color, etc.) with the parameter ranges of the templates in the library. If no matching template is found, it indicates that the capacitor to be tested is a new model, a specially customized model, or a type not included in the template library (such as niche brand capacitors or irregularly shaped capacitors), and existing templates cannot meet the testing requirements.
[0062] S140, if a capacitor detection template corresponding to the appearance parameters is not obtained, then a second image of the capacitor to be tested is obtained, the second image including a standard capacitor required view of the capacitor to be tested placed manually.
[0063] Among them, "standard capacitor" refers to a qualified capacitor that is completely consistent with the model and specifications of the capacitor to be tested (its parameter compliance can be confirmed manually). The purpose of manual placement is twofold: firstly, to ensure that the required viewing surface (such as the front, side, and pin surface) of the standard capacitor is consistent with the viewing angle, lighting conditions, and shooting distance of the first image, so as to avoid parameter extraction deviation due to shooting differences; secondly, to allow the second image to provide a "benchmark reference" and to establish a standard parameter template for the capacitor to be tested based on the appearance characteristics of the qualified capacitor.
[0064] Specifically, if no matching capacitor detection template is found, staff select multiple known qualified standard capacitors of the same model and specifications as the capacitor to be tested, acquire the second image in the same way as the first image, and extract parameters from the second image.
[0065] S150, extract parameters from the second image to obtain the standard appearance parameters of the capacitor to be detected;
[0066] In terms of parameter extraction dimensions, the first and second images are completely identical (such as dimensional accuracy, marking clarity, and pin integrity on the same viewpoint), ensuring that the parameters extracted from both can be effectively compared. The second image extracts the standard appearance parameters of the capacitor, which are the core basis for generating the subsequent detection template. For example, the height of the marking text on the front of the standard capacitor is 0.5mm ± 0.05mm, and this parameter will be used as the comparison threshold for "marking integrity" in the template.
[0067] Specifically, the pin spacing parameters of the capacitor can be obtained by performing ±3σ statistics on the second image; the positive and negative electrode parameters of the capacitor can be obtained by dynamically setting the grayscale threshold range of the second image; and the sleeve parameters of different types of capacitors can be obtained by performing adaptive structural element processing on the second image.
[0068] S160, generate a capacitance detection template for the capacitor to be tested based on the standard appearance parameters, enter the capacitance detection template into the template library, and return to obtain a first image of the capacitor to be tested, wherein the first image includes a required view of the capacitor to be tested.
[0069] The capacitance testing template is a dataset containing threshold ranges for standard appearance parameters (such as dimensional tolerances, marking clarity criteria, and defect identification benchmarks). When generating the template, information such as the threshold ranges and parameter weights (e.g., dimensional parameters have a higher weight than surface condition parameters) of the standard appearance parameters must be integrated. After being entered into the template library, the template can be directly called upon for subsequent capacitance tests of the same type. Returning to the initial step is to re-test the original capacitor. At this point, the template library already contains the corresponding template, and a compliance assessment can be completed based on the newly generated template (e.g., determining whether the appearance of the capacitor meets the parameter requirements of standard capacitors). The first image of the capacitor under test is the first image of the capacitor under test before the test results are known.
[0070] In this embodiment, for capacitors not included in the template library (such as new models or customized products), a dedicated testing template can be quickly created through a "standard capacitor image + template generation" process. This solves the problem of "inability to detect due to lack of template" in traditional testing and is applicable to diverse capacitor testing scenarios (such as niche brand capacitors in incoming material inspection in electronics factories and new capacitors in the R&D stage). The second image generates parameters based on standard capacitors that have been manually verified, avoiding the bias of "relying on theoretical data to build templates." The generated template is closer to the actual product characteristics, and the judgment of appearance defects and parameter compliance during subsequent testing will be more accurate (such as the judgment of pin spacing error is more in line with actual production standards). After the newly generated template is entered into the template library, it can be directly called for subsequent testing of the same type of capacitor without repeating the manual intervention process. As the types and number of tests increase, the template library will cover more capacitor types, reducing the frequency of manual operation and reducing the time and labor costs of long-term testing (especially suitable for scenarios where capacitor models are frequently updated). The closed-loop design from "no template - template generation - re-testing" ensures that every capacitor to be tested can ultimately be evaluated based on a standard template. Meanwhile, the newly generated template can serve as a long-term testing benchmark for this type of capacitor, and the quality consistency of subsequent capacitors in the same batch can be quickly verified through the template.
[0071] In one embodiment, reference Figure 4 S140, the step of evaluating the capacitor to be tested based on the capacitor detection template to obtain the detection result of the capacitor to be tested includes:
[0072] S141, based on the capacitance detection template, the appearance parameters of the capacitor to be tested are evaluated to obtain a first detection result of the capacitor to be tested. The first detection result includes those that meet the requirements of the capacitance detection template and those that do not meet the requirements of the capacitance detection template.
[0073] In this step, the extracted parameters of the capacitor to be tested (such as the main body diameter, the integrity of the capacitance value marking, and the pin length) are compared with the template threshold one by one to determine whether they are within the qualified range.
[0074] Specifically, if a test template for an aluminum electrolytic capacitor specifies "body diameter φ10mm±0.2mm, capacitance value marking (1000μF) must be complete and identifiable, and pin spacing 5mm±0.1mm", then if the capacitor to be tested has a diameter of φ10.1mm (within the threshold), a clear capacitance value marking, and a pin spacing of 4.95mm (within the threshold), then the first test result is "compliant with the capacitor test template". If the capacitor to be tested has a diameter of φ10.3mm (exceeding the threshold), or if the capacitance value marking is worn and "1000μF" cannot be identified, then the first test result is "non-compliant with the capacitor test template".
[0075] S142, perform damage identification on the capacitor to be tested to obtain a second detection result of the capacitor to be tested, the second detection result including damaged and undamaged;
[0076] Among them, damage identification uses image recognition technology to detect whether capacitors have structural defects (such as cracks, bulges, leakage, etc. that directly affect performance) and stains. During identification, special attention should be paid to the weak parts of the capacitor (such as the explosion-proof texture on the top of aluminum electrolytic capacitors, the root of the leads, and the corners of ceramic capacitors). In addition to damage caused by parameter problems of critical parts (such as leads, positive and negative terminals, sleeves, etc.), capacitor damage may also involve non-critical structures, external environmental effects, and latent defects. The location or cause of damage is not directly related to the parameters (size, spacing, integrity) of critical parts (leads, electrodes, positive and negative terminals), but it can still affect capacitor performance by "damaging the seal", "accelerating material aging", and "expanding the defect range". During the training phase of image recognition technology, damage can be manually marked and learned.
[0077] Specifically, the aluminum electrolytic capacitor is damaged: if the image shows cracks in the top explosion-proof texture, leakage marks on the side (in the form of yellow oil stains), or broken leads, the second detection result is "damaged". If the capacitor surface has only slight scratches (not penetrating the casing), no cracks or leakage, and the leads are intact, the second detection result is "not damaged".
[0078] S143, when the first detection result meets the requirements of the capacitor detection template and the second detection result is undamaged, the detection result of the capacitor to be tested is good;
[0079] This step is a "double qualification judgment", which means that the appearance parameters meet the template (to ensure that the size, markings and other requirements are compatible with the circuit) and there is no structural damage (to ensure stable performance). Only when both conditions are met can the capacitor be judged as a good product.
[0080] S144, when the first detection result does not meet the requirements of the capacitor detection template, or the second detection result is damaged, the detection result of the capacitor to be tested is defective.
[0081] This step employs a "one-vote veto system," meaning that if the appearance parameters do not conform to the template (e.g., the size is too large to install), or if there is damage (e.g., cracks leading to leakage risk), the product is immediately deemed defective. This is because both types of problems can render the capacitor unusable (or pose a safety hazard).
[0082] In this embodiment, a good product is determined by the dual criteria of "appearance parameters meeting the template requirements" and "no damage." This avoids capacitors with "qualified appearance but hidden damage" (such as internal cracks) from flowing downstream (these capacitors may suddenly fail during use), and also excludes capacitors with "no damage but incorrect parameters" (such as incorrect capacitance values) (these capacitors will cause the circuit performance to fail). The parameter evaluation based on the preset template (S141) and the clear damage identification criteria (S142) replaces the subjective judgment of manual inspection (such as "whether scratches are considered defects" or "whether pin bending is acceptable"). For example, different inspectors may have different tolerances for the "pin bending angle". The template is preset to "bending > 15° is non-compliant", which can ensure that all test results are consistent and avoid misjudgment due to differences in personnel experience. The defective product judgment adopts "OR logic" (S144). As long as one item is non-compliant, it is judged as a defective product. No additional testing is required, and problematic capacitors can be quickly screened out. Appearance parameters (such as capacitance value and withstand voltage marking) determine whether the capacitor is "compatible with the circuit", and the damage status determines whether the capacitor "can work safely". Both of them cover the core risk points of capacitor use.
[0083] In one embodiment, reference Figure 2 S140, after the step of evaluating the capacitor to be tested based on the capacitor detection template to obtain the detection result of the capacitor to be tested, the method includes:
[0084] S150, calculate the defect rate of the test results. When the defect rate does not exceed a preset ratio, return to the step of obtaining the first image of the capacitor to be tested. The defect rate is equal to the proportion of the capacitor to be tested that is defective in the total number of capacitors to be tested.
[0085] The defect rate in the test results refers to the defect rate recorded in the current test results and historical test results. Defect rate = (Number of defective products ÷ Total number of products tested) × 100%. The defect rate is a key indicator in batch testing, used to determine the overall quality stability of the current batch of capacitors. The preset ratio needs to be set according to the production scenario (e.g., the preset ratio for routine incoming material testing is 1%, and the preset ratio for high-precision circuit capacitors is 0.5%), and can also be adjusted according to the application of the capacitors. When the defect rate is within the preset range, it indicates that the batch quality is qualified, and normal testing can continue for the next batch or the next capacitor; if it exceeds the preset ratio, an alarm should be triggered.
[0086] S160, when the defect rate exceeds the preset ratio, trigger an early warning and return to the step of obtaining the first image of the capacitor to be tested.
[0087] A defect rate exceeding a preset percentage typically indicates a systemic problem in the batch (such as raw material defects, abnormal production processes, or damage during transportation). Early warning methods include audible and visual alarms (workshop equipment emits beeping sounds and flashing warning lights) and system push notifications (sending warning information to the terminals of quality inspectors and production supervisors). It is also necessary to record the warning time, defect rate value, and main problems of defective products for subsequent traceability. Returning to the testing step after an early warning is to continuously monitor whether the quality of subsequent capacitors improves.
[0088] In this embodiment, defect rate statistics can avoid "focusing only on a single defective product while ignoring the overall batch problem". Through early warning, problems in upstream production or transportation links can be investigated in a timely manner (such as mold calibration, packaging reinforcement), preventing a large number of defective products from flowing into subsequent processes. When the defect rate does not exceed the standard, testing continues (S150) to ensure production continuity; when it exceeds the standard, an early warning is issued (S160) and continuous monitoring is carried out, forming a closed loop of "detection-statistics-early warning-traceability". Historical defect rate data can be used to analyze the quality fluctuation pattern (such as "the defect rate of aluminum electrolytic capacitors increases during high summer temperatures" or "the defect rate of a certain supplier's batch is generally high"), providing a basis for production optimization.
[0089] In one embodiment, refer to... Figure 2 S140, after the step of evaluating the capacitor to be tested based on the capacitor detection template to obtain the detection result of the capacitor to be tested, the method includes:
[0090] S150, when the number of consecutive defective products detected is not less than a preset number, return to the step of obtaining the first image of the capacitor to be tested;
[0091] The "Number of Consecutive Defective Products" refers to the cumulative number of consecutive "defective" results since a certain inspection (e.g., if the 5th, 6th, and 7th products are all defective, the consecutive count is 3). The "Preset Quantity" is the threshold for judging "random defects" and "consecutive anomalies" (e.g., 3 times for normal scenarios and 2 times for high-precision scenarios). When the number of consecutive defects does not reach the preset quantity, it is considered an accidental situation (e.g., a brief misjudgment by the testing equipment, or damage to individual capacitors during transportation), and the normal testing process continues.
[0092] S160, when the number of consecutive defective products detected is not less than a preset number, stop returning to the step of acquiring the first image of the capacitor to be tested and trigger an alarm.
[0093] If the number of consecutive failures reaches or exceeds a preset limit, it usually indicates a systemic problem in the testing process or the capacitor itself (such as lens contamination of the testing equipment or batch breakage due to material jams in the capacitor production line). In this case, the testing process should be stopped (to avoid invalid testing), and alarms (such as equipment shutdown, audible and visual alarms, and information push notifications to maintenance personnel) should be used to prompt manual intervention for troubleshooting.
[0094] In this embodiment, consecutive defective products are often signals of "detection equipment failure" or "abnormal batch of capacitors," rather than accidental factors. By monitoring and controlling consecutive defective products, it is possible to prevent subsequent capacitors from being pinched off (from "batch defective" to "batch scrap"), reduce the wasted time of equipment idling, and reduce the risk of misjudgment. The preset number setting (e.g., 3 times) can filter out "accidental consecutive defects" (e.g., 2 consecutive defects may be due to two capacitors having defects), avoid affecting the production rhythm due to "stopping the machine due to one or two defective products," and balance the continuity and reliability of detection. The "common characteristics" of consecutive defective products can quickly pinpoint the source of the problem. For small batch detection (e.g., 5 samples detected in the R&D stage), the defect rate statistics (e.g., 2 out of 5 are defective, defect rate 40%) may be distorted due to the small sample size, while the number of consecutive defects is more intuitive.
[0095] It should be noted that in this embodiment, the steps of checking whether the number of consecutive defective products exceeds a preset quantity (S150) and whether the defect rate exceeds a preset proportion (S150 in the previous embodiment) can be performed simultaneously, or one step can be performed before the other. (Refer to...) Figure 2 .
[0096] In one embodiment, after step S140, which involves evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested, the following steps are included:
[0097] S150, when the capacitance detection template is matched a preset number of times, a better capacitance detection template for the capacitor to be tested is generated according to the appearance parameters in the preset number of times, and the better capacitance detection template is used to replace the capacitance detection template in the template library.
[0098] The "preset number of times the capacitor detection template is matched" refers to the number of times the template is used for evaluation during detection, reaching a preset value (e.g., 500 times, meaning the template triggers optimization after matching 500 capacitors of the same type). The "appearance parameters in the preset number of matches" are the actual appearance parameters of these 500 capacitors (e.g., size, pin spacing, marking clarity, etc.). A better template is generated by statistically analyzing the common characteristics of these parameters (e.g., mean, reasonable fluctuation range). Compared to the initial template, the parameter thresholds of the better template will better reflect normal fluctuations in actual production (avoiding the initial template's thresholds being too strict or too lenient). Finally, the new template replaces the old one, achieving dynamic template iteration.
[0099] In this embodiment, by monitoring the number of times the capacitance detection template is called, automatic optimization is triggered by a preset number of calls, achieving dynamic template optimization that aligns with actual production patterns. Through cumulative parameter analysis of the preset number of calls, a better template can accommodate reasonable fluctuations (such as normal errors in production), avoiding "misjudging good products as defective products." Simultaneously, the initial template may be affected by "individual differences in standard capacitors" (e.g., the standard capacitor pin spacing used to generate the template is too short, causing the threshold to be biased to one side). When generating a better template based on parameters from a preset number of calls (e.g., 500 times), extreme values (e.g., 1-2 abnormal parameters caused by accidental factors) are statistically excluded, retaining the mainstream reasonable range, making the detection results more stable. This eliminates the need for manual periodic collection of detection data and analysis of threshold rationality, and the better template is generated based on the latest detection data, automatically adapting to process changes.
[0100] In one embodiment, step S150, the step of extracting parameters from the second image to obtain the standard appearance parameters of the capacitor to be detected includes:
[0101] S151, preprocess the second image to obtain the third image;
[0102] The second image is a standard view of the capacitor (e.g., a front and side view including positive and negative terminals, pins, and bushings). Preprocessing aims to eliminate image interference (such as reflections, shadows, and background noise) and enhance the visibility of key areas (such as pin edges and positive / negative terminal markings), providing a clear image for subsequent feature localization. Common preprocessing operations include: denoising: removing grainy noise from the image (such as ambient light interference during shooting) using Gaussian filtering; contrast enhancement: increasing the brightness difference between key areas and the background (e.g., enhancing the contrast between polarity markings on the bushing and the bushing itself); distortion correction: correcting image distortion caused by the shooting angle (e.g., trapezoidal distortion in a side view due to tilted shooting, corrected to a front view through perspective transformation).
[0103] S152, perform feature localization of key parts on the third image, determine the position and outline of the key parts and measure them to obtain the size data of the key parts, the key parts include positive and negative electrodes, pins and sleeves, etc.
[0104] In this embodiment, based on the preprocessed third image, key parts—positive and negative electrodes (such as negative electrode color bands and positive electrode pins), pins (complete outlines from root to end), and sleeves (metal sleeves of capacitor shells)—are located using image recognition algorithms (such as edge detection and template matching). The actual size is measured by pixel conversion (using a known image scale: e.g., 10 pixels correspond to 1 mm). In this embodiment, a modified YOLOv8 segmentation + target detection algorithm is used for key feature localization. Then, a precision calibration matrix is used to calibrate and optimize the accuracy of the size detection algorithm for size measurement.
[0105] S153, take the maximum and minimum values of the size data of each key part as the maximum and minimum values of the size range of the key part, and obtain the standard size parameters of each key part;
[0106] To avoid overly stringent dimensional parameters due to individual differences in a single standard capacitor (such as a slightly shorter lead on a standard capacitor), statistical analysis is typically performed on multiple standard capacitors of the same model (or multiple measurements of the same standard capacitor). The maximum and minimum values of the dimensional data for the same critical component are taken as the reasonable dimensional range for that component (rather than a single value), ensuring that the standard dimensional parameters conform to normal fluctuations in actual production. If some parameters require specific values (such as lead spacing or sleeve length), multiple measurements are taken, and the maximum and minimum values are removed before averaging (to reduce random errors).
[0107] S154, Obtain the standard appearance parameters of the capacitor to be tested based on the standard size parameters.
[0108] The standard appearance parameters are an integration of standard dimensional parameters. In addition to the dimensional range of key parts, they also include the "feature integrity requirements" of key parts (such as whether the positive and negative markings are identifiable and whether the pins are free from bending). These parameters can also be obtained through parameter extraction. That is, standard appearance parameters = "dimensional range" + "feature integrity", providing a complete basis for the subsequent generation of inspection templates.
[0109] In this embodiment, preprocessing (S151) eliminates interference such as reflections and color variations during shooting (e.g., blurred pin edges caused by reflections from aluminum electrolytic capacitor sheaths) through noise reduction and contrast enhancement, making the positioning of key parts (S152) more accurate. S153 determines the size range by "taking the maximum and minimum values," rather than relying on the size of a single standard capacitor, thus accommodating normal fluctuations in production (e.g., ±0.1mm errors due to mold precision). Standard appearance parameters (S154) integrate size ranges and feature requirements, resulting in a more comprehensive test template (e.g., requiring not only pin length within the range but also no bending). During subsequent testing, comparing the appearance parameters of the capacitor under test with this standard allows for a more accurate determination of its qualification (e.g., a capacitor with the required pin length but bending will be judged as defective due to non-compliance with the "no bending" requirement), ensuring consistent test results.
[0110] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0111] Based on the same inventive concept, the second aspect, such as Figure 5 As shown, the present invention also provides an appearance inspection device for multiple types of capacitors, comprising:
[0112] Acquisition unit 110 is used to acquire a first image of the capacitor to be detected, the first image including a required view of the capacitor to be detected.
[0113] Extraction unit 120 is used to extract parameters from the first image to obtain the appearance parameters of the capacitor to be detected;
[0114] The matching unit 130 is used to match the appearance parameters in the template library to obtain a capacitance detection template corresponding to the appearance parameters.
[0115] Evaluation unit 140 is used to evaluate the capacitor to be tested based on the capacitor detection template to obtain the detection result of the capacitor to be tested.
[0116] This multi-type capacitor appearance inspection device is used to implement the capacitor appearance inspection method described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more appearance inspection device embodiments provided below can be found in the limitations of the appearance inspection method above, and will not be repeated here.
[0117] Thirdly, the present invention provides a storage medium comprising a stored program, wherein the program executes the appearance inspection method for multi-type capacitors as described in any one of the first aspects.
[0118] Fourthly, the present invention provides a processor for running a program, wherein the program executes the appearance detection method for multiple capacitor models as described in any one of the first aspects.
[0119] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0120] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0121] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0122] The above are merely preferred embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for visual inspection of multiple capacitor models, characterized in that, The method for visual inspection of multi-type capacitors includes: Acquire a first image of the capacitor to be tested, the first image including a required view of the capacitor to be tested; Parameters are extracted from the first image to obtain the appearance parameters of the capacitor to be detected; The appearance parameters are matched in the template library to obtain the capacitance detection template corresponding to the appearance parameters; Based on the capacitance detection template, the capacitor to be tested is evaluated to obtain the detection result of the capacitor to be tested.
2. The method for visual inspection of multiple capacitor models as described in claim 1, characterized in that, After the step of extracting parameters from the first image to obtain the appearance parameters of the capacitor to be detected, the method further includes: Match the appearance parameters in the template library; If a capacitance detection template corresponding to the appearance parameters is not obtained, a second image of the capacitor to be tested is obtained. The second image includes a required view of a standard capacitor with the capacitor to be tested placed manually. Parameters are extracted from the second image to obtain the standard appearance parameters of the capacitor to be detected; The steps of generating a capacitance detection template for the capacitor to be tested based on the standard appearance parameters, recording the capacitance detection template into the template library, and returning to obtain a first image of the capacitor to be tested, wherein the first image includes a required view of the capacitor to be tested.
3. The method for visual inspection of multiple capacitor models as described in claim 1, characterized in that, The steps for evaluating the capacitor to be tested based on the capacitance detection template and obtaining the detection result of the capacitor to be tested include: Based on the capacitance detection template, the appearance parameters of the capacitor to be tested are evaluated to obtain a first detection result of the capacitor to be tested. The first detection result includes those that meet the requirements of the capacitance detection template and those that do not meet the requirements of the capacitance detection template. The capacitor to be tested is subjected to damage identification to obtain a second detection result of the capacitor to be tested, the second detection result including damaged and undamaged; When the first test result meets the requirements of the capacitor test template and the second test result is undamaged, the test result of the capacitor to be tested is good. When the first test result does not meet the requirements of the capacitor test template, or the second test result is that the capacitor to be tested is damaged, the test result of the capacitor to be tested is a defective product.
4. The method for visual inspection of multiple capacitor models as described in claim 1, characterized in that, After the step of evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested, the following steps are included: Calculate the defect rate of the test results. When the defect rate does not exceed a preset ratio, return to the step of obtaining the first image of the capacitor to be tested. The defect rate is equal to the proportion of the capacitor to be tested that is defective in the total number of capacitors to be tested. When the defect rate exceeds a preset ratio, an early warning is triggered, and the process returns to the step of obtaining the first image of the capacitor to be tested.
5. The method for visual inspection of multiple capacitor models as described in claim 1, characterized in that, After the step of evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested, the following steps are included: When the number of consecutive defective products detected is not less than a preset number, return to the step of obtaining the first image of the capacitor to be tested; When the number of consecutive defective products detected is not less than a preset number, the step of returning to obtain the first image of the capacitor to be tested is stopped, and an alarm is triggered.
6. The method for visual inspection of multiple capacitor models as described in claim 1, characterized in that, After the step of evaluating the capacitor to be tested based on the capacitance detection template to obtain the detection result of the capacitor to be tested, the following steps are included: When the capacitance detection template is matched a preset number of times, a better capacitance detection template is generated for the capacitor to be tested based on the appearance parameters in the preset number of times, and the better capacitance detection template is used to replace the capacitance detection template in the template library.
7. The method for visual inspection of multiple capacitor models as described in claim 2, characterized in that, The step of extracting parameters from the second image to obtain the standard appearance parameters of the capacitor to be detected includes: The second image is preprocessed to obtain the third image; The key parts of the third image are located, the position and outline of the key parts are determined and measured, and the size data of the key parts are obtained. The key parts include positive and negative electrodes, pins and sleeves, etc. The maximum and minimum values of the dimensional data of each key part are taken as the maximum and minimum values of the dimensional range of the key part, and the standard dimensional parameters of each key part are obtained. The standard appearance parameters of the capacitor to be tested are obtained based on the standard size parameters.
8. A device for visually inspecting multiple types of capacitors, characterized in that, The appearance inspection device for the multi-type capacitors includes: An acquisition unit is used to acquire a first image of the capacitor to be detected, the first image including a required view of the capacitor to be detected. An extraction unit is used to extract parameters from the first image to obtain the appearance parameters of the capacitor to be detected. A matching unit is used to match the appearance parameters in the template library to obtain a capacitance detection template corresponding to the appearance parameters; An evaluation unit is used to evaluate the capacitor to be tested based on the capacitor detection template to obtain the detection result of the capacitor to be tested.
9. A storage medium, characterized in that, The storage medium includes a stored program, wherein the program executes the appearance inspection method for multi-type capacitors as described in any one of claims 1 to 7.
10. A processor, characterized in that, The processor is used to run a program, wherein the program executes the appearance inspection method for multi-type capacitors according to any one of claims 1 to 7.