Nickel plate internal defect automatic detection method and system based on infrared color image

By using infrared color imaging and deep learning semantic segmentation technology, the problems of automation and accuracy in nickel plate defect detection have been solved, realizing non-destructive and automated nickel plate quality inspection, which is applicable to high-end manufacturing fields such as aerospace, electronic components and new energy batteries.

CN122175908APending Publication Date: 2026-06-09LANZHOU UNIVERSITY OF TECHNOLOGY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LANZHOU UNIVERSITY OF TECHNOLOGY
Filing Date
2026-03-04
Publication Date
2026-06-09

Smart Images

  • Figure CN122175908A_ABST
    Figure CN122175908A_ABST
Patent Text Reader

Abstract

This invention discloses an automatic detection method and system for internal defects in nickel plates based on infrared color images, belonging to the field of metal material defect detection technology. The method includes: acquiring an infrared image of the nickel plate to be detected and determining whether it is an infrared Rainbow pseudo-color image; processing it using a pre-trained YOLO semantic segmentation model to output a nickel plate region mask and a hot circle region mask; if the ratio of the nickel plate pixel area to the total pixel area of ​​the image is greater than or equal to a preset threshold, performing hot circle contour extraction, noise contour removal, and thermal index filtering on the hot circle region mask, classifying it into complete hot circles and incomplete hot circles, calculating the pixel area ratio of complete hot circles, and generating standardized detection results. This application improves the automation and accuracy of nickel plate defect detection by combining deep learning semantic segmentation and multi-dimensional feature verification, and can be widely applied to nickel plate quality control in high-end manufacturing fields.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of metal material defect detection technology, and in particular to an automatic detection method and system for internal defects of nickel plates based on infrared color images. Background Technology

[0002] Nickel plates, as an important industrial metal material, are widely used in high-end manufacturing fields such as aerospace, electronic components, and new energy batteries. Their internal defects (such as pores, cracks, and inclusions) directly affect the mechanical properties and service life of the products. Therefore, strict quality testing of nickel plates is a key link in industrial production.

[0003] In the prior art, Chinese patent CN120801425A discloses a method for detecting internal defects in a nickel plate, including the following steps: S100: Dividing the nickel plate array into several test areas; S200: Heating the test area on one side of the nickel plate using a heating device, while simultaneously capturing a video of the temperature distribution change in that area on the other side of the nickel plate using an infrared camera; S300: Repeating step S200 to capture the temperature distribution change video of all test areas, and then stitching all the temperature distribution change videos together according to the positions of several test areas to obtain a temperature distribution video of the entire nickel plate; S400: Analyzing the temperature distribution video of the entire nickel plate using image processing methods to determine the location and size of internal defects in the nickel plate.

[0004] However, the splicing process of the above-mentioned existing technologies is prone to positional deviations, and the image processing relies only on basic temperature distribution analysis, resulting in low accuracy in identifying hot zone features. Manual assistance is required to judge defects, and the automation and accuracy of nickel plate defect detection need to be improved. Summary of the Invention

[0005] This application provides an automatic detection method and system for internal defects in nickel plates based on infrared color images, which addresses the problem that the automation and accuracy of nickel plate defect detection in the prior art need to be improved.

[0006] On the one hand, this application provides an automatic detection method for internal defects in nickel plates based on infrared color images, including the following steps: Step 1: Obtain an infrared image of the nickel plate to be tested.

[0007] Step 2: Determine whether the infrared image is an infrared Rainbow pseudo-color image. If not, output a detection failure message and terminate the detection; if yes, proceed to Step 3.

[0008] Step 3: After preprocessing, the infrared Rainbow pseudo-color image is input into the pre-trained YOLO semantic segmentation model, and the model outputs the nickel plate region mask and the hot circle region mask through forward inference.

[0009] Step 4: Calculate the nickel plate pixel area based on the nickel plate region mask. If the ratio of the nickel plate pixel area to the total pixel area of ​​the image is less than a preset threshold, output a detection failure message and terminate the detection. If the ratio is greater than or equal to the preset threshold, proceed to step 5.

[0010] Step 5: Extract the thermal circle contour, remove noise contours, and filter the thermal index of the thermal circle region mask to obtain the effective thermal circle contour.

[0011] Step 6: Calculate the roundness of the effective hot circle contour. Based on the roundness threshold, divide the effective hot circle contour into complete hot circles and incomplete hot circles. Count the number of complete hot circles and the number of incomplete hot circles. Calculate the pixel area ratio of complete hot circles and generate standardized detection results.

