Circuit breaker defect detection method and device, storage medium and electronic equipment
By performing image acquisition, enhancement processing, and edge detection on circuit breakers, combined with a support vector machine model, automated detection of thread defects in circuit breakers has been achieved. This solves the problems of low detection efficiency and insufficient accuracy in existing technologies, and improves the speed and accuracy of detection.
Patent Information
- Application Number
- CN202411138844.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2044-08-19
AI Technical Summary
Existing technologies for detecting thread defects in circuit breakers are inefficient and inaccurate, and are easily affected by human factors, making it difficult to meet the high efficiency and high precision requirements of modern manufacturing.
By acquiring images of circuit breakers, performing image enhancement and edge detection, identifying thread defects using a support vector machine model, and combining industrial cameras and photoelectric sensors, automated inspection is achieved.
It enables rapid and accurate identification of thread defects in circuit breakers, improves detection efficiency and accuracy, reduces interference from human factors, and ensures the reliability and safety of detection.
Smart Images

Figure CN119090829B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of machine vision, in particular to a circuit breaker defect detection method and device, a storage medium and an electronic device. BACKGROUND
[0002] In modern industrial production, as an important electrical equipment, the reliability of the performance of the circuit breaker is directly related to the stable operation of the power system. The threaded part of the circuit breaker, as a key structure for connection and transmission, directly affects the service life and safety of the circuit breaker. However, the existing threaded defect detection method mainly relies on manual visual inspection or simple machine vision technology, and these methods have many shortcomings, such as low detection efficiency, low accuracy, and being easily affected by human factors. Especially in high-speed and large-batch production, the current detection means has been difficult to meet the demand of modern manufacturing for high efficiency and high precision. In addition, the process of manual detection has the problems of missed detection and misjudgment, which not only increases the production cost, but also may bury safety hazards.
[0003] At present, there is no effective solution to the above problems. SUMMARY
[0004] The embodiments of the present application provide a circuit breaker defect detection method and device, a storage medium and an electronic device to at least solve the technical problems of slow circuit breaker threaded defect detection speed and insufficient accuracy in the related art.
[0005] According to an aspect of the embodiments of the present application, a circuit breaker defect detection method is provided, comprising: acquiring an initial image of a circuit breaker by image acquisition, wherein the initial image comprises a thread of the circuit breaker; performing image enhancement processing on the initial image to obtain a target image, wherein the distinction degree of an initial contour line of the thread in the initial image is less than the distinction degree of a target contour line of the thread in the target image; extracting the target contour line to obtain a first image feature, wherein the first image feature is a feature corresponding to a region with a threaded defect in the target image, the first image feature is different from a second image feature, and the second image feature is a feature corresponding to a region without a threaded defect in the target image; and determining a defect recognition result of the circuit breaker based on the first image feature.
[0006] Optionally, the circuit breaker is placed on a conveyor belt, and the acquiring an initial image of the circuit breaker by image acquisition comprises: in a case where the circuit breaker is conveyed to a predetermined shooting position by the conveyor belt, acquiring a blocking signal of a photoelectric sensor of the circuit breaker to the predetermined shooting position; and in response to the blocking signal, controlling the image acquisition of the circuit breaker to obtain the initial image.
[0007] Optionally, the image enhancement processing on the initial image to obtain a target image comprises: processing the initial image by using a gray processing method to obtain a first image; processing the first image by using a Gaussian filter processing method to obtain the target image.
[0008] Optionally, after the image enhancement processing on the initial image to obtain a target image, the method further comprises: processing the target image by using a binary processing method to obtain a second image; in the case that the second image comprises a plurality of first pixels, determining, for a target first pixel in the plurality of first pixels, a gray difference value between the target first pixel and other first pixels, wherein the other first pixels are first pixels in the plurality of first pixels excluding the target first pixel; determining, based on the gray difference value, whether the target first pixel belongs to a thread defect area included in the target image; in the case that the target first pixel belongs to the thread defect area included in the target image, determining that the target first pixel belongs to a defect pixel set; determining, by using the method of determining that the target first pixel belongs to the defect pixel set, whether the plurality of first pixels respectively belong to the defect pixel set; and determining the defect recognition result based on the defect pixel set.
[0009] Optionally, the extraction of the target contour line to determine that the thread defect area in the target image is displayed as a first image feature comprises: extracting the target contour line by using an edge detection algorithm to determine gray values respectively corresponding to a plurality of second pixels included in the target contour line; and obtaining the first image feature based on the gray values respectively corresponding to the plurality of second pixels.
[0010] Optionally, the obtaining of the first image feature based on the gray values respectively corresponding to the plurality of second pixels comprises: identifying a change trend between the gray values respectively corresponding to the second pixels by using a target model to determine the first image feature, wherein the target model is obtained by training a gray data set, the gray data set is obtained based on a collected image of a training circuit breaker, and a type of the circuit breaker matches a type of the training circuit breaker.
[0011] Optionally, the circuit breaker is placed on a conveyor belt, and the determination of the defect recognition result based on the first image feature comprises: in response to a prompt signal that the defect recognition result indicates that the circuit breaker has a thread defect area, controlling a predetermined time length of air jet processing on the circuit breaker to make the circuit breaker leave the conveyor belt, wherein the predetermined time length is determined based on a force feature of the circuit breaker.
[0012] According to another aspect of the embodiments of the present application, a circuit breaker defect detection device is provided, comprising: an acquisition module configured to acquire an image of a circuit breaker to obtain an initial image, wherein the initial image comprises threads of the circuit breaker; a processing module configured to perform image enhancement processing on the initial image to obtain a target image, wherein a distinction degree of an initial contour line of the threads in the initial image is less than a distinction degree of a target contour line of the threads in the target image; an extraction module configured to extract the target contour line to obtain a first image feature, wherein the first image feature is a feature corresponding to a region with a thread defect in the target image, and the first image feature is different from a second image feature corresponding to a region without a thread defect in the target image; and an identification module configured to determine a defect identification result of the circuit breaker based on the first image feature.
[0013] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, which stores a plurality of instructions adapted to be loaded and executed by a processor to implement any of the circuit breaker defect detection methods.
[0014] According to another aspect of the embodiments of the present application, an electronic device is provided, comprising: one or more processors and a memory configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any of the circuit breaker defect detection methods.
[0015] In the embodiments of the present application, an image of a circuit breaker is acquired to obtain an initial image, wherein the initial image comprises threads of the circuit breaker; image enhancement processing is performed on the initial image to obtain a target image, wherein a distinction degree of an initial contour line of the threads in the initial image is less than a distinction degree of a target contour line of the threads in the target image; the target contour line is extracted to obtain a first image feature, wherein the first image feature is a feature corresponding to a region with a thread defect in the target image, and the first image feature is different from a second image feature corresponding to a region without a thread defect in the target image; and a defect identification result of the circuit breaker is determined based on the first image feature. The purposes of automatically detecting thread defects of the circuit breaker and improving detection efficiency and accuracy are achieved, the technical effects of quickly and accurately identifying thread defects are achieved through machine vision and image processing technology, and the technical problems of slow circuit breaker thread defect detection speed and insufficient accuracy in related technologies are solved. BRIEF DESCRIPTION OF DRAWINGS
[0016] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
[0017] Figure 1 is a flow chart of an optional circuit breaker defect detection method provided according to an embodiment of the application;
[0018] Figure 2 is a schematic diagram of an optional circuit breaker defect detection device provided according to an embodiment of the application. DETAILED DESCRIPTION
[0019] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative work should fall within the protection scope of the present application.
[0020] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to the process, method, product or device.
[0021] For ease of description, some nouns or terms related to the embodiments of the present application are described below:
[0022] A photoelectric sensor is a device that converts optical signals into electrical signals, and its working principle is based on the photoelectric effect, that is, when light is irradiated onto certain materials, it will cause the excitation of internal electrons of the materials, thereby generating a change in current or voltage.
[0023] A CDD (Charge-Coupled Device) is a device used in image sensor technology, in which the light signal captured by each pixel point is converted into a charge packet, which is gradually transmitted to a register through a shift register, and finally converted into a voltage signal to form an image.
[0024] CMOS (Complementary Metal-Oxide-Semiconductor) is a technology used in image sensors, where each pixel has an associated amplifier and readout circuit. CMOS directly converts light signals into voltage signals at each pixel, which are then processed by the readout circuit.
[0025] Edge detection algorithms are image processing techniques used to identify the outlines of objects in an image. They work by analyzing the brightness changes of pixels in the image to determine the boundaries of objects.
[0026] STC89C52RC is a microcontroller that belongs to the 8-bit family and is widely used in automation control systems for receiving signals and sending control commands.
[0027] Open CV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library that provides a wide range of image and video analysis tools. It is commonly used for real-time image processing, face recognition, object detection, and other applications.
[0028] Gaussian filtering is an image smoothing technique that uses a Gaussian function to convolve an image, reducing noise and achieving a blur effect while highlighting image features.
[0029] Hough circle detection is an algorithm used to identify circles in an image by analyzing the edge points to determine possible centers and radii. In the Open CV library, the HoughCircles function implements this algorithm and can be used to detect circular outlines in images.
[0030] Canny operator is an edge detection algorithm that extracts the boundaries of objects in an image and is widely used in image segmentation, feature retrieval, and image analysis.
[0031] SVM (Support Vector Machine) is a supervised learning algorithm used for classification and regression by finding the optimal boundary between data points to distinguish different classes. It can handle both linear and non-linear problems and has good generalization ability.
[0032] According to the embodiments of the present application, a circuit breaker defect detection method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than shown here.
[0033] Figure 1 FIG. 7 is a flowchart of an optional circuit breaker defect detection method according to an embodiment of the present application, as shown in the figure, the method comprises the following steps: Figure 1
[0034] In step S102, an initial image of the circuit breaker is collected, wherein the initial image includes the threads of the circuit breaker.
[0035] It can be understood that collecting the initial image including the threads of the circuit breaker is the basis for subsequent judgment of whether there is a defect.
[0036] Optionally, the device for collecting the initial image is an industrial camera, which has higher image stability, transmission capacity and anti-interference capability. The industrial camera can be various, including CDD camera and CMOS camera. The industrial camera with universal serial bus (USB) interface has relatively slow transmission speed, which is difficult to meet the real-time requirement of the present application, so the industrial camera with network interface is adopted. The industrial camera with network interface has fast transmission speed, which can reach more than 1 Gbps, and can capture clear initial images of the threads of the circuit breaker within an effective range, meeting the shooting accuracy requirement.
[0037] Optionally, a plurality of industrial cameras are arranged to collect initial images of the circuit breaker from different angles. Each industrial camera is connected to a computer through a switch, and each industrial camera is distinguished by being configured with different web addresses.
[0038] Optionally, the industrial camera is greatly affected by external interference light during shooting. The present application selects a ring-shaped shadowless light source, which can be fixed above the industrial camera to reduce the interference from external light.
[0039] In an optional embodiment, the circuit breaker is placed on a conveyor belt, and the initial image of the circuit breaker is collected, comprising: in the case that the circuit breaker is conveyed to a predetermined shooting position by the conveyor belt, obtaining a shielding signal of a photoelectric sensor of the predetermined shooting position shielded by the circuit breaker; in response to the shielding signal, controlling the image collection of the circuit breaker to obtain the initial image.
[0040] It can be understood that the photoelectric sensor is arranged at the predetermined shooting position, and when the circuit breaker is conveyed to the predetermined shooting position by the conveyor belt, the circuit breaker shields the light signal emitted by the photoelectric sensor. The photoelectric sensor converts the light signal into a shielding signal, and in response to the shielding signal, the image collection of the circuit breaker is performed to obtain the target image. The automatic collection of the circuit breaker image is realized.
[0041] In step S104, the initial image is subjected to image enhancement processing to obtain a target image, wherein the difference degree of the initial contour line of the thread in the initial image is less than the difference degree of the target contour line of the thread in the target image.
[0042] It can be understood that the initial image collected is subjected to enhancement processing to obtain a target image, so that the difference degree of the contour line of the target image is more obvious. The subsequent edge detection and defect determination result are more accurate.
[0043] It should be noted that the contour line difference degree of the thread is the difference degree of the pixel value of the pixel point.
[0044] In an optional embodiment, the initial image is subjected to image enhancement processing to obtain a target image, comprising: adopting a gray processing manner to process the initial image to obtain a first image; adopting a Gaussian filter processing manner to process the first image to obtain the target image.
[0045] It can be understood that the initial image is subjected to gray processing to obtain a first image, and then the first image is subjected to noise removal by using Gaussian filter to obtain a target image. In the target image, the contour line of the thread has higher contrast, and the visualization quality of the thread part is improved, laying a foundation for the subsequent defect detection step.
[0046] Optionally, the gray processing is to convert a color or multi-channel image into a single-channel gray image. This is achieved by calculating the weighted sum of the red, green and blue color channels of each pixel point to obtain a single value reflecting the information of the pixel point. The first image after gray processing reduces the data amount while retaining important visual information in the initial image.
[0047] Optionally, the Gaussian filter is a linear filter technique for smoothing images using a Gaussian function. The Gaussian filter applies a Gaussian function around each pixel point to weight the average of neighboring pixels to reduce random noise in the image and retain edge information. Gaussian filter is particularly effective in removing Gaussian noise, and due to its smoothing property, it can make the edges of the image smoother and reduce the sawtooth effect, providing a clearer target image for subsequent edge detection.
[0048] In an optional embodiment, after the initial image is subjected to image enhancement processing to obtain a target image, the method further comprises: processing the target image by using a binarization processing manner to obtain a second image; in the case that the second image comprises a plurality of first pixels, determining, for a target first pixel in the plurality of first pixels, a gray value difference between the target first pixel and other first pixels, wherein the other first pixels are the first pixels in the plurality of first pixels excluding the target first pixel; determining, based on the gray value difference, whether the target first pixel belongs to a thread defect area included in the target image; in the case that the target first pixel belongs to the thread defect area included in the target image, determining that the target first pixel belongs to a defect pixel set; determining, by using the manner of determining that the target first pixel belongs to the defect pixel set, whether the plurality of first pixels respectively belong to the defect pixel set; and determining a defect recognition result based on the defect pixel set.
[0049] It can be understood that the target image subjected to image enhancement is subjected to binarization processing to convert the target image into a second image containing only black and white pixels, the target first pixel is compared with the other first pixels to determine whether the target first pixel belongs to a thread defect area, and once it is determined that the target first pixel belongs to the defect area, it is classified into the defect pixel set. The plurality of target first pixels are traversed, and the defect recognition result is determined based on the defect pixel set. All the target first pixels in the second image are traversed, and the pixel-level analysis is performed to realize the thread defect detection of the circuit breaker. However, the processing speed of the algorithm for traversing the entire image is very low, and is not suitable for high-speed detection systems.
[0050] Optionally, the binarization processing simplifies the image content by converting the image into a form containing only two pixel values, selects a specific threshold, and marks all pixel points higher than the threshold in the target image as foreground (the foreground is white), and marks the pixel points lower than the threshold as background (the background is black). Thus, the target image is highlighted in a high-contrast form.
[0051] In step S106, the target contour line is extracted to obtain a first image feature, wherein the first image feature is a feature corresponding to a thread defect area in the target image, and the first image feature is different from a second image feature, and the second image feature is a feature corresponding to a region in the target image where no thread defect exists.
[0052] It can be understood that after the target image is obtained, the target contour line is further extracted, and the thread defect area is displayed as the first image feature. By analyzing the target image, the first image feature and the second image feature of the thread are distinguished to provide a basis for judging the defect recognition result.
[0053] In an optional embodiment, the target contour line is extracted, and it is determined that the thread defect area in the target image is displayed as a first image feature, including: using an edge detection algorithm to extract the target contour line, the target contour line including a plurality of second pixels corresponding to a gray value; and obtaining the first image feature based on the gray value corresponding to each of the plurality of second pixels.
[0054] It can be understood that the target image is processed by using the edge detection algorithm to extract the target contour line of the thread, and the gray value corresponding to each of the plurality of second pixels included in the target contour line is determined. By analyzing the gray value corresponding to each of the plurality of second pixels, a set of pixel points having a significant difference compared with the normal area is identified, so as to determine the thread defect area, and the thread defect area is displayed as the first image feature, which is different from the second image feature displayed by the thread defect area. The first image feature reflects the thread defect area, which provides a basis for subsequent judgment and identification of the thread defect.
[0055] Optionally, in the present application, the edge detection algorithm uses the Canny operator method, which is an edge detection algorithm with high detection accuracy and robustness to noise. The main steps include gradient calculation, non-maximum suppression, hysteresis threshold processing and edge tracking. The gradient calculation includes the calculation of gradient amplitude and direction, and the gradient amplitude reflects the degree of change of the pixel value of the target image, which is a measure of the edge strength. The gradient component can be represented by the Sobel operator, and the calculation formula of the gradient amplitude G and the direction θ is: where G x and G y are the gradient components along the x and y directions. Non-maximum suppression is used to thin the edge to ensure that the edge is as thin as possible. This is achieved by comparing the gradient amplitudes of the current second pixel and the adjacent second pixels, and only the pixel with the local maximum gradient amplitude is retained. Hysteresis threshold processing is used to further determine and connect the edge. A double threshold method is used, the second pixel higher than the high threshold is determined as a strong edge, the second pixel higher than the low threshold but not connected to the strong edge is ignored, and the second pixel higher than the low threshold and connected to the strong edge is determined as a weak edge, thereby connecting the edge fragments. By tracking the edge points, the isolated second pixels are connected into continuous edge lines to ensure the integrity and continuity of the edge.
[0056] In an optional embodiment, the first image feature is obtained based on the gray value corresponding to each of the plurality of second pixels, including: using a target model to identify the trend of change between the gray values corresponding to the second pixels, and determining the first image feature, wherein the target model is obtained by training a gray data set, and the gray data set is obtained based on the collected images of the training circuit breaker, and the type of the circuit breaker matches the type of the training circuit breaker.
[0057] It can be understood that the gray scale data is obtained by collecting the images of the training circuit breakers, the target model is trained by using the gray scale data set, and the change trend between the gray scale values corresponding to the second pixels in the target image is recognized by using the trained target model to obtain the first image feature. The first image feature obtained by the target model is the threaded defect area, which can effectively identify the defect area of the circuit breaker thread.
[0058] Optionally, the target model can be a support vector machine (SVM). After the support vector machine receives the target image, the gray scale values corresponding to the second pixels in each target image are combined to form a gray scale value matrix, and the gray scale value matrix is converted into a feature column vector in an n-dimensional feature space. The obtained feature column vector is input into the support vector machine model as a feature. The support vector machine determines the hyperplane of the classification through an optimization process, which aims to maximize the interval between the two types of data points. The support vector machine processes non-linearly separable data by selecting a suitable kernel function, and trains the support vector machine model by using the gray scale data set, so that it learns how to distinguish between defective and non-defective circuit breaker thread images according to the feature column vector. During the training process, only the feature vectors located on the boundary contribute to the decision function of the model, which makes the support vector machine model have good generalization ability for high-dimensional data.
[0059] It should be noted that the training circuit breakers include a plurality of defective circuit breakers and a plurality of non-defective circuit breakers. In order not to be affected by external light, when collecting the target images of the training circuit breakers, an industrial camera is used in a dark box that is not affected by external light. The final obtained gray scale data set is divided into a training set and a test set according to a ratio of 4:1.
[0060] Step S108, based on the first image feature, determining the defect recognition result of the circuit breaker.
[0061] It can be understood that after the target model determines the first image feature, it is judged that the circuit breaker has a defect.
[0062] In an optional embodiment, the circuit breaker is placed on a conveyor belt, and based on the first image feature, the defect recognition result is determined, which includes: in response to the prompt signal that the circuit breaker has a threaded defect area, controlling the air jet treatment of the circuit breaker for a predetermined time length, so that the circuit breaker leaves the conveyor belt, wherein the predetermined time length is determined based on the force characteristics of the circuit breaker.
[0063] It can be understood that the circuit breaker is placed on a conveyor belt, and based on the first image feature, the defect recognition result is determined, which includes: in response to the prompt signal that the circuit breaker has a threaded defect area, controlling the air jet treatment of the circuit breaker for a predetermined time length, so that the circuit breaker leaves the conveyor belt, wherein the predetermined time length is determined based on the force characteristics of the circuit breaker.
[0064] Optionally, the air jet treatment of the circuit breaker for a predetermined length of time is completed by the air pump and the electromagnetic valve. The air pump is responsible for providing the necessary compressed air, and the electromagnetic valve controls the flow direction and opening time of the compressed air. When it is determined that the circuit breaker has a thread defect area, the single-chip microcomputer sends a rejection signal to the electromagnetic valve, and the electromagnetic valve quickly responds to guide the compressed air to the position of the circuit breaker, effectively rejecting the circuit breaker with defects.
[0065] Optionally, the data transmission and instruction sending in the application are completed by a microcontroller, which can be an STC89C52RC single-chip microcomputer. The STC89C52RC single-chip microcomputer is simple and convenient to use, easy to operate, and has a sufficient number of interfaces.
[0066] Through the above step S102, the circuit breaker is image collected to obtain an initial image, wherein the initial image includes the threads of the circuit breaker; step S104, the initial image is image enhanced to obtain a target image, wherein the difference degree of the initial contour line of the thread in the initial image is less than the difference degree of the target contour line of the thread in the target image; step S106, the target contour line is extracted to obtain a first image feature, wherein the first image feature is a feature corresponding to a region with thread defects in the target image, the first image feature is different from a second image feature, and the second image feature is a feature corresponding to a region without thread defects in the target image; step S108, based on the first image feature, a defect recognition result of the circuit breaker is determined. The purpose of improving the detection efficiency and accuracy can be achieved by automatically detecting the thread defects of the circuit breaker. Through the machine vision and image processing technology, the technical effect of quickly and accurately identifying the thread defects is achieved, thereby solving the technical problems of slow detection speed and insufficient accuracy of the thread defects of the circuit breaker in the related art.
[0067] Based on the above embodiments and optional embodiments, an optional implementation of the application is provided.
[0068] Step S1, an optical sensor is arranged at a predetermined shooting position, when the circuit breaker is conveyed to the predetermined shooting position by the conveying belt, the circuit breaker blocks the light signal emitted by the optical sensor, the optical sensor converts the light signal into a blocking signal, and the circuit breaker is image collected in response to the blocking signal to obtain a target image.
[0069] Optionally, the device for collecting the initial image is an industrial camera, which has higher image stability, transmission capacity and anti-interference ability.
[0070] Step S2, the collected initial image is enhanced to obtain a target image, so that the difference degree of the contour line of the target image is more obvious.
[0071] Optionally, the enhancement processing of the collected initial image includes grayscale processing and Gaussian filtering processing. The grayscale processing is to convert a color or multi-channel image into a single-channel grayscale image. The first image after grayscale processing reduces the data volume while retaining important visual information in the initial image. The Gaussian filtering is a linear filtering technique for smoothing an image using a Gaussian function. Due to the smoothing property, the edges of the image are smoother, and the jagged effect is reduced.
[0072] In step S21, the target image after image enhancement is binarized to convert the target image into a second image containing only black and white pixels. By comparing the grayscale difference between the target first pixel and other first pixels, it is determined whether the target first pixel belongs to a region with a thread defect. Once it is determined that the target first pixel belongs to a defect region, it is classified into a defect pixel set. Based on the defect pixel set, a defect recognition result is determined. By traversing all target first pixels in the second image, pixel-level analysis is performed to realize thread defect detection of the circuit breaker.
[0073] In step S3, after obtaining the target image, an edge detection algorithm is used to process the target image to extract the target contour line of the thread and determine the grayscale values corresponding to the plurality of second pixels included in the target contour line. By analyzing the grayscale values corresponding to the plurality of second pixels, a set of pixels with significant differences compared to the normal region is identified, thereby determining the thread defect region, which is displayed as the first image feature.
[0074] In step S4, the trained target model is used to identify the trend of changes between the grayscale values corresponding to the second pixels in the target image to obtain the first image feature.
[0075] Optionally, the target model can be a support vector machine (SVM). After receiving the target image, the support vector machine forms a grayscale value matrix composed of the grayscale values corresponding to the second pixels in each target image, converts the grayscale value matrix into a feature column vector in an n-dimensional feature space, and inputs the obtained feature column vector into the support vector machine model as a feature to classify the circuit breaker with or without defects.
[0076] In step S5, after the target model determines the first image feature, it is determined that the circuit breaker has a defect. A prompt signal indicating that the circuit breaker has a thread defect region is sent, and the circuit breaker is subjected to a predetermined duration of air jet processing to move the circuit breaker away from the conveyor belt.
[0077] The above optional embodiments at least achieve the following effects: the application realizes accurate detection of the thread defects of the circuit breaker by combining the edge detection algorithm with the support vector machine. The edge detection capability of the Canny operator eliminates the interference of false defects, ensuring the accuracy of the target image and the feature vector extraction. The support vector machine can accurately identify whether the circuit breaker has defects through training, improving the detection speed and accuracy, reducing the interference of human factors, and removing the defective circuit breaker through compressed air, ensuring that only the circuit breaker meeting the standard can enter the next link.
[0078] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from here.
[0079] In this embodiment, a circuit breaker defect detection device is also provided, which is used to implement the above embodiments and preferred embodiments, which have been described and will not be repeated. As used below, the term "module" "device" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware implementation is also possible and contemplated.
[0080] According to the embodiment of the present application, a device embodiment for implementing the circuit breaker defect detection method is also provided, Figure 2 is a schematic diagram of an optional circuit breaker defect detection device according to an embodiment of the present application, as Figure 2 shown, the circuit breaker defect detection device comprises a collection module 202, a processing module 204, an extraction module 206 and an identification module 208, which will be described below.
[0081] The collection module 202 is used for image collection of the circuit breaker to obtain an initial image, wherein the initial image includes the thread of the circuit breaker.
[0082] The processing module 204 is connected with the collection module 202 and is used for image enhancement processing of the initial image to obtain a target image, wherein the distinction degree of the initial contour line of the thread in the initial image is less than the distinction degree of the target contour line of the thread in the target image.
[0083] The extraction module 206 is connected with the processing module 204 and is used for extracting the target contour line to determine that the thread defect area in the target image is displayed as a first image feature, wherein the first image feature and the second image feature displayed as the thread defect area not existing are different image features.
[0084] The identification module 208, connected with the extraction module 206, is used for determining a defect identification result based on the first image feature.
[0085] The circuit breaker defect detection device provided by the embodiment of the present application comprises a collection module 202, a processing module 204, an extraction module 206 and an identification module 208. The collection module 202 is used for collecting images of the circuit breaker to obtain an initial image, wherein the initial image comprises threads of the circuit breaker. The processing module 204, connected with the collection module 202, is used for performing image enhancement processing on the initial image to obtain a target image, wherein the distinction degree of an initial contour line of the threads in the initial image is less than the distinction degree of a target contour line of the threads in the target image. The extraction module 206, connected with the processing module 204, is used for extracting the target contour line to determine that a thread defect area in the target image is displayed as a first image feature, wherein the first image feature is different from a second image feature that is displayed as a thread defect area that does not exist. The identification module 208, connected with the extraction module 206, is used for determining a defect identification result based on the first image feature. The purpose of automatically detecting thread defects of the circuit breaker and improving the detection efficiency and accuracy is achieved. The technical effect of quickly and accurately identifying thread defects is achieved through the machine vision and image processing technology, and the technical problems of slow detection speed and insufficient accuracy of thread defects of the circuit breaker in the related art are solved.
[0086] It should be noted that each of the above modules can be implemented by software or hardware. For example, for the latter, the above modules can be located in the same processor, or the above modules can be located in different processors in any combination.
[0087] It should be noted that the collection module 202, the processing module 204, the extraction module 206 and the identification module 208 correspond to steps S102 to S108 in the embodiment, and the above modules have the same instances and application scenarios as the corresponding steps, but are not limited to the contents disclosed in the above embodiment. It should be noted that the above modules, as part of the device, can run in a computer terminal.
[0088] It should be noted that the optional or preferred embodiments of the present embodiment can refer to the related description in the embodiment, which will not be repeated here.
[0089] The circuit breaker defect detection device can further comprise a processor and a memory. The collection module 202, the processing module 204, the extraction module 206 and the identification module 208 are stored in the memory as program units, and the processor executes the above program units stored in the memory to realize the corresponding functions.
[0090] The processor includes a core, and the core calls corresponding program units in the memory. The core can be one or more. The memory can include a non-permanent memory in a computer readable medium, a random access memory (RAM), and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory, and the memory includes at least one memory chip.
[0091] Embodiments of the present application provide a non-volatile storage medium, which stores a program, and the program is executed by a processor to implement the circuit breaker defect detection method.
[0092] Embodiments of the present application provide an electronic device, which includes a processor, a memory, and a program stored in the memory and executable in the processor, and the processor implements the following steps when executing the program: image acquisition is performed on a circuit breaker to obtain an initial image, wherein the initial image includes threads of the circuit breaker; image enhancement processing is performed on the initial image to obtain a target image, wherein a distinction degree of an initial contour line of the threads in the initial image is less than a distinction degree of a target contour line of the threads in the target image; extraction is performed on the target contour line to obtain a first image feature, wherein the first image feature is a feature corresponding to a region with a thread defect in the target image, the first image feature is different from a second image feature, and the second image feature is a feature corresponding to a region without a thread defect in the target image; and a defect recognition result of the circuit breaker is determined based on the first image feature. The device in the present application can be a server, a PC, or the like.
[0093] The present application also provides a computer program product, which, when executed on a data processing device, is adapted to execute a program that is initialized with the following method steps: image acquisition is performed on a circuit breaker to obtain an initial image, wherein the initial image includes threads of the circuit breaker; image enhancement processing is performed on the initial image to obtain a target image, wherein a distinction degree of an initial contour line of the threads in the initial image is less than a distinction degree of a target contour line of the threads in the target image; extraction is performed on the target contour line to obtain a first image feature, wherein the first image feature is a feature corresponding to a region with a thread defect in the target image, the first image feature is different from a second image feature, and the second image feature is a feature corresponding to a region without a thread defect in the target image; and a defect recognition result of the circuit breaker is determined based on the first image feature.
[0094] Those skilled in the art should understand that embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0095] The present application is described in reference to the drawings of flowchart and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart and / or block diagrams, and combinations of blocks in the flowchart and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 Figure 1
[0096] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart and / or block diagram block or blocks. Figure 1 Figure 1
[0097] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 Figure 1
[0098] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0099] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, for storing instructions and data. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), flash memory, or other non-volatile memory. The memory can be a memory of a computer-readable medium.
[0100] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0101] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0102] Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system or computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer usable program code.
[0103] The above merely provides embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the scope of claims of the present application.
Claims
1. A method for detecting circuit breaker defects, characterized in that, include: An initial image is obtained by acquiring an image of the circuit breaker, wherein the initial image includes the threads of the circuit breaker; The initial image is subjected to image enhancement processing to obtain a target image, wherein the distinguishability of the initial contour line of the thread in the initial image is less than the distinguishability of the target contour line of the thread in the target image; The target contour line is extracted to obtain a first image feature, wherein the first image feature is the feature corresponding to the area in the target image where there is a thread defect, and the first image feature is different from the second image feature, wherein the second image feature is the feature corresponding to the area in the target image where there is no thread defect; Based on the first image features, the defect identification result of the circuit breaker is determined; The step of image acquisition of the circuit breaker includes: setting up at least one industrial camera to acquire initial images of the circuit breaker from different angles, wherein the circuit breaker is placed on a conveyor belt, and when the circuit breaker is conveyed to a predetermined shooting position by the conveyor belt, acquiring the occlusion signal of the circuit breaker on the photoelectric sensor at the predetermined shooting position; and responding to the occlusion signal, controlling image acquisition of the circuit breaker to obtain the initial image. The method further includes: determining the first image features based on a target model, wherein the target model is obtained by training using a grayscale data set; The step of extracting the target contour line and determining the presence of a thread defect area in the target image as a first image feature includes: using an edge detection algorithm to extract the target contour line and determine the grayscale values corresponding to multiple second pixels included in the target contour line; using a target model to identify the changing trends between the grayscale values corresponding to the second pixels and determine the first image feature, wherein the grayscale data set is obtained based on the acquired images of the training circuit breaker, and the type of the circuit breaker matches the type of the training circuit breaker.
2. The method according to claim 1, characterized in that, The step of performing image enhancement processing on the initial image to obtain the target image includes: The initial image is processed by grayscale conversion to obtain the first image; The first image is processed using Gaussian filtering to obtain the target image.
3. The method according to claim 2, characterized in that, After performing image enhancement processing on the initial image to obtain the target image, the method further includes: The target image is processed using binarization to obtain a second image; In the case where the second image includes a plurality of first pixels, for a target first pixel among the plurality of first pixels, the grayscale difference between the target first pixel and other first pixels is determined, wherein the other first pixels are the first pixels among the plurality of first pixels excluding the target first pixel; Based on the grayscale difference, determine whether the target first pixel belongs to the area containing thread defects in the target image; If the target first pixel belongs to a region with thread defects included in the target image, it is determined that the target first pixel belongs to the set of defect pixels; The method of determining whether the target first pixel belongs to the defective pixel set is used to determine whether the plurality of first pixels belong to the defective pixel set respectively; The defect identification result is determined based on the set of defective pixels.
4. The method according to any one of claims 1 to 3, characterized in that, The circuit breaker is placed on a conveyor belt, and the determination of the defect identification result based on the first image features includes: In response to a warning signal indicating that the circuit breaker has a thread defect area, the circuit breaker is subjected to a pre-determined jet treatment for a predetermined duration so that it leaves the conveyor belt. The predetermined duration is determined based on the stress characteristics of the circuit breaker.
5. A circuit breaker defect detection device, characterized in that, include: The acquisition module is used to acquire images of the circuit breaker to obtain an initial image, wherein the initial image includes the threads of the circuit breaker; The processing module is used to perform image enhancement processing on the initial image to obtain a target image, wherein the distinguishability of the initial contour line of the thread in the initial image is less than the distinguishability of the target contour line of the thread in the target image; The extraction module extracts the target contour line to obtain a first image feature, wherein the first image feature is the feature corresponding to the area in the target image where there is a thread defect, and the first image feature is different from the second image feature, wherein the second image feature is the feature corresponding to the area in the target image where there is no thread defect; The identification module determines the defect identification result of the circuit breaker based on the first image features; The acquisition module is further configured to set at least one industrial camera to acquire initial images of the circuit breaker from different angles. The circuit breaker is placed on a conveyor belt. When the circuit breaker is conveyed to a predetermined shooting position by the conveyor belt, the module acquires the occlusion signal of the circuit breaker on the photoelectric sensor at the predetermined shooting position. In response to the occlusion signal, the module controls the acquisition of images of the circuit breaker to obtain the initial images. The device is further configured to determine the first image features based on a target model, wherein the target model is obtained by training a grayscale data set; The extraction module is further configured to use an edge detection algorithm to extract the target contour line, determine the gray values corresponding to the multiple second pixels included in the target contour line, and use a target model to identify the changing trend between the gray values corresponding to the second pixels to determine the first image feature. The gray data set is obtained based on the collected images of the training circuit breaker, and the type of the circuit breaker matches the type of the training circuit breaker.
6. A non-volatile storage medium, characterized in that, The non-volatile storage medium stores multiple instructions, which are adapted to be loaded by a processor and executed by the circuit breaker defect detection method according to any one of claims 1 to 4.
7. An electronic device, characterized in that, include: One or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the circuit breaker defect detection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Screw thread defect detection apparatus and method based on CCD camera image processing technology
CN108387516A
Defect detection method and device, electronic device and storage medium
CN110766736A
Plant phenotype color image feature extraction method
CN116721121A