Target detection model construction method and device, equipment, medium and program product
By generating a mask by calculating the density values of point cloud data, the problem of feature information loss caused by randomly generated masks is solved, thus improving the accuracy and generalization ability of the target detection model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, processing images with randomly generated masks leads to the loss of important feature information, resulting in a decrease in the accuracy of target detection models.
By calculating the density values of point cloud data to generate a mask, the voxel tensor is processed using the density-generated mask to retain point cloud data in the voxel space with higher density values, thereby reducing the amount of data and improving the accuracy of model training.
It improves the accuracy of the target detection model, retains more feature information, and enhances the model's generalization ability.
Smart Images

Figure CN121789002A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, and in particular relates to a method, apparatus, device, medium and program product for constructing a target detection model. Background Technology
[0002] In the field of point cloud object detection, efficient processing of point clouds is achieved by utilizing varying levels of supervision information and data volume. Among these, the Masked Autoencoder (MAE) is based on the Transformer's attention mechanism. It learns image features by generating masks to cover parts of the image and predicting the pixel values of the missing parts.
[0003] However, currently, masks are mainly generated randomly, and then the image is masked based on the randomly generated mask. This results in the masking of some regions of the image containing important feature information. Subsequently, the masked image is used to train the model to obtain the object detection model, which leads to a decrease in the accuracy of the object detection model. Summary of the Invention
[0004] This invention provides a method, apparatus, device, medium, and program product for constructing a target detection model, which can improve the accuracy of the target detection model.
[0005] In a first aspect, embodiments of the present invention provide a method for constructing a target detection model, comprising: Obtain the voxel tensor of the object to be detected, wherein the voxel tensor is used to represent point cloud data in multiple voxel spaces; For each voxel space, the density value of the point cloud in the voxel space is calculated based on the point cloud data in the voxel space. Generate a mask corresponding to the voxel space based on the density values of the point cloud in the voxel space; The voxel tensor is masked using the mask to obtain the visible voxel tensor; The target detection model is obtained by training the neural network model using the voxel tensor and the visible voxel tensor.
[0006] In one possible implementation, calculating the density value of the point cloud in the voxel space based on the point cloud data in the voxel space includes: Randomly select the i-th initial point cloud in the voxel space, where i≥1; In the voxel space, determine the i-th target point cloud that is closest to the i-th initial point cloud; Calculate the connection distance between the i-th target point cloud and the i-th initial point cloud; The i-th target point cloud is used as the (i+1)-th initial point cloud, and the (i+1)-th target point cloud that is closest to the (i+1)-th initial point cloud is determined in the voxel space. Calculate the connection distance between the (i+1)th target point cloud and the (i+1)th initial point cloud; When the set of the i-th initial point cloud, the i-th target point cloud, and the (i+1)-th target point cloud is all the point clouds in the voxel space, or when i=N, calculate the average value of the connection distance between the i-th target point cloud and the i-th initial point cloud to obtain the density value of the voxel space. Where N is a preset value.
[0007] In one possible implementation, the mask includes a first value or a second value; generating the mask corresponding to the voxel space based on the density values of the point cloud in the voxel space includes: The density values are normalized or linearly mapped to obtain the mask probabilities corresponding to the voxel space. Generate random numbers using a random number generator; If the random number is greater than or equal to the mask probability, the mask corresponding to the voxel space is set to a first value; If the random number is less than the mask probability, the mask corresponding to the voxel space is set to the second value.
[0008] In one possible implementation, the step of masking the voxel tensor using the mask to obtain a visible voxel tensor includes: The voxel space with the first mask value is masked to obtain the visible voxel tensor.
[0009] In one possible implementation, the step of masking the voxel tensor using the mask to obtain a visible voxel tensor includes: For a voxel space with the mask set to the first value, the product of the point cloud data in the voxel space and the mask probability is calculated to obtain the visible voxel tensor.
[0010] In one possible implementation, the neural network model includes an initial encoder, an initial decoder, and the initial multilayer perceptron; The step of training a neural network model using the voxel tensor and the visible voxel tensor to obtain a target detection model includes: Input the voxel tensor into the initial encoder; The initial encoder extracts features from the voxel tensor using an attention mechanism to obtain an initial encoding vector. Input the initial encoding vector and the visible voxel tensor into the initial decoder; The visible voxel tensor is reconstructed using the initial decoder based on a cross-attention mechanism to obtain the reconstructed voxel tensor. The reconstructed voxel tensor is input into the initial multilayer perceptron to obtain the prediction result.
[0011] Calculate the loss function based on the prediction results and the voxel tensor; The target detection model is obtained by adjusting the model parameters of the initial encoder, the initial decoder, and the initial multilayer perceptron using the loss function.
[0012] Secondly, embodiments of this application provide an apparatus for constructing a target detection model, comprising: The acquisition module is used to acquire the voxel tensor of the object to be detected, wherein the voxel tensor is used to represent point cloud data in multiple voxel spaces; The calculation module is used to calculate the density value of the point cloud in the voxel space based on the point cloud data in the voxel space for each voxel space. The generation module is used to generate a mask corresponding to the voxel space based on the density values of the point cloud in the voxel space. The processing module is used to perform masking processing on the voxel tensor using the mask to obtain the visible voxel tensor; The training module is used to train the neural network model using the voxel tensor and the visible voxel tensor to obtain the target detection model.
[0013] Thirdly, embodiments of the present invention provide an electronic device, the device comprising: a processor, and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the method for constructing a target detection model as described in the first aspect.
[0014] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the method for constructing a target detection model as described in the first aspect.
[0015] Fifthly, embodiments of the present invention provide a computer program product, including a computer program, which, when executed, implements the method for constructing a target detection model as described in the first aspect.
[0016] This invention discloses a method, apparatus, device, medium, and program product for constructing a target detection model. The method involves acquiring a voxel tensor of the object to be detected, wherein the voxel tensor is obtained by voxelizing the point cloud data of the object. Then, the density value of the point cloud in each voxel space is calculated. A mask for the voxel space is generated using the density values. Since the mask is generated based on the density values of the point cloud, subsequent masking processing of the voxel tensor using the mask can mask the point cloud data in the voxel space based on the density values, thereby ensuring that the visible voxel tensor retains more features and improving the accuracy of the target detection model. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a method for constructing a target detection model according to an embodiment of the present invention; Figure 2 This is a schematic flowchart of a density value estimation method provided in an embodiment of the present invention; Figure 3 This is a flowchart illustrating a mask generation method provided in an embodiment of the present invention; Figure 4 This is a flowchart illustrating a model training method provided in an embodiment of the present invention; Figure 5 This is an exemplary schematic diagram of a model training method provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of a device for constructing a target detection model provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0019] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the present invention and not to limit the present invention. For those skilled in the art, the present invention can be practiced without some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present invention by illustrating examples of the invention.
[0020] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0021] It should be noted that the acquisition, storage, use, and processing of data in this application embodiment all comply with the relevant provisions of national laws and regulations.
[0022] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0023] To address the problems in the prior art, embodiments of the present invention provide a method, apparatus, device, medium, and program product for constructing a target detection model.
[0024] The method for constructing the target detection model provided in the embodiments of the present invention will be introduced first below.
[0025] Figure 1 A flowchart illustrating a method for constructing a target detection model according to an embodiment of the present invention is shown. This method is applied to electronic devices, such as... Figure 1 As shown, the method includes S101-S105: S101. Obtain the voxel tensor of the object to be detected.
[0026] Among them, the voxel tensor is used to represent point cloud data in multiple voxel spaces.
[0027] Specifically, after electronic devices collect point cloud data of the object to be detected through devices such as lidar, they perform voxelization processing on the point cloud data to obtain voxel tensors.
[0028] S102. For each voxel space, calculate the density value of the point cloud in the voxel space based on the point cloud data in the voxel space.
[0029] The density value is used to represent the quantity and distribution of point cloud data in the voxel space.
[0030] S103. Generate a mask corresponding to the voxel space based on the density values of the point cloud in the voxel space.
[0031] Understandably, a higher density value indicates a larger and more densely distributed point cloud in the voxel space, meaning this voxel space contains more features of the object to be detected. Therefore, voxels in this voxel space are preserved using a mask. Conversely, a lower density value indicates a smaller and more sparsely distributed point cloud in the voxel space, meaning this voxel space contains fewer features of the object to be detected. Therefore, voxels in this voxel space are filtered out using a mask, thereby reducing the amount of data to be processed.
[0032] The mask is a binary mask, consisting of a first value and a second value. Specifically, the first value is 1, and the second value is 0.
[0033] S104. Mask the voxel tensor to obtain the visible voxel tensor.
[0034] Each voxel space corresponds to a mask, and the value of the mask determines whether to filter out voxel spaces.
[0035] Specifically, the visible voxel tensor is obtained by calculating the product of the point cloud data and the mask value in the voxel space.
[0036] In one example, the mask value corresponding to voxel space 1 is 1, and the mask value corresponding to voxel space 2 is 0. The electronic device calculates the product of the point cloud data in voxel space 1 and the mask to determine the point cloud data in voxel space 1 to be retained, and calculates the product of the point cloud data in voxel space 2 and the mask to determine the point cloud data in voxel space 2 to be filtered out.
[0037] S105. Train the neural network model using voxel tensors and visible voxel tensors to obtain the target detection model.
[0038] The method provided in this application provides an example of obtaining the voxel tensor of the object to be detected. The voxel tensor is obtained by voxelizing the point cloud data of the object. Then, the density value of the point cloud in each voxel space is calculated. A mask for the voxel space is generated using these density values. Since the mask is generated based on the density values of the point cloud, subsequent masking of the voxel tensor using the mask can mask the point cloud data in the voxel space based on the density values, thus ensuring that the visible voxel tensor retains more features and improving the accuracy of the target detection model.
[0039] Regarding S101 above, obtaining the voxel tensor of the object to be detected can be specifically implemented as follows: Step 1: Obtain the point cloud data of the object to be detected.
[0040] Point cloud data includes coordinate information. By using point cloud data, the three-dimensional structure of objects in the actual scene can be constructed, aiming to depict the shape and position of objects such as roads, buildings, and vehicles.
[0041] Step 2: Determine the spatial location of the object to be detected based on the coordinate information of the point cloud data.
[0042] Step 3: Divide the space of the object to be detected according to the preset space size to obtain multiple voxel spaces.
[0043] The preset spatial size is set based on experience. A smaller preset spatial size can improve resolution, allowing the object detection model to capture more detailed features, while a larger preset spatial size can reduce computational costs. Therefore, users can adjust the size of the preset spatial size according to the actual application scenario.
[0044] Step 4: Determine the voxel space where each point cloud is located based on the coordinate information of the point cloud data.
[0045] Step 5: Perform voxelization on the point cloud in each voxel space to obtain the voxel tensor corresponding to the object to be detected.
[0046] For S102 above, for each voxel space, the density value of the point cloud in the voxel space is calculated based on the point cloud data in the voxel space. Specifically, this can be implemented as S1021-S1026, such as... Figure 2 As shown: S1021. Randomly select the i-th initial point cloud in the voxel space.
[0047] Where i ≥ 1.
[0048] S1022. Determine the i-th target point cloud that is closest to the i-th initial point cloud in the voxel space.
[0049] The electronic device traverses all point clouds in the voxel space, calculates the distance between each point cloud data and the i-th initial point cloud, and thus determines the target point cloud corresponding to the i-th initial point cloud.
[0050] S1023. Calculate the connection distance between the i-th target point cloud and the i-th initial point cloud.
[0051] Specifically, based on the position coordinates of the target point cloud and the initial point cloud, the Euclidean distance between the target point cloud and the initial point cloud is calculated, and the calculated Euclidean distance is used as the connection distance.
[0052] S1024. Take the i-th target point cloud as the i+1-th initial point cloud, and determine the i+1-th target point cloud that is closest to the i+1-th initial point cloud in the voxel space.
[0053] S1025. Calculate the connection distance between the (i+1)th target point cloud and the (i+1)th initial point cloud.
[0054] S1026. If the set of the i-th initial point cloud, the i-th target point cloud and the (i+1)-th target point cloud is all point clouds in the voxel space, or if i=N, calculate the average value of the connection distance between the i-th target point cloud and the i-th initial point cloud to obtain the density value in the voxel space.
[0055] Where N is a preset value.
[0056] In one example, a point cloud P0 is randomly selected in the voxel space. Then, the point cloud P1 that is closest to P0 is found in the voxel space, and the connection distance D1 between P1 and P0 is calculated. The process continues to find the point cloud P2 that is closest to P1 in the voxel space, where P2 is a point cloud other than P0 and P1. This process is repeated until a point cloud Pn is found, where n is equal to the number of point clouds in the voxel space minus one. Alternatively, if the number of times the search operation is performed reaches a preset value N, the average value of the connection distance is calculated to obtain the density value.
[0057] Using the method provided in this application, the i-th initial point cloud in the voxel space is randomly selected. Then, other point clouds in the voxel space are traversed to determine the i-th target point cloud that is closest to the i-th point cloud. The connection distance between the i-th initial point cloud and the i-th target point cloud is then calculated. Furthermore, using the i-th target point cloud as the (i+1)-th initial point cloud, the (i+1)-th target point cloud corresponding to the (i+1)-th initial point cloud is searched among the point clouds excluding the i-th target point cloud and the i-th initial point cloud. Thus, when the set of the i-th initial point cloud, the i-th target point cloud, and the (i+1)-th target point cloud represents all point clouds in the voxel space, it indicates that all point clouds in the voxel space have been traversed. Therefore, when i=N, the average value of the connection distance between the i-th target point cloud and the i-th initial point cloud is calculated to obtain the density value of the voxel space. Thus, based on the connection distance between point clouds, the density value of the voxel space is calculated. By combining the number of point clouds and the degree of aggregation in the voxel space, the distribution of point clouds in the voxel space is calculated, ensuring the accuracy of the density value.
[0058] After calculating the density values, feature extraction is performed on the point cloud data in each voxel space, extracting geometric and statistical features corresponding to the voxel space. Geometric features can include the mean, variance, and center point coordinates of the point cloud data, while statistical features can include the number of points and the density value. The electronic device integrates these features to generate a fixed-length one-dimensional numerical vector, thus obtaining the voxel token. Subsequently, the electronic device performs masking processing on the voxel token and trains the model.
[0059] The mask includes a first value or a second value. For S103 above, based on the density values of the point cloud in the voxel space, a mask corresponding to the voxel space is generated. Specifically, this can be implemented as S1031-S1034, such as... Figure 3 As shown: S1031. Normalize the density values or perform linear mapping on the density values to obtain the mask probabilities corresponding to the voxel space.
[0060] Normalizing the density values means mapping them to the [0,1] interval to generate the mask probabilities corresponding to the voxel space.
[0061] Alternatively, a linear mapping can be used, employing the formula P=kD, where P is the mask probability, k is the intensity coefficient, and D is the normalized density value. The normalized density value is obtained by normalizing the density values. The intensity coefficient is preset based on experience.
[0062] In one example, D is 0.8 and k is 0.9, then P = 0.72.
[0063] S1032. Generate random numbers using a random number generator.
[0064] S1033. When the random number is greater than or equal to the mask probability, set the mask corresponding to the voxel space to the first value.
[0065] The first value is 1, and the second value is 0.
[0066] S1034. If the random number is less than the mask probability, set the mask corresponding to the voxel space to the second value.
[0067] The method provided in this application calculates the mask probability of the voxel space by normalizing the density values or by using a linear mapping. Then, the electronic device generates random numbers using a random number generator. If the random number is greater than or equal to the mask probability corresponding to the voxel space, the mask is set to a first value; if the random number is less than the mask probability, the mask is set to a second value. Thus, the mask probability reflects the importance of each voxel in the overall point cloud data of the object to be detected. Voxel spaces with higher density values correspond to lower mask probabilities, thereby preserving more point cloud features. Voxel spaces with lower density values correspond to higher mask probabilities, masking voxel spaces with fewer point cloud features reduces the amount of data processed subsequently.
[0068] In some embodiments of this application, after the above calculation generates the mask corresponding to each voxel space, the mask processing includes the following two methods: The first method: Mask the voxel space with the first mask value to obtain the visible voxel tensor.
[0069] The visible voxel tensor is obtained by calculating the product of the mask and the token corresponding to the voxel space.
[0070] The second method: For a voxel space with the first mask value, calculate the product of the point cloud data in the voxel space and the mask probability to obtain the visible voxel tensor.
[0071] Specifically, for each voxel space, the product of the token and mask probabilities corresponding to the voxel space is calculated to obtain the visible voxel tensor.
[0072] Using the method provided in this application, when the mask is a first value, the voxel space is directly masked to obtain the visible voxel tensor. Alternatively, the weight of the voxel space is reduced by calculating the product of the point cloud data in the voxel space and the mask probability, so that the target detection model pays more attention to the region with higher density value, thereby ensuring the accuracy of the target detection model.
[0073] In some embodiments of this application, the neural network model includes an initial encoder and an initial decoder. Regarding the above-described S105, the neural network model is trained using voxel tensors and visible voxel tensors to obtain an object detection model. Specifically, this can be implemented as S1051-S1056, as follows: Figure 4 As shown: S1051. Input the voxel tensor into the initial encoder.
[0074] S1052. The initial encoder extracts features from the voxel tensor using an attention mechanism to obtain the initial encoding vector.
[0075] The following describes the initial encoder's feature extraction process based on an attention mechanism: For each voxel token, a predetermined number of nearest-neighbor voxel tokens are calculated. A linear transformation is performed on the voxel token to obtain the Query. Linear transformations are then performed on the nearest-neighbor voxel tokens to obtain their Keys and Values. Using the Query, Key, and Value, a similarity score is calculated between the voxel token and each of its nearest-neighbor voxel tokens. The similarity scores for each nearest-neighbor voxel token are then weighted and summed to obtain the attention feature of the voxel token. This attention feature is then passed through a feedforward network, residual connections, and a normalization layer to obtain the feature vector for each voxel token. These feature vectors are then integrated to obtain the initial encoding vector.
[0076] S1053. Input the initial encoding vector and the visible voxel tensor into the initial decoder.
[0077] S1054. The visible voxel tensor is reconstructed using the initial decoder based on the cross-attention mechanism to obtain the reconstructed voxel tensor.
[0078] The following describes the working process of the initial decoder: First, the initial encoding vector and the visible voxel vector are concatenated to obtain a concatenated token. For each token in the concatenated token, the query, key, and value of that token are calculated. The similarity score between the query and the key of other tokens is calculated, and the similarity score is normalized to obtain the attention weight. The values of tokens with similarity scores greater than a preset threshold are obtained, and the extracted values are weighted and summed according to the corresponding attention weights to obtain a fused feature vector. The fused feature vector is then passed through a feedforward network, a residual connection, and a normalization layer to obtain the feature vector corresponding to each token. The feature vectors corresponding to each token are then integrated to obtain the reconstructed voxel tensor.
[0079] S1055. Input the reconstructed voxel tensor into the initial multilayer perceptron to obtain the prediction result.
[0080] The prediction results include information such as the category, location, and pose of the object to be detected.
[0081] Specifically, the initial multilayer perceptron consists of multiple fully connected layers, which are connected to each other by a non-linear activation function.
[0082] It should be noted that in this embodiment, a lightweight multilayer perceptron is used. The lightweight multilayer perceptron has a simple structure and fewer parameters, thereby ensuring the efficiency of model training and model inference and reducing computational costs.
[0083] S1056. Calculate the loss function based on the prediction results and the category information of the voxel tensor.
[0084] S1057. Adjust the model parameters of the initial encoder, initial decoder and initial multilayer perceptron using the loss function to obtain the target detection model.
[0085] The method provided in this application involves inputting a voxel tensor into an initial encoder. The initial encoder then extracts features from the voxel tensor using an attention mechanism, compressing the extracted features into a smaller representation. This preserves the key features of the voxel tensor, reduces data dimensionality, and improves representation efficiency. The initial vector and the visible voxel tensor are then used as the initial decoder to reconstruct the reconstructed voxel tensor. Since occluded voxels are excluded from the initial encoder's encoding process, they lack effective encoded features. Therefore, the visible voxel tensor is used as a substitute, ensuring that the trained object detection model can predict features at occluded locations, thus improving the generalization ability of the object detection model.
[0086] The following combination Figure 5 This application describes the complete process of constructing the target detection model provided in its embodiments, such as... Figure 5 As shown: S501. Obtain point cloud data of the input scene.
[0087] The input scene refers to a scene containing the object to be detected, and the electronic device acquires point cloud data through sensors such as LiDAR.
[0088] S502. Perform voxelization on the point cloud data.
[0089] The method for voxelization is described in the above embodiments and will not be repeated here.
[0090] S503, Estimate the original point cloud density in voxel space.
[0091] The method for estimating the original point cloud density in voxel space is the same as the method for calculating the density value in the above embodiments. For details, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0092] S504. Mask the voxel token.
[0093] After obtaining the density value through the above calculation, feature extraction is performed on the point cloud data in the voxel space. Geometric and statistical features are extracted to construct the voxel tokens corresponding to the voxel space.
[0094] S505, Input Sparse Encoder.
[0095] The sparse encoder is the initial encoder in the above embodiments.
[0096] S506, Input Sparse Decoder.
[0097] The sparse decoder is the initial decoder in the above embodiments.
[0098] S507, Input multilayer perceptron.
[0099] The multilayer perceptron is the initial multilayer perceptron in the above embodiments.
[0100] S508, the prediction results are obtained.
[0101] The model parameters of the sparse encoder, sparse decoder, and multilayer perceptron are adjusted according to the prediction results to obtain the target detection model.
[0102] Furthermore, during the model inference process, after the electronic device collects the point cloud data of the target object, it inputs the point cloud data into the target detection model, and the target detection model can output information such as the category, position, and pose of the target object.
[0103] Based on the same concept, embodiments of this application provide an apparatus for constructing a target detection model, such as... Figure 6 As shown, the device includes: The acquisition module 601 is used to acquire the voxel tensor of the object to be detected, wherein the voxel tensor is used to represent point cloud data in multiple voxel spaces. The calculation module 602 is used to calculate the density value of the point cloud in the voxel space based on the point cloud data in the voxel space for each voxel space. The generation module 603 is used to generate a mask corresponding to the voxel space based on the density values of the point cloud in the voxel space. Processing module 604 is used to perform masking processing on the voxel tensor using the mask to obtain a visible voxel tensor; The training module 605 is used to train the neural network model using the voxel tensor and the visible voxel tensor to obtain the target detection model.
[0104] In one possible implementation, the computing module 602 is specifically used for: Randomly select the i-th initial point cloud in the voxel space, where i≥1; In the voxel space, determine the i-th target point cloud that is closest to the i-th initial point cloud; Calculate the connection distance between the i-th target point cloud and the i-th initial point cloud; The i-th target point cloud is used as the (i+1)-th initial point cloud, and the (i+1)-th target point cloud that is closest to the (i+1)-th initial point cloud is determined in the voxel space. Calculate the connection distance between the (i+1)th target point cloud and the (i+1)th initial point cloud; When the set of the i-th initial point cloud, the i-th target point cloud, and the (i+1)-th target point cloud is all the point clouds in the voxel space, or when i=N, calculate the average value of the connection distance between the i-th target point cloud and the i-th initial point cloud to obtain the density value of the voxel space. Where N is a preset value.
[0105] In one possible implementation, the mask includes a first value or a second value; the generation module 603 is specifically used for: The density values are normalized or linearly mapped to obtain the mask probabilities corresponding to the voxel space. Generate random numbers using a random number generator; If the random number is greater than or equal to the mask probability, the mask corresponding to the voxel space is set to a first value; If the random number is less than the mask probability, the mask corresponding to the voxel space is set to the second value.
[0106] In one possible implementation, processing module 604 is specifically used for: The voxel space with the first mask value is masked to obtain the visible voxel tensor.
[0107] In one possible implementation, processing module 604 is specifically used for: For a voxel space with the mask set to the first value, the product of the point cloud data in the voxel space and the mask probability is calculated to obtain the visible voxel tensor.
[0108] In one possible implementation, the neural network model includes an initial encoder, an initial decoder, and the initial multilayer perceptron; the training module 605 is specifically used for: Input the voxel tensor into the initial encoder; The initial encoder extracts features from the voxel tensor using an attention mechanism to obtain an initial encoding vector. Input the initial encoding vector and the visible voxel tensor into the initial decoder; The visible voxel tensor is reconstructed using the initial decoder based on a cross-attention mechanism to obtain the reconstructed voxel tensor. The reconstructed voxel tensor is input into the initial multilayer perceptron to obtain the prediction result.
[0109] Calculate the loss function based on the prediction results and the voxel tensor; The target detection model is obtained by adjusting the model parameters of the initial encoder, the initial decoder, and the initial multilayer perceptron using the loss function.
[0110] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown.
[0111] An electronic device may include a processor 701 and a memory 702 storing computer program instructions.
[0112] Specifically, the processor 701 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention.
[0113] Memory 702 may include mass storage for data or instructions. For example, and not limitingly, memory 702 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 702 may include removable or non-removable (or fixed) media, or memory 702 may be a non-volatile solid-state memory. Memory 702 may be internal or external to an electronic device.
[0114] In one instance, memory 702 may be read-only memory (ROM). In one instance, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0115] Memory 702 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.
[0116] The processor 701 reads and executes computer program instructions stored in the memory 702 to achieve... Figure 1 The method for constructing the target detection model in the illustrated embodiment.
[0117] In one example, the electronic device may also include a communication interface 703 and a bus 704. Wherein, as... Figure 7 As shown, the processor 701, memory 702, and communication interface 703 are connected through bus 704 and complete communication with each other.
[0118] The communication interface 703 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of the present invention.
[0119] Bus 704 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 704 may include one or more buses. While specific buses are described and illustrated in embodiments of the invention, the invention contemplates any suitable bus or interconnect.
[0120] Furthermore, in conjunction with the target detection model construction method in the above embodiments, this invention can be implemented using a computer storage medium. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the target detection model construction methods in the above embodiments.
[0121] This application also provides a computer program product, including a computer program that, when executed by a processor, implements a method for constructing any of the target detection models described in the above embodiments.
[0122] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0123] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0124] It should also be noted that the exemplary embodiments mentioned in this invention describe methods or systems based on a series of steps or apparatus. However, this invention is not limited to the order of the steps described above; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0125] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0126] The above description is merely a specific embodiment of the present invention. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.
Claims
1. A method for constructing an object detection model, characterized in that, include: Obtain the voxel tensor of the object to be detected, wherein the voxel tensor is used to represent point cloud data in multiple voxel spaces; For each voxel space, the density value of the point cloud in the voxel space is calculated based on the point cloud data in the voxel space. Generate a mask corresponding to the voxel space based on the density values of the point cloud in the voxel space; The voxel tensor is masked using the mask to obtain the visible voxel tensor; The target detection model is obtained by training the neural network model using the voxel tensor and the visible voxel tensor.
2. The method according to claim 1, characterized in that, The step of calculating the density value of the point cloud in the voxel space based on the point cloud data in the voxel space includes: Randomly select the i-th initial point cloud in the voxel space, where i≥1; In the voxel space, determine the i-th target point cloud that is closest to the i-th initial point cloud; Calculate the connection distance between the i-th target point cloud and the i-th initial point cloud; The i-th target point cloud is used as the (i+1)-th initial point cloud, and the (i+1)-th target point cloud that is closest to the (i+1)-th initial point cloud is determined in the voxel space. Calculate the connection distance between the (i+1)th target point cloud and the (i+1)th initial point cloud; When the set of the i-th initial point cloud, the i-th target point cloud, and the (i+1)-th target point cloud is all the point clouds in the voxel space, or when i=N, calculate the average value of the connection distance between the i-th target point cloud and the i-th initial point cloud to obtain the density value of the voxel space. Where N is a preset value.
3. The method according to claim 1, characterized in that, The mask includes a first value or a second value; generating the mask corresponding to the voxel space based on the density values of the point cloud in the voxel space includes: The density values are normalized or linearly mapped to obtain the mask probabilities corresponding to the voxel space. Generate random numbers using a random number generator; If the random number is greater than or equal to the mask probability, the mask corresponding to the voxel space is set to a first value; If the random number is less than the mask probability, the mask corresponding to the voxel space is set to the second value.
4. The method according to claim 3, characterized in that, The step of masking the voxel tensor using the mask to obtain the visible voxel tensor includes: The voxel space with the first mask value is masked to obtain the visible voxel tensor.
5. The method according to claim 3, characterized in that, The step of masking the voxel tensor using the mask to obtain the visible voxel tensor includes: For a voxel space with the mask set to the first value, the product of the point cloud data in the voxel space and the mask probability is calculated to obtain the visible voxel tensor.
6. The method according to claim 1, characterized in that, The neural network model includes an initial encoder, an initial decoder, and an initial multilayer perceptron; The step of training a neural network model using the voxel tensor and the visible voxel tensor to obtain a target detection model includes: Input the voxel tensor into the initial encoder; The initial encoder extracts features from the voxel tensor using an attention mechanism to obtain an initial encoding vector. Input the initial encoding vector and the visible voxel tensor into the initial decoder; The visible voxel tensor is reconstructed using the initial decoder based on a cross-attention mechanism to obtain the reconstructed voxel tensor. The reconstructed voxel tensor is input into the initial multilayer perceptron to obtain the prediction result; Calculate the loss function based on the prediction results and the voxel tensor; The target detection model is obtained by adjusting the model parameters of the initial encoder, the initial decoder, and the initial multilayer perceptron using the loss function.
7. An apparatus for constructing a target detection model, characterized in that, include: The acquisition module is used to acquire the voxel tensor of the object to be detected, wherein the voxel tensor is used to represent point cloud data in multiple voxel spaces; The calculation module is used to calculate the density value of the point cloud in the voxel space based on the point cloud data in the voxel space for each voxel space. The generation module is used to generate a mask corresponding to the voxel space based on the density values of the point cloud in the voxel space. The processing module is used to perform masking processing on the voxel tensor using the mask to obtain the visible voxel tensor; The training module is used to train the neural network model using the voxel tensor and the visible voxel tensor to obtain the target detection model.
8. An electronic device, characterized in that, The electronic device includes: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the method for constructing a target detection model as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the method for constructing a target detection model as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, Includes a computer program, which, when executed, implements the method for constructing a target detection model as described in any one of claims 1 to 6.