[0012] In one possible implementation, step two, determining whether the infrared image is an infrared Rainbow pseudo-color image, includes: S21, determine whether the infrared image satisfies the condition of being non-empty and having 3 channels. If not, the infrared image is not an infrared Rainbow pseudo-color image; if so, proceed to S22.

[0013] S22, the infrared image is split into three single-channel images: B, G, and R.

[0014] S23, calculate the mean of the R channel image and the mean of the B channel image respectively.

[0015] S24. If the ratio of the mean value of the R channel image to the mean value of the B channel image is less than or equal to a preset ratio threshold, then the infrared image is not an infrared Rainbow pseudo-color image; if it is greater than the preset ratio threshold, then the infrared image is an infrared Rainbow pseudo-color image.

[0016] In one possible implementation, step three, the preprocessing includes normalization, size adjustment, and channel dimension adjustment.

[0017] In one possible implementation, the pre-training process of the YOLO semantic segmentation model in step three is as follows: S301. Construct a dataset of infrared Rainbow pseudo-color images of nickel plates containing different defect types, shooting angles, and lighting conditions. Each image in the dataset is labeled with mask labels for the nickel plate region and the hot circle region.

[0018] S302 uses the YOLOv8-seg model as the basic network architecture, and sets the input size, optimizer, initial learning rate, and weight decay coefficient.

[0019] S303 uses a weighted sum of cross-entropy loss and Dice loss as the loss function to iteratively train the YOLOv8-seg model until the mask intersection-union ratio on the validation set is greater than 0.95, at which point training stops and a pre-trained YOLO semantic segmentation model is obtained.

[0020] In one possible implementation, in step four, the preset threshold value ranges from 0.4 to 0.6, and the preset threshold is obtained by statistical calibration of at least 1000 standard nickel plate infrared images.

[0021] In one possible implementation, step five includes: S51, extract the hot circle contour from the hot circle region mask to obtain several hot circle candidate contours.

[0022] S52, calculate the pixel area of ​​each hot circle candidate contour, and remove hot circle candidate contours that are smaller than the preset area threshold to achieve noise contour removal.

[0023] S53, for the remaining candidate thermal circles after noise contour removal, extract the region of interest corresponding to the infrared image based on the boundary rectangle of the contour, use the difference between the mean of the R channel and the mean of the B channel of the region of interest as the thermal index, remove candidate thermal circles with thermal index less than the preset thermal threshold, realize thermal index screening, and obtain effective thermal circle contours.

[0024] In one possible implementation, step six includes: S61, calculate the roundness of the effective thermal circle profile using the roundness formula.

[0025] S62, set a first roundness threshold and a second roundness threshold, determine the effective hot circle contour with roundness greater than the first roundness threshold as a complete hot circle, determine the effective hot circle contour with roundness greater than the second roundness threshold and less than or equal to the first roundness threshold as a defective hot circle, and remove the effective hot circle contour with roundness less than or equal to the second roundness threshold.

[0026] S63 counts the number of complete and incomplete hot circles, calculates the ratio of the sum of the pixel areas of all complete hot circles to the pixel area of ​​the nickel plate, i.e., the percentage of pixel area of ​​complete hot circles, and generates standardized test results.

[0027] On the one hand, this application provides an automatic detection system for internal defects of nickel plates based on infrared color images, which adopts the above-mentioned automatic detection method for internal defects of nickel plates based on infrared color images, including: an image acquisition module, a legality verification module, a semantic segmentation module, a nickel plate integrity judgment module, a thermal circle analysis module, and a result output module.

[0028] The image acquisition module is configured to acquire an infrared image of the nickel plate to be inspected.

[0029] The legality verification module is configured to: determine whether the infrared image is an infrared Rainbow pseudo-color image; if not, output a detection failure message and terminate the detection; if yes, transmit the infrared Rainbow pseudo-color image to the semantic segmentation module.

[0030] The semantic segmentation module is configured to: input the pre-processed infrared Rainbow pseudo-color image into a pre-trained YOLO semantic segmentation model, and output the nickel plate region mask and the hot circle region mask through forward inference of the model.

[0031] The nickel plate integrity judgment module is configured to: calculate the nickel plate pixel area based on the nickel plate region mask; if the ratio of the nickel plate pixel area to the total pixel area of ​​the image is less than a preset threshold, output a detection failure message and terminate the detection; if the ratio is greater than or equal to the preset threshold, transmit the thermal circle region mask to the thermal circle analysis module.

[0032] The thermal circle analysis module is configured to extract the thermal circle contour, remove noise contours, and filter thermal indexes from the thermal circle region mask to obtain an effective thermal circle contour.

