A method and system for rapid detection of visual defects in square power battery casings

Through the method of combining multi-view image acquisition and deep learning, the problem of insufficient viewing angle coverage and low accuracy in square power battery case detection is solved, and the rapid identification and accurate positioning of multiple types of surface defects is achieved, which improves the level of detection automation.

CN120318234BActive Publication Date: 2025-09-05TIANJIN HAOCHEN INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510803667.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-17
Publication Date
2025-09-05
Estimated Expiration
2045-06-17

AI Technical Summary

Technical Problem

In the prior art, the detection of square power battery case has insufficient viewing angle coverage, low detection accuracy, and weak intelligent recognition capabilities, resulting in multiple types of surface defects being easily missed or misjudged, making it difficult to meet the needs of automated quality inspection.

Method used

Using a method of combining multi-view image acquisition device and deep learning recognition, the multi-view image acquisition, image preprocessing, front visual scratch detection and deep learning model recognition can quickly identify and accurately locate multiple surface defects in the square power battery case.

Benefits of technology

It realizes efficient and accurate detection of surface defects of square power battery housing, significantly improves detection coverage and accuracy, reduces missed and missed inspections, and improves the automation and accuracy of quality inspections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318234B_ABST
    Figure CN120318234B_ABST
Patent Text Reader

Abstract

The present application provides a method and system for rapid detection of visual defects in square power battery casings, which relates to the field of image processing technology, including: obtaining a high-resolution multi-view image sequence, outputting standardized image data, performing front-view scratch detection, outputting the location and characteristics of scratch defects, outputting defect candidate areas containing confidence scores, identifying bubble-type defects, summarizing the recognition results of defect candidate areas and generating annotated images. The present application solves the problem in the prior art that due to the insufficient fusion of multi-view image information, the traditional scratch detection relies on a single edge feature, and the main defect recognition model has insufficient recognition ability for subtle defects such as bubbles, resulting in low defect detection accuracy, serious missed detection and false detection phenomena, and difficulty in achieving comprehensive and accurate defect positioning and classification. It improves the multi-view information fusion capability and the recognition accuracy and detection efficiency of multiple categories of defects, and achieves high precision, comprehensiveness and real-time quality monitoring of defect detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a method and system for rapid detection of visual defects in square power battery casings. Background Art

[0002] With the rapid development of the new energy vehicle industry, power batteries, as one of the core components, have a significant impact on the performance, safety, and service life of the vehicle. Prismatic power batteries, in particular, are widely used in electric vehicles, power tools, and energy storage devices due to their compact structure and flexible assembly. However, in actual production, prismatic battery casings are prone to surface defects such as scratches, dents, dirt, and bubbles during stamping, welding, coating, and assembly. These defects not only affect the battery's appearance but can also lead to safety hazards such as leakage and short circuits.

[0003] At present, the quality inspection of power battery casings is still mainly based on manual visual inspection. Although some companies have introduced visual inspection equipment based on traditional image processing, they use single-view cameras, which makes it difficult to comprehensively inspect multiple sides and corner areas of the battery casing, resulting in a high missed inspection rate. Summary of the Invention

[0004] The present application provides a method and system for rapid detection of visual defects in square power battery casings, which solves the problem in the prior art of being unable to comprehensively, efficiently and accurately detect multiple types of surface defects in battery casings due to the lack of multi-perspective imaging and intelligent defect recognition mechanisms. It achieves the technical effect of rapid identification and accurate positioning of various defects such as scratches, pits, bubbles, and dirt, thereby significantly improving the casing quality control efficiency and automation level in the power battery production process.

[0005] In view of the above problems, the first aspect of the present application provides a method for rapid detection of visual defects in square power battery shells, the method comprising: using a multi-view image acquisition device to acquire images of multiple planes and angles of the square power battery shell to obtain a high-resolution multi-view image sequence, the multi-view image acquisition device comprising a plurality of industrial cameras, which are respectively arranged in the top view, oblique view and side view directions to form a three-dimensional imaging array around the top and side of the shell; pre-processing the image sequence to output standardized image data; performing front-view scratch detection on the standardized image data, performing rapid scratch recognition based on edge features, and outputting the scratch defect position and Features: the front visual scratch detection is based on the linear structure enhancement algorithm combined with morphological processing to identify slender scratch areas; the deep learning model is used to identify the main defects of the preprocessed image, and the scratch defect position is comprehensively detected, and the defect candidate area containing the confidence score is output. The main defect identification is to identify pits, dirt, uneven coating, and foreign matter; low-confidence defect candidate areas are obtained, and local image enhancement, texture analysis and secondary classification operations are performed on the low-confidence defect candidate areas to identify bubble defects; the recognition results of the defect candidate areas are summarized and annotated images are generated, and the defect type, location and severity information are output to the quality inspection system.

[0006] A second aspect of the present application provides a system for rapid visual defect detection of prismatic power battery casings, the system comprising: a multi-view image acquisition module configured to acquire images of multiple planes and angles of the prismatic power battery casing using a multi-view image acquisition device to obtain a high-resolution multi-view image sequence, the multi-view image acquisition device comprising a plurality of industrial cameras, each disposed in top, oblique, and side view directions, forming a three-dimensional imaging array surrounding the top and sides of the casing;

[0007] An image preprocessing module, configured to preprocess the image sequence and output standardized image data;

[0008] A front-view scratch detection module, which is used to perform front-view scratch detection on the standardized image data, perform fast scratch recognition based on edge features, and output the location and features of scratch defects. The front-view scratch detection is based on a linear structure enhancement algorithm combined with morphological processing to identify slender scratch areas;

[0009] A primary defect recognition module, which is used to use a deep learning model to perform primary defect recognition on the preprocessed image, perform comprehensive defect detection on the scratch defect location, and output a defect candidate area including a confidence score. The primary defect recognition includes identifying pits, dirt, uneven coating, and foreign matter.

[0010] A bubble defect recognition module is used to obtain low-confidence defect candidate areas, perform local image enhancement, texture analysis, and secondary classification operations on the low-confidence defect candidate areas, and identify bubble defects;

[0011] The data output module is used to summarize the recognition results of the defect candidate areas and generate annotated images, and at the same time output the defect type, location and severity information to the quality inspection system.

[0012] One or more technical solutions provided in this application have at least the following technical effects or advantages: A method and system for rapid visual defect detection of prismatic power battery casings, relating to the field of graphics processing technology, obtains a high-resolution multi-view image sequence, outputs standardized image data, performs front-view scratch detection, outputs the scratch defect location and features, outputs defect candidate regions with confidence scores, identifies bubble-like defects, summarizes the recognition results of the defect candidate regions, and generates an annotated image. By fusing multi-view high-resolution image information and combining front-view scratch detection with deep learning primary defect recognition, the system achieves accurate recognition and location of various types of defects on the battery casing surface, including scratches and bubbles, significantly improving detection coverage and accuracy. A secondary recognition mechanism based on confidence scores is introduced to perform texture feature analysis and classification on candidate regions with insufficient confidence in the primary detection phase, effectively filtering for minor defects such as bubbles and improving overall detection sensitivity. By combining geometric-texture feature extraction, deep learning with rule screening, and spatial registration with feature fusion, the system effectively addresses the inaccuracy of traditional detection solutions caused by image distortion, limited viewing angles, or weak defect features. This application solves the problem in the existing technology that due to the lack of multi-view imaging and intelligent defect recognition mechanism, it is impossible to comprehensively, efficiently and accurately detect various types of surface defects of battery casings. It achieves the technical effect of realizing rapid identification and accurate positioning of various defects such as scratches, pits, bubbles, dirt, etc., thereby significantly improving the casing quality control efficiency and automation level in the power battery production process.

