Appearance defect detection method and device of electrical equipment, electronic equipment and medium
By acquiring images and analyzing pixel distribution data of texture features in the appearance inspection of electrical equipment, and combining illumination difference and target position templates, the problem of low accuracy and efficiency of screw recognition in the appearance defect inspection of electrical equipment is solved, realizing efficient and accurate screw detection and meeting the needs of production lines.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HAIER DIGITAL TECHNOLOGY (QINGDAO) CO LTD
- Filing Date
- 2022-08-05
- Publication Date
- 2026-07-24
AI Technical Summary
Existing methods for detecting defects in the appearance of electrical equipment, especially those for identifying whether screws are missing on the C-side of the equipment, are not very accurate and efficient, and cannot meet the production cycle requirements of actual production lines.
By acquiring images of the appearance of electrical equipment, the area to be inspected is determined. Based on defect detection benchmark data, the pixel distribution data of the texture features of the target object is analyzed. By using the difference analysis between the standard image and the defect image obtained under preset lighting, the type and location of the screw are determined. Combined with the target location template, the location positioning time is shortened, and the detection efficiency and accuracy are improved.
It enables efficient and accurate detection of whether screws are missing on the C-side of electrical equipment, meeting the production cycle requirements of production lines, achieving 100% accuracy, and reducing hardware costs.
Smart Images