[0033] The result output module is configured to: calculate the roundness of the effective hot circle contour, divide the effective hot circle contour into complete hot circles and incomplete hot circles according to the roundness threshold, count the number of complete hot circles and the number of incomplete hot circles, calculate the pixel area ratio of complete hot circles, and generate standardized detection results.

[0034] In one possible implementation, the automatic detection system for internal defects in nickel plates based on infrared color images also includes a model storage module.

[0035] The model storage module is used to store the ONNX format files of the pre-trained YOLO semantic segmentation model.

[0036] In one possible implementation, the automatic detection system for internal defects of nickel plates based on infrared color images also includes an anomaly processing module.

[0037] The exception handling module is used to receive the detection failure information from the legality verification module and the nickel plate integrity judgment module and terminate the detection.

[0038] The automatic detection method and system for internal defects of nickel plates based on infrared color images in this application have the following advantages: The detection process utilizes infrared thermal imaging technology, eliminating the need for direct contact with the nickel plate and preventing scratches or contamination of its surface. No pre- or post-processing steps are required. By combining deep learning semantic segmentation with multi-dimensional feature verification—specifically, the YOLO semantic segmentation model in step three, and the infrared Rainbow pseudo-color image judgment in step two, the area ratio verification in step four, the thermal circle contour extraction and rejection in step five, and the roundness analysis in step six—the automation and accuracy of nickel plate defect detection are significantly improved, making it widely applicable to quality control of nickel plates in high-end manufacturing.

[0039] This technology is the first to combine infrared thermal imaging, deep learning semantic segmentation, and multi-dimensional feature verification, filling a gap in existing technology and providing a new technical path for nickel plate defect detection. It promotes the technological upgrade of nickel plate quality inspection from "traditional contact and manual interpretation" to "non-contact, non-destructive, automated, and precise detection".

[0040] The proposed ONNX format file for storing pre-trained YOLO semantic segmentation models can be quickly loaded and inferred using the DNN deep learning module of the OpenCV computer vision library, without relying on complex deep learning frameworks and expensive dedicated equipment. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 This is a flowchart illustrating the automatic detection method for internal defects of nickel plates based on infrared color images, provided in an embodiment of this application. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0044] like Figure 1 As shown in the figure, this application provides an automatic detection method for internal defects in nickel plates based on infrared color images, including the following steps: Step 1: Obtain an infrared image of the nickel plate to be tested.

[0045] Step 2: Determine whether the infrared image is an infrared Rainbow pseudo-color image. If not, output a detection failure message and terminate the detection; if yes, proceed to Step 3.

[0046] Step 3: After preprocessing, the infrared Rainbow pseudo-color image is input into the pre-trained YOLO semantic segmentation model, and the model outputs the nickel plate region mask and the hot circle region mask through forward inference.

[0047] Step 4: Calculate the nickel plate pixel area based on the nickel plate region mask. If the ratio of the nickel plate pixel area to the total pixel area of ​​the image is less than a preset threshold, output a detection failure message and terminate the detection. If the ratio is greater than or equal to the preset threshold, proceed to step 5.

[0048] Step 5: Extract the thermal circle contour, remove noise contours, and filter the thermal index of the thermal circle region mask to obtain the effective thermal circle contour.

[0049] Step 6: Calculate the roundness of the effective hot circle contour. Based on the roundness threshold, divide the effective hot circle contour into complete hot circles and incomplete hot circles. Count the number of complete hot circles and the number of incomplete hot circles. Calculate the pixel area ratio of complete hot circles and generate standardized detection results.

[0050] Specifically, in this embodiment, in step one, an infrared image of the nickel plate to be inspected is acquired using an infrared camera. The image format is an RGB three-channel 8-bit image, stored in cv::Mat format. In actual industrial scenarios, the infrared camera can be connected to the inspection system via an image acquisition card to achieve real-time image acquisition and transmission.

[0051] For example, in step two, determining whether the infrared image is an infrared Rainbow pseudo-color image includes: S21, determine whether the infrared image satisfies the condition of being non-empty and having 3 channels. If not, the infrared image is not an infrared Rainbow pseudo-color image; if so, proceed to S22.

[0052] S22, the infrared image is split into three single-channel images: B, G, and R.

[0053] S23, calculate the mean of the R channel image and the mean of the B channel image respectively.

[0054] S24. If the ratio of the mean value of the R channel image to the mean value of the B channel image is less than or equal to a preset ratio threshold, then the infrared image is not an infrared Rainbow pseudo-color image; if it is greater than the preset ratio threshold, then the infrared image is an infrared Rainbow pseudo-color image.

