A method and device for determining a battery box pin defect, an electronic device and a medium
By scanning battery box images and performing automated pin inspection, the problems of missed detection, false detection and high cost of traditional manual inspection are solved, and efficient and accurate pin defect detection is achieved.
Patent Information
- Application Number
- CN202211701036.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-12-28
AI Technical Summary
Traditional manual methods for detecting defects in battery box pins suffer from problems such as missed detections, poor repeatability, high cost, and high false detection rate. They cannot detect pins that are slightly retracted or misaligned, resulting in low detection accuracy and the potential damage to the pins.
By acquiring scanned images of the battery box and utilizing grayscale and depth information, the system automatically identifies the socket area and pin positions, performs various detection types (such as pin quantity, depth, offset, etc.) to determine pin defects, and uses 3D laser scanners and image processing technology to achieve automated detection.
It has enabled automated detection of battery box pins, reducing labor costs, improving detection accuracy and production efficiency, and reducing the false positive rate.
Smart Images

Figure CN115855821B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of wiring harness production, in particular to a battery box pin defect determination method and device, electronic equipment and a medium. BACKGROUND
[0002] The battery box wiring harness pin defect is a common problem in the wiring harness production industry. If it occurs, it will directly cause the battery box to fail to work, and in severe cases, it will cause traffic accidents. The traditional method for detecting pin defects is visual inspection and direct pin insertion. Through manual detection of appearance and current conduction, it is verified whether the pin is missing, whether it is skewed or broken, but if the pin is slightly retracted or skewed, it cannot be detected, resulting in low detection accuracy. In addition, the existing detection method may also damage the pin.
[0003] At present, the manual detection method of pin defects has the following problems: 1) manual detection is prone to missed detection; 2) it is easily affected by individual differences of the detector, resulting in poor repeatability and reproducibility; 3) the number of sockets to be detected is large, resulting in long manual detection time and high cost; 4) the types of pin sockets to be detected are various, and the standards are various, and manual detection is prone to false detection; therefore, how to determine the defects of the battery box pin has become a problem to be solved. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a battery box pin defect determination method and device, electronic equipment and a medium, which can scan the battery box, determine the socket area of the battery box in the obtained scan image, and detect the pin in the socket area to determine whether the pin has defects. The purpose of automatic detection of the pin not only reduces the labor cost, improves the production efficiency of the battery box wiring harness, but also reduces the false judgment caused by manual detection and improves the accuracy of the battery box wiring harness pin detection.
[0005] The present application mainly includes the following aspects:
[0006] In a first aspect, the present application provides a battery box pin defect determination method, which comprises:
[0007] Obtaining a scan image of a target battery box;
[0008] Based on the gray scale information in the scan image, determining the socket area where each socket of the target battery box is located;
[0009] Obtaining the model of the target battery box, and based on the preset mapping relationship between the model of the battery box and the socket parameter, obtaining the target socket parameter corresponding to the model of the target battery box;
[0010] For each socket area, based on the target socket parameter, the pin in the socket area is detected to obtain the corresponding detection result, if the detection result exists indicating the abnormal pin, the indicating abnormal pin is determined as the defective pin, and the defective pin is marked.
[0011] Further, the step of detecting the pins in the socket area based on the target socket parameter to obtain the corresponding detection result for each socket area comprises:
[0012] For each socket area, the center point coordinates of the socket area are obtained;
[0013] Based on the center point coordinates of the socket area and the corresponding target length and target width in the target socket parameter, a rectangular area with the center point coordinates as the center, the target length and the target width in the socket area is determined as the pin area of the pin in the socket area;
[0014] Based on the gray scale information of the pin area, the predicted number of pins in the pin area and the coordinates of each pin are determined;
[0015] Obtain the detection type, for each detection type, based on the detection type and the predicted number of pins in the pin area and the coordinates of each pin, the pins in the pin area are detected to determine the detection result corresponding to the detection type.
[0016] Further, the step of determining the predicted number of pins in the pin area and the coordinates of each pin based on the gray scale information of the pin area comprises:
[0017] Based on the gray scale information of the pin area, the gray scale information of the pin area is converted into depth information to obtain the depth information of the pin area;
[0018] Based on the depth information of the pin area, it is determined whether there is a depth greater than a preset depth threshold in the plurality of depths included in the depth information;
[0019] If there is, the depth greater than the preset depth threshold is determined as the depth of the pin, the coordinates of each pin in the pin area are obtained, and the number of depths greater than the preset depth threshold is determined as the predicted number of pins in the pin area.
[0020] Further, the step of determining the socket area where each socket of the target battery box is located based on the gray scale information in the scanning image comprises:
[0021] Based on the scanned image, according to the preset row coordinates and the preset longitudinal coordinates of each socket, an area formed by the preset row coordinates and the preset longitudinal coordinates of each socket in the scanned image is extracted, to obtain a target image of each socket;
[0022] For the target image of each socket, based on the gray scale information of the target pattern of the socket, the pixel points with a gray scale value less than a preset gray scale threshold value in the gray scale information are determined, to obtain each connected area formed by the pixel points with the gray scale value less than the preset gray scale threshold value;
[0023] The open operation processing is performed on each connected area, to obtain a plurality of selected areas of the socket;
[0024] The similarity comparison is performed between each selected area and a pre-stored area with a socket feature, and the selected area with the largest similarity is determined as a socket area where the socket is located.
[0025] Further, the scanned image of the target battery box is obtained by the following steps:
[0026] Each depth information of the target battery box obtained by the laser equipment scanning the target battery box once every preset time is obtained;
[0027] Based on a preset relationship between the depth information and the gray scale information, each depth information is converted into gray scale information, and each gray scale information is arranged in turn in the horizontal axis direction, to obtain the scanned image of the target battery box.
[0028] Further, the step of detecting the pins in the pin area based on the detection type, the predicted number of pins in the pin area, and the coordinates of each pin for each detection type, to determine the detection result corresponding to the detection type, includes:
[0029] For each detection type, if the detection type is pin vertical axis depth detection, then for each pin, based on the vertical axis depth of the pin vertical coordinate, it is determined whether the difference between the vertical axis depth of the pin and the outer shell depth of the target battery box determined in advance is within a preset difference range, if yes, the detection result corresponding to the pin vertical axis depth detection of the pin is determined as normal, if not, the detection result corresponding to the pin vertical axis depth detection of the pin is determined as abnormal;
[0030] If the detection type is pin number detection, then it is determined whether the predicted number of pins in the pin area is consistent with the corresponding pin number in the target socket parameter, if yes, the detection result corresponding to the pin number detection of the pin area is determined as normal, if not, the detection result corresponding to the pin number detection of the pin area is determined as abnormal;
[0031] If the detection type is the pin longitudinal axis offset detection, then based on the coordinates of each pin, fitting is performed on each pin to obtain a fitting straight line, and it is determined whether the distance from each pin to the fitting straight line is within a preset distance, if yes, the detection result corresponding to the pin longitudinal axis offset detection of the pin is determined as normal, if no, the detection result corresponding to the pin longitudinal axis offset detection of the pin is determined as abnormal.
[0032] If the detection type is the pin transverse axis offset detection, then based on the abscissa of each pin, it is determined whether the transverse axis distance of each pin is within a preset distance, if yes, the detection result corresponding to the pin transverse axis offset detection of the pin is determined as normal, if no, the detection result corresponding to the pin transverse axis offset detection of the pin is determined as abnormal.
[0033] Further, the determination method further comprises:
[0034] In the scanned image, the shell region of the target battery box is determined;
[0035] The gray scale information of the shell region is converted into depth information, and the depths of a plurality of preset sampling points in the shell region are determined;
[0036] Based on the depth of each preset sampling point, it is determined whether the difference value of the depth of each preset sampling point is within a preset segment difference value;
[0037] If no, the shell of the target battery box is determined as uneven;
[0038] If yes, the shell of the target battery box is determined as flat, and the average value of the depths of the plurality of preset sampling points is determined as the shell depth of the target battery box.
[0039] Further, the step of determining the shell region of the target battery box in the scanned image comprises:
[0040] In the scanned image, the remaining region after removing each socket region in the scanned image is obtained;
[0041] In the remaining region, a connected region is determined;
[0042] Based on the gray scale information of each connected region, an average gray scale value of each connected region is obtained;
[0043] In the average gray scale value, the connected region corresponding to the maximum average gray scale value is determined as the shell region of the target battery box.
[0044] Further, the determination method further comprises:
[0045] Obtain product information of the target battery box, and store each detection result of each socket of the target battery box under the product information to provide retrieval basis.
[0046] In a second aspect, the embodiments of the present application further provide a battery box pin defect determination device, which comprises:
[0047] The acquisition module is configured to acquire a scan image of a target battery box.
[0048] The first processing module is configured to determine, based on the grayscale information in the scan image, a socket region in which each socket of the target battery box is located.
[0049] The mapping module is configured to obtain a model of the target battery box, and obtain target socket parameters corresponding to the model of the target battery box based on a preset mapping relationship between the model of the battery box and the socket parameters.
[0050] The determination module is configured to, for each socket region, detect pins in the socket region based on the target socket parameters to obtain a corresponding detection result, and determine a pin indicating an abnormality as a defective pin if the detection result includes the pin indicating the abnormality, and mark the defective pin as defective.
[0051] In a third aspect, the embodiments of the present application further provide an electronic device, which comprises a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, and the processor and the memory communicate through the bus when the electronic device is running, and the machine readable instructions are executed by the processor to perform the steps of the battery box pin defect determination method as described above.
[0052] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the steps of the battery box pin defect determination method as described above.
[0053] The battery box pin defect determination method, device, electronic device and storage medium provided by the embodiments of the present application comprise the following steps: acquiring a scan image of a target battery box; determining, based on grayscale information in the scan image, a socket region in which each socket of the target battery box is located; obtaining a model of the target battery box, and obtaining target socket parameters corresponding to the model of the target battery box based on a preset mapping relationship between the model of the battery box and the socket parameters; for each socket region, detecting pins in the socket region based on the target socket parameters to obtain a corresponding detection result, and determining a pin indicating an abnormality as a defective pin if the detection result includes the pin indicating the abnormality, and marking the defective pin as defective.
[0054] Thus, by using the technical solution provided in the present application, the plug-in area of the battery box can be determined in the obtained scanning image by scanning the battery box, and various detections are performed on the pins in the plug-in area to determine whether the pins have defects, so as to achieve the purpose of automatic detection of the pins. This not only reduces the labor cost and improves the production efficiency of the battery box wire harness, but also reduces the misjudgment caused by manual detection and improves the accuracy of the pin detection of the battery box wire harness.
[0055] In order to make the above objectives, characteristics and advantages of the present application more apparent, clear and easy to understand, the following preferred embodiments are specifically described below, and the accompanying drawings are referred to for detailed description. BRIEF DESCRIPTION OF DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be considered as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0057] Figure 1 A flow chart of a method for determining pin defects of a battery box provided by an embodiment of the present application is shown;
[0058] Figure 2 A flow chart of another method for determining pin defects of a battery box provided by an embodiment of the present application is shown;
[0059] Figure 3 A structure diagram of a device for determining pin defects of a battery box provided by an embodiment of the present application is shown;
[0060] Figure 4 A structure diagram of a device for determining pin defects of a battery box provided by an embodiment of the present application is shown;
[0061] Figure 5 A structure diagram of an electronic device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0062] To make the purposes, technical solutions, and advantages of the embodiments of the present application clearer, 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. It should be understood that the drawings in the present application only serve the purpose of description and illustration, and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn according to the actual proportions. The flowcharts used in the present application show the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowcharts can not be implemented in sequence, and the steps without logical context relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowcharts or one or more operations can be removed from the flowcharts under the guidance of the content of the present application.
[0063] In addition, the described embodiments are only some of the embodiments of the present application, not all the embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0064] In order to enable those skilled in the art to use the content of the present application, the following implementation is given in combination with a specific application scenario "determination of battery box pin defects", and those skilled in the art can apply the general principles defined herein to other embodiments and application scenarios without departing from the spirit and scope of the present application.
[0065] The methods, devices, electronic devices or computer readable storage media described in the embodiments of the present application can be applied to any scenario that needs to determine battery box pin defects, and the embodiments of the present application do not limit the specific application scenario. Any solution using the method, device, electronic device and storage medium provided by the embodiments of the present application for determining battery box pin defects is within the scope of protection of the present application.
[0066] It is worth noting that the battery box harness pin defect is a common problem in the harness production industry. If it occurs, it will directly cause the battery box to be unable to work, and in severe cases, it will cause traffic accidents. The traditional method for detecting pin defects is to use visual inspection and direct pin-through power-on, and to verify whether the pin is missing, whether it is skewed or broken by manually detecting the appearance and current conduction. However, if the pin is slightly retracted or skewed, it cannot be detected, resulting in low detection accuracy. In addition, the existing detection method can also cause damage to the pin.
[0067] At present, the following problems are prone to occur in the manual detection method of the pin defects: 1) the manual detection is prone to missing detection; 2) the manual detection is prone to be affected by individual differences of the detector, resulting in poor repeatability and reproducibility of the detection; 3) a long time is required for the manual detection of a large number of sockets, resulting in high cost; and 4) a large number of socket pins need to be detected, and a large number of standards are prone to be misdetected in the manual detection; therefore, how to determine the defects of the battery box pins has become a problem to be solved.
[0068] Based on this, the application provides a battery box pin defect determination method and device, electronic equipment and storage medium, the determination method comprises: obtaining a scan image of a target battery box; determining the socket area where each socket of the target battery box is located based on the gray scale information in the scan image; obtaining the model of the target battery box, and obtaining the target socket parameter corresponding to the model of the target battery box based on the preset mapping relationship between the model of the battery box and the socket parameter; for each socket area, based on the target socket parameter, the pins in the socket area are detected to obtain the corresponding detection result, if there is an abnormal pin indicating in the detection result, the abnormal pin indicating is determined as a defect pin, and the defect pin is marked.
[0069] In this way, the technical scheme provided by the application can determine the socket area of the battery box in the obtained scan image by scanning the battery box, and judge whether the pins exist defects by detecting the pins in the socket area, so as to achieve the purpose of automatic detection of the pins, not only reduce the labor cost, improve the production efficiency of the battery box harness, but also reduce the misjudgment caused by manual detection, and improve the accuracy of the battery box harness pin detection.
[0070] In order to facilitate the understanding of the application, the technical scheme provided by the application will be described in detail in combination with specific embodiments.
[0071] Please refer to Figure 1 , Figure 1 The flow chart of the battery box pin defect determination method provided by the embodiment of the application is shown in Figure 1 The determination method comprises:
[0072] S101, obtaining a scan image of a target battery box;
[0073] In this step, the battery box pin defect determination method provided by the embodiment can be applied to a battery box pin defect determination system, which comprises a servo motor, a rotary cylinder, a 3D laser scanner and a single-axis cylinder; the servo motor moves the target battery box to a starting detection position, the single-axis cylinder moves the 3D laser scanner to a scanning position, the servo motor uniformly moves the target battery box to a corresponding ending detection position, while the 3D laser scanner starts scanning the pins of the target battery box, after scanning and processing each face, the scanning image of the target battery box on the face and the corresponding detection result are obtained, the rotary cylinder rotates the target battery box to the next face, and the same processing process is performed until the last face of the target battery box is traversed, and the detection result of each pin on each face of the target battery box is obtained.
[0074] It should be noted that the scanning image of the target battery box is obtained through the following steps:
[0075] I. Obtain each piece of depth information of the target battery box obtained by the laser equipment scanning the target battery box once every preset time;
[0076] II. Based on the preset relationship between the depth information and the gray information, convert each piece of depth information into gray information, and arrange each piece of gray information in the horizontal axis direction in turn to obtain the scanning image of the target battery box.
[0077] In this step, the laser emitted by the 3D laser scanner is irradiated on the target battery box, the target battery box emits based on the received laser, and after reflection, it returns to different positions of the camera (CCD) of the 3D laser scanner. According to the straight-line propagation of light and the principle of similar triangles, the depth information of the target battery box can be inferred, and the accuracy is about 0.01mm. During the movement of the target battery box from the starting detection position to the ending detection position, the 3D laser scanner will also collect a piece of depth information about the target battery box every fixed time. After the target battery box moves to the ending detection position, a plurality of depth information about the target battery box will be obtained. Different numbers of pieces of depth information will be obtained according to different products of the target battery box. The depth information of each scanning line obtained is converted into gray information with a range of 0 to 255, and finally each piece of gray information collected is accumulated in the horizontal axis, i.e. the X-axis direction, to arrange and obtain the scanning image of the target battery box. The 3D laser measurement has good repeatability, reproducibility and accuracy, which avoids the detection errors caused by human factors during manual measurement.
[0078] S102, based on the gray information in the scanning image, determine the plug-in area where each plug-in of the target battery box is located;
[0079] It should be noted that the step of determining the plug-in area where each plug-in of the target battery box is located based on the gray information in the scanning image comprises:
[0080] S1021、based on the scanning image, extracting a region formed by the preset row coordinate and the preset longitudinal coordinate of each socket in the scanning image according to the preset row coordinate and the preset longitudinal coordinate of each socket, to obtain a target image of each socket;
[0081] S1022, for the target image of each socket, based on the gray scale information of the target image of the socket, determining the pixel points with a gray scale value less than a preset gray scale threshold in the gray scale information, to obtain each connected region composed of the pixel points with the gray scale value less than the preset gray scale threshold;
[0082] S1023, performing an opening operation on each connected region to obtain a plurality of selected regions of the socket;
[0083] S1024, comparing the similarity of each selected region with the region with the socket feature stored in advance, and determining the selected region with the largest similarity as the socket region where the socket is located.
[0084] In this step, the method of Blob analysis can be used to locate the socket region. The row coordinate and the longitudinal coordinate of the image region (scanning image) to be analyzed need to be set, and the effective image part (target image) to be analyzed is extracted. After obtaining the effective image, the effective image is first binarized, and the information meeting the socket feature in the region is screened out. All connected domains in the input region are calculated, and the connected parts in the region are separated, so that each region meeting the socket characteristics becomes an independent part. Then, the region is processed by opening operation to prevent excessive region corrosion and well maintain the shape of the region, so as to remove burrs around the socket region. The selected region is screened according to the area shape characteristics, other interference objects in the region are excluded, and the region is sorted to obtain each accurate socket region and the center coordinate of the socket region.
[0085] S103, obtaining the model of the target battery box, and based on the preset mapping relationship between the model of the battery box and the socket parameter, obtaining the target socket parameter corresponding to the model of the target battery box;
[0086] In this step, the socket parameters corresponding to each battery box are different, so according to the mapping relationship between the model of the battery box and the socket parameter, the target socket parameter corresponding to the model of the target battery box is obtained. The target socket parameter includes the processing times, that is, the processing times are equal to the number of sockets of the target battery box, so as to perform the defect detection processing of the socket pin in each socket.
[0087] S104. For each socket area, based on the target socket parameter, detecting the pins in the socket area to obtain a corresponding detection result, if the detection result includes an abnormal pin, determining the abnormal pin as a defective pin, and marking the defective pin.
[0088] It should be noted that, please refer to Figure 2 , Figure 2 The flowchart of another battery box pin defect determination method provided by the embodiment of the present application is shown in Figure 2 For each socket area, based on the target socket parameter, detecting the pins in the socket area to obtain a corresponding detection result, if the detection result includes an abnormal pin, determining the abnormal pin as a defective pin, and marking the defective pin.
[0089] S201. For each socket area, obtaining the center point coordinates of the socket area.
[0090] S202. Based on the center point coordinates of the socket area and the corresponding target length and target width in the target socket parameter, determining a rectangular area with the center point coordinates as the center, the target length and the target width in the socket area as the pin area of the pins in the socket area.
[0091] In this step, the Blob analysis and morphological processing are performed in the approximate range of the socket center. The center point coordinates of the extracted socket area are subjected to rectangular area, and then the gray information of the rectangular area and the pins is read to obtain the Z-axis value of each pin in the point cloud, which is then converted into a depth value. The maximum depth of the pins in the rectangular area can be extracted, and the pin area is subjected to binaryzation, morphological processing such as rectangular area inflation, and pin coordinates are obtained.
[0092] S203. Based on the gray information of the pin area, determining the predicted number of pins in the pin area and the coordinates of each pin.
[0093] It should be noted that, based on the gray information of the pin area, the step of determining the predicted number of pins in the pin area and the coordinates of each pin includes:
[0094] S2031. Based on the gray information of the pin area, converting the gray information of the pin area into depth information to obtain the depth information of the pin area.
[0095] S2032. Based on the depth information of the pin area, determining whether there is a depth greater than a preset depth threshold in the multiple depths included in the depth information.
[0096] S2033, if yes, determining the depth greater than the preset depth threshold as the depth of the pin, obtaining the coordinates of each pin in the pin region, and determining the number of the depth greater than the preset depth threshold, and determining the number of the depth greater than the preset depth threshold as the predicted number of pins in the pin region.
[0097] S204, obtaining a detection type, and for each detection type, detecting the pins in the pin region based on the detection type and the predicted number of pins in the pin region and the coordinates of each pin, and determining the detection result corresponding to the detection type.
[0098] It should be noted that for each detection type, the step of detecting the pins in the pin region based on the detection type and the predicted number of pins in the pin region and the coordinates of each pin, and determining the detection result corresponding to the detection type, comprises:
[0099] S2041, for each detection type, if the detection type is pin vertical axis depth detection, then for each pin, based on the vertical axis depth of the pin vertical coordinate, determine whether the difference between the vertical axis depth of the pin and the pre-determined shell depth of the target battery box is within the preset difference range, if yes, determine the detection result corresponding to the pin vertical axis depth detection of the pin as normal, if not, determine the detection result corresponding to the pin vertical axis depth detection of the pin as abnormal.
[0100] In this step, based on the obtained pin segment difference value, it is judged whether the pins have the situation of retreat, that is, the depth of each pin is subtracted from the shell depth, if each difference value is within the preset difference value range, there is no pin retreat, and the pins with difference values not within the preset difference value range are determined as retreat defects. Here, the shell depth is determined based on the shell region of the battery box.
[0101] It should be noted that the determination method further comprises:
[0102] 1) In the scanned image, the shell region of the target battery box is determined;
[0103] It should be noted that the step of determining the shell region of the target battery box in the scanned image comprises:
[0104] (1) In the scanned image, the remaining region after removing each socket region in the scanned image is obtained;
[0105] (2) In the remaining region, the connected regions are determined;
[0106] (3) Based on the gray scale information of each connected region, the average gray scale value of each connected region is obtained;
[0107] (4) determining the connected region corresponding to the average gray value with the largest value in the average gray values as the shell region of the target battery box.
[0108] In this step, the scanning image is also binarized, and an opening operation is performed to obtain the remaining region after the socket region determined in the scanning image. The connected region in the remaining region, i.e., the image data conforming to the shell region, can be determined as the shell region based on the gray histogram of the remaining region. The maximum average gray value in the connected region is determined as the shell region.
[0109] 2) converting the gray information of the shell region into depth information and determining the depths of a plurality of preset sampling points in the shell region;
[0110] 3) determining whether the depth difference of each preset sampling point is within a preset segment difference value based on the depth of each preset sampling point;
[0111] 4) if not, determining that the shell of the target battery box is uneven;
[0112] 5) if yes, determining that the shell of the target battery box is flat, and determining the average depth of the plurality of preset sampling points as the shell depth of the target battery box.
[0113] For example, the flatness of the shell can be determined according to the segment difference between the left, middle, and right sampling points of the shell region. If the segment difference, i.e., the depth difference, between two adjacent sampling points is not within the preset segment difference value, the shell is determined to be uneven. If all the segment differences are within the preset segment difference value, the shell is flat. In this case, the average depth of each sampling point can be determined as the shell depth.
[0114] S2042, if the detection type is the pin number detection, determining whether the predicted number of pins in the pin region is consistent with the corresponding pin number in the target socket parameter. If yes, the detection result corresponding to the pin number detection of the pin region is determined to be normal. If not, the detection result corresponding to the pin number detection of the pin region is determined to be abnormal.
[0115] S2043, if the detection type is the pin longitudinal axis offset detection, fitting each pin based on the coordinates of each pin to obtain a fitting straight line, and determining whether the distance from each pin to the fitting straight line is within a preset distance. If yes, the detection result corresponding to the pin longitudinal axis offset detection of the pin is determined to be normal. If not, the detection result corresponding to the pin longitudinal axis offset detection of the pin is determined to be abnormal.
[0116] S2044, if the detection type is the pin horizontal axis offset detection, then based on the horizontal coordinate of each pin, determine whether the horizontal axis distance of each pin is within the preset distance, if yes, determine the detection result corresponding to the pin horizontal axis offset detection of the pin as normal, if not, determine the detection result corresponding to the pin horizontal axis offset detection of the pin as abnormal.
[0117] In this step, the number of pins is inferred according to the pin area, and is compared with the corresponding number of pins in the socket parameter, so as to determine whether there is a pin missing; a straight line is fitted by using the least square method according to the coordinates of each pin in the pin area, the distance between each pin and the straight line is calculated, and whether each pin is skewed on the vertical axis is determined according to the distance; whether each pin is skewed in the horizontal axis direction is determined according to the distance between each pin in the Y axis (i.e. the X axis coordinate). Exemplarily, the determined detection result, the straight line fitted by the pin area, can be displayed on the interface, and the abnormal pin is marked; for example, when any one of the defects such as pin missing, displacement, skewing exists, the pin is marked as red, and if the shell is not flat, the shell is also marked for defects.
[0118] Here, after the battery box pin detection is completed, the detection result is summarized into a local document together with the detection picture, so as to be kept for future product generation tracking. Through experiments, the entire detection and recording process is completed in about 15 seconds, which saves a lot of human resources and reduces the generation cost.
[0119] It should be noted that the determination method further comprises:
[0120] I. Obtain the product information of the target battery box, and store each detection result of each socket of the target battery box under the product information, so as to provide a retrieval basis.
[0121] In this step, before acquiring the scanning image, the product information of the target battery box also needs to be acquired. After the target battery box is placed at a position for scanning the product information, the servo motor moves the target battery box to the two-dimensional code scanning area, reads out the product information of the target battery box, uploads the determination system (for example, the MES system) for pre-process verification. After the target battery box is detected, the detection result is uploaded to the MES system again to provide a search basis for subsequent processes, thereby avoiding the missed detection phenomenon caused by manual detection. Here, after the product information is obtained, the process of battery box pin defect detection corresponding to the product information is automatically switched to, which can avoid the misjudgment caused by manual detection due to the large number of product types and complex standards. Therefore, the embodiment can use a 3D laser scanner to replace manual detection, improve production efficiency, reduce misjudgment caused by manual detection, reduce labor, and reduce labor cost. The height of the pin and the height of the shell are compared to determine, which improves the accuracy of detection. In addition, the detection can be universal for various harness pins, which improves the applicability of detection.
[0122] The determination method for the battery box pin defect provided in the embodiment of the application includes: acquiring a scanning image of a target battery box; determining a pinhole area where each pinhole of the target battery box is located based on gray scale information in the scanning image; acquiring a model of the target battery box, and obtaining target pinhole parameters corresponding to the model of the target battery box based on a preset mapping relationship between the model of the battery box and the pinhole parameters; for each pinhole area, detecting pins in the pinhole area based on the target pinhole parameters to obtain a corresponding detection result, and determining a pin indicating an abnormality in the detection result as a defective pin and marking the defective pin if the pin indicating the abnormality exists in the detection result.
[0123] In this way, the technical solution provided in the application can determine the pinhole area of the battery box in the obtained scanning image by scanning the battery box, and determine whether the pins in the pinhole area have defects by performing various detections on the pins, so as to achieve the purpose of automatic detection of the pins. This not only reduces labor cost and improves the production efficiency of the battery box harness, but also reduces misjudgment caused by manual detection and improves the accuracy of battery box harness pin detection.
[0124] Based on the same application concept, the embodiment of the application also provides a determination device for a battery box pin defect corresponding to the determination method for the battery box pin defect provided in the above embodiment. Since the principle of solving problems in the device in the embodiment of the application is similar to that of the determination method for the battery box pin defect provided in the above embodiment of the application, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described herein.
[0125] Please refer to Figure 3 , Figure 4 , Figure 3Figure 1 is a structural diagram of a battery box pin defect determination device provided by an embodiment of the present application, Figure 4 Figure 2 is another structural diagram of a battery box pin defect determination device provided by an embodiment of the present application. As shown in Figure 3 The determination device 310 comprises:
[0126] The acquisition module 311 is configured to acquire a scanning image of a target battery box.
[0127] The first processing module 312 is configured to determine, based on grayscale information in the scanning image, a socket region in which each socket of the target battery box is located.
[0128] The mapping module 313 is configured to acquire a model of the target battery box, and obtain target socket parameters corresponding to the model of the target battery box based on a preset mapping relationship between models of battery boxes and socket parameters.
[0129] The determination module 314 is configured to, for each socket region, detect pins in the socket region based on the target socket parameters to obtain a corresponding detection result, and determine a pin indicating an abnormality as a defective pin if the detection result includes the pin indicating the abnormality, and mark the defective pin.
[0130] Optionally, when the determination module 314 is configured to, for each socket region, detect pins in the socket region based on the target socket parameters to obtain a corresponding detection result, the determination module 314 is specifically configured to:
[0131] For each socket region, acquire a center point coordinate of the socket region.
[0132] Based on the center point coordinate of the socket region and a corresponding target length and target width in the target socket parameters, determine a rectangular region with the center point coordinate as a center, the target length, and the target width as the socket region in which pins are located.
[0133] Determine, based on grayscale information of the pin region, a predicted number of pins in the pin region and a coordinate of each pin.
[0134] Acquire a detection type, and for each detection type, detect pins in the pin region based on the detection type, the predicted number of pins in the pin region, and the coordinate of each pin to determine a detection result corresponding to the detection type.
[0135] Optionally, when the determination module 314 is configured to determine, based on grayscale information of the pin region, a predicted number of pins in the pin region and a coordinate of each pin, the determination module 314 is specifically configured to:
[0136] convert the gray scale information of the pin region into depth information based on the gray scale information of the pin region, to obtain the depth information of the pin region;
[0137] determine whether there is a depth greater than a preset depth threshold in the depths included in the depth information based on the depth information of the pin region;
[0138] If there is, determine the depth greater than the preset depth threshold as the depth of the pin, obtain the coordinates of each pin in the pin region, and determine the number of depths greater than the preset depth threshold, and determine the number of depths greater than the preset depth threshold as the predicted number of pins in the pin region.
[0139] Optionally, when the first processing module 312 is used to determine the socket region where each socket of the target battery box is located based on the gray scale information in the scan image, the first processing module 312 is specifically used to:
[0140] based on the scan image, extract the region formed by the preset row coordinates and the preset longitudinal coordinates of each socket in the scan image according to the preset row coordinates and the preset longitudinal coordinates of each socket, to obtain the target image of each socket;
[0141] For the target image of each socket, based on the gray scale information of the target image of the socket, determine the pixel points with a gray scale value less than a preset gray scale threshold in the gray scale information, to obtain each connected region formed by the pixel points with the gray scale value less than the preset gray scale threshold.
[0142] perform an opening operation on each connected region to obtain a plurality of candidate regions of the socket;
[0143] compare the similarity of each candidate region with the region with the socket feature stored in advance, and determine the candidate region with the largest similarity as the socket region where the socket is located.
[0144] Optionally, as shown in Figure 4 the determination device 310 further includes a scanning module 315, and the scanning module 315 is used to:
[0145] obtain each depth information of the target battery box obtained by the laser equipment scanning the target battery box once every preset time;
[0146] based on the preset relationship between the depth information and the gray scale information, convert each depth information into gray scale information, and arrange each gray scale information in turn in the horizontal axis direction to obtain the scan image of the target battery box.
[0147] Optionally, when the determining module 314 is specifically used for determining the detection result corresponding to each detection type by detecting the pins in the pin area based on the detection type, the predicted number of pins in the pin area and the coordinates of each pin, the determining module 314 is specifically used for:
[0148] For each detection type, if the detection type is the pin vertical axis depth detection, for each pin, it is determined whether the difference between the vertical axis depth of the pin and the pre-determined shell depth of the target battery box is within the pre-set difference range based on the vertical coordinate of the pin, if yes, the detection result corresponding to the pin vertical axis depth detection of the pin is determined as normal, if no, the detection result corresponding to the pin vertical axis depth detection of the pin is determined as abnormal.
[0149] If the detection type is the pin number detection, it is determined whether the predicted number of pins in the pin area is consistent with the corresponding pin number in the target socket parameter, if yes, the detection result corresponding to the pin number detection of the pin area is determined as normal, if no, the detection result corresponding to the pin number detection of the pin area is determined as abnormal.
[0150] If the detection type is the pin longitudinal axis offset detection, it is determined whether the distance of each pin to the fitted straight line is within the pre-set distance by fitting each pin based on the coordinates of each pin to obtain the fitted straight line, if yes, the detection result corresponding to the pin longitudinal axis offset detection of the pin is determined as normal, if no, the detection result corresponding to the pin longitudinal axis offset detection of the pin is determined as abnormal.
[0151] If the detection type is the pin transverse axis offset detection, it is determined whether the transverse axis distance of each pin is within the pre-set distance based on the transverse coordinates of each pin, if yes, the detection result corresponding to the pin transverse axis offset detection of the pin is determined as normal, if no, the detection result corresponding to the pin transverse axis offset detection of the pin is determined as abnormal.
[0152] Optionally, as shown in Figure 4 The determining apparatus 310 further includes a second processing module 316, and the second processing module 316 is used for:
[0153] In the scanned image, the shell area of the target battery box is determined;
[0154] The gray scale information of the shell area is converted into depth information, and the depths of a plurality of pre-set sampling points in the shell area are determined;
[0155] Based on the depth of each pre-set sampling point, it is determined whether the difference of the depth of each pre-set sampling point is within the pre-set segment difference;
[0156] If no, the shell of the target battery box is determined as uneven;
[0157] If yes, the shell of the target battery box is determined as even, and the average depth of the plurality of preset sampling points is determined as the shell depth of the target battery box.
[0158] Optionally, when the second processing module 316 is used for determining the shell region of the target battery box in the scanning image, the second processing module 316 is specifically used for:
[0159] acquiring, in the scanning image, a remaining region after each socket region in the scanning image is removed;
[0160] determining a connected region in the remaining region;
[0161] obtaining an average gray value of each connected region based on the gray information of each connected region;
[0162] determining, in the average gray value, the connected region corresponding to the average gray value with the maximum value as the shell region of the target battery box.
[0163] Optionally, as shown in Figure 4 the determining apparatus 310 further includes a storage module 317, and the storage module 317 is used for:
[0164] acquiring product information of the target battery box, and storing each detection result of each socket of the target battery box under the product information to provide a retrieval basis.
[0165] The determining apparatus for battery box pin defects provided by the embodiment of the application includes: an acquisition module, which is used for acquiring a scanning image of a target battery box; a first processing module, which is used for determining a socket region where each socket of the target battery box is located based on gray information in the scanning image; a mapping module, which is used for acquiring a model of the target battery box, and obtaining target socket parameters corresponding to the model of the target battery box based on a preset mapping relationship between the models of the battery boxes and the socket parameters; and a determination module, which is used for, for each socket region, detecting pins in the socket region based on the target socket parameters to obtain a corresponding detection result, and determining an abnormal pin indicated in the detection result as a defective pin and performing defective marking on the defective pin.
[0166] Thus, by using the technical solution provided in this application, the battery box can be scanned, and the socket area of the battery box can be determined in the obtained scan image. Various tests can be performed on the pins in the socket area to determine whether there are defects in the pins, thereby achieving the purpose of automated pin detection. This not only reduces labor costs and improves the production efficiency of battery box wiring harnesses, but also reduces misjudgments caused by manual inspection and improves the accuracy of battery box wiring harness pin detection.
[0167] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 500 includes a processor 510, a memory 520, and a bus 530.
[0168] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 and the memory 520 communicate via the bus 530. When the machine-readable instructions are executed by the processor 510, they can perform the operations described above. Figure 1 as well as Figure 2 The steps of the method for determining the defect of the battery box pin in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.
[0169] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 as well as Figure 2 The steps of the method for determining the defect of the battery box pin in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.
[0170] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0171] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0172] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0173] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.
[0174] If the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.
[0175] Finally, it should be noted that: the above-described embodiments are only specific embodiments of the present application, used to illustrate the technical solutions of the present application, and not to limit them. The protection scope of the present application is not limited thereto, although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any skilled person familiar with the technical field can modify or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present application, or make equivalent replacements to some technical features; and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for determining defects in battery box pins, characterized in that, The determination method includes: Acquire a scanned image of the target battery box; Based on the grayscale information in the scanned image, determine the port area where each port of the target battery box is located; The step of determining the port area where each port of the target battery box is located based on the grayscale information in the scanned image includes: Based on the scanned image, according to the preset row coordinates and preset ordinates of each socket, the region formed by the preset row coordinates and preset ordinates of each socket in the scanned image is extracted to obtain the target image of each socket; For each socket's target image, based on the grayscale information of the target image of that socket, determine the pixels whose grayscale values are less than a preset grayscale threshold, and obtain each connected region composed of the pixels whose grayscale values are less than the preset grayscale threshold. Perform an opening operation on each connected region to obtain multiple candidate regions for the socket; Each candidate region is compared with a pre-stored region containing socket features, and the candidate region with the highest similarity is determined as the socket region where the socket is located. Obtain the model number of the target battery box, and based on the preset mapping relationship between the battery box model number and the socket parameters, obtain the target socket parameters corresponding to the model number of the target battery box. For each socket area, based on the target socket parameters, the pins in the socket area are detected to obtain the corresponding detection results. If there are pins indicating an abnormality in the detection results, the pins indicating an abnormality are identified as defective pins and the defective pins are marked as defective. The step of detecting the pins in each socket area based on the target socket parameters and obtaining the corresponding detection results includes: For each socket area, obtain the coordinates of the center point of that socket area; Based on the center point coordinates of the socket area and the target length and target width corresponding to the target socket parameters, the rectangular area formed by the center point coordinates, the target length and the target width in the socket area is determined as the pin area where the pin is located in the socket area. Based on the grayscale information of the pin region, the predicted number of pins in the pin region and the coordinates of each pin are determined; Obtain the detection type. For each detection type, based on the detection type, the predicted number of pins in the pin area, and the coordinates of each pin, detect the pins in the pin area and determine the detection result corresponding to the detection type.
2. The determination method according to claim 1, characterized in that, The step of determining the predicted number of pins and the coordinates of each pin in the pin region based on the grayscale information of the pin region includes: Based on the grayscale information of the pin region, the grayscale information of the pin region is converted into depth information to obtain the depth information of the pin region; Based on the depth information of the pin region, determine whether there is a depth greater than a preset depth threshold among the multiple depths included in the depth information; If present, the depth greater than the preset depth threshold is determined as the depth of the pin, the coordinates of each pin in the pin region are obtained, and the number of depths greater than the preset depth threshold is determined. The number of depths greater than the preset depth threshold is then determined as the predicted number of pins in the pin region.
3. The determination method according to claim 1, characterized in that, Obtain a scanned image of the target battery box using the following steps: The depth information of the target battery box is obtained by scanning the target battery box once at preset time intervals using a laser device. Based on the preset relationship between depth information and grayscale information, each piece of depth information is converted into grayscale information, and each piece of grayscale information is accumulated sequentially and arranged in the horizontal axis direction to obtain the scanned image of the target battery box.
4. The determination method according to claim 1, characterized in that, The step of detecting the pins in the pin area and determining the detection result corresponding to each detection type, based on the detection type, the predicted number of pins in the pin area, and the coordinates of each pin, includes: For each detection type, if the detection type is pin vertical axis depth detection, then for each pin, based on the vertical axis depth of the pin's vertical coordinate, determine whether the difference between the pin's vertical axis depth and the predetermined target battery box's outer shell depth is within a preset difference range. If yes, then the detection result corresponding to the pin's pin vertical axis depth detection is determined to be normal; otherwise, then the detection result corresponding to the pin's pin vertical axis depth detection is determined to be abnormal. If the detection type is pin count detection, then determine whether the predicted number of pins in the pin area is consistent with the number of pins in the target socket parameter. If yes, then the detection result corresponding to the pin count detection in the pin area is determined to be normal. If no, then the detection result corresponding to the pin count detection in the pin area is determined to be abnormal. If the detection type is pin vertical axis offset detection, then based on the coordinates of each pin, each pin is fitted to obtain a fitted straight line, and it is determined whether the distance from each pin to the fitted straight line is within a preset distance. If it is, the detection result corresponding to the pin vertical axis offset detection of that pin is determined to be normal; otherwise, the detection result corresponding to the pin vertical axis offset detection of that pin is determined to be abnormal. If the detection type is pin horizontal axis offset detection, then based on the horizontal coordinate of each pin, it is determined whether the horizontal axis spacing of each pin is within the preset spacing. If it is, the detection result corresponding to the pin horizontal axis offset detection of that pin is determined to be normal; otherwise, the detection result corresponding to the pin horizontal axis offset detection of that pin is determined to be abnormal.
5. The determination method according to claim 1, characterized in that, The determination method further includes: The outer casing area of the target battery compartment is identified from the scanned image; The grayscale information of the outer shell region is converted into depth information, and the depth of multiple preset sampling points is determined in the outer shell region; Based on the depth of each preset sampling point, determine whether the difference in depth of each preset sampling point is within the preset segment difference value; If not, the outer shell of the target battery box is determined to be uneven; If so, the outer shell of the target battery box is determined to be flat, and the average depth of the multiple preset sampling points is determined as the outer shell depth of the target battery box.
6. The determination method according to claim 5, characterized in that, The step of determining the outer casing area of the target battery box in the scanned image includes: In the scanned image, obtain the remaining area after removing each socket area; Identify the connected regions in the remaining region; Based on the grayscale information of each connected region, the average grayscale value of each connected region is obtained; The region corresponding to the highest average gray value among the average gray values is determined as the outer shell region of the target battery box.
7. The determination method according to claim 1, characterized in that, The determination method further includes: Obtain the product information of the target battery box, and store each detection result of each port of the target battery box under the product information to provide a basis for retrieval.
8. A device for determining defects in battery box pins, characterized in that, The determining device includes: The acquisition module is used to acquire scanned images of the target battery box; The first processing module is used to determine the port area where each port of the target battery box is located based on the grayscale information in the scanned image; When the first processing module determines the port area of each port of the target battery box based on the grayscale information in the scanned image, the first processing module is specifically used for: Based on the scanned image, according to the preset row coordinates and preset ordinates of each socket, the region formed by the preset row coordinates and preset ordinates of each socket in the scanned image is extracted to obtain the target image of each socket; For each socket's target image, based on the grayscale information of the target image of that socket, determine the pixels whose grayscale values are less than a preset grayscale threshold, and obtain each connected region composed of the pixels whose grayscale values are less than the preset grayscale threshold. Perform an opening operation on each connected region to obtain multiple candidate regions for the socket; Each candidate region is compared with a pre-stored region containing socket features, and the candidate region with the highest similarity is determined as the socket region where the socket is located. The mapping module is used to obtain the model of the target battery box and, based on the preset mapping relationship between the model of the battery box and the socket parameters, obtain the target socket parameters corresponding to the model of the target battery box. The determination module is used to detect the pins in each socket area based on the target socket parameters and obtain the corresponding detection results. If there are pins indicating abnormality in the detection results, the pins indicating abnormality are determined as defective pins and the defective pins are marked as defects. When the determining module is used to detect the pins in each socket area based on the target socket parameters and obtain the corresponding detection result, the determining module is specifically used for: For each socket area, obtain the coordinates of the center point of that socket area; Based on the center point coordinates of the socket area and the target length and target width corresponding to the target socket parameters, the rectangular area formed by the center point coordinates, the target length and the target width in the socket area is determined as the pin area where the pin is located in the socket area. Based on the grayscale information of the pin region, the predicted number of pins in the pin region and the coordinates of each pin are determined; Obtain the detection type. For each detection type, based on the detection type, the predicted number of pins in the pin area, and the coordinates of each pin, detect the pins in the pin area and determine the detection result corresponding to the detection type.
9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the machine-readable instructions are executed by the processor to perform the steps of the method for determining a battery box pin defect as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method for determining battery box pin defects as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Defect detection evaluation method and device, electronic equipment and storage medium
CN112037214A
Defect detection method, device and equipment and storage medium
CN115272280A
Detection device for detecting pin defects of electric connector
CN217878964U