Figure CN115294060B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image detection technology, and in particular to a method, apparatus, electronic device and medium for detecting appearance defects in electrical equipment. Background Technology
[0002] In the inspection of appearance defects in electrical equipment, detecting whether screws are missing from the C-side (surface) is a crucial task. The C-side has a large number of screws, which are relatively small (e.g., approximately 4ms in diameter), and most are scattered along the sides of the panel. The shadows cast by these screws under light are similar in color to the black border of the panel. Therefore, locating them is challenging, and the large number of screws to be identified further complicates the process. Currently used algorithms are based on neural networks for object detection (such as YOLO and Faster R-CNN), but their accuracy is low and their detection efficiency is slow, thus failing to meet the production cycle requirements of actual production lines (e.g., operator execution speed requirement <70ms / screw). Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, and medium for detecting appearance defects in electrical equipment, which can improve the detection efficiency and identification accuracy of target objects, and the detection efficiency can meet the production cycle requirements of actual production lines.
[0004] In a first aspect, this application provides a method for detecting appearance defects in electrical equipment, the method comprising:
[0005] Acquire an external image of the surface of the electrical equipment to be inspected, and determine the area to be inspected in the external image;
[0006] When a target object is detected in the region to be detected, the pixel distribution data of the current texture features of the target object is determined;
[0007] Based on the defect detection benchmark data, the pixel distribution data of the current texture feature is analyzed to obtain the type of the target object, and the number and location of the target objects of the type are determined, thereby obtaining the appearance defect detection result of the electrical equipment.
[0008] This application provides a method for detecting appearance defects in electrical equipment. The method involves acquiring an appearance image of the surface of the electrical equipment to be inspected and determining the area to be inspected within the image. When a target object is detected in the area to be inspected, the pixel distribution data of the current texture features of the target object is determined. Based on defect detection benchmark data, the pixel distribution data of the current texture features is analyzed to obtain the type of the target object, and the number and location of target objects of that type are determined, thereby obtaining the appearance defect detection result of the electrical equipment. This application first determines the area to be inspected corresponding to each target object using a pre-defined target location template, which can shorten the time for locating the target object and thus improve detection efficiency. Then, by analyzing the pixel distribution data of the target object using defect detection benchmark data, the type of the target object is determined, thereby judging whether the target object has defects, which can improve the accuracy of target object recognition. Furthermore, the number and location of target objects with defects are further determined. Therefore, implementing the technical solution of this application can improve the detection efficiency and recognition accuracy of target objects, and the detection efficiency can meet the production cycle requirements of actual production lines.
[0009] Furthermore, the target object type includes a first type of target and / or a second type of target, wherein the second type of target is used to install the first type of target, and the defect detection benchmark data for the appearance defect detection of the electrical equipment is determined in the following manner:
[0010] A standard image of the surface to be detected is acquired under a preset illumination, and pixel distribution data of the standard texture features of the first type of target in the standard image are determined; the standard image is a second type of target in the surface to be detected on which the first type of target is installed;
[0011] Acquire a defect image of the surface to be inspected, and determine the pixel distribution data of the defect texture features of the second type of target in the defect image; the defect image is a surface to be inspected where the first type of target is not installed on the second type of target.
[0012] The defect detection benchmark data is obtained by performing difference analysis on the pixel distribution data of the standard texture feature and the pixel distribution data of the defect texture feature.
[0013] Furthermore, determining the pixel distribution data of the standard texture features of the first type of target in the standard image includes:
[0014] Determine the pixel distribution data of each first-class target in the standard image, wherein the standard image includes multiple first-class targets;
[0015] Determine the light and shadow weights corresponding to each of the first-type targets;
[0016] The pixel distribution data of each of the first-class targets is weighted with the light and shadow weights of the corresponding first-class targets, and the weighted result is used as the pixel distribution data of the standard texture feature.
[0017] Furthermore, the pixel distribution data includes pixel intervals, the number of groups of pixel intervals, and the number of pixels in each pixel interval group. The pixel intervals and the number of groups of pixel intervals are determined based on a preset pixel grouping interval. The step of performing difference analysis on the pixel distribution data of the standard texture feature and the pixel distribution data of the defect texture feature to obtain defect detection benchmark data includes:
[0018] Calculate the first difference between the number of pixels in each group corresponding to the pixel distribution data of the standard texture feature and the pixel distribution data of the defect texture feature;
[0019] A preset number of first target differences are selected from the first differences, and the first target differences and the pixel intervals corresponding to the first target differences are used as the defect detection benchmark data.
[0020] Furthermore, the step of analyzing the pixel distribution data of the current texture features based on defect detection benchmark data to obtain the type of the target object includes:
[0021] Calculate the second difference between the number of pixels in each group corresponding to the pixel distribution data of the standard texture feature and the pixel distribution data of the current texture feature;
[0022] Select the preset number of second target differences from the second differences, and use the second target differences and the pixel intervals corresponding to the second target differences as the appearance data of the target object;
[0023] The variance results were obtained by performing an analysis of variance on the defect detection benchmark data and the appearance data.
[0024] If the variance result is greater than a preset threshold, then the type of the target object is determined to be the first type of target;
[0025] If the variance result is not greater than the preset threshold, then the type of the target object is determined to be the second type of target.
[0026] Furthermore, determining the region to be detected in the appearance image includes:
[0027] The first region in the appearance image containing the target object is predicted based on the target location template. The target location template is determined by annotating the target object in the surface to be detected. The target location template is obtained from the template library based on the attribute information of the electrical equipment.
[0028] The detection area is obtained by expanding the left and right sides of the first area by a preset width.
[0029] Furthermore, detecting a target object in the area to be detected includes:
[0030] Determine whether a contour feature of a preset shape can be detected in the area to be detected, wherein the contour feature of the preset shape is determined based on the shapes of the first type of target and the second type of target;
[0031] If detected, it is determined that the target object has been detected in the area to be detected.
[0032] Furthermore, determining the pixel distribution data of the current texture features of the target object includes:
[0033] Determine the pixel information of the target object;
[0034] Histogram analysis of the pixel information yields the pixel distribution data of the current texture features of the target object.
[0035] Secondly, this application provides a device for detecting appearance defects in electrical equipment, the device comprising:
[0036] The region determination module is used to acquire an appearance image of the surface of the electrical equipment to be inspected, and to determine the region to be inspected in the appearance image;
[0037] The data determination module is used to determine the pixel distribution data of the current texture features of the target object when a target object is detected in the area to be detected;
[0038] The defect detection module is used to analyze the pixel distribution data of the current texture features based on defect detection benchmark data to obtain the type of the target object, and determine the number and location of the target objects of the type, thereby obtaining the appearance defect detection result of the electrical equipment.
[0039] Thirdly, this application provides an electronic device comprising:
[0040] At least one processor; and
[0041] A memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the appearance defect detection method for electrical equipment according to any embodiment of this application.
[0043] Fourthly, this application provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the appearance defect detection method for electrical equipment according to any embodiment of this application.
[0044] It should be noted that the aforementioned computer instructions may be stored, in whole or in part, on a computer-readable storage medium. This computer-readable storage medium may be packaged together with the processor of the electrical equipment appearance defect detection device, or it may be packaged separately from the processor of the electrical equipment appearance defect detection device; this application does not impose any limitations on this.
[0045] The descriptions of the second, third, and fourth aspects in this application can be referenced to the detailed description of the first aspect; and the beneficial effects described in the second, third, and fourth aspects can be referenced to the analysis of the beneficial effects of the first aspect, which will not be repeated here.
[0046] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a schematic diagram of the first process of a method for detecting appearance defects in electrical equipment provided in an embodiment of this application;
[0049] Figure 2 This is a schematic diagram of the second process of a method for detecting appearance defects in electrical equipment provided in an embodiment of this application;
[0050] Figure 3 This is a schematic diagram of the structure of an electrical equipment appearance defect detection device provided in an embodiment of this application;
[0051] Figure 4 This is a block diagram of an electronic device used to implement a method for detecting appearance defects in electrical equipment according to an embodiment of this application. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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 should fall within the scope of protection of this application.
[0053] It should be noted that the terms "first," "second," "target," and "original," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein. Furthermore, the terms "comprising," "having," and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0054] Before introducing the embodiments of this application, a brief overview of its application scenario is provided. This application is used in a specific stage of electrical equipment manufacturing to detect appearance defects on the production line of electrical equipment. Due to the production cycle requirements of the production line, the processor executing the appearance defect detection method of this application requires an operator execution speed of <70ms / operator. The types of target objects on the appearance C-surface include first-type targets and / or second-type targets. This application uses screws as an example of first-type targets and holes where screws need to be installed as second-type targets to introduce the appearance defect detection method of this application. This application detects whether screws are missing from the appearance C-surface of electrical equipment, that is, whether screws are not installed in the holes. When screws are not installed in the holes, it indicates that there is an appearance defect on the appearance C-surface of the electrical equipment, and it is also necessary to determine the number and location of the missing screws.
[0055] Figure 1 This is a first flowchart illustrating a method for detecting appearance defects in electrical equipment according to an embodiment of this application. This embodiment is applicable to inspecting the appearance of electrical equipment to determine whether screws are missing from surface C of the equipment. The method for detecting appearance defects in electrical equipment provided in this embodiment can be executed by the device for detecting appearance defects in electrical equipment provided in this embodiment. This device can be implemented through software and / or hardware and integrated into the electronic device executing the method. Preferably, the electronic device in this embodiment can be an appearance inspection device.
[0056] See Figure 1 The method in this embodiment includes, but is not limited to, the following steps:
[0057] S110. Acquire an image of the surface of the electrical equipment to be inspected and determine the area to be inspected in the image.
[0058] In this embodiment, the electrical equipment can be a household appliance such as a washing machine, refrigerator, or oven, or an electronic product such as a computer host or game console; no limitation is made here. The surface to be inspected refers to the side of the electrical equipment's exterior, i.e., the C-side of the exterior, which in this application refers to the surface where screws need to be installed. An image of the surface to be inspected (i.e., the C-side of the exterior) is acquired by an image acquisition device, which can be an industrial camera, a camera, or a mobile phone, etc.
[0059] Furthermore, determining the area to be detected in the appearance image includes: marking the approximate location of the target object (i.e., screws and / or holes) on the appearance image based on the target position template, thereby predicting the first area in the appearance image where the target object exists; since the fixed position of electrical equipment on the product assembly line may deviate and the position may also move when the appearance image is acquired, it is necessary to expand the left and right sides of the first area by a preset width (e.g., 50mm) to obtain the area to be detected.
[0060] The target location template is determined by marking the target objects on the surface to be inspected. The target location template is obtained from a template library based on the electrical equipment's attribute information (such as product model). A target location template is pre-defined for each product model of electrical equipment to mark the positions of screws and / or holes on the C-surface, allowing for quick prediction of the areas to be inspected where screws and / or holes exist during the inspection of appearance defects. The advantage of this setup is that when there are many screws on the C-surface and the screw sizes are relatively small, the pre-defined target location templates can roughly determine the area to be inspected for each target object, shortening the time required for locating the target objects and thus improving inspection efficiency.
[0061] S120. When a target object is detected in the area to be detected, determine the pixel distribution data of the current texture features of the target object.
[0062] In this embodiment of the application, the detection area determined by the above steps is only a general prediction of the range of the target object. This step also needs to further determine whether the target object exists in the detection area.
[0063] Specifically, detecting target objects in the detection area includes: detecting the contour features of a preset shape in the detection area using a blob contour feature algorithm; if the contour features of the preset shape are detected, it is determined that a target object, i.e., a screw or a hole without a screw installed, has been detected in the detection area. The contour features of the preset shape are determined based on the shapes of the first type of target (i.e., the screw) and the second type of target (i.e., the hole). When the screw and the hole have the same shape, such as both being circular, then the preset shape is also circular. When the screw and the hole have different shapes, such as one being circular and the other being quadrilateral, the one with the largest outer contour is selected as the preset shape. In practical applications, this application accurately locates the target object's position (i.e., the detection area), thus achieving a detection and recognition accuracy of 100%.
[0064] Furthermore, determining the pixel distribution data of the current texture features of the target object includes: determining the pixel value of each pixel block in the target object, thereby obtaining the pixel information of the target object; and performing histogram analysis on the pixel information to obtain the pixel distribution data of the current texture features of the target object. Here, the pixel distribution data describes the distribution of pixel information of the target object. The pixel distribution data includes pixel intervals, the number of groups of pixel intervals, and the number of pixels in each pixel interval group. The pixel intervals and the number of groups of pixel intervals are determined based on a preset pixel grouping interval.
[0065] For example, after determining the pixel information of the target object, the pixel values from 0 to 255 are first divided into 26 pixel intervals according to a preset pixel grouping interval (e.g., 10 pixel units), such as pixel intervals 0-9, 10-19, 20-29, ..., 240-249, 250-255. Then, the number of pixels in each pixel block of the target object whose pixel values fall within the above 26 pixel intervals is counted.
[0066] S130. Based on the defect detection benchmark data, analyze the pixel distribution data of the current texture features to obtain the type of the target object, and determine the number and location of the target objects of the type, thereby obtaining the appearance defect detection result of the electrical equipment.
[0067] The defect detection benchmark data is pre-determined for the inspection of appearance defects in electrical equipment. The specific process for determining the defect detection benchmark data will be described in the following embodiments. The target object types include a first type of target and / or a second type of target, where the second type of target is used to install the first type of target. For example, the first type of target may be a screw, and the second type of target may be a hole where a screw needs to be installed.
[0068] Specifically, the target object type is obtained by analyzing the pixel distribution data of the current texture features based on defect detection benchmark data. This includes: First, acquiring a standard image of the surface to be inspected, and determining the pixel distribution data of the standard texture features of the first type of target (i.e., screws) in the standard image; the standard image shows that all the second type of target (i.e., holes) in the surface to be inspected are equipped with the first type of target (i.e., screws), and the standard texture features refer to the texture information of the screw surface in the standard image; the pixel distribution data of the standard texture features is the same as the method and process of determining the pixel distribution data of the current texture features in step S120 above, and will not be repeated here. Similarly, the number of pixels in the 26 pixel intervals corresponding to the standard texture features can be obtained.
[0069] Then, the pixel counts of the standard texture feature and the current texture feature are subtracted one by one from the pixel counts of the 26 pixel intervals corresponding to the current texture feature. This yields the second difference between the pixel distribution data of the standard texture feature and the pixel distribution data of the current texture feature, i.e., the second difference between the 26 pixel counts. From these second differences, the second target difference with the largest preset number (e.g., 20) is selected. The second target difference and the pixel intervals corresponding to the second target difference are then used as the appearance data of the target object.
[0070] Finally, variance analysis was performed on the defect detection baseline data (20 data points) and appearance data (20 data points) to obtain the variance results. If the variance results are greater than the preset threshold, the target object type is determined to be the first type of target (i.e., screws); if the variance results are not greater than the preset threshold, the target object type is determined to be the second type of target (i.e., holes).
[0071] Optionally, the appearance image may include multiple target objects.
[0072] In this embodiment, the type of each target object in the appearance image is determined. When a screw is detected, it indicates that a screw is installed in the hole at that location, meaning there is no appearance defect at that location. When a hole is detected, it indicates that no screw is installed in the hole at that location, meaning there is an appearance defect at that location. The number of holes with installed screws, the number of holes without installed screws, and the location of the holes when no screws are installed are recorded. Finally, the type, location, and quantity of the target object are used as the appearance defect detection result of the electrical equipment.
[0073] Optionally, the position of the screw can be recorded when it is installed in the hole, or the area to be tested can be used as the position of the hole or screw.
[0074] In practical applications, the appearance defect detection method for electrical equipment proposed in this application operates quickly. If approximately 30 screws need to be inspected on the C-side of the appearance, the execution time of a single operator is within 40ms, and the total inspection time for all screws on the entire C-side does not exceed 1.4 seconds, which meets the production cycle requirements of actual production lines. Furthermore, it has minimal hardware requirements, reducing hardware costs, as it relies solely on CPU computation and does not require a GPU.
[0075] The technical solution provided in this embodiment acquires an appearance image of the surface to be inspected of an electrical device and determines the area to be inspected in the appearance image. When a target object is detected in the area to be inspected, the pixel distribution data of the current texture features of the target object is determined. Based on defect detection benchmark data, the pixel distribution data of the current texture features is analyzed to obtain the type of the target object, and the number and location of target objects of that type are determined, thereby obtaining the appearance defect detection result of the electrical device. The application first determines the area to be inspected corresponding to each target object by using a pre-defined target location template, which can shorten the time for locating the target object and thus improve the detection efficiency. Then, the pixel distribution data of the target object is analyzed using defect detection benchmark data to determine the type of the target object, thereby judging whether the target object has a defect, which can improve the recognition accuracy of the target object, and further determine the number and location of target objects with defects. Therefore, implementing the technical solution of this application can improve the detection efficiency and recognition accuracy of the target object, and the detection efficiency can meet the production cycle requirements of the actual production line.
[0076] The following further describes the method for detecting appearance defects in electrical equipment provided by embodiments of the present invention. Figure 2 This is a schematic diagram of the second process of a method for detecting appearance defects in electrical equipment, provided in an embodiment of this application. This embodiment is an optimization based on the above embodiment, specifically an optimization that provides a detailed explanation of the process for determining defect detection benchmark data for detecting appearance defects in electrical equipment.
[0077] See Figure 2 The method in this embodiment includes, but is not limited to, the following steps:
[0078] S210. Acquire a standard image of the surface to be detected under preset illumination, and determine the pixel distribution data of the standard texture features of the first type of target in the standard image.
[0079] The target object types include a first type of target and / or a second type of target, where the second type of target is used to mount the first type of target. For example, the first type of target could be a screw, and the second type of target could be a hole where the screw is mounted. The standard image shows all the second type of targets (i.e., holes) in the surface to be inspected mounted with first type of targets (i.e., screws). Standard texture features refer to the texture information of the screw surface in the standard image.
[0080] In this embodiment, if the outer surface color of the screw is the same as the background color of surface C of the electrical appliance, and both are reflective surfaces, it increases the difficulty of detecting whether surface C of the electrical appliance is missing a screw. To solve this problem, this application first acquires a standard image of the surface to be inspected under the same illumination angle using an image acquisition device, then determines the pixel distribution data of each first-type target in the standard image, and then combines the light and shadow weights of each first-type target under the aforementioned illumination angle to determine the pixel distribution data of the standard texture features of the first-type target. Optionally, the standard image includes multiple first-type targets.
[0081] Specifically, the process of determining the pixel distribution data of the standard texture features of the first type of target in the standard image is as follows: determine the pixel distribution data of each first type of target in the standard image; determine the light and shadow weights of each first type of target under the above illumination angle; weight the pixel distribution data of each first type of target with the corresponding light and shadow weights of each first type of target, and use the weighted result as the pixel distribution data of the standard texture features.
[0082] The pixel distribution data of the standard texture feature is obtained through the same process as step S120 in the above embodiment for determining the pixel distribution data of the current texture feature, and will not be repeated here. Similarly, the number of pixels in the 26 pixel intervals corresponding to the standard texture feature can be obtained.
[0083] Current screw detection methods often reveal significant differences in screw characteristics depending on whether they are shadowed or not under illumination, making it impossible to use a single standard feature for screw detection. To address this issue, this application disregards the presence or absence of shadows and focuses solely on the screw's standard texture features. Therefore, this application is adaptable to various lighting conditions and exhibits high recognition stability. These standard texture features can be determined by examining screws with different light and shadow weights under the same illumination angle. Optionally, the standard texture feature can be the cross-shaped pattern on the screw surface.
[0084] S220. Obtain the defect image of the surface to be inspected, and determine the pixel distribution data of the defect texture features of the second type of target in the defect image.
[0085] In this embodiment, the defect image is a second type of target (i.e., a hole) on the surface to be inspected where the first type of target (i.e., a screw) is not installed. The defect texture feature refers to the texture information of the hole surface in the defect image. The pixel distribution data of the defect texture feature is the same as the method for determining the pixel distribution data of the current texture feature in step S120 of the above embodiment, and will not be repeated here. Similarly, the number of pixels in the 26 pixel intervals corresponding to the defect texture feature can be obtained.
[0086] When a hole reflects light or casts a shadow under illumination, the defect texture feature can be determined by holes with different light and shadow weights under the same illumination angle; when a hole does not reflect light or cast a shadow under illumination, the defect texture feature can also be the defect texture feature of any hole in the defect image.
[0087] S230. Perform difference analysis on the pixel distribution data of standard texture features and the pixel distribution data of defect texture features to obtain defect detection benchmark data.
[0088] In this embodiment, the pixel distribution data includes pixel intervals, the number of pixel interval groups, and the number of pixels in each pixel interval group. The pixel intervals and the number of pixel interval groups are determined based on a preset pixel grouping interval. First, the number of pixels in each of the 26 pixel interval groups corresponding to the standard texture feature and the number of pixels in each of the 26 pixel interval groups corresponding to the defect texture feature are subtracted one by one to calculate the first difference between the pixel distribution data of the standard texture feature and the pixel distribution data of the defect texture feature, i.e., the first difference between the number of pixels in each of the 26 pixel interval groups. Then, a preset number (e.g., 20) of first target differences are selected from the first differences. Finally, the first target differences and the pixel intervals corresponding to the first target differences are used as the defect detection benchmark data.
[0089] The technical solution provided in this embodiment involves acquiring a standard image of the surface to be inspected under preset illumination, determining the pixel distribution data of the standard texture features of a first type of target in the standard image, acquiring a defect image of the surface to be inspected, and determining the pixel distribution data of the defect texture features of a second type of target in the defect image, and performing difference analysis on the pixel distribution data of the standard texture features and the pixel distribution data of the defect texture features to obtain defect detection benchmark data. This application first determines the defect detection benchmark data for the appearance defect detection of electrical equipment, then analyzes the pixel distribution data of the target object using the defect detection benchmark data to determine the type of the target object, thereby determining whether the target object has a defect, which can improve the accuracy of target object recognition, and further determine the number and location of target objects with defects. Therefore, implementing the technical solution of this application can improve the detection efficiency and recognition accuracy of target objects, and the detection efficiency can meet the production cycle requirements of actual production lines.
[0090] Figure 3 This is a schematic diagram of the structure of an electrical equipment appearance defect detection device provided in an embodiment of this application, as shown below. Figure 3 As shown, the device 300 may include:
[0091] The region determination module 310 is used to acquire an appearance image of the surface of the electrical equipment to be inspected, and to determine the region to be inspected in the appearance image;
[0092] The data determination module 320 is used to determine the pixel distribution data of the current texture features of the target object when a target object is detected in the area to be detected;
[0093] The defect detection module 330 is used to analyze the pixel distribution data of the current texture feature based on the defect detection benchmark data to obtain the type of the target object, and determine the number and location of the target objects of the type, thereby obtaining the appearance defect detection result of the electrical equipment.
[0094] Optionally, the type of the target object includes a first type of target and / or a second type of target, wherein the second type of target is used to install the first type of target.
[0095] Furthermore, the aforementioned electrical equipment appearance defect detection device may also include: a reference data determination module;
[0096] The reference data determination module is used to acquire a standard image of the surface to be inspected under a preset illumination, and determine the pixel distribution data of the standard texture features of the first type of target in the standard image; the standard image is a second type of target on the surface to be inspected with the first type of target installed; acquire a defect image of the surface to be inspected, and determine the pixel distribution data of the defect texture features of the second type of target in the defect image; the defect image is a second type of target on the surface to be inspected without the first type of target installed; perform difference analysis on the pixel distribution data of the standard texture features and the pixel distribution data of the defect texture features to obtain defect detection reference data.
[0097] Furthermore, the aforementioned benchmark data determination module can also be specifically used to: determine the pixel distribution data of each first type of target in the standard image, wherein the standard image includes multiple first type targets; determine the light and shadow weights corresponding to each first type target; weight the pixel distribution data of each first type target with the corresponding light and shadow weights of each first type target, and use the weighted result as the pixel distribution data of the standard texture feature.
[0098] Optionally, the pixel distribution data includes pixel intervals, the number of groups of pixel intervals, and the number of pixels in each pixel interval group. The pixel intervals and the number of groups of pixel intervals are determined based on a preset pixel grouping interval.
[0099] Furthermore, the aforementioned benchmark data determination module can also be specifically used to: calculate the first difference between the number of pixels in each group corresponding to the pixel distribution data of the standard texture feature and the pixel distribution data of the defect texture feature; select a preset number of first target differences from the first differences, and use the first target differences and the pixel intervals corresponding to the first target differences as the defect detection benchmark data.
[0100] Furthermore, the aforementioned defect detection module 330 can be specifically used to: calculate a second difference between the pixel distribution data of the standard texture feature and the pixel distribution data of the current texture feature for each group of pixels; select a preset number of second target differences from the second differences, and use the second target differences and the pixel intervals corresponding to the second target differences as the appearance data of the target object; perform variance analysis on the defect detection benchmark data and the appearance data to obtain a variance result; if the variance result is greater than a preset threshold, determine that the type of the target object is the first type of target; if the variance result is not greater than the preset threshold, determine that the type of the target object is the second type of target.
[0101] Furthermore, the aforementioned region determination module 310 can be specifically used to: predict a first region in the appearance image where a target object exists based on a target location template, wherein the target location template is determined by marking the target object in the surface to be detected, and the target location template is obtained from a template library based on the attribute information of the electrical equipment; and expand the left and right sides of the first region by a preset width to obtain the region to be detected.
[0102] Furthermore, the aforementioned data determination module 320 can be specifically used to: determine whether a preset shape contour feature can be detected in the area to be detected, the preset shape contour feature being determined based on the shapes of the first type of target and the second type of target; if it can be detected, then it is determined that the target object has been detected in the area to be detected.
[0103] Furthermore, the aforementioned data determination module 320 can be specifically used to: determine the pixel information of the target object; and perform histogram analysis on the pixel information to obtain the pixel distribution data of the current texture features of the target object.
[0104] The electrical equipment appearance defect detection device provided in this embodiment can be applied to the electrical equipment appearance defect detection method provided in any of the above embodiments, and has corresponding functions and beneficial effects.
[0105] Figure 4This is a block diagram of an electronic device used to implement a display method according to an embodiment of this application. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present application described and / or claimed herein.
[0106] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0107] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0108] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as methods for detecting appearance defects in electrical equipment.
[0109] In some embodiments, the method for detecting appearance defects in electrical equipment can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for detecting appearance defects in electrical equipment described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the method for detecting appearance defects in electrical equipment by any other suitable means (e.g., by means of firmware).
[0110] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0111] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0112] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0113] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0114] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0115] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0116] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0117] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for detecting appearance defects in electrical equipment, characterized in that, The method includes: Acquire an external image of the surface of the electrical equipment to be inspected, and determine the area to be inspected in the external image; When a target object is detected in the region to be detected, the pixel distribution data of the current texture features of the target object is determined; Based on the defect detection benchmark data, the pixel distribution data of the current texture feature is analyzed to obtain the type of the target object, and the number and location of the target objects of the type are determined, thereby obtaining the appearance defect detection result of the electrical equipment; The target object type includes a first type of target and / or a second type of target. The second type of target is used to install the first type of target. Defect detection benchmark data is determined for the appearance defect detection of the electrical equipment in the following manner: A standard image of the surface to be inspected is acquired under preset illumination; the pixel distribution data of the standard texture features of the first type of target in the standard image is determined; the standard image is a second type of target on the surface to be inspected with the first type of target installed; a defect image of the surface to be inspected is acquired; the pixel distribution data of the defect texture features of the second type of target in the defect image is determined; the defect image is a second type of target on the surface to be inspected without the first type of target installed; difference analysis is performed on the pixel distribution data of the standard texture features and the pixel distribution data of the defect texture features to obtain the defect detection benchmark data. The pixel distribution data includes pixel intervals, the number of groups of pixel intervals, and the number of pixels in each group of pixel intervals. The pixel intervals and the number of groups of pixel intervals are determined based on a preset pixel grouping interval. The step of performing difference analysis on the pixel distribution data of the standard texture feature and the pixel distribution data of the defect texture feature to obtain defect detection benchmark data includes: calculating a first difference between the number of pixels in each group of the pixel distribution data of the standard texture feature and the pixel distribution data of the defect texture feature; selecting a preset number of first target differences from the first differences; and using the first target differences and the pixel intervals corresponding to the first target differences as the defect detection benchmark data.
2. The method for detecting appearance defects in electrical equipment according to claim 1, characterized in that, The pixel distribution data for determining the standard texture features of the first type of target in the standard image includes: Determine the pixel distribution data of each first-class target in the standard image, wherein the standard image includes multiple first-class targets; Determine the light and shadow weights corresponding to each of the first-type targets; weight the pixel distribution data of each of the first-type targets with the corresponding light and shadow weights of each of the first-type targets, and use the weighted result as the pixel distribution data of the standard texture feature.
3. The method for detecting appearance defects in electrical equipment according to claim 1, characterized in that, The method of analyzing the pixel distribution data of the current texture features based on defect detection benchmark data to obtain the type of the target object includes: Calculate the second difference between the number of pixels in each group corresponding to the pixel distribution data of the standard texture feature and the pixel distribution data of the current texture feature; Select the preset number of second target differences from the second differences, and use the second target differences and the pixel intervals corresponding to the second target differences as the appearance data of the target object; The variance results were obtained by performing an analysis of variance on the defect detection benchmark data and the appearance data. If the variance result is greater than a preset threshold, then the type of the target object is determined to be the first type of target; If the variance result is not greater than the preset threshold, then the type of the target object is determined to be the second type of target.
4. The method for detecting appearance defects in electrical equipment according to claim 1, characterized in that, Determining the region to be detected in the appearance image includes: The first region in the appearance image containing the target object is predicted based on the target location template. The target location template is determined by annotating the target object in the surface to be detected. The target location template is obtained from the template library based on the attribute information of the electrical equipment. The detection area is obtained by expanding the left and right sides of the first area by a preset width.
5. The method for detecting appearance defects in electrical equipment according to claim 1, characterized in that, The detection of a target object in the area to be detected includes: Determine whether a contour feature of a preset shape can be detected in the area to be detected, wherein the contour feature of the preset shape is determined based on the shapes of the first type of target and the second type of target; If detected, it is determined that the target object has been detected in the area to be detected.
6. The method for detecting appearance defects in electrical equipment according to claim 1, characterized in that, The pixel distribution data for determining the current texture features of the target object includes: Determine the pixel information of the target object; Histogram analysis of the pixel information yields the pixel distribution data of the current texture features of the target object.
7. A device for detecting appearance defects in electrical equipment, characterized in that, For implementing the method for detecting appearance defects in electrical equipment as described in claim 1, the apparatus comprises: The region determination module is used to acquire an appearance image of the surface of the electrical equipment to be inspected, and to determine the region to be inspected in the appearance image; The data determination module is used to determine the pixel distribution data of the current texture features of the target object when a target object is detected in the area to be detected; The defect detection module is used to analyze the pixel distribution data of the current texture features based on defect detection benchmark data to obtain the type of the target object, and determine the number and location of the target objects of the type, thereby obtaining the appearance defect detection result of the electrical equipment.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the appearance defect detection method for electrical equipment according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the appearance defect detection method for electrical equipment as described in any one of claims 1 to 6.