[0055] Specifically, in this embodiment, in S22, the cv::split function is called to split the infrared image into three single-channel images: B, G, and R, to obtain the channel vector ch, where ch[0] is the B channel image, ch[1] is the G channel image, and ch[2] is the R channel image.

[0056] In S23, the cv::mean function is called to calculate the pixel mean of the R channel image and the B channel image respectively, i.e. meanR=mean(ch[2])[0], meanB=mean(ch[0])[0].

[0057] In step S24, based on the characteristics of infrared Rainbow pseudo-color images, the R-channel pixel values ​​corresponding to high-temperature regions are significantly higher than the B-channel pixel values. Therefore, a judgment condition is set where the ratio of the mean R-channel image value to the mean B-channel image value (meanR / meanB) is greater than 1.15 (this threshold is obtained through statistical calibration of 5000 standard infrared Rainbow images and 2000 non-infrared images, ensuring a recognition accuracy greater than 99%). If the infrared image is deemed a true infrared Rainbow pseudo-color image, it is not; a detection failure message is output, and the detection process is terminated.

[0058] For example, in step three, the preprocessing includes normalization, size adjustment, and channel dimension adjustment.

[0059] Specifically, in this embodiment, the normalization process includes: normalizing the pixel values ​​of the infrared Rainbow pseudo-color image to the [0,1] interval, with a normalization coefficient of 1.0 / 255.0.

[0060] The resizing process includes adjusting the normalized image to a fixed size of 640×640, which is the input size during model training to ensure inference accuracy.

[0061] Channel dimension adjustment includes: converting the BGR channel to the RGB channel using the swapRB parameter (set to true) of the cv::dnn::blobFromImage function.

[0062] For example, in step three, the pre-training process of the YOLO semantic segmentation model is as follows: S301. Construct a dataset of infrared Rainbow pseudo-color images of nickel plates containing different defect types, shooting angles, and lighting conditions. Each image in the dataset is labeled with mask labels for the nickel plate region and the hot circle region.

[0063] S302 uses the YOLOv8-seg model as the basic network architecture, and sets the input size, optimizer, initial learning rate, and weight decay coefficient.

[0064] S303 uses a weighted sum of cross-entropy loss and Dice loss as the loss function to iteratively train the YOLOv8-seg model until the mask intersection-union ratio on the validation set is greater than 0.95, at which point training stops and a pre-trained YOLO semantic segmentation model is obtained.

[0065] Specifically, in this embodiment, in S302, the input size is set to 640×640, the optimizer is SGD, the initial learning rate is 0.01, and the weight decay coefficient is 0.0005.

[0066] In this embodiment, after obtaining the pre-trained YOLO semantic segmentation model, the model is saved as an ONNX format file. The ONNX file is read using the cv::dnn::readNetFromONNX function to initialize the deep learning network net. At the same time, the computation backend of the network is set to DNN_BACKEND_OPENCV and the target computing device is set to DNN_TARGET_CPU to ensure that the model can run efficiently on general-purpose hardware.

[0067] After preprocessing, the infrared Rainbow pseudo-color image is input into the pre-trained YOLO semantic segmentation model (i.e., deep learning network net). The net.forward function is called to perform forward inference, and two output branch results outs[0] and outs[1] are obtained. Outs[0] is the nickel plate region mask (the pixel value is 1 to represent the nickel plate region and 0 to represent the background region), and outs[1] is the hot circle region mask (the pixel value is 1 to represent the hot circle region and 0 to represent the non-hot circle region).

[0068] For example, in step four, the preset threshold value ranges from 0.4 to 0.6, and the preset threshold is obtained by statistical calibration of at least 1,000 standard nickel plate infrared images.

[0069] Specifically, in this embodiment, in step four, the cv::countNonZero function is called to count the number of pixels with a value of 1 in the nickel plate area mask outs[0], which is the nickel plate pixel area nickelArea; at the same time, the total pixel area imgArea of ​​the input image is calculated as image.rows×image.cols.

[0070] The ratio of the nickel plate pixel area to the total pixel area of ​​the image is calculated as ratio = nickelArea / imgArea. In this embodiment, a preset threshold of 0.4 is set (this threshold is obtained by statistical analysis of 1000 complete nickel plate images and 500 incomplete nickel plate images; when ratio ≥ 0.4, the nickel plate is considered complete). If ratio < 0.4, an error message "nickel plate incomplete" is output and the detection is terminated; if ratio ≥ 0.4, the nickel plate is considered complete, and the process proceeds to step five.

[0071] For example, step five includes: S51, extract the hot circle contour from the hot circle region mask to obtain several hot circle candidate contours.

