Detection method and detection device
Patent Information
- Application Number
- CN202510443241.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]本申请实施例提供一种检测方法及检测设备,旨在解决如何提升电路板检测精度的问题
[0033]可理解,本申请实施例第二方面提供的检测设备、第三方面提供的计算机可读存储介质及第四方面提供的计算机程序产品的有益效果与第一方面提供的检测方法的有益效果大致相同,此处不再赘述。
Smart Images

Figure CN122989506A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent manufacturing technology, specifically to a testing method and testing equipment. Background Technology
[0002] Circuit boards, as an indispensable part of electronic devices, determine the basic architecture and performance of these devices. Circuit board testing is a crucial step in the manufacturing process of electronic devices. With the trend of miniaturization and lightweighting of electronic devices, the density of components on circuit boards is increasing, placing higher demands on testing methods. Summary of the Invention
[0003] This application provides a testing method and testing equipment, aiming to solve the problem of how to improve the testing accuracy of circuit boards.
[0004] The first aspect of this application provides a detection method for detecting defects on a circuit board. The detection method includes: constructing and training a detection model, wherein the network architecture of the detection model is a YOLOv8 network, and the loss function of the detection model includes a Gaussian Distribution Similarity Metric (GDSM) function; acquiring a circuit board image; inputting the circuit board image into the detection model, and outputting the detection result.
[0005] In this embodiment, the detection model uses a YOLOv8 network architecture. The loss function of the YOLOv8 network typically includes the Intersection over Union (IOU) function. The IOU function has low error sensitivity to local features, making it difficult to accurately capture image details. The GDSM function is used instead of the IOU function. The GDSM function has high error sensitivity to both global and local features, enabling accurate identification of image details and thus improving the accuracy of the detection model.
[0006] In one embodiment, the GDSM function is:
[0007]
[0008] in, The square of the Wasserstein distance between the Gaussian distributions is given. The predicted bounding box is a Gaussian distribution. Let C be the Gaussian distribution of the true bounding boxes, C be the normalization constant, and λ be a constant.
[0009] In this embodiment, a normalization constant C and a constant λ are used to adjust the distance scale so that the distance metric can accurately reflect the degree of similarity between the predicted box and the ground truth box.
[0010] In another embodiment, the square of the Wasserstein distance is:
[0011]
[0012] in, Let m be the Euclidean distance between the mean vectors. a Gaussian distribution The mean vector, m b Gaussian distribution The mean vector, The square of the Frobenius norm between the square roots of the covariance matrix. Gaussian distribution The square root of the covariance matrix, Gaussian distribution The square root of the covariance matrix, where δ is a constant.
[0013] In this embodiment, a constant δ is used to adjust the distance between the Gaussian distribution of the predicted bounding box and the Gaussian distribution of the ground truth bounding box, so that the distance metric can accurately reflect the similarity between the predicted bounding box and the ground truth bounding box.
[0014] In another embodiment, the mean vector m a The mean vector m represents the center coordinates of the predicted bounding box. b Represents the center coordinates of the actual bounding box.
[0015] In another embodiment, the covariance matrix ∑ a The covariance matrix ∑ represents the size and shape of the prediction box. b This indicates the size and shape of the actual frame.
[0016] In another embodiment, the network architecture of the detection model includes a Backbone layer, a Neck layer, and a Head layer. The Backbone layer includes a first Conv module, a second Conv module, a first C2f module, a third Conv module, a second C2f module, a fourth Conv module, a third C2f module, a fifth Conv module, a fourth C2f module, an SPPF module, and a Bi-Level Routing Attention (BRA) module. The Neck layer includes a first Upsample module, a first Concat module, a fifth C2f module, a second Upsample module, a second Concat module, a sixth C2f module, a sixth Conv module, a third Concat module, a seventh C2f module, a seventh Conv module, a fourth Concat module, and an eighth C2f module. The Head layer includes a first Detect module, a second Detect module, and a third Detect module.
[0017] The input to the first Conv module is image data. The output of the first Conv module is the input to the second Conv module. The output of the second Conv module is the input to the first C2f module. The output of the first C2f module is the input to the third Conv module. The output of the third Conv module is the input to the second C2f module. The output of the second C2f module is the input to the fourth Conv module. The output of the fourth Conv module is the input to the third C2f module. The output of the third C2f module is the input to the fifth Conv module. The output of the fifth Conv module is the input to the fourth C2f module. The output of the fourth C2f module is the input to the SPPF module. The output of the SPPF module is the input to the BRA module. The output of the BRA module is the input to the first Upsample module and the fourth Concat module. The output of the first Upsample module is the input of the first Concat module. The output of the first Concat module is the input of the fifth C2f module. The output of the fifth C2f module is the input of the second Upsample module. The output of the second Upsample module is the input of the second Concat module. The output of the second Concat module is the input of the sixth C2f module. The output of the sixth C2f module is the input of the first Detect module and the sixth Conv module. The output of the first Detect module is the first boundary regression loss and the first classification loss. The output of the sixth Conv module is the input of the third Concat module. The output of the third Concat module is the input of the seventh C2f module. The output of the seventh C2f module is the input of the second Detect module and the seventh Conv module. The output of the second Detect module is the second boundary regression loss and the second classification loss. The output of the seventh Conv module is the input of the fourth Concat module. The output of the fourth Concat module is the input of the eighth C2f module. The output of the eighth C2f module is the input of the third Detect module. The output of the third Detect module is the third boundary regression loss and the third classification loss.
[0018] In this embodiment, the network architecture of the detection model introduces the BRA module in the Backbone layer of the YOLOv8 network. The BRA module adopts a two-layer routing mechanism. First, it divides or clusters the input sequence at a coarse-grained level, and then performs more precise attention calculation at a fine-grained level. This allows the detection model to focus on the most important information segments and ignore irrelevant parts, thereby reducing computational complexity and improving detection efficiency.
[0019] In another embodiment, the output of the BRA module is:
[0020] O = Attention(Q,K) g V g)
[0021] Where O is the attention weight matrix, Q is the query vector of a sub-region of the feature map, and K... g V is the target key vector of a subregion of the feature map. g is the target value vector of a sub-region of the feature map.
[0022] In another embodiment, the target key vector K g and the target value vector V g They are respectively:
[0023] K g =gather(K,I) r )
[0024] V g =gather(V,I) r )
[0025] Where K is the key vector of a sub-region of the feature map, V is the value vector of a sub-region of the feature map, and I r This is the routing index matrix.
[0026] In another embodiment, the routing index matrix I r for:
[0027] I r =topK(A r )
[0028] A r =Q r (K r ) T
[0029] Among them, A r Let Q be the adjacency matrix. r Let K be the mean vector of Q. r Let K be the mean vector.
[0030] A second aspect of this application provides a detection device including a memory and a processor, which implements the detection method provided in the first aspect when the processor executes computer instructions stored in the memory.
[0031] A third aspect of this application provides a computer-readable storage medium storing computer instructions thereon, which, when executed by a processor, implements the detection method provided in the first aspect.
[0032] A fourth aspect of this application provides a computer program product including computer instructions that, when executed by a processor, implement the detection method provided in the first aspect.
[0033] It is understood that the beneficial effects of the detection device provided in the second aspect of the embodiments of this application, the computer-readable storage medium provided in the third aspect, and the computer program product provided in the fourth aspect are substantially the same as the beneficial effects of the detection method provided in the first aspect, and will not be repeated here. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of a circuit board inspection scenario provided as an example.
[0035] Figure 2 This is a schematic diagram of the structure of a detection model provided as an example.
[0036] Figure 3 yes Figure 2 The diagram shows the structure of the BRA module in the detection model.
[0037] Figure 4 yes Figure 2 The diagram shows the structure of the Conv module in the detection model.
[0038] Figure 5 yes Figure 2 The diagram shows the structure of the C2f module in the detection model.
[0039] Figure 6 yes Figure 2 The diagram shows the structure of the SPPF module in the detection model.
[0040] Figure 7 yes Figure 2 The diagram shows the structure of the Detect module in the detection model.
[0041] Figure 8 This is a flowchart of a detection method provided as an example. Detailed Implementation
[0042] It should be noted that in the embodiments of this application, "multiple" refers to two or more. The terms "first," "second," "third," "fourth," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence. The methods disclosed in the embodiments of this application, or the methods shown in the flowcharts, include one or more steps for implementing the method. Without departing from the scope of the claims, the execution order of multiple steps can be interchanged, and some steps can also be deleted.
[0043] In this application embodiment, the circuit board includes a printed circuit board (PCB) and a flexible circuit board (FCB). Circuit board defects include, but are not limited to, short circuits and open circuits, solder mask defects, poor silkscreen printing, hole defects, poor plating, poor substrate, soldering problems, and loose or misaligned components.
[0044] The following is a brief description of the application scenarios of circuit board testing, using a mobile phone motherboard as an example.
[0045] like Figure 1 As shown, during the production process of the mobile phone motherboard 10, when the mobile phone motherboard 10 enters the target shooting range of the industrial camera 20, the industrial camera 20 captures the circuit board image of the mobile phone motherboard 10 and transmits the captured circuit board image to the inspection equipment 30. After receiving the circuit board image, the inspection equipment 30 performs image processing and inspection based on technologies such as machine vision, artificial intelligence, and deep learning to determine whether the mobile phone motherboard 10 has defects, and further determines the type of defect when it is determined that the mobile phone motherboard 10 has defects. Since the mobile phone motherboard 10 moves with the production line, the inspection of the mobile phone motherboard 10 requires not only high accuracy but also a short inspection time.
[0046] The YOLOv8 network is an efficient and flexible object detection network. Due to its fewer model parameters and strong feature extraction capabilities, it boasts high inference speed and detection accuracy. However, the loss function of the YOLOv8 network typically includes an IOU function. The IOU function has low sensitivity to errors in local features, making it difficult to accurately capture image details. This makes the YOLOv8 network susceptible to background noise interference when detecting image details, thus affecting the reliability of circuit board detection.
[0047] The embodiments of this application are based on the YOLOv8 network to build a detection model. The loss function of the detection model includes the GDSM function. The GDSM function has high error sensitivity to both global and local features, and can accurately identify image details, thereby improving the accuracy of the detection model.
[0048] The network architecture of the detection model in this application embodiment is described in detail below.
[0049] like Figure 2 As shown, the detection model includes a Backbone layer, a Neck layer, and a Head layer.
[0050] The Backbone layer is used for feature extraction. The Backbone layer includes a first Conv module, a second Conv module, a first C2f module, a third Conv module, a second C2f module, a fourth Conv module, a third C2f module, a fifth Conv module, a fourth C2f module, an SPPF module, and a BRA module.
[0051] The Neck layer is used for multi-scale feature fusion. The Neck layer includes the first Upsample module, the first Concat module, the fifth C2f module, the second Upsample module, the second Concat module, the sixth C2f module, the sixth Conv module, the third Concat module, the seventh C2f module, the seventh Conv module, the fourth Concat module, and the eighth C2f module.
[0052] The Head layer is used to generate detection results, which include the target category and bounding box. The Head layer includes a first Detect module, a second Detect module, and a third Detect module.
[0053] The input to the first Conv module is image data. The output of the first Conv module is the input to the second Conv module. The output of the second Conv module is the input to the first C2f module. The output of the first C2f module is the input to the third Conv module. The output of the third Conv module is the input to the second C2f module. The output of the second C2f module is the input to the fourth Conv module. The output of the fourth Conv module is the input to the third C2f module. The output of the third C2f module is the input to the fifth Conv module. The output of the fifth Conv module is the input to the fourth C2f module. The output of the fourth C2f module is the input to the SPPF module. The output of the SPPF module is the input to the BRA module. The output of the BRA module is the input to the first Upsample module and the fourth Concat module. The output of the first Upsample module is the input of the first Concat module. The output of the first Concat module is the input of the fifth C2f module. The output of the fifth C2f module is the input of the second Upsample module. The output of the second Upsample module is the input of the second Concat module. The output of the second Concat module is the input of the sixth C2f module. The output of the sixth C2f module is the input of the first Detect module and the sixth Conv module. The output of the first Detect module is the first boundary regression loss and the first classification loss. The output of the sixth Conv module is the input of the third Concat module. The output of the third Concat module is the input of the seventh C2f module. The output of the seventh C2f module is the input of the second Detect module and the seventh Conv module. The output of the second Detect module is the second boundary regression loss and the second classification loss. The output of the seventh Conv module is the input of the fourth Concat module. The output of the fourth Concat module is the input of the eighth C2f module. The output of the eighth C2f module is the input of the third Detect module. The output of the third Detect module is the third boundary regression loss and the third classification loss.
[0054] In this embodiment, the network architecture of the detection model introduces the BRA module in the Backbone layer of the YOLOv8 network. The BRA module adopts a two-layer routing mechanism. First, it divides or clusters the input sequence at a coarse-grained level, and then performs more precise attention calculation at a fine-grained level. This allows the detection model to focus on the most important information segments and ignore irrelevant parts, thereby reducing computational complexity and improving detection efficiency.
[0055] For example, such as Figure 3As shown, the BRA module first divides the input feature map into S×S non-overlapping regions, that is, S×S sub-regions of the feature map. Then, a linear projection is performed on each sub-region of the feature map to obtain the query vector, key vector and value vector, as shown in formula (1).
[0056]
[0057] Where Q is the query vector of a sub-region of the feature map, K is the key vector of a sub-region of the feature map, V is the value vector of a sub-region of the feature map, and X... r For a sub-region of the feature map, W q W is the projected weight of the query vector. k W represents the projected weights of the key vectors. v The projection weights are the values of the vector.
[0058] To determine the region of interest for each sub-region of the feature map, the BRA module first calculates the mean vector Q of the query vector Q. r The mean vector K of the key vector K r Then, the mean vector K r The transpose matrix and mean vector Q r Multiplying these two regions yields the adjacency matrix, which represents the degree of association between two regions. The topK algorithm is then used to process the adjacency matrix to obtain the routing index matrix, as shown in formula (2).
[0059]
[0060] Among them, I r Let A be the routing index matrix. r It is an adjacency matrix.
[0061] As can be understood, the top-K algorithm refers to a class of algorithms that find the top K maximum (or minimum) values and their corresponding indices from a set of data. The top-K algorithm is used to process the adjacency matrix A. r It can retain the top K sub-regions that are highly correlated with each feature map, while deleting the sub-regions that are less correlated with each feature map.
[0062] After calculating the routing index matrix, the BRA module uses the gather function to collect the key vectors and value vectors corresponding to the top K sub-regions that are highly correlated with the sub-regions of each feature map scattered across the entire feature map, and obtains the target key vector and target value vector, as shown in formula (3).
[0063]
[0064] Among them, K g V is the target key vector of a subregion of the feature map. gis the target value vector of a sub-region of the feature map.
[0065] After calculating the target key vector and the target value vector, the BRA module uses the attention mechanism of the Attention function to find the sub-region with the highest correlation to each feature map, as shown in formula (4).
[0066] O = Attention(Q,K) g V g (4)
[0067] Where O is the attention weight matrix.
[0068] In this embodiment, the Conv module is used for feature extraction and transformation. For example, as shown... Figure 4 As shown, the Conv module includes the Conv2d module, the BatchNormalv2d module, and the SiLU module. The input to the Conv2d module is the input to the Conv module, the output of the Conv2d module is the input to the BatchNormalv2d module, the output of the BatchNormalv2d module is the input to the SiLU module, and the output of the SiLU module is the output of the Conv module.
[0069] As you can understand, the Conv2d module is used for convolution processing, the BatchNormalv2d module is used for normalization processing, and the SiLU module is used for nonlinear transformations, including the SiLU activation function.
[0070] In this embodiment, the C2f module is used for multi-scale feature fusion. For example, as shown... Figure 5 As shown, the C2f module includes a first Conv module, a Split module, a first Bottleneck module, a second Bottleneck module, a Concat module, and a second Conv module. The input of the first Conv module is the input of the C2f module; the output of the first Conv module is the input of the Split module; the output of the Split module is the input of both the first Bottleneck module and the Concat module; the output of the first Bottleneck module is the input of both the second Bottleneck module and the Concat module; the output of the second Bottleneck module is the input of the Concat module; the output of the Concat module is the input of the second Conv module; and the output of the second Conv module is the output of the C2f module.
[0071] Understandably, the Split module is used for feature segmentation, the Bottleneck module for feature extraction, and the Concat module for feature fusion.
[0072] In this embodiment, the SPPF module is used for multi-scale feature fusion and to enhance the receptive field of the detection model. For example, as shown... Figure 6 As shown, the SPPF module includes a first Conv module, a first MaxPool2d module, a second MaxPool2d module, a third MaxPool2d module, a Concat module, and a second Conv module. The input of the first Conv module is the input of the SPPF module; the output of the first Conv module is the input of the first MaxPool2d module; the output of the first MaxPool2d module is the input of the second MaxPool2d module and the input of the Concat module; the output of the second MaxPool2d module is the input of the third MaxPool2d module and the input of the Concat module; the output of the third MaxPool2d module is the input of the Concat module; the output of the Concat module is the input of the second Conv module; and the output of the second Conv module is the output of the SPPF module.
[0073] Understandably, the MaxPool2d module is used for pooling.
[0074] In this embodiment, the Detect module is used to predict the target category and bounding box. For example, as shown... Figure 7 As shown, the Detect module includes a first branch and a second branch. The first branch includes a first Conv module, a second Conv module, a first Conv2d module, and a BoxLoss module. The second branch includes a third Conv module, a fourth Conv module, a second Conv2d module, and a ClassLoss module. The inputs of the first and third Conv modules are the inputs of the Detect module. The output of the first Conv module is the input of the second Conv module, the output of the second Conv module is the input of the first Conv2d module, the output of the first Conv2d module is the input of the BoxLoss module, the output of the third Conv module is the input of the fourth Conv module, the output of the fourth Conv module is the input of the second Conv2d module, the output of the second Conv2d module is the input of the ClassLoss module, and the outputs of the BoxLoss and ClassLoss modules are the outputs of the Detect module.
[0075] As can be understood, the BoxLoss module is used to calculate the boundary regression loss, and the ClassLoss module is used to calculate the classification loss. The loss of the detection model includes boundary regression loss and classification loss. In this embodiment, the GDSM function is used to calculate the boundary regression loss, and the Binary Cross-Entropy Loss (BCE Loss) function or the Focal Loss function is used to calculate the classification loss.
[0076] The process of calculating the boundary regression loss is described in detail below.
[0077] Assume the center position and size parameters of the predicted bounding box A are (cx a cy a w a h a The center position and size parameters of the true bounding box B are (cx b cy b w b h b ). Among them, (cx a cy a ) represents the center coordinates of the predicted bounding box A, w a To predict the width of bounding box A, h a To predict the height of bounding box A, (cx b cy b ) represents the center coordinates of the true bounding box B, w b h is the width of the actual bounding box B. b The height of the actual bounding box B.
[0078] Model the prediction box A as a Gaussian distribution. Model the real bounding box B as a Gaussian distribution.
[0079] Calculate the Gaussian distribution separately Gaussian distribution The mean vector represents the center coordinates of the bounding box, as shown in formula (5).
[0080]
[0081] Where, m a Gaussian distribution The mean vector, m b Gaussian distribution The mean vector.
[0082] Calculate the Gaussian distribution separately Gaussian distribution The covariance matrix represents the size and shape of the bounding box, as shown in Equation (6).
[0083]
[0084] Where, ∑ a Gaussian distribution The covariance matrix, ∑ b Gaussian distribution The covariance matrix, The width of the predicted bounding box A is half. The height is half the height of the predicted box A. It is half the width of the actual frame B. It is half the height of the actual bounding box B.
[0085] Calculate the Gaussian distribution based on its mean vector and covariance matrix. Gaussian distribution The square of the Wasserstein distance between them is shown in Equation (7).
[0086]
[0087] in, The square of the Wasserstein distance between Gaussian distributions. Let be the Euclidean distance between the mean vectors. The square of the Frobenius norm between the square roots of the covariance matrix. Gaussian distribution The square root of the covariance matrix, Gaussian distribution The square root of the covariance matrix, where δ is a constant.
[0088] It is understandable that a constant δ is used to adjust the Gaussian distribution of the prediction box A. Gaussian distribution of the true bounding box B The distance between them allows the distance metric to accurately reflect the similarity between the predicted box A and the ground truth box B.
[0089] The boundary regression loss is calculated based on the square of the Wasserstein distance between Gaussian distributions, as shown in Equation (8).
[0090]
[0091] in, λ is the boundary regression loss between Gaussian distributions, with a value greater than 0 and less than 1. C is the normalization constant, and λ is a constant.
[0092] Understandably, normalization constants C and λ are used to adjust the distance scale so that the distance metric can accurately reflect the degree of similarity between the predicted box A and the ground truth box B.
[0093] Based on the network architecture and loss function of the above detection model, the detection method of this application embodiment is briefly described below.
[0094] The detection method is applied to the detection equipment. For example... Figure 8 As shown, the detection method includes the following steps:
[0095] S101. Construct and train the detection model. The network architecture of the detection model is a YOLOv8 network, and the loss function of the detection model includes the GDSM function.
[0096] In this embodiment, compared with the traditional IOU function, the GDSM function has higher error sensitivity to both global and local features, and can accurately identify image details.
[0097] Understandably, the detection model is trained using a training sample set, which can be circuit board images captured by industrial cameras on the circuit board production line.
[0098] S102, Obtain circuit board image.
[0099] In this embodiment, an industrial camera on the circuit board production line captures images of the circuit boards and transmits these images to the testing equipment.
[0100] Understandably, the inspection equipment can control the shooting parameters of the industrial camera, thereby adjusting the size and clarity of the circuit board image.
[0101] S103. Input the circuit board image into the detection model and output the detection results.
[0102] In this embodiment, the detection result includes the target category and the bounding box. The target category is one of a variety of preset circuit board defect categories, and the bounding box is the location of the circuit board defect in the circuit board image.
[0103] It is understood that the detection device may include a processor and a memory, and the processor implements the various steps of the detection method in the above embodiments when it executes computer instructions stored in the memory.
[0104] Processors include, but are not limited to, central processing units (CPUs), neural-network processing units (NPUs), application processors (APs), and digital signal processors (DSPs).
[0105] The memory is used to store executable program code for a computer, including instructions. The memory includes a program storage area and a data storage area. The program storage area may store the operating system and at least one application (APP) required for a given function. The data storage area may store data created during the use of the testing device. The memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, and Universal Flash Storage (UFS).
[0106] The steps performed by the detection device in the above embodiments can also be applied to chips, computer-readable storage media, or computer program products.
[0107] The chip includes a processor and an interface circuit, with the processor and interface circuit electrically connected. The interface circuit can read computer instructions stored in the memory and send the computer instructions to the processor. When the processor executes the computer instructions, it implements the various steps performed by the detection device in the above embodiments.
[0108] The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the various steps performed by the detection device in the above embodiments.
[0109] Computer-readable storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer.
[0110] The computer program product includes computer instructions that, when executed by a processor, implement the various steps performed by the detection device in the above embodiments.
[0111] The embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of this application.
Claims
1. A detection method for detecting defects in circuit boards, characterized in that, The method includes: A detection model is constructed and trained. The network architecture of the detection model is a YOLOv8 network, and the loss function of the detection model includes the Gaussian distribution similarity measure GDSM function. Acquire circuit board images; The circuit board image is input into the detection model, and the detection result is output.
2. The detection method as described in claim 1, characterized in that, The GDSM function is: in, The square of the Wasserstein distance between the Gaussian distributions. The predicted bounding box is a Gaussian distribution. Let C be the Gaussian distribution of the true bounding boxes, C be the normalization constant, and λ be a constant.
3. The detection method as described in claim 2, characterized in that, The square of the Wasserstein distance is: in, Let m be the Euclidean distance between the mean vectors. a Gaussian distribution The mean vector, m b Gaussian distribution The mean vector, The square of the Frobenius norm between the square roots of the covariance matrix. Gaussian distribution The square root of the covariance matrix, Gaussian distribution The square root of the covariance matrix, where δ is a constant.
4. The detection method as described in claim 3, characterized in that, Mean vector m a The mean vector m represents the center coordinates of the prediction box. b This represents the center coordinates of the actual bounding box.
5. The detection method as described in claim 3, characterized in that, covariance matrix ∑ a The size and shape of the prediction box are represented by the covariance matrix ∑. b This indicates the size and shape of the actual frame.
6. The detection method as described in claim 1, characterized in that, The network architecture of the detection model includes a Backbone layer, a Neck layer, and a Head layer; The Backbone layer includes a first Conv module, a second Conv module, a first C2f module, a third Conv module, a second C2f module, a fourth Conv module, a third C2f module, a fifth Conv module, a fourth C2f module, an SPPF module, and a dual-layer routing attention (BRA) module. The Neck layer includes a first Upsample module, a first Concat module, a fifth C2f module, a second Upsample module, a second Concat module, a sixth C2f module, a sixth Conv module, a third Concat module, a seventh C2f module, a seventh Conv module, a fourth Concat module, and an eighth C2f module; The Head layer includes a first Detect module, a second Detect module, and a third Detect module; Wherein, the input of the first Conv module is image data, the output of the first Conv module is the input of the second Conv module, the output of the second Conv module is the input of the first C2f module, the output of the first C2f module is the input of the third Conv module, the output of the third Conv module is the input of the second C2f module, the output of the second C2f module is the input of the fourth Conv module, the output of the fourth Conv module is the input of the third C2f module, the output of the third C2f module is the input of the fifth Conv module, the output of the fifth Conv module is the input of the fourth C2f module, the output of the fourth C2f module is the input of the SPPF module, the output of the SPPF module is the input of the BRA module, the output of the BRA module is the input of the first Upsample module and the fourth Concat module; the output of the first Upsample module is the input of the first Concat module, the output of the first Concat module is the input of the fifth C2f module, and the output of the fifth C2f module is the input of the first Concat module. The second Upsample module is the input to the second Concat module, and the output of the second Upsample module is the input to the sixth C2f module. The output of the sixth C2f module is the input to the first Detect module and the sixth Conv module. The output of the first Detect module is the first boundary regression loss and the first classification loss. The output of the sixth Conv module is the input to the third Concat module, and the output of the third Concat module is the input to the seventh C2f module. The output of the seventh C2f module is the input to the second Detect module and the seventh Conv module. The output of the second Detect module is the second boundary regression loss and the second classification loss. The output of the seventh Conv module is the input to the fourth Concat module, and the output of the fourth Concat module is the input to the eighth C2f module. The output of the eighth C2f module is the input to the third Detect module, and the output of the third Detect module is the third boundary regression loss and the third classification loss.
7. The detection method as described in claim 6, characterized in that, The output of the BRA module is: O=Attention(Q,K g ,V g ) Where O is the attention weight matrix, Q is the query vector of a sub-region of the feature map, and K... g V is the target key vector of a subregion of the feature map. g is the target value vector of a sub-region of the feature map.
8. The detection method as described in claim 7, characterized in that, Target key vector K g and the target value vector V g They are respectively: K g =gather(K,I r ) V g =gather(V,I r ) Where K is the key vector of the sub-region of the feature map, V is the value vector of the sub-region of the feature map, and I r This is the routing index matrix.
9. The detection method as described in claim 8, characterized in that, Routing Index Matrix I r for: AND r =topK(A r ) A r =Q r (K r ) T Among them, A r Let Q be the adjacency matrix. r Let K be the mean vector of Q. r Let K be the mean vector.
10. A testing device, characterized in that, It includes a processor and a memory, which implement the detection method as described in any one of claims 1-9 when the processor executes computer instructions stored in the memory.