[0013] To summarize, this application, by constructing a multi-view industrial camera array and integrating a deep learning recognition model, can achieve high-resolution image acquisition of multiple surfaces and corner areas of the square power battery casing, and perform comprehensive multi-category defect recognition and positioning analysis, reducing missed defects and false detections due to blind spots or insufficient recognition accuracy, avoiding the problems of low efficiency and poor stability of manual visual inspection and poor adaptability of traditional algorithms to complex defects, and can output structured defect information and link with the back-end quality inspection system, thereby improving the degree of automation and accuracy of power battery casing quality inspection, and helping to promote quality traceability and intelligent manufacturing upgrades in the power battery manufacturing process.

[0014] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0016] Figure 1 A schematic flow chart of a method for rapid detection of visual defects in a square power battery casing provided in an embodiment of the present application.

[0017] Figure 2 A schematic diagram of the structure of a rapid detection system for visual defects in a square power battery casing provided in an embodiment of the present application.

[0018] Explanation of the accompanying drawings: multi-view image acquisition module 10, image preprocessing module 20, front visual scratch detection module 30, main defect recognition module 40, bubble defect recognition module 50, data output module 60. DETAILED DESCRIPTION

[0019] The present application provides a method and system for rapid detection of visual defects in square power battery casings, which is used to solve the problems of insufficient visual coverage, low detection accuracy, and weak intelligent recognition capabilities in the existing power battery casing defect detection process, resulting in multiple types of surface defects being easily missed or misjudged, and it is difficult to meet the technical problems of automated quality inspection requirements. The method achieves the technical effect of combining multi-perspective image acquisition with deep learning recognition to achieve efficient, comprehensive, and accurate detection of surface defects such as scratches, pits, and bubbles.

[0020] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0021] It should be noted that the terms "first", "second", etc. in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices.

[0022] Example 1, as Figure 1 As shown, the present application provides a method for rapid detection of visual defects in a square power battery housing, the method comprising:

[0023] S100: Use a multi-view image acquisition device to capture images of multiple surfaces and angles of the square power battery casing to obtain a high-resolution multi-view image sequence. The multi-view image acquisition device includes multiple industrial cameras, which are respectively set in the top view, oblique view and side view directions to form a three-dimensional imaging array around the top and sides of the casing.

[0024] Specifically, the multi-view image acquisition device is used to capture images from multiple planes and angles of the power battery casing, producing high-resolution, multi-view image sequences. To comprehensively detect defects in various locations of the square casing (including the top, edges, and sidewalls), the device constructs a three-dimensional imaging array with a rational spatial layout and complementary viewing angles.

[0025] The multi-view image acquisition device comprises multiple high-resolution industrial cameras, each fixedly positioned at the inspection station in the top, oblique, and side view directions. The top-view camera captures flat images of the housing's top cover. The oblique camera, mounted at an angle to the top surface, captures detailed information about the top edge and corners. The side-view camera acquires images of the sidewalls. This multi-angle spatial arrangement creates a three-dimensional imaging array capable of simultaneously capturing images of multiple critical surfaces of the prismatic battery housing during a single inspection. To minimize image distortion and blind spots, the camera positions, angles, and focal lengths are calibrated and optimized to ensure uniform spatial resolution and geometric alignment accuracy. The system automatically controls the synchronization of each camera according to the inspection cycle, ultimately outputting a multi-view image sequence that is fed into subsequent image processing and intelligent recognition modules for further analysis. This system achieves full-view, no-blind-angle image perception of the prismatic power battery housing, providing high-quality input for subsequent defect detection and significantly improving inspection comprehensiveness and accuracy.

[0026] S200: Preprocessing the image sequence and outputting standardized image data.

[0027] Specifically, the image sequence is subjected to lens distortion correction, image alignment and spatial registration, denoising, enhancement and format unification processing to output standardized image data with uniform size, clarity and color space.

[0028] Furthermore, step S200 in the embodiment of the present application further includes:

[0029] S201: Perform lens distortion correction on the image sequence to correct the geometric distortion caused by industrial camera imaging; S202: Perform image alignment and spatial registration on images from different angles to establish a unified spatial reference coordinate system; S203: Use Gaussian filtering and non-local mean methods to denoise the image; S204: Perform image enhancement operations, including contrast enhancement, edge sharpening and brightness equalization; S205: Convert the image into a predetermined grayscale or color space, and adjust it to a unified resolution and data format to obtain standardized image data.

[0030] It should be understood that to address geometric distortion caused by lens characteristics during the imaging process of industrial cameras, distortion models (such as a pinhole model combined with radial and tangential distortion parameters) are used to geometrically correct the image to restore the object's true spatial structure and edge morphology. This process typically includes camera calibration, distortion parameter estimation, and image remapping. For example, when inspecting metal surface defects, if the camera mounting angle or lens type causes significant barrel distortion at the image edge, the uncorrected image will deform straight scratches and distort the area size, affecting subsequent scratch extraction and defect location. After distortion correction, straight line boundaries in the image are restored to their standard form, ensuring the accuracy of geometric measurement and defect analysis. Camera intrinsic and extrinsic calibration is performed on each captured image frame. Using a pinhole model or wide-angle lens distortion model, radial and tangential distortion are corrected to maintain consistent spatial geometric relationships. To address potential perspective deviations in multi-view images, feature point matching or template alignment techniques are used to spatially align and uniformly scale the image sequence to ensure regional correspondence between images. Image alignment and spatial registration of images from different angles aims to address parallax and positional inconsistencies caused by multi-view imaging, ensuring that the same defect or target in different images has a consistent positional representation within a unified spatial reference coordinate system. This process typically includes feature point extraction, image pairing and matching, transformation matrix estimation (such as a homography or rigid transformation), image resampling, and alignment. For example, when performing multi-view defect inspection on a battery casing, images captured by different cameras may exhibit rotation, translation, or scale differences due to different mounting positions and angles. Without registration, the positions of the same scratch defect in each view will be misaligned, affecting defect fusion judgment and localization accuracy. Image registration maps images from all viewpoints to a unified reference plane, ensuring accurate correspondence between defect areas and providing a reliable foundation for multi-view information fusion and subsequent judgment. Algorithms such as brightness histogram equalization, gamma correction, and adaptive enhancement are used to enhance image contrast and texture detail, improving the visibility of subtle scratches or low-contrast defects. To address potential interference such as salt-and-pepper noise and sensor thermal noise in the captured images, image smoothing is performed using methods such as median filtering, Gaussian filtering, or non-local means (NLM) filtering to preserve edge information while suppressing noise. If the subsequent recognition task is based on grayscale features, grayscale conversion can be performed on the color image. For color texture recognition tasks, color space normalization (e.g., RGB to Lab or HSV) is performed to maintain feature consistency. All images are ultimately scaled or cropped to a standard resolution (e.g., 512×512 or 640×480). This results in a standardized image dataset with consistent structure, uniform quality, and clear texture, which serves as the basic input for subsequent scratch recognition and primary defect detection.