[0072] S52, calculate the pixel area of ​​each hot circle candidate contour, and remove hot circle candidate contours that are smaller than the preset area threshold to achieve noise contour removal.

[0073] S53, for the remaining candidate thermal circles after noise contour removal, extract the region of interest corresponding to the infrared image based on the boundary rectangle of the contour, use the difference between the mean of the R channel and the mean of the B channel of the region of interest as the thermal index, remove candidate thermal circles with thermal index less than the preset thermal threshold, realize thermal index screening, and obtain effective thermal circle contours.

[0074] Specifically, in this embodiment, in step five, the contour of the hot circle region mask outs[1] is extracted, the cv::findContours function is called, the contour retrieval mode is set to RETR_EXTERNAL (only the outermost contour is extracted), the contour approximation method is CHAIN_APPROX_SIMPLE (compress contour points), and the hot circle candidate contour set contours (i.e., several hot circle candidate contours) is obtained.

[0075] Traverse each candidate hot circle contour and call the cv::contourArea function to calculate the pixel area of ​​each candidate hot circle contour. If the area is less than 150 (the preset area threshold is an empirical threshold for noise contours. Through a large number of experiments, contours with an area less than 150 are all environmental noise or image noise), then the candidate hot circle contour is directly removed.

[0076] For the remaining candidate contours, the cv::boundingRect function is called to obtain the boundary rectangle box of the contour. To avoid the boundary rectangle from exceeding the image range, the boundary is cropped by box&=Rect(0,0,image.cols,image.rows). The region of interest (ROI) is extracted from the original infrared image based on the cropped boundary rectangle. The cv::mean function is called to calculate the mean m of the B, G, and R channels of the ROI region, where m[0] is the mean of the B channel and m[2] is the mean of the R channel. The heat index heatIndex=m[2]-m[0] is defined. The larger the heat index, the higher the temperature of the region, and the more likely it is to be a real hot circle region. The heat threshold is set to 20 (this threshold is obtained by statistical analysis of 3000 real hot circle ROIs and 1000 pseudo hot circle ROIs). If heatIndex≤20, it is judged as a pseudo hot circle and is removed; if heatIndex>20, it is retained as a valid hot circle contour.

[0077] For example, step six includes: S61, calculate the roundness of the effective thermal circle profile using the roundness formula.

[0078] S62, set a first roundness threshold and a second roundness threshold, determine the effective hot circle contour with roundness greater than the first roundness threshold as a complete hot circle, determine the effective hot circle contour with roundness greater than the second roundness threshold and less than or equal to the first roundness threshold as a defective hot circle, and remove the effective hot circle contour with roundness less than or equal to the second roundness threshold.

[0079] S63 counts the number of complete and incomplete hot circles, calculates the ratio of the sum of the pixel areas of all complete hot circles to the pixel area of ​​the nickel plate, i.e., the percentage of pixel area of ​​complete hot circles, and generates standardized test results.

[0080] Specifically, in this embodiment, in step six, the cv::arcLength function is called to calculate the perimeter of the selected valid hot circular contours (setting the closed parameter to true indicates that the contour is a closed contour). The roundness of the contour is calculated using the roundness formula: circularity = 4 × CV_PI × contour area / (perimeter² + 1e-6), where 1e-6 is a minimum value to prevent division by zero errors when the perimeter is 0. The roundness value ranges from (0,1], and the closer the roundness is to 1, the closer the contour is to a standard circle.

[0081] In this embodiment, the first roundness threshold is set to 0.8, and the second roundness threshold is set to 0.4. If the roundness of the outline is >0.8, it is determined to be a complete hot circle (corresponding to the normal area of ​​the nickel plate); if 0.4 < roundness ≤ 0.8, it is determined to be a defective hot circle (corresponding to the internal defect area of ​​the nickel plate); if the roundness ≤ 0.4, it is determined to be an irregular hot area and is rejected.

[0082] The system counts the number of complete hot-drilled circles (fullCircleCount) and the number of broken hot-drilled circles (brokenCircleCount). It then calculates the sum of the pixel areas of all complete hot-drilled circles (fullCircleArea), and further calculates the area ratio of complete hot-drilled circles (areaRatio = fullCircleArea / nickelArea). The system encapsulates the success flag, status message, and parameters such as fullCircleCount, brokenCircleCount, nickelArea, fullCircleArea, and areaRatio into a DetectResult structure to output the detection results. In practical applications, defect judgment criteria can be set based on areaRatio and brokenCircleCount. For example, when areaRatio < 0.8 and brokenCircleCount > 0, the nickel plate is judged to have a defect and must be rejected; when areaRatio ≥ 0.8 and brokenCircleCount = 0, the nickel plate is judged to be of acceptable quality.

