Micro component pin distance measurement method based on deep learning
By improving the dataset construction and using the ResNet18 and YOLOv8n networks, the low efficiency and insufficient robustness of the micro-component pin ranging task are solved, and efficient and accurate pin ranging is achieved.
Patent Information
- Application Number
- CN202510786549.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-19
AI Technical Summary
In existing technologies, the task of measuring the distance between the pins of micro components requires professional engineers to configure the inspection process one by one, which is inefficient; traditional OpenCV image processing methods have poor generalization, and environmental changes lead to large detection errors; deep learning methods require a large number of samples, but the production line images are highly homogeneous, and the model lacks robustness.
By improving the dataset construction method, a simulated training dataset was generated, and the ResNet18 and YOLOv8n networks were used to build a pin ranging model to solve the model overfitting problem and improve robustness.
The efficiency and accuracy of micro-component pin distance measurement are improved, and the adaptability and robustness of the model are enhanced, which is more advantageous than traditional methods.
Smart Images

Figure CN120673193A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of industrial component detection, and in particular to a method for measuring the distance between pins of micro components based on deep learning. Background Art
[0002] As key components for circuit connection and information transmission in electronic systems, the quality of microelectronic components directly impacts the performance of the entire system. While the rapid development of industrial production has significantly improved the production efficiency of microelectronic components, surface defects (such as insufficient filling, cracks, missing solder tabs, scratches, etc.) and dimensional defects (such as excessively wide / narrow pin spacing and excessively long / short solder tabs) still exist. Efficient and accurate inspection of individual components is essential, but manual review cannot meet the speed and accuracy requirements. In recent years, with advances in artificial intelligence technology, machine vision-based inspection methods have gradually become the primary means of quality inspection for microelectronic components.
[0003] Current deep learning methods are primarily used for surface defect detection in industrial products. For distance measurement tasks, OpenCV image processing pipeline configuration is primarily used. However, OpenCV image processing suffers from the following drawbacks: 1. Low efficiency. The configuration process requires specialized engineers to configure the inspection process for each component individually, making process configuration inefficient for a wide range of component models. 2. Poor adaptability. Traditional rule-based or statistical OpenCV image processing methods have poor generalization, and even subtle changes in the environment can cause significant detection errors. Furthermore, deep learning methods require a large number of training samples, but images on production lines are often highly homogeneous, making the trained models lack robustness. Summary of the Invention
[0004] In view of this, the present application provides a micro-component pin ranging method based on deep learning, which solves the technical problem that the configuration process of existing micro-component pin ranging tasks requires professional engineers to configure the detection process for each component one by one, and the process configuration efficiency is low for components with a large number of models; the traditional OpenCV image processing method based on rules or statistics has poor generalization, and slight changes in the environment may also cause large detection errors. In addition, the use of deep learning methods requires a large number of samples for training, but the images on the production line are often highly homogeneous, which makes the trained model lack robustness.
[0005] To achieve the above object, the present invention provides the following technical solutions: This invention primarily involves a deep learning-based method for measuring the distance between micro-component pins. It proposes an optimized technical solution for this problem. By improving the dataset construction method, it addresses the model overfitting problem caused by image homogeneity on the production line. Pin distance measurement models are constructed based on ResNet18 and YOLOv8n networks, respectively, providing an effective approach for accurately measuring the distance between micro-component pins. The method includes: collecting image data of micro-component pins to form a dataset; The pin image data in the dataset is preprocessed to obtain preprocessed image data. The preprocessing includes: detecting key points on the complete component image to determine the position of the component in the image; rotating the image based on the key points to keep the component upright and eliminate the impact of image tilt on subsequent analysis; and cropping the image based on the relative position of the key points to obtain independent images of each pair of pins, which facilitates subsequent model learning and analysis of pin features. Constructing a micro component pin distance measurement model and a training data set, and using the training data set to train the micro component pin distance measurement model to obtain a trained micro component pin distance measurement model; The preprocessed image data is input into the trained micro component pin distance measurement model to extract the micro component pin features, and the distance between the pins is calculated based on the micro component pin features.
[0006] Since the images collected on the production line are highly homogeneous and the pin positions are basically similar, this can lead to serious model overfitting. However, by designing a method to generate pin images, a large amount of data (training dataset) is simulated and generated. The generated images have greater differences in quality inspection, which can improve the robustness of the model. The specific construction of the training dataset includes: Randomly extract several background images and multiple pin images from real component images; The captured background images and component images are divided into training and test sets according to a ratio of 7:3; From the training set and test set, two pin images and one background image are randomly selected each time. While keeping the y coordinates the same, the pin images are randomly placed in the background image and the distance between the two pins is recorded. Repeat the above steps to generate a training dataset containing training images and test images. The images generated by this method have great diversity, which effectively improves the robustness of the subsequent model.
[0007] Furthermore, a micro-component pin ranging model is constructed based on the ResNet18 network. The micro-component pin ranging model based on the ResNet18 network includes a convolutional layer, a batch normalization layer, and a pooling layer. The network uses the linear rectification function (ReLU) as the activation function.
[0008] Furthermore, the micro component pin features extracted by the micro component pin ranging model based on the ResNet18 network are input into the fully connected layer, and the fully connected layer outputs the regression prediction value of the distance.
[0009] The micro-component pin ranging model based on the ResNet18 network includes: input layer: image input, output size is 108×72, and the number of channels is 3; batch normalization layer: 1 convolution kernel is 7×7 and the stride is 2, the output size is 54×36, the number of channels is 64, and 4 residual convolution blocks (convolution kernel 3×3), the output sizes are 27×18, 14×9, 7×5, 4×3, and the number of channels are 64, 128, 256, and 512 respectively; pooling layer: 1 global average pooling layer for compressing spatial dimensions, the output size is 1×1, and the number of channels is 512; fully connected layer: the output size is 1×1, and the number of channels is 1.
[0010] Furthermore, the loss function of the micro-component pin ranging model based on the ResNet18 network adopts ,in, is the number of samples, is the true value, The MSE value directly reflects the difference between the predicted distance and the labeled distance. The larger the MSE value, the greater the difference between the predicted distance and the labeled distance. The smaller the MSE value, the smaller the difference between the predicted distance and the labeled distance, and the higher the prediction accuracy of the model.
[0011] Furthermore, a micro-component pin ranging model is constructed based on the YOLOv8n network. The micro-component pin ranging model based on the YOLOv8n network includes a CSPNet (Cross Stage Partial Network) backbone network, a different-scale feature map fusion structure combining the FPN (Feature Pyramid Network) module and the PAN (Path Aggregation Network) module, and a detection head for predicting the category and position of the target.
[0012] Furthermore, according to the pin position features detected by the micro-component pin ranging model based on the YOLOv8n network, the detection box information is used to calculate the distance between two pins.
[0013] The micro-component pin ranging model based on the YOLOv8n network includes: input layer: image input, output size is 108×72, and the number of channels is 3; Backbone module: 4 convolution kernels are 3×3 convolutions with a stride of 2, and the output sizes are 54×36, 27×18, 14×9, 7×5, and the number of channels are 16, 32, 64, and 128, and 4 residual convolution blocks, and the output sizes are 54×36, 27×18, 14×9, 7×5, and the number of channels is 1 6, 32, 64, 128; Neck module: 1 pooling layer for fusing features of different scales, with an output size of 7×5 and 128 channels, an upsampling layer (output size of 14×9 and 192 channels), 2 residual convolution blocks with output sizes of 14×9, 7×5, 64 channels and 128 channels, and a downsampling layer (output size of 7×5 and 64 channels); Head module: detection layer, multi-scale output, detection on 14×9 and 7×5 feature maps.
[0014] Furthermore, the loss function of the micro-component pin ranging model based on the YOLOv8n network adopts ,A represents the predicted bounding box A, and B represents the predicted bounding box B. The specific steps of using yolov8n to calculate the pin distance include: obtaining the image of the pin pair by preprocessing the complete component image; using yolov8n to detect and obtain the detection frame of the pin; and subtracting the x values of the two detection frames to obtain the distance between the two pins.
[0015] It can be seen from the above technical solution that the advantages of the present invention are: In this application, the model is trained using a simulated training data set to avoid the problem of model overfitting, increase the robustness of the model, and use a deep learning method to measure the distance of micro-component pins. Compared with the traditional OpenCV image processing-based method, it is more efficient and accurate, and has better adaptability. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings that constitute a part of this application are used to provide further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute improper limitations on this application.
[0017] Figure 1 This is a schematic diagram of the steps of the micro-component pin ranging method based on deep learning in this application.
[0018] Figure 2 This is a flowchart of the process of constructing a training dataset in this embodiment.
[0019] Figure 3This is a schematic diagram of the framework structure of the micro component pin ranging model constructed based on the ResNet18 network in this embodiment.
[0020] Figure 4 This is a schematic diagram of the framework structure of a micro-component pin ranging model constructed based on the YOLOv8n network in this embodiment.
[0021] Figure 5 This is a schematic diagram of the composition structure of the micro component pin distance measurement device based on deep learning in this embodiment.
[0022] Reference numerals: 1. Image acquisition unit; 2. Preprocessing unit; 3. Model training unit; 4. Pin ranging unit. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail in conjunction with the embodiments and drawings. Here, the illustrative embodiments of this application and their descriptions are used to explain this application, but are not intended to limit this application.
[0024] In industrial visual quality inspection, measuring the distance between the pins of microelectronic components is a difficult problem. Accurately measuring the distance between the pins of microcomponents is a key step in ensuring the quality and performance of electronic products. The traditional method uses OpenCV to perform a large number of image operations on the pin images. The process requires engineers to make repeated adjustments, which is inefficient and not very accurate. In addition, the image data collected on the production line has strong homogeneity and similar pin positions, which can easily lead to model overfitting and seriously affect the accuracy and robustness of the distance measurement model. Figures 1 to 5 This embodiment provides a micro-component pin distance measurement method based on deep learning, which has better robustness and is more efficient and accurate than the traditional OpenCV image processing method, and has better adaptability. Figure 1 As shown, the method includes: Step S1: collecting pin image data of micro components to form a data set.
[0025] Step S2: Preprocess the pin image data in the data set to obtain preprocessed image data. The preprocessing includes: performing key point detection on the complete component image to determine the position of the component in the image; rotating the image according to the key points so that the component remains in a vertical state; and cropping the image of each pair of pins according to the relative position of the key points.
[0026] Step S3: constructing a micro component pin distance measurement model and a training data set, and using the training data set to train the micro component pin distance measurement model to obtain a trained micro component pin distance measurement model.
[0027] In visual quality inspection of microelectronic components, it is usually necessary to first locate the components. After positioning, the pins will be fixed in the image. Therefore, by cropping the relative positions of the images, multiple pin pair images can be obtained. Next, distance measurement is performed using pin ranging methods. However, due to the high similarity of images taken on the production line, the components in each image are basically in the same position. This type of data can cause model training to overfit, reducing the model's robustness. Therefore, generating a pin pair dataset with large image quality inspection differences through simulation can avoid overfitting. By randomly producing a background and randomly overlaying the pin images on the background, a diverse dataset with different backgrounds and pin distances can be obtained.
[0028] like Figure 2 Specifically, constructing a training data set includes: Randomly extract 20 background images and 100 pin images from real component images; The background images and component images are divided into training set and test set according to the ratio of 7:3; Randomly select two pin images and one background image, randomly place the two pin images in the background image, keep the y coordinates the same, and record the spacing; Repeat the above steps in the training set and test set to generate 7,000 training images and 3,000 test images.
[0029] Step S4: input the pre-processed image data into the trained micro component pin distance measurement model to extract the micro component pin features, and calculate the distance between the pins based on the micro component pin features.
[0030] In Example 1, a micro-component pin distance measurement model was constructed based on the ResNet18 network. This model includes convolutional layers, batch normalization layers, and pooling layers, and uses the ReLU (rectified linear unit) activation function. The micro-component pin features extracted by this ResNet18 model are then input into a fully connected layer, which then outputs a regression prediction of the distance.
[0031] The micro-component pin ranging model based on the ResNet18 network includes: input layer: image input, output size is 108×72, and the number of channels is 3; batch normalization layer: 1 convolution kernel is 7×7 and the stride is 2, the output size is 54×36, the number of channels is 64, and 4 residual convolution blocks (convolution kernel 3×3), the output sizes are 27×18, 14×9, 7×5, 4×3, and the number of channels are 64, 128, 256, and 512 respectively; pooling layer: 1 global average pooling layer for compressing spatial dimensions, the output size is 1×1, and the number of channels is 512; fully connected layer: the output size is 1×1, and the number of channels is 1.
[0032] The specific structure of the micro-component pin ranging model based on the ResNet18 network is shown in Table 1: Table 1
[0033] The network has fewer parameters and lower computational cost, which is in line with the high speed required for quality inspection of micro components. Moreover, the output of the network can be adjusted according to demand, which is suitable for distance measurement requirements. Figure 3 As shown, this application mainly extracts features from the image through the ResNet18 network, and the fully connected layer outputs the regression prediction value of the distance.
[0034] During model training, the loss function of the micro-component pin ranging model based on the ResNet18 network is ,in, is the number of samples, is the true value, is the predicted value. The larger the MSE value, the greater the difference between the predicted distance and the labeled distance. The smaller the MSE value, the smaller the difference between the predicted distance and the labeled distance, and the higher the prediction accuracy of the model.
[0035] For the ResNet18 detection method, a numerical value is directly obtained through the network to represent the predicted pin distance. Example 1 uses the mean square error (MSE) to measure the error between the predicted value and the labeled value.
[0036] In Example 2, a micro-component pin ranging model is constructed based on the YOLOv8n network. The micro-component pin ranging model based on the YOLOv8n network includes a CSPNet backbone network, a different-scale feature map fusion structure combining an FPN module and a PAN module, and a detection head for predicting the category and position of the target. According to the pin position features detected by the micro-component pin ranging model based on the YOLOv8n network, the detection frame information is used to calculate the distance between the two pins. The specific steps of using yolov8n to calculate the pin distance include: obtaining an image of the pin pair by preprocessing the complete component image; using yolov8n detection to obtain a detection frame of the pin; and subtracting the x values of the two detection frames to obtain the distance between the two pins.
[0037] In this embodiment, the micro-component pin ranging model based on the YOLOv8n network includes: input layer: image input, output size is 108×72, and the number of channels is 3; Backbone module: 4 convolution kernels are 3×3 convolutions with a stride of 2, and the output sizes are 54×36, 27×18, 14×9, and 7×5, respectively, and the number of channels is 16, 32, 64, and 128, and 4 residual convolution blocks, and the output sizes are 54×36, 27×18, 14×9, and 7×5, respectively, and the number of channels is 16, 32, 64, and 128. The numbers are 16, 32, 64, and 128; Neck module: 1 pooling layer for fusing features of different scales, with an output size of 7×5 and 128 channels, an upsampling layer (output size of 14×9 and 192 channels), 2 residual convolution blocks, with output sizes of 14×9, 7×5, 64 channels, and 128 channels, and a downsampling layer (output size of 7×5 and 64 channels); Head module: detection layer, multi-scale output, detection on 14×9 and 7×5 feature maps.
[0038] The specific structure of the micro-component pin ranging model based on the YOLOv8n network is shown in Table 2: Table 2
[0039] For industrial component pin distance measurement, accuracy and speed are two important indicators.
[0040] During model training, the loss function of the micro component pin ranging model based on the YOLOv8n network is ,A represents the predicted bounding box A, and B represents the predicted bounding box B.
[0041] The YOLO object detection method first requires obtaining the pin's detection bounding box and then measuring the distance. The model training loss is a bounding box loss, primarily focused on bounding box regression. The IoU (Intersection over Union) loss is scale-invariant and directly reflects the quality of the predicted bounding box. Therefore, in Example 2, the IoU loss is used. This loss primarily measures the degree of overlap between the predicted bounding box generated by the model and the actual bounding box. The area of the overlap between the predicted and actual bounding boxes is the intersection, and the area of the shape formed by the two is the union. The Intersection over Union (IoU) loss is the ratio of the intersection to the union of the two bounding boxes. The IoU loss effectively measures the accuracy of the model's pin positioning. By tracking this metric, the model can be effectively fitted to achieve the desired results. Higher IoU values indicate higher overlap between the model's predicted and annotated bounding boxes, while lower IoU values indicate lower overlap between the model's predicted and annotated bounding boxes. Its value ranges from 0 to 1. For the YOLOv8n detection method, the IoU loss is supervised during model training.
[0042] During the model training process of the micro component pin ranging model, the training parameters are shown in Table 3: Table 3
[0043] During training, if the learning rate drops to a too low value too early, the model may fall into a local optimum and terminate parameter updates. This application uses the learning rate scheduler in PyTorch to coordinate the adjustment of the learning rate. The learning rate of the optimizer is dynamically adjusted according to the cosine annealing strategy, that is, the learning rate is adjusted based on the characteristics of the cosine function. The learning rate change trajectory follows a part of the cosine function, so that the learning rate first decreases and then increases in a smooth manner. This mechanism helps the model escape from the local optimal solution, especially in the later stages of training, when the learning rate becomes very small, and a better solution can be obtained by restarting the learning rate. The length of half a cycle is set to 50, that is, the time step required for the learning rate to drop from the initial value to the minimum value is 50 rounds.
[0044] This embodiment also discloses a deep learning-based micro-component pin distance measurement device, comprising: an image acquisition unit, a preprocessing unit, a model training unit, and a pin distance measurement unit. The image acquisition unit is used to acquire pin image data of micro-components to form a data set; the preprocessing unit is used to preprocess the pin image data in the data set to obtain preprocessed image data; the model training unit is used to construct a micro-component pin distance measurement model and a training data set, and train the micro-component pin distance measurement model using the training data set to obtain a trained micro-component pin distance measurement model; the pin distance measurement unit is used to input the preprocessed image data into the trained micro-component pin distance measurement model to extract micro-component pin features and calculate the distance between pins based on the micro-component pin features.
[0045] This application uses a ResNet18 network-based solution and the YOLOv8n object detection model to calculate the distance between pins. Furthermore, a method for simulating pin images is designed to increase the diversity of training data, thereby enhancing the model's generalization and robustness. This deep learning approach improves the accuracy of electronic component pin distance measurement compared to OpenCV. It effectively addresses the model overfitting issue caused by production line image data and provides a viable solution for precise distance measurement of micro-component pins.
[0046] This embodiment also discloses an electronic device, including: a memory and one or more processors; Memory, used to store programs; One or more processors are used to execute programs to implement the various steps of the above-mentioned micro component pin distance measurement method.
[0047] It should be understood that the processor in the embodiments of the present invention may be a central processing unit (CPU), but may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0048] It should also be understood that the memory in the embodiments of the present invention may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0049] The above embodiments can be implemented in whole or in part via software, hardware (e.g., circuits), firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. A computer program product comprises one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the processes or functions according to the embodiments of the present invention are fully or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means (e.g., infrared, wireless, microwave, etc.). A computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server or data center that contains a collection of one or more available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media. Semiconductor media can be solid-state drives. In this disclosure, "at least one" means one or more, and "more" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, "at least one of a, b, or c" can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.
[0050] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0051] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0052] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0053] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, and can be electrical, mechanical, or other forms.
[0054] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0055] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0056] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or the portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of the present invention. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0057] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Those skilled in the art will appreciate that various modifications and variations of the present embodiment are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A micro-component pin distance measurement method based on deep learning, characterized in that: include: Collect pin image data of micro components to form a data set; Preprocessing the pin image data in the data set to obtain preprocessed image data; Constructing a micro component pin distance measurement model and a training data set, and using the training data set to train the micro component pin distance measurement model to obtain a trained micro component pin distance measurement model; The pre-processed image data is input into a trained micro component pin distance measurement model to extract micro component pin features, and the distance between the pins is calculated based on the micro component pin features.
2. The micro-component pin distance measurement method based on deep learning according to claim 1, characterized in that: Preprocessing the pin image data in the data set includes: detecting key points on the complete component image to determine the position of the component in the image; According to the key points, the image is rotated so that the components remain vertical; According to the relative positions of the key points, the images of each pair of pins are cut.
3. The micro-component pin distance measurement method based on deep learning according to claim 1, characterized in that: Building a training dataset includes: Randomly capture several background images and multiple pin images from real component images; The background images and component images are divided into training set and test set according to the ratio of 7:3; Randomly select two pin images and one background image, randomly place the two pin images in the background image, keep the y coordinates the same, and record the spacing; Repeat the above steps in the training set and the test set to generate a training data set, which includes training images and test images.
4. The micro-component pin distance measurement method based on deep learning according to claim 1, characterized in that: A micro-component pin ranging model is constructed based on the ResNet18 network. The micro-component pin ranging model based on the ResNet18 network includes a convolutional layer, a batch normalization layer, and a pooling layer. The network uses the linear rectification function ReLU as the activation function.
5. The micro-component pin distance measurement method based on deep learning according to claim 4, characterized in that: The micro component pin features extracted by the micro component pin distance measurement model based on the ResNet18 network are input into the fully connected layer, and the regression prediction value of the pin spacing is output through the fully connected layer.
6. The micro-component pin distance measurement method based on deep learning according to claim 4, characterized in that: The loss function of the micro component pin ranging model based on the ResNet18 network is adopted ,in, is the number of samples, is the true value, The larger the MSE value, the greater the difference between the predicted distance and the marked distance, and the smaller the MSE value, the smaller the difference between the predicted distance and the marked distance.
7. The micro-component pin distance measurement method based on deep learning according to claim 1, characterized in that: A micro-component pin ranging model is constructed based on the YOLOv8n network. The micro-component pin ranging model based on the YOLOv8n network includes a CSPNet backbone network, a different-scale feature map fusion structure combining the FPN module and the PAN module, and a detection head for predicting the category and position of the target.
8. The micro-component pin distance measurement method based on deep learning according to claim 7, characterized in that: According to the pin position features detected by the micro component pin ranging model based on the YOLOv8n network, the distance between two pins is calculated using the detection box information.
9. The micro-component pin distance measurement method based on deep learning according to claim 7, characterized in that: The loss function of the micro component pin distance measurement model based on the YOLOv8n network is adopted ,A represents the predicted bounding box A, and B represents the predicted bounding box B.