[0031] S300: Performing front-view scratch detection on the standardized image data, executing fast scratch recognition based on edge features, and outputting the scratch defect position and features.

[0032] Specifically, front-view scratch detection is performed on standardized image data, including edge extraction, morphological processing and connected domain analysis, to quickly identify scratch areas with slender structures and directional consistency, extract their feature information such as position, length, direction, and output the scratch defect location and feature data.

[0033] Furthermore, step S300 in the embodiment of the present application further includes:

[0034] S301: Extract the front view image data corresponding to the top area of ​​the battery casing in the multi-view image sequence as the detection input image; S302: Perform edge enhancement processing on the front view image, and use the edge detection operator to extract the linear structure with directionality and continuity in the image to obtain an edge image, and the edge detection operator is a combination of Sobel and Canny; S303: Perform morphological processing on the edge image, and combine the connected domain analysis algorithm to extract slender and directional consistent candidate scratch areas; S304: Perform geometric and texture feature analysis on the candidate scratch areas, including calculating features such as area length, width, grayscale gradient direction consistency, and screening real scratch areas based on thresholds; S305: Output the position information and feature parameters of the real scratch area, including position coordinates, size parameters, and optional confidence scores and defect level labels.

[0035] It should be understood that front-view image data corresponding to the top area of ​​the prismatic power battery casing is extracted from the multi-view image sequence and used as the input image for scratch defect detection. This front-view image covers the critical detection area on the casing top, ensuring complete capture of details such as scratches. Specifically, after the image acquisition system simultaneously acquires image frames from multiple angles, such as the top, left, and right sides of the battery casing, it uses camera calibration parameters or preset spatial positioning information in the image to identify the image frame containing the top area and use it as the input image for subsequent surface defect detection for scratches, pits, and other defects. For example, in an image sequence captured by three industrial cameras, the image frame numbered "Cam_Front" is a front-view image of the battery casing top. The system analyzes the positioning marks or casing structural features contained in this image frame to confirm that it corresponds to the battery top surface. It then selects this image frame as the defect detection input for the deep learning model or image processing algorithm, ensuring that the detection results focus on the critical surface area and improving detection efficiency and accuracy. Edge enhancement processing is performed on the front-view image using a combination of edge detection operators, including the Sobel operator and the Canny operator. First, the Sobel operator is used to extract horizontal and vertical gradient information from the image, highlighting edge details. Subsequently, the Canny operator is combined with non-maximum suppression and double thresholding to filter out linear edge structures with both directionality and continuity, effectively enhancing the recognition of scratch outlines. Morphological processing methods, such as dilation and erosion, are applied to the binary edge image obtained after edge detection to connect broken edge lines and remove isolated noise points. A connected component analysis algorithm is then used to identify and extract all elongated, directional, and connected regions in the image as candidate scratch regions. These regions meet preset length-to-width ratio and directional consistency requirements, making them useful for screening potential scratches. For example, when processing an edge image of the front view of a battery case, the morphological operation yields several thin lines. Using connected component analysis, the system identifies three elongated regions, numbered "C1," "C2," and "C3," each with an aspect ratio of approximately 10:1 or greater and a generally consistent orientation. Based on these characteristics, these regions are considered possible scratch regions and are included in the set of candidate scratch regions for subsequent defect confirmation and classification. A detailed geometric and texture feature analysis is performed on the candidate scratch area. This includes calculating the length and width of the candidate area's circumscribed rectangle to determine its aspect ratio; evaluating the area's size; analyzing the consistency of the grayscale gradient's direction to determine the scratch's direction; and filtering based on preset thresholds (such as aspect ratio thresholds, area thresholds, and directional consistency thresholds) to eliminate non-scratched areas and ultimately identify the true scratch area. The location information and feature parameters of the identified scratch defect area are output. This includes the defect's two-dimensional coordinate location, scratch dimensions (such as length and width), and orientation angle. Optionally, a confidence score and defect grade label are also output for subsequent defect classification and quality inspection.It can quickly and accurately identify and locate scratch defects on the top of the square power battery casing, providing precise data support for subsequent defect processing.

[0036] Furthermore, step S303 of the embodiment of the present application further includes:

[0037] Specifically, a morphological opening operation is first applied to the edge image, and erosion and dilation operations are performed using slender structuring elements to remove noise and connect broken edges. Then, a thinning operation is performed on the processed image to extract an edge skeleton with a single pixel width. Then, a connected domain labeling algorithm is used to identify all connected regions, and the geometric features of each region are calculated, including the aspect ratio of the circumscribed rectangle and the consistency of the main direction. Regions with large aspect ratios and high directional consistency are screened out as candidate scratch regions with slender and consistent directionality for subsequent detection and analysis.

[0038] S303-1: Perform an opening operation on the edge image, wherein the opening operation includes erosion and dilation operations on the image using a slender structuring element; S303-2: Perform a thinning process on the edge map after morphological processing to extract a linear edge skeleton structure with a single pixel width; S303-3: Perform connected region labeling on the thinned image, extract all connected regions and obtain their geometric morphological parameters; S303-4: Calculate the aspect ratio, area and main direction linearity of the circumscribed rectangle of each connected region, perform feature extraction and classification identification on regions with an aspect ratio greater than a preset threshold and high directional consistency, extract scratch candidate regions, and establish a scratch candidate region set.