[0083] This application also provides an automatic detection system for internal defects of nickel plates based on infrared color images. The automatic detection method for internal defects of nickel plates based on infrared color images described above includes: an image acquisition module, a legality verification module, a semantic segmentation module, a nickel plate integrity judgment module, a thermal circle analysis module, and a result output module.

[0084] The image acquisition module is configured to acquire an infrared image of the nickel plate to be inspected.

[0085] The legality verification module is configured to: determine whether the infrared image is an infrared Rainbow pseudo-color image; if not, output a detection failure message and terminate the detection; if yes, transmit the infrared Rainbow pseudo-color image to the semantic segmentation module.

[0086] The semantic segmentation module is configured to: input the pre-processed infrared Rainbow pseudo-color image into a pre-trained YOLO semantic segmentation model, and output the nickel plate region mask and the hot circle region mask through forward inference of the model.

[0087] The nickel plate integrity judgment module is configured to: calculate the nickel plate pixel area based on the nickel plate region mask; if the ratio of the nickel plate pixel area to the total pixel area of ​​the image is less than a preset threshold, output a detection failure message and terminate the detection; if the ratio is greater than or equal to the preset threshold, transmit the thermal circle region mask to the thermal circle analysis module.

[0088] The thermal circle analysis module is configured to extract the thermal circle contour, remove noise contours, and filter thermal indexes from the thermal circle region mask to obtain an effective thermal circle contour.

[0089] The result output module is configured to: calculate the roundness of the effective hot circle contour, divide the effective hot circle contour into complete hot circles and incomplete hot circles according to the roundness threshold, count the number of complete hot circles and the number of incomplete hot circles, calculate the pixel area ratio of complete hot circles, and generate standardized detection results.

[0090] Specifically, in this embodiment, the image acquisition module is implemented using C++ language combined with the OpenCV library. It reads locally stored infrared images through the cv::imread function, or acquires image data transmitted by the infrared camera in real time through an image acquisition interface (such as USB or GigE). The acquired images are converted into cv::Mat format and transmitted to the validity verification module.

[0091] The validity verification module implements the core logic of step two, including an image basic verification submodule, a channel splitting submodule, a mean calculation submodule, and a threshold judgment submodule. Specifically, the image basic verification submodule is responsible for determining whether the image is empty and whether the number of channels is 3; the channel splitting submodule performs three-channel splitting using the `cv::split` function; the mean calculation submodule calculates the channel mean using the `cv::mean` function; and the threshold judgment submodule determines validity by comparing the value of `meanR` with `meanB × 1.15`. If the verification passes, the image is transmitted to the semantic segmentation module; if the verification fails, the error message is transmitted to the exception handling module.

[0092] The semantic segmentation module includes a model initialization submodule, an image preprocessing submodule, and a forward inference submodule. The model initialization submodule reads the ONNX file from the model storage module using the `cv::dnn::readNetFromONNX` function, initializes the deep learning network, and sets up the computation backend and target device. The image preprocessing submodule performs image normalization, resizing, and channel conversion. The forward inference submodule inputs the preprocessed image into the network to obtain the nickel plate region mask and the hot circle region mask, which are then transmitted to the nickel plate integrity judgment module.

[0093] The nickel plate integrity assessment module calculates the pixel area of ​​the nickel plate using the `cv::countNonZero` function, calculates the area ratio based on the total pixel area of ​​the image, and compares it with a preset threshold of 0.4 to determine the integrity of the nickel plate. If the determination is complete, the mask of the hot circle region is transmitted to the hot circle analysis module; if the determination is incomplete, the error information is transmitted to the exception handling module.

[0094] The hot circle analysis module includes a contour extraction submodule, a noise removal submodule, a heat index filtering submodule, and a roundness classification submodule. The contour extraction submodule extracts candidate hot circle contours using the `cv::findContours` function; the noise removal submodule removes contours with an area less than 150; the heat index filtering submodule extracts the ROI and calculates the heat index, removing pseudo-hot circles with a heat index ≤ 20; the roundness classification submodule calculates the contour roundness, distinguishes between complete and incomplete hot circles based on a roundness threshold, and transmits the classification results to the results output module.

[0095] The results output module encapsulates the number of complete and incomplete hot circles output by the hot circle analysis module, along with parameters such as the pixel area of ​​the nickel plate and the total area of ​​the complete hot circles, into a DetectResult structure. It supports two output methods: one is printing output through the console for easy debugging; the other is transmitting data to the production control system via an industrial communication interface (such as Modbus or Profinet) to provide data support for nickel plate quality classification.