[0039] It should be understood that the binary edge image obtained after edge detection undergoes a morphological opening operation. This opening operation utilizes a slender structuring element. An erosion operation is first performed on the image to remove isolated noise points and subtle noise, followed by a dilation operation to restore the continuity and slender structure of the edge. This effectively connects broken edge lines, filters out irregular noise, and highlights the slender contours of potential scratches. The edge image after morphological opening is then subjected to a thinning operation. The thinning algorithm shrinks the edge region to a single pixel width, extracting the edge's skeletal linear structure. For example, when processing the edge image of a battery casing image, an opening operation is performed on the image using a horizontal linear structuring element with a length of 15 pixels and a width of 1 pixel. Erosion removes most of the nonlinear speckle noise in the original image. Then, dilation restores the remaining slender scratch edges, forming a clear and continuous outline of the candidate scratch region. This operation significantly improves the accuracy and completeness of scratch extraction in the subsequent connected domain analysis. This step preserves the shape and orientation of the scratch, facilitating subsequent connected domain analysis and accurate identification. Connected region labeling is performed on the refined binary skeleton graph. The system scans all connected pixels in the image, identifies and extracts each independent connected region, and calculates and records its geometric parameters, including area, boundary shape, and outline information, providing basic data for subsequent feature analysis. For each connected region, the aspect ratio, area, and principal direction linearity of its minimum bounding rectangle are calculated. The aspect ratio measures the slenderness of the region, the area is used to exclude small, noisy regions, and the principal direction linearity assesses the directional stability of the region by analyzing grayscale gradients or edge directional consistency. Connected regions with an aspect ratio greater than a preset threshold and high directional consistency are selected as scratch candidate regions. Further feature extraction and classification are performed on these regions, ultimately creating a set of scratch candidate regions for subsequent scratch detection and localization. Regions with an aspect ratio greater than a preset threshold (e.g., >5:1) and high principal direction linearity (e.g., principal axis directional consistency exceeding 0.8) are considered candidate regions with typical scratch morphology. For example, in a battery casing inspection image, the circumscribed rectangle of a connected region is 50 pixels long and 6 pixels wide, with an aspect ratio of approximately 8.3. The main direction of its grayscale distribution aligns with the overall scratch direction, with a linearity of 0.87, and its area falls within a preset range. This region meets the scratch determination criteria and is included in the scratch candidate region set. All regions that meet these criteria are screened to form a preliminary scratch candidate region set, providing target input for subsequent feature extraction and classification recognition, thereby improving the accuracy and robustness of scratch recognition.

[0040] Furthermore, step S303-4 of the embodiment of the present application further includes:

[0041] Specifically, for each connected region, the aspect ratio and area of ​​its minimum circumscribed rectangle are first calculated to characterize the geometric structural characteristics of the region. At the same time, the principal component analysis (PCA) method is used to determine the main direction of the region, and its linearity is evaluated based on this to characterize whether the region has a clear linear arrangement trend. Subsequently, based on preset screening conditions, including whether the aspect ratio is greater than the slenderness threshold, whether the area exceeds the minimum significance threshold, the degree of consistency between the main direction and the expected direction of the scratch (for example, whether the main direction angle deviation is less than the angle threshold), and whether the linear fitting residual is lower than the fitting quality threshold, the above calculation results are subjected to multi-dimensional feature extraction and preliminary classification and identification. Through the above-mentioned conditional judgment, regions with obvious slenderness, directional consistency and good linear structure are extracted as scratch candidate regions, and finally a complete set of scratch candidate regions is established for subsequent defect identification and analysis modules to call.

[0042] S303-4-1: Calculate the aspect ratio, area and main direction linearity of the minimum circumscribed rectangle of the connected domain of each scratch candidate area; S303-4-1-2: Filter the connected areas based on preset threshold conditions, the preset filtering conditions include the aspect ratio being greater than the first threshold, the area being greater than the second threshold, the difference between the main direction angle and the direction of the adjacent area being less than the preset angle threshold, and the linear fitting residual being less than the third threshold; S303-4-1-3: Extract multidimensional feature vectors including geometric features and texture features from the connected areas that meet the filtering conditions, extract the scratch candidate areas, and establish a scratch candidate area set.

[0043] It should be understood that a geometric analysis is performed on the connected domain of each candidate scratch region. First, the aspect ratio and area of ​​its minimum bounding rectangle are calculated to characterize the region's elongation and spatial occupancy. Principal component analysis (PCA) is then used to extract the connected domain's principal direction vectors and calculate their principal direction linearity index to measure whether the region exhibits distinct linear alignment. Based on predefined structural screening criteria, these geometric parameters and directional information are subjected to multiple constraints to screen out suspected scratch regions. These screening criteria include, but are not limited to: an aspect ratio greater than a first threshold (e.g., 3.5), indicating an elongated structure; an area greater than a second threshold (e.g., a number of pixels), ensuring the region's significant presence in the image; and an angle difference between the region's principal direction and that of its adjacent regions less than a preset angle threshold (e.g., 10°), ensuring consistent overall scratch structural orientation. For example, in an image of the top of a battery casing, a connected region with an aspect ratio of 6.2 and an area of ​​78 pixels² differed only 7° from its principal direction with that of adjacent scratch regions, with an average residual error of 1.5 for the fitted line. This area meets all four screening conditions and is therefore retained as a suspected scratch area and included in the candidate scratch area set. This refined screening method based on multiple geometric and directional indicators significantly improves the accuracy and robustness of scratch defect recognition. In addition, the least squares residual of the regional contour fitting line is less than the third threshold to verify the linear fitting quality of the regional edge. For all connected domain areas that meet the above screening conditions, their multi-dimensional feature vectors are further extracted. The feature dimensions include geometric structure features (such as length, width, and circumscribed rectangle angle) and texture features (such as grayscale variance, gradient direction consistency, edge energy distribution, etc.), thereby constructing a scratch candidate area set, providing high-confidence input candidate areas for the subsequent classification and recognition module.

[0044] S400: Use a deep learning model to identify major defects in the preprocessed image, perform comprehensive defect detection on the scratch defect location, and output a defect candidate area including a confidence score. The major defect identification includes identifying pits, dirt, uneven coating, and foreign matter.

[0045] Specifically, the pre-processed standardized image is first input into the main defect recognition module. This module extracts features and classifies various defect types that may exist in the image based on a pre-trained deep learning model (such as an improved convolutional neural network (CNN) or a multi-scale feature fusion network). The model has the ability to perceive tiny features in complex backgrounds and can accurately identify typical main defect types including pits, dirt, uneven coatings, and foreign matter. It also determines the overlap with the scratch candidate area based on the spatial position relationship in the feature map, thereby achieving comprehensive defect detection in scratch-related areas. During the recognition process, the model outputs a candidate detection result for each suspected defect area, including a defect type label, confidence score, and area location coordinates, thereby forming a structured set of defect candidate areas for subsequent confidence screening and multi-category judgment processing.

[0046] Furthermore, step S400 in this embodiment of the present application further includes:

[0047] S401: Input the preprocessed standardized image data into the multi-category target detection deep learning model, which is constructed based on a convolutional neural network; S402: The multi-category target detection deep learning model generates candidate defect areas through multi-layer feature extraction, and classifies each candidate defect area to identify the main defect categories including pits, dirt and foreign matter; S403: Output the category label and the corresponding confidence score for each candidate defect area, and filter the valid defect areas through a preset confidence threshold; S404: Perform fusion judgment on the same defect in multi-view images; S405: Perform comprehensive defect detection on the scratch defect position obtained by the front visual scratch detection, combined with the detection results of the deep learning model, and output a set of defect candidate areas containing scratches and main defects, with attached position and confidence information.

[0048] It should be understood that in step S401, the image data normalized by the image preprocessing module is input into a multi-category object detection deep learning model. This model is built on a modified convolutional neural network (CNN) architecture and possesses multi-scale perception and feature fusion capabilities, enabling it to identify and locate a variety of surface defects in images. The image data normalized by the image preprocessing module is input into a multi-category object detection deep learning model. This model, built on a modified convolutional neural network (CNN) architecture, possesses multi-scale perception and feature fusion capabilities, enabling it to simultaneously capture defect features of varying sizes and shapes, enabling accurate identification and location of a variety of surface defects in the image. For example, when inspecting the surface of a battery casing, this model can effectively identify defects such as pits, dirt, uneven coating, and foreign matter. Regardless of the significant size of the defects, multi-scale feature fusion accurately labels their location and category, significantly improving the comprehensiveness and accuracy of defect detection. In step S402, the model extracts key image features such as spatial, texture, and edge information through a multi-layer convolutional and feature extraction network. This generates multiple candidate defect regions and predicts their category for each candidate region, identifying primary defect types including pits, dirt, uneven coating, and foreign matter. In step S403, each candidate defect region is assigned a corresponding defect category label and confidence score. Low-confidence regions are eliminated based on a preset confidence threshold, retaining only valid, high-confidence defect regions. In step S404, for the same defect identified in multi-view images, the system fuses the candidate regions from different viewpoints through methods such as feature matching and spatial position verification, ultimately determining the final location and category of the defect. For example, if a suspected pit defect is detected on the battery casing surface in both the front and side views, the system merges these candidate regions into a single defect entity based on the spatial coordinates and feature similarity of the defect in the different images. This prevents double counting and improves the accuracy and reliability of defect identification by integrating multi-view information. In step S405, the system integrates the scratch defect locations output by the aforementioned scratch detection module with the candidate results of the main defect recognition model, jointly analyzes and supplements the multi-type defect information in the same area, and achieves comprehensive recognition of typical defects such as scratches, pits, dirt, uneven coating, and foreign matter on the battery casing surface. The final output includes a set of defect candidate areas containing defect categories, location coordinates, and confidence scores, providing basic data support for the subsequent execution of quality inspection strategies. For example, when inspecting battery casings, the system not only identifies the elongated scratch areas on the surface, but also accurately locates the surface pit defects in combination with the deep learning model, forming a complete defect information set, which improves the comprehensiveness and accuracy of defect detection.

[0049] Furthermore, step S403 of the embodiment of the present application further includes:

[0050] S403-1: A set of confidence threshold parameters is set for each type of defect in advance, and the confidence threshold can be flexibly configured according to actual detection requirements; S403-2: For each defect candidate area identified by the deep learning model, a multi-category classification operation is performed, and defect category labels including pits, dirt, uneven coating, and foreign matter and their corresponding confidence scores are output; S403-3: The confidence scores are compared with the preset confidence thresholds corresponding to each type of defect, and candidate areas with confidence higher than their corresponding category thresholds are retained as valid defect areas; S403-4: When there is overlap between candidate areas, the area with the highest confidence is retained based on the non-maximum suppression algorithm NMS; S403-5: Structured defect information results are output, including the location coordinates, defect category label, confidence score and image perspective identifier of each valid defect area.

[0051] It should be understood that for each candidate defect area detected by the deep learning model, the system outputs a corresponding defect category label (such as pits, dirt, uneven coating, foreign matter, etc.) and a corresponding confidence score based on the multi-category classification results. This score quantifies the reliability of the model's judgment that the area belongs to a specific defect category. For example, for critical defects such as pits, a higher confidence threshold (such as 0.8) is set to ensure that only highly reliable detection results are adopted; for relatively minor dirt defects, a lower threshold (such as 0.5) can be set to avoid missing minor stains. By flexibly configuring the confidence threshold, the system can balance detection accuracy and recall to meet quality control requirements in different application scenarios. Subsequently, this confidence score is compared with pre-set confidence thresholds for each defect category, retaining only candidate areas with confidence scores above the threshold for their category as valid defect areas. This filter out uncertain or misjudged detection results and improves the accuracy and credibility of the final output. A set of corresponding confidence threshold parameters is set in advance for each main defect category. The threshold can be flexibly configured and adjusted according to different application scenarios, detection accuracy requirements and actual sample statistical results. For each defect candidate area identified by the deep learning model, a multi-category classification operation is performed to output predicted labels for defect categories such as pits, dirt, uneven coating and foreign matter, and a corresponding confidence score is generated for each label. The above confidence scores are compared one by one with the preset confidence thresholds of each type of defect, and defect candidate areas with confidence higher than their corresponding category thresholds are retained as valid defect areas, thereby eliminating low-confidence or false detection areas and improving detection accuracy. When there is overlap or partial overlap between multiple candidate areas, the non-maximum suppression (NMS) algorithm is further applied to process the overlapping areas, and only the defect areas with the highest confidence scores are retained to avoid repeated labeling or redundant identification. The final output is a structured defect information result, which includes the position coordinates of each valid defect area in the image, the corresponding defect category label, the confidence score value, and the perspective identification of the current image (such as top view, oblique view or side view), providing a basic basis for subsequent defect fusion and quality assessment.

[0052] S500: Obtain a low-confidence defect candidate area, perform local image enhancement, texture analysis, and secondary classification operations on the low-confidence defect candidate area, and identify bubble-type defects.

[0053] Specifically, for defect candidate areas whose confidence level is lower than the preset threshold but still has suspicious features, the system marks them as low-confidence areas and extracts them separately. It then performs local image enhancement processing to enhance the detail contrast and edge structure in the area, so that subsequent analysis is more accurate. Based on the enhanced image, local texture features such as gray-level co-occurrence matrix and local binary pattern (LBP) are further extracted to analyze their texture distribution characteristics and local structural laws. Combined with the extracted texture features, a lightweight secondary classifier is used to re-identify the area, especially for typical features of bubble-type defects such as blurred edges, uneven texture, and local circularity. This allows for effective supplementary recognition of bubble-type defects that were not clearly identified initially, thereby improving the defect recognition integrity and robustness of the overall detection system.

[0054] Furthermore, step S500 in the embodiment of the present application further includes:

[0055] S501: Based on the output of the main defect recognition stage, the candidate defect areas with confidence scores lower than the preset first threshold are screened to form a low-confidence candidate area set; S502: Local image enhancement processing is performed on the low-confidence candidate areas, and the enhancement processing includes local contrast enhancement, edge enhancement, and image sharpening; S503: Texture features are extracted from the enhanced image area, including local binary pattern LBP, gray-level co-occurrence matrix GLCM features and Gabor filter response; S504: The texture features are input into the binary classifier for bubble recognition, and secondary defect recognition is performed, and the identification label and corresponding confidence score of the bubble defect are output; S505: If the corresponding confidence score of the output bubble defect is higher than the second threshold, the current candidate area is determined to be a bubble defect and added to the final defect area set.