[0096] For example, the automatic detection system for internal defects of nickel plates based on infrared color images also includes a model storage module.

[0097] The model storage module is used to store the ONNX format files of the pre-trained YOLO semantic segmentation model.

[0098] Specifically, in this embodiment, the model storage module supports reading, updating, and backing up model files. The ONNX format has cross-platform and cross-framework characteristics, ensuring that the model can be flexibly deployed in different industrial control systems.

[0099] For example, the automatic detection system for internal defects of nickel plates based on infrared color images also includes an anomaly processing module.

[0100] The exception handling module is used to receive the detection failure information from the legality verification module and the nickel plate integrity judgment module and terminate the detection.

[0101] Specifically, in this embodiment, the error handling module receives error information transmitted by the legality verification module and the nickel plate integrity judgment module, generates standardized error prompts (such as "non-Rainbow image" or "nickel plate incomplete"), triggers the system alarm mechanism (such as audible and visual alarm), and terminates the subsequent detection process to ensure stable system operation.

[0102] This application embodiment utilizes infrared thermal imaging technology for detection, eliminating the need for direct contact with the nickel plate and preventing scratches or contamination of its surface. No pre- or post-processing steps are required. By combining deep learning semantic segmentation and multi-dimensional feature verification—specifically, the YOLO semantic segmentation model in step three, and the infrared Rainbow pseudo-color image judgment in step two, the area ratio verification in step four, the thermal circle contour extraction and rejection in step five, and the roundness analysis in step six—the automation and accuracy of nickel plate defect detection are significantly improved, making it widely applicable to nickel plate quality control in high-end manufacturing.

[0103] This technology is the first to combine infrared thermal imaging, deep learning semantic segmentation, and multi-dimensional feature verification, filling a gap in existing technology and providing a new technical path for nickel plate defect detection. It promotes the technological upgrade of nickel plate quality inspection from "traditional contact and manual interpretation" to "non-contact, non-destructive, automated, and precise detection".

[0104] The proposed ONNX format file for storing pre-trained YOLO semantic segmentation models can be quickly loaded and inferred using the DNN deep learning module of the OpenCV computer vision library, without relying on complex deep learning frameworks and expensive dedicated equipment.

[0105] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0106] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. An automatic detection method for internal defects in nickel plates based on infrared color images, characterized in that, Includes the following steps: Step 1: Acquire an infrared image of the nickel plate to be tested; Step 2: Determine whether the infrared image is an infrared Rainbow pseudo-color image. If not, output a detection failure message and terminate the detection; if yes, proceed to Step 3. Step 3: After preprocessing, the infrared Rainbow pseudo-color image is input into the pre-trained YOLO semantic segmentation model, and the model outputs the nickel plate region mask and the hot circle region mask through forward inference. Step 4: Calculate the nickel plate pixel area based on the nickel plate region mask. If the ratio of the nickel plate pixel area to the total pixel area of ​​the image is less than a preset threshold, output a detection failure message and terminate the detection; if the ratio is greater than or equal to the preset threshold, proceed to step 5. Step 5: Extract the hot circle contour, remove noise contours, and filter the thermal index of the hot circle region mask to obtain the effective hot circle contour. Step 6: Calculate the roundness of the effective hot circle contour. Based on the roundness threshold, divide the effective hot circle contour into complete hot circles and incomplete hot circles. Count the number of complete hot circles and the number of incomplete hot circles. Calculate the pixel area ratio of complete hot circles and generate standardized detection results.

2. The automatic detection method for internal defects of nickel plates based on infrared color images according to claim 1, characterized in that, Step two, determining whether the infrared image is an infrared Rainbow pseudo-color image, includes: S21, determine whether the infrared image satisfies the condition of being non-empty and having 3 channels. If not, the infrared image is not an infrared Rainbow pseudo-color image; if yes, proceed to S22. S22, the infrared image is split into three single-channel images: B, G, and R; S23, calculate the mean value of the R channel image and the mean value of the B channel image respectively; S24. If the ratio of the mean value of the R channel image to the mean value of the B channel image is less than or equal to a preset ratio threshold, then the infrared image is not an infrared Rainbow pseudo-color image; if it is greater than the preset ratio threshold, then the infrared image is an infrared Rainbow pseudo-color image.

3. The automatic detection method for internal defects of nickel plates based on infrared color images according to claim 1, characterized in that, In step three, the preprocessing includes normalization, size adjustment, and channel dimension adjustment.