[0056] It should be understood that in the defect recognition process of the present invention, for candidate defect areas whose confidence scores are lower than the preset first threshold in the main defect recognition stage, the following operations are specifically performed to identify potential bubble-type defects: S501, first, all candidate areas with insufficient confidence are screened out to form a low-confidence candidate area set; the confidence scores of all candidate defect areas output by the deep learning model are judged, and areas with confidence scores lower than the preset first threshold are screened out. These areas are not included in the main defect detection results due to insufficient scores, but may still contain weak or edge defects that are not accurately identified. Through this screening operation, an independent low-confidence candidate area set is constructed, which provides a target area basis for subsequent local enhancement processing and fine recognition, ensuring the comprehensiveness and reliability of the overall detection results in terms of coverage and recognition accuracy. For example, during the detection process, the confidence scores of some scratch areas are 0.55 and 0.50, both lower than the threshold of 0.6. Therefore, these areas will be classified into the low-confidence candidate area set and await subsequent enhancement and secondary recognition processing, thereby preventing defects from being missed due to uncertainty in the initial recognition and improving the integrity and accuracy of the overall detection. In step S502, local image enhancement is performed on these areas to improve the discernibility of subtle features in the local image by enhancing contrast, edge definition, and overall sharpness. In step S503, representative texture features are extracted from the enhanced image. These include local binary patterns (LBP) to capture fine-grained texture, gray-level co-occurrence matrices (GLCMs) to describe grayscale distribution relationships, and Gabor filter responses to identify texture information of specific directions and scales. In step S504, the extracted texture features are input into a pre-trained bubble defect binary classifier for secondary recognition, outputting a bubble defect label and its corresponding confidence score. The extracted texture features are then input into a pre-trained bubble defect binary classifier for targeted secondary recognition. This classifier, trained on typical bubble defect samples, effectively identifies small circular or translucent areas with specific texture patterns. The input texture features include the local structural distribution reflected by the local binary pattern (LBP), the co-occurrence of pixel grayscales described by the gray-level co-occurrence matrix (GLCM), and the directional texture frequency information revealed by the Gabor filter responses. For each input region, the classifier outputs a label indicating whether it is a bubble defect (e.g., "yes" or "no") and a corresponding confidence score (e.g., 0.92 indicates a high confidence bubble defect). For example, for a candidate region, the texture features extracted after image enhancement exhibit a fine radial texture structure. After input into the classifier, the output is "yes" with a confidence score of 0.87, indicating that the region is classified as a bubble defect with high confidence. This step improves the recognition of weakly visible bubble defects and enhances the system's detection robustness in complex defect environments.S505: If the confidence score is higher than the set second threshold, the candidate area is confirmed as a bubble-type defect and added to the final output defect area set, thereby realizing supplementary detection of bubble defects missed in the main recognition stage. If the bubble defect confidence score output by the binary classifier is higher than the preset second threshold (for example, 0.75), the system determines the candidate area as a bubble-type defect and includes it in the final defect area set, thereby supplementing the bubble defects that were not identified in the main recognition stage due to low confidence. For example, if an image area only obtains a confidence score of 0.6 in the main defect recognition stage and fails the initial screening, but after the binary classifier enhances texture analysis, the confidence score is increased to 0.8, the system will identify it as a valid bubble defect, ensuring that the detection results are more comprehensive and accurate.

[0057] S600: Summarize the recognition results of the defect candidate area and generate an annotated image, and output the defect type, location and severity information to the quality inspection system.

[0058] Specifically, all candidate defect areas that have been screened and classified are aggregated and combined with each area's defect category label, location information, and confidence score to generate clearly labeled defect images, indicating the defect's location and category. At the same time, each defect is assigned a corresponding severity level based on the confidence level and pre-set severity rules. Structured data, including the defect type, specific location coordinates, and severity level, is then synchronously output to the backend quality inspection system, enabling visual display of defect information and supporting subsequent quality management decisions.

[0059] Furthermore, step S600 in the embodiment of the present application further includes:

[0060] S601: Summarize the recognition results of multiple defect candidate areas, where the defect candidate areas include defect type, defect location and defect severity information; S602: Merge spatially overlapping or adjacent defect candidate areas according to a preset overlap threshold to generate a set of non-repeated defect areas; S603: Classify and count the merged defect areas according to the defect type to obtain the number and proportion of each defect category; S604: Grade the severity of defects based on indicators such as the confidence score and area of ​​the defects; S605: Annotate the merged defect areas on the original high-resolution image, use different colors or graphics to identify different defect types, and add text labels of the defect type and severity at the corresponding positions to generate an annotated image; S606: Encapsulate the defect type, defect location and severity information into a structured data format, and upload it to the quality inspection system through a preset communication interface; S607: The quality inspection system receives the defect detection results and annotated images, and automatically triggers an alarm notification for defects whose severity exceeds a preset threshold.

[0061] It should be understood that step S601 first summarizes the identification results of multiple defect candidate areas. These results include information on the type, specific location, and severity of the defect. When summarizing the identification results of multiple defect candidate areas, the system will integrate information such as the defect type (such as scratches, pits, bubbles, etc.), specific spatial location coordinates (such as the pixel coordinates or physical size location of the center point of the top of the shell), and the severity level of the defect (such as minor, medium, and severe) in each area to form a complete defect information list. For example, the system may identify a long, narrow scratch in the upper left corner of the battery shell with a medium severity level; another pit on the right side with a severe severity level; and a bubble defect in the top area with a minor severity level. All of this information will be summarized to facilitate subsequent statistical analysis and quality assessment. In step S602, spatially overlapping or adjacent defect areas are merged based on a preset overlap threshold to eliminate duplication and generate a unique and clear set of defect areas. For spatially overlapping or adjacent defect areas, the system will make a judgment based on a preset overlap threshold (for example, the intersection-over-union ratio of two defect areas exceeds 70%) and merge multiple overlapping or closely located defect areas into a unified defect area, thereby avoiding repeated counting and redundant annotation. For example, if two scratch candidate areas are detected on the surface of the battery casing, they partially overlap in the image and the intersection-over-union ratio reaches 80%, the system will merge the two areas into a larger scratch area, ensuring that each defect in the output defect area set is uniquely and clearly represented, improving the accuracy and readability of the detection results. In step S603, the merged defect areas are classified and counted by defect type, and the number and proportion of defects in each category are calculated to provide data support for subsequent analysis. In step S604, the severity of the defects is graded based on the confidence score of each defect and key indicators such as the defect area. Based on the confidence score of each defect and key indicators such as the defect area, the system will grade the severity of the defects. For example, when the confidence score of a defect is high and the defect area is large, the system will judge it as "serious" and require priority attention and processing; defects with low confidence and small area are classified as "minor" and recorded as minor defects. For example, a pit on the battery casing with a confidence score of 0.95 and an area of ​​more than 50 square millimeters will be marked as a "serious defect", while dirt with a confidence score of 0.6 and an area of ​​only 5 square millimeters will be judged as a "minor defect", thereby achieving scientific and reasonable defect management and quality control.Step S605 visually annotates the merged defect areas on the original high-resolution image, using different colors or shapes to identify different defect types. Text labels are added to the corresponding locations to display the defect category and severity level, generating a clear annotated image. On the original high-resolution image, the merged defect areas are visually annotated, using different colors or shapes to distinguish different types of defects. For example, a red frame is used to identify pits, a blue circle is used to identify dirt, and a yellow triangle is used to identify uneven coating. Text labels are added next to each annotated area to display the defect category name and severity level, such as "Pit - Severe" or "Dirt - Minor." This generates an intuitive and informative annotated image, making it easier for quality inspectors to quickly identify and judge the defect situation. For example, on the battery casing image, a red rectangular frame with the text "Pit - Severe" appears in the upper left corner, and "Dirt - Minor" is labeled next to the blue circle on the right, improving the readability of the defect detection results and the efficiency of on-site application. In step S606, information such as the defect type, location, and severity is encapsulated into structured data and uploaded to the quality inspection system via a pre-defined communication interface, enabling real-time data synchronization and management. Key information, such as the detected defect type, specific location coordinates, and severity, is encapsulated according to a pre-defined data structure into a standardized structured data format (such as JSON or XML). This data is then uploaded to the quality inspection system in real time via a pre-defined communication interface (e.g., TCP / IP, HTTP API, or industrial fieldbus), enabling instant synchronization and centralized management of defect data. For example, if an "uneven coating - medium severity" defect is detected on a battery casing, the system encapsulates the defect type, specific coordinates in the image, and severity, and sends this data to the quality inspection platform in real time. This ensures that quality inspectors have access to the latest defect information, facilitating subsequent tracking, processing, and quality control. Finally, in step S607, the quality inspection system automatically identifies defects with a severity exceeding a pre-set threshold based on the received defect detection results and annotated images, triggering an alarm notification to ensure timely response and resolution.

[0062] In summary, the embodiments of the present application have at least the following technical effects:

[0063] This application uses a preprocessing method that combines image edge enhancement, morphological processing and connected domain analysis to determine scratch candidate areas with directional and slender features, and constructs a multi-stage defect detection framework including main defect identification, bubble supplementary identification and result visualization output.

[0064] By integrating a deep learning-based multi-category object detection model with traditional texture feature analysis algorithms, we achieve high-precision identification and screening of multiple defect types, including pits, dirt, foreign matter, and bubbles. Combining a multi-view defect fusion strategy with a dynamic confidence threshold mechanism improves recognition accuracy and robustness, enabling structured output of defect type, location, and severity, and enabling real-time interaction with quality inspection systems.

[0065] Example 2, based on the same inventive concept as the method for rapid detection of visual defects of a square power battery housing in the above embodiment, Figure 2 As shown, the present application provides a system for rapid visual defect detection of square power battery housings. The system and method embodiments in the present application are based on the same inventive concept. The system includes:

[0066] A multi-view image acquisition module 10 is configured to acquire images of multiple planes and angles of the prismatic power battery housing using a multi-view image acquisition device to obtain a high-resolution multi-view image sequence. The multi-view image acquisition device includes multiple industrial cameras, each positioned in top, oblique, and side view directions, to form a three-dimensional imaging array surrounding the top and sides of the housing.

[0067] An image preprocessing module 20, configured to preprocess the image sequence and output standardized image data;

[0068] A front-view scratch detection module 30 is configured to perform front-view scratch detection on the standardized image data, perform fast scratch recognition based on edge features, and output the location and features of scratch defects. The front-view scratch detection is based on a linear structure enhancement algorithm combined with morphological processing to identify slender scratch areas.

[0069] A primary defect recognition module 40 is configured to use a deep learning model to perform primary defect recognition on the preprocessed image, perform comprehensive defect detection on the scratch defect location, and output a defect candidate region including a confidence score. The primary defect recognition includes identifying pits, dirt, uneven coating, and foreign matter.

[0070] A bubble defect recognition module 50 is used to obtain low-confidence defect candidate areas, perform local image enhancement, texture analysis, and secondary classification operations on the low-confidence defect candidate areas, and identify bubble defects;

[0071] The data output module 60 is used to summarize the recognition results of the defect candidate areas and generate annotated images, and at the same time output the defect type, location and severity information to the quality inspection system.

[0072] It should be noted that the order in which the embodiments of the present application are presented is for illustrative purposes only and does not necessarily represent the superiority or inferiority of the embodiments. Furthermore, the foregoing descriptions of specific embodiments of this specification are provided. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential sequence shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

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

[0074] This specification and drawings are merely illustrative of the present application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Obviously, those skilled in the art may make various modifications and variations to this application without departing from the scope of this application. Thus, this application is intended to include such modifications and variations as fall within the scope of this application and its equivalents.

Claims

1. A method for rapid detection of visual defects in square power battery casings, characterized in that: The method comprises: S100. Use a multi-view image acquisition device to acquire images of multiple surfaces and angles of the prismatic power battery housing to obtain a high-resolution multi-view image sequence. The multi-view image acquisition device includes multiple industrial cameras, each positioned in top, oblique, and side views, to form a three-dimensional imaging array surrounding the top and sides of the housing. S200, preprocessing the image sequence and outputting standardized image data; S300, performing front-view scratch detection on the standardized image data, performing fast scratch recognition based on edge features, and outputting the scratch defect location and features; S400, using a deep learning model to perform major defect recognition on the preprocessed image, performing comprehensive defect detection on the scratch defect location, and outputting a defect candidate region including a confidence score, wherein the major defect recognition includes identifying pits, dirt, and foreign matter; S500: Obtain a low-confidence defect candidate region, perform local image enhancement, texture analysis, and secondary classification operations on the low-confidence defect candidate region, and identify bubble-type defects. Identifying bubble-type defects includes: Based on the output of the main defect recognition stage, the defect candidate areas with confidence scores lower than the preset first threshold are screened to form a low-confidence candidate area set. Performing local image enhancement processing on the low confidence candidate area, wherein the enhancement processing includes local contrast enhancement, edge enhancement, and image sharpening, Extract texture features from the enhanced image area, including local binary pattern LBP, gray level co-occurrence matrix GLCM features and Gabor filter response, The texture features are input into a binary classifier for bubble recognition, secondary defect recognition is performed, and the identification label of the bubble defect and the corresponding confidence score are output. If the confidence score corresponding to the output bubble-type defect is higher than the second threshold, the current candidate area is determined to be a bubble-type defect and added to the final defect area set; S600: Summarize the recognition results of the defect candidate area and generate a labeled image, and output the defect type, location and severity information to the quality inspection system.

2. A method for rapid detection of visual defects of a square power battery casing according to claim 1, characterized in that: The preprocessing of the image sequence to output standardized image data includes: Perform lens distortion correction on image sequences to correct geometric distortion caused by industrial camera imaging; Perform image alignment and spatial registration on images from different angles to establish a unified spatial reference coordinate system; The image is denoised using Gaussian filtering and non-local mean methods; Perform image enhancement operations, including contrast enhancement, edge sharpening, and brightness equalization; The images are uniformly converted into a predetermined grayscale or color space and adjusted to a uniform resolution and data format to obtain standardized image data.

3. The method for rapid detection of visual defects of a square power battery casing according to claim 1, characterized in that: The method of performing front-view scratch detection on the standardized image data, performing fast scratch recognition based on edge features, and outputting the scratch defect location and features includes: S301, extracting front view image data corresponding to the top area of ​​the battery casing from the multi-view image sequence as a detection input image; S302, performing edge enhancement processing on the front view image, using an edge detection operator to extract linear structures with directionality and continuity in the image to obtain an edge image, wherein the edge detection operator is a combination of Sobel and Canny; S303, performing morphological processing on the edge image, and extracting candidate scratch regions that are elongated and have consistent directionality in combination with a connected domain analysis algorithm; S304, performing geometric and texture feature analysis on the candidate scratch regions, including calculating region length, width, and grayscale gradient directional consistency features, and screening real scratch regions based on a threshold; S305 : Outputting the position information and characteristic parameters of the real scratch area, including position coordinates, size parameters, and optional confidence score and defect grade label.