4. The automatic detection method for internal defects of nickel plates based on infrared color images according to claim 1, characterized in that, In step three, the pre-training process of the YOLO semantic segmentation model is as follows: S301, Construct a dataset of infrared Rainbow pseudo-color images of nickel plates containing different defect types, different shooting angles, and different lighting conditions. Each image in the dataset is labeled with mask labels for the nickel plate area and the hot circle area. S302 uses the YOLOv8-seg model as the basic network architecture, and sets the input size, optimizer, initial learning rate, and weight decay coefficient. S303 uses a weighted sum of cross-entropy loss and Dice loss as the loss function to iteratively train the YOLOv8-seg model until the mask intersection-union ratio on the validation set is greater than 0.95, at which point training stops and a pre-trained YOLO semantic segmentation model is obtained.

5. The automatic detection method for internal defects of nickel plates based on infrared color images according to claim 1, characterized in that, In step four, the preset threshold value ranges from 0.4 to 0.6, and the preset threshold is obtained by statistical calibration of at least 1000 standard nickel plate infrared images.

6. The automatic detection method for internal defects of nickel plates based on infrared color images according to claim 1, characterized in that, Step five includes: S51, extract the hot circle contour from the hot circle region mask to obtain several hot circle candidate contours; S52, calculate the pixel area of ​​each hot circle candidate contour, and remove hot circle candidate contours that are smaller than the preset area threshold to achieve noise contour removal. S53, for the remaining candidate thermal circles after noise contour removal, extract the region of interest corresponding to the infrared image based on the boundary rectangle of the contour, use the difference between the mean of the R channel and the mean of the B channel of the region of interest as the thermal index, remove candidate thermal circles with thermal index less than the preset thermal threshold, realize thermal index screening, and obtain effective thermal circle contours.

7. The automatic detection method for internal defects of nickel plates based on infrared color images according to claim 1, characterized in that, Step six includes: S61, calculate the roundness of the effective hot circle profile using the roundness formula; S62, set a first roundness threshold and a second roundness threshold, determine the effective hot circle contour with roundness greater than the first roundness threshold as a complete hot circle, determine the effective hot circle contour with roundness greater than the second roundness threshold and less than or equal to the first roundness threshold as a defective hot circle, and remove the effective hot circle contour with roundness less than or equal to the second roundness threshold. S63 counts the number of complete and incomplete hot circles, calculates the ratio of the sum of the pixel areas of all complete hot circles to the pixel area of ​​the nickel plate, i.e., the percentage of pixel area of ​​complete hot circles, and generates standardized test results.

8. An automatic detection system for internal defects in nickel plates based on infrared color images, employing the automatic detection method for internal defects in nickel plates based on infrared color images as described in any one of claims 1 to 7, characterized in that, include: Image acquisition module, legality verification module, semantic segmentation module, nickel plate integrity judgment module, hot circle analysis module, and result output module; The image acquisition module is configured to acquire an infrared image of the nickel plate to be inspected; The legality verification module is configured to: determine whether the infrared image is an infrared Rainbow pseudo-color image; if not, output a detection failure message and terminate the detection; if yes, transmit the infrared Rainbow pseudo-color image to the semantic segmentation module. The semantic segmentation module is configured to: input the pre-processed infrared Rainbow pseudo-color image into the pre-trained YOLO semantic segmentation model, and output the nickel plate region mask and the hot circle region mask through forward inference of the model. The nickel plate integrity judgment module is configured to: calculate the nickel plate pixel area based on the nickel plate region mask; if the ratio of the nickel plate pixel area to the total pixel area of ​​the image is less than a preset threshold, output a detection failure message and terminate the detection; if the ratio is greater than or equal to the preset threshold, transmit the hot circle region mask to the hot circle analysis module. The thermal circle analysis module is configured to: extract the thermal circle contour, remove noise contours, and filter thermal indexes from the thermal circle region mask to obtain an effective thermal circle contour. The result output module is configured to: calculate the roundness of the effective hot circle contour, divide the effective hot circle contour into complete hot circles and incomplete hot circles according to the roundness threshold, count the number of complete hot circles and the number of incomplete hot circles, calculate the pixel area ratio of complete hot circles, and generate standardized detection results.

9. The automatic detection system for internal defects of nickel plates based on infrared color images according to claim 8, characterized in that, It also includes a model storage module; The model storage module is used to store the ONNX format files of the pre-trained YOLO semantic segmentation model.

10. The automatic detection system for internal defects of nickel plates based on infrared color images according to claim 8, characterized in that, It also includes an exception handling module; The exception handling module is used to receive the detection failure information from the legality verification module and the nickel plate integrity judgment module and terminate the detection.