4. A method for rapid detection of visual defects of a square power battery casing according to claim 3, characterized in that: The morphological processing of the edge image and the extraction of slender candidate scratch regions with consistent directionality in combination with a connected domain analysis algorithm include: S303-1. Performing an opening operation on the edge image, wherein the opening operation includes performing erosion and dilation operations on the image using a slender structure element; S303-2, performing thinning processing on the edge image after morphological processing to extract a linear edge skeleton structure with a single pixel width; S303-3, performing connected region labeling on the thinned image, extracting all connected regions and obtaining their geometric parameters; S303-4. Calculate the aspect ratio, area, and main direction linearity of the circumscribed rectangle of each connected region, perform feature extraction and classification recognition on the calculation results according to preset screening conditions, extract scratch candidate regions, and establish a scratch candidate region set.

5. A method for rapid detection of visual defects of a square power battery casing according to claim 4, characterized in that: The method of calculating the aspect ratio, area, and main direction linearity of the circumscribed rectangle of each connected region, performing feature extraction and classification recognition on the calculation results according to preset screening conditions, extracting scratch candidate regions, and establishing a scratch candidate region set includes: For each connected region of the scratch candidate area, the aspect ratio, area and main direction linearity of its minimum bounding rectangle are calculated; Filter connected areas based on preset threshold conditions, where the preset screening conditions include an aspect ratio greater than a first threshold, an area greater than a second threshold, a difference between the main direction angle and the direction of the adjacent area less than a preset angle threshold, and a linear fitting residual less than a third threshold; Multidimensional feature vectors including geometric features and texture features are extracted from connected regions that meet the screening conditions, scratch candidate regions are extracted, and a scratch candidate region set is established.

6. A method for rapid detection of visual defects of a square power battery casing according to claim 1, characterized in that: The deep learning model is used to identify the main defects of the preprocessed image, and a comprehensive defect detection is performed on the scratch defect location, and a defect candidate area including a confidence score is output. The main defect identification is to identify pits, dirt, and foreign matter, including: Inputting the preprocessed standardized image data into a multi-category object detection deep learning model, wherein the multi-category object detection deep learning model is built based on a convolutional neural network; The multi-category target detection deep learning model generates candidate defect areas through multi-layer feature extraction, and classifies each candidate defect area to identify the main defect categories including pits, dirt and foreign matter; Output the category label and corresponding confidence score for each candidate defect area, and filter the valid defect areas by pre-set confidence threshold; Perform fusion judgment on the same defect in multi-view images; The scratch defect positions obtained by the front visual scratch detection are combined with the detection results of the deep learning model to perform comprehensive defect detection, and output a set of defect candidate areas containing scratches and main defects, along with location and confidence information.

7. A method for rapid detection of visual defects in a square power battery housing according to claim 6, characterized in that: Outputting a category label and a corresponding confidence score for each candidate defect area and screening valid defect areas using a preset confidence threshold includes: A set of confidence threshold parameters is pre-set for each type of defect, and the confidence threshold can be flexibly configured according to actual detection requirements; For each defect candidate area identified by the deep learning model, a multi-category classification operation is performed to output defect category labels including pits, dirt, and foreign matter, as well as their corresponding confidence scores. Comparing the confidence score with the preset confidence threshold corresponding to each type of defect, and retaining candidate areas with confidence scores higher than the corresponding category threshold as valid defect areas; When there is overlap between candidate regions, the region with the highest confidence is retained based on the non-maximum suppression algorithm NMS; Output structured defect information results, including the location coordinates of each valid defect area, defect category label, confidence score and image view identification.

8. The method for rapid detection of visual defects of a square power battery casing according to claim 1, characterized in that: The process of aggregating the recognition results of the defect candidate areas and generating annotated images, while outputting the defect type, location, and severity information to the quality inspection system, includes: Summarize the recognition results of multiple defect candidate areas, wherein the defect candidate areas include defect type, defect location and defect severity information; Merge spatially overlapping or adjacent defect candidate areas according to a preset overlap threshold to generate a set of non-repeated defect areas; Classify and count the merged defect areas according to defect type to obtain the number and proportion of each defect category; Defect severity is graded based on the defect confidence score and area index; Mark the merged defect area on the original high-resolution image, use different colors or graphics to identify different defect types, and add text labels of defect type and severity at the corresponding positions to generate a marked image; Encapsulate defect type, defect location, and severity information into a structured data format and upload it to the quality inspection system through a preset communication interface; The quality inspection system receives defect detection results and annotated images, and automatically triggers alarm notifications for defects whose severity exceeds a preset threshold.

9. A rapid detection system for visual defects of square power battery casings, characterized in that: The system comprises: A multi-view image acquisition module, which uses a multi-view image acquisition device to acquire images of multiple planes and angles of the prismatic power battery housing to obtain a high-resolution multi-view image sequence. The multi-view image acquisition device includes multiple industrial cameras, which are respectively set in the top view, oblique view, and side view directions to form a three-dimensional imaging array around the top and sides of the housing; An image preprocessing module, configured to preprocess the image sequence and output standardized image data; A front vision scratch detection module, configured to perform front vision scratch detection on the standardized image data, perform fast scratch recognition based on edge features, and output the location and features of scratch defects; A primary defect recognition module, which is used to use a deep learning model to identify primary defects in preprocessed images, perform comprehensive defect detection on the scratch defect location, and output defect candidate areas including confidence scores. The primary defect recognition includes identifying pits, dirt, uneven coating, and foreign matter. A bubble defect recognition module is used to obtain low-confidence defect candidate areas, perform local image enhancement, texture analysis, and secondary classification operations on the low-confidence defect candidate areas, and identify bubble defects. Identifying bubble defects includes: Based on the output of the main defect recognition stage, the defect candidate areas with confidence scores lower than the preset first threshold are screened to form a low-confidence candidate area set. Performing local image enhancement processing on the low confidence candidate area, wherein the enhancement processing includes local contrast enhancement, edge enhancement, and image sharpening, Extract texture features from the enhanced image area, including local binary pattern LBP, gray level co-occurrence matrix GLCM features and Gabor filter response, The texture features are input into a binary classifier for bubble recognition, secondary defect recognition is performed, and the identification label of the bubble defect and the corresponding confidence score are output. If the confidence score corresponding to the output bubble-type defect is higher than the second threshold, the current candidate area is determined to be a bubble-type defect and added to the final defect area set; The data output module is used to summarize the recognition results of the defect candidate areas and generate annotated images, and at the same time output the defect type, location and severity information to the quality inspection system.

Citation Information

Patent Citations

  • Battery shell appearance defect image processing method and device

    CN116228684A

  • Method for size measurement and appearance detection of O-shaped ring

    CN119919410A