A model training, three-dimensional target detection method, device, equipment and medium
By extracting features in the depth prediction model and training the 3D target detection model, the problem of low 3D target detection accuracy in monocular visual images is solved and high-precision 3D target detection is achieved.
Patent Information
- Application Number
- CN202110990742.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-26
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-08-26
AI Technical Summary
Existing 3D target detection solutions based on monocular vision images have low detection accuracy.
By obtaining the first feature extraction network for feature extraction in the depth prediction model, and determining the second feature extraction network in the 3D original detection model based on its network parameters, multiple sets of training are performed using the target annotation results of known 3D targets, Until the target loss function converges, a three-dimensional target detection model with depth perception capability is formed.
The accuracy of three-dimensional target detection in monocular visual images is improved, especially the accuracy of the position and orientation of the detection frame, and a three-dimensional target detection model with high detection accuracy is achieved.
Smart Images

Figure CN113705432B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of image processing technology, and in particular to a model training, three-dimensional target detection method, device, equipment and medium. Background Art
[0002] Three-dimensional (3D) object detection plays an important role in the autonomous driving system of unmanned vehicles / intelligent driving vehicles. It allows autonomous vehicles to accurately predict and plan their own behaviors and paths, thereby avoiding dangerous situations such as vehicle collisions or violations.
[0003] On this basis, since monocular cameras are easy to operate and inexpensive, 3D target detection based on monocular visual images captured by monocular cameras (i.e., monocular visual three-dimensional detection) is the first choice for economical autonomous driving systems.
[0004] In the process of implementing the present invention, the inventors discovered that the prior art has the following technical problems: the existing 3D target detection solution based on monocular vision images has low detection accuracy. Summary of the invention
[0005] Embodiments of the present invention provide a model training, three-dimensional target detection method, device, equipment and medium to achieve the effect of 3D target detection with high detection accuracy.
[0006] In a first aspect, an embodiment of the present invention provides a model training method, which may include:
[0007] When the depth prediction model training is completed, obtaining a first feature extraction network in the depth prediction model for extracting features from the monocular visual image, wherein a first training sample for training the depth prediction model includes the monocular visual image and the first depth image collected at the same viewing angle;
[0008] Determining network parameters of a second feature extraction network in the three-dimensional original detection model according to network parameters of the first feature extraction network, wherein the second feature extraction network is used to extract features from the monocular vision image;
[0009] The monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image are used as a group of second training samples, and the three-dimensional original detection model is trained based on the multiple groups of second training samples;
[0010] When the target loss function corresponding to the three-dimensional original detection model meets the convergence condition, the three-dimensional original detection model is determined as a three-dimensional target detection model, wherein the three-dimensional target detection model is used to detect a known three-dimensional target from a monocular visual image.
[0011] In a second aspect, an embodiment of the present invention further provides a three-dimensional target detection method, which may include:
[0012] Acquire an image to be detected acquired by a monocular vision acquisition device and a three-dimensional target detection model trained according to the method provided in any embodiment of the present invention;
[0013] The image to be detected is input into the three-dimensional object detection model, and the object detection result of the three-dimensional object to be detected in the image to be detected is obtained according to the output result of the three-dimensional object detection model.
[0014] In a third aspect, an embodiment of the present invention further provides a model training device, which may include:
[0015] A network acquisition module, used for acquiring a first feature extraction network for extracting features from a monocular visual image in the depth prediction model when the depth prediction model training is completed, wherein the first training sample for training the depth prediction model includes a monocular visual image and a first depth image collected at the same viewing angle;
[0016] A network parameter determination module, used to determine the network parameters of a second feature extraction network in the three-dimensional original detection model according to the network parameters of the first feature extraction network, wherein the second feature extraction network can be used to extract features from a monocular visual image;
[0017] A model training module, used for taking the monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image as a group of second training samples, and training the three-dimensional original detection model based on multiple groups of second training samples;
[0018] The model determination module is used to determine the three-dimensional original detection model as a three-dimensional target detection model when the target loss function corresponding to the three-dimensional original detection model meets the convergence condition, wherein the three-dimensional target detection model is used to detect a known three-dimensional target from a monocular visual image.
[0019] In a fourth aspect, an embodiment of the present invention further provides a three-dimensional object detection device, which may include:
[0020] A model acquisition module, used to acquire an image to be detected acquired by a monocular vision acquisition device and a three-dimensional target detection model trained according to the method provided in any embodiment of the present invention;
[0021] The target detection module is used to input the image to be detected into the three-dimensional target detection model, and obtain the target detection result of the three-dimensional target to be detected in the image to be detected according to the output result of the three-dimensional target detection model.
[0022] In a fifth aspect, an embodiment of the present invention further provides an electronic device, which may include:
[0023] one or more processors;
[0024] A memory for storing one or more programs;
[0025] When one or more programs are executed by one or more processors, the one or more processors implement the model training method or three-dimensional target detection method provided by any embodiment of the present invention.
[0026] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a model training method or a three-dimensional target detection method as provided in any embodiment of the present invention.
[0027] The technical solution of the embodiment of the present invention is that for the depth prediction model obtained by training based on the monocular vision image and the first depth image collected at the same viewing angle, the first feature extraction network obtained therefrom for feature extraction of the monocular vision image has a certain depth perception ability, and thus the second feature extraction network for feature extraction of the monocular vision image in the three-dimensional original detection model determined according to the network parameters of the first feature extraction network also has a certain depth perception ability, that is, the three-dimensional original detection model also has a certain depth perception ability; furthermore, the monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image are used as a group of second training samples, and the three-dimensional original detection model is trained based on multiple groups of second training samples, thereby, when the target loss function corresponding to the three-dimensional original detection model satisfies the convergence condition, the three-dimensional target detection model determined according to the three-dimensional original detection model also has a certain depth perception ability, which ensures the detection accuracy of the known three-dimensional target by accurately extracting the deep-level depth information in the monocular vision image. The above technical solution, when training a three-dimensional target detection model with monocular visual images as input data, transfers the depth prior knowledge to the three-dimensional original detection model based on the idea of cross-modal transfer learning, and improves the detection accuracy of the position and orientation of the three-dimensional detection box by supplementing the depth information, thereby achieving the effect of training a three-dimensional target detection model with high detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a flow chart of a model training method in Embodiment 1 of the present invention;
[0029] Figure 2 is a flow chart of a model training method in Embodiment 2 of the present invention;
[0030] Figure 3a It is a first schematic diagram of an optional example of a model training method in Embodiment 2 of the present invention;
[0031] Figure 3b is a second schematic diagram of an optional example of a model training method in Embodiment 2 of the present invention;
[0032] Figure 4 is a flow chart of a three-dimensional target detection method in Embodiment 3 of the present invention;
[0033] Figure 5 is a structural block diagram of a model training device in Embodiment 4 of the present invention;
[0034] Figure 6 is a structural block diagram of a three-dimensional object detection device in Embodiment 5 of the present invention;
[0035] Figure 7 It is a structural schematic diagram of an electronic device in Embodiment 6 of the present invention. DETAILED DESCRIPTION
[0036] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It is also necessary to explain that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0037] Embodiment 1
[0038] Figure 1 : is a flow chart of a model training method provided in Embodiment 1 of the present invention. This embodiment can be applied to the case where a 3D target detection model for accurate 3D target detection is obtained through training. The method can be executed by a model training device provided in an embodiment of the present invention, which can be implemented by software and / or hardware, and can be integrated in electronic devices, such as various user terminals or servers.
[0039] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:
[0040] S110. When the depth prediction model training is completed, obtain a first feature extraction network in the depth prediction model for extracting features from a monocular visual image, wherein a first training sample for training the depth prediction model includes a monocular visual image and a first depth image collected at the same viewing angle.
[0041] Among them, the monocular vision image (Monocular Vision Image) can be an image acquired by using a monocular vision acquisition device such as a monocular camera, a monocular video camera, etc.; the first depth image (Depth Map) can be an image directly acquired at the same visual angle (i.e., viewing angle) as the monocular vision image, or it can be an image estimated based on the monocular vision image and 3D point cloud data acquired at the same viewing angle, and no specific limitation is made here. In practical applications, optionally, the monocular vision image and the first depth image can be used as a group of first training samples, and the depth prediction model to be trained can be trained based on multiple groups of first training samples to obtain a trained depth prediction model, wherein the monocular vision image and the first depth image can be understood as multimodal data.
[0042] On this basis, the depth prediction model can be a machine learning model that has been trained to predict the first depth image based on the monocular visual image, which may include a first feature extraction network for extracting features from the monocular visual image, so as to extract high-level semantic information from the monocular visual image according to the first feature extraction network. Thus, a first feature extraction network with certain depth perception capabilities can be obtained from the trained depth prediction model.
[0043] S120. Determine network parameters of a second feature extraction network in the three-dimensional original detection model according to the network parameters of the first feature extraction network, wherein the second feature extraction network is used to extract features from the monocular vision image.
[0044] Among them, the three-dimensional original detection model may include a second feature extraction network for extracting features from the monocular visual image, and its network parameters may be determined according to the network parameters of the first feature extraction network. For example, the network parameters of the second feature extraction network are initialized based on the network parameters of the first feature extraction network. Because the first feature extraction network has a certain depth perception capability, the second feature extraction network obtained after initialization by it also has a certain depth perception capability, which can be used to extract deep depth information in the monocular visual image. This is an idea of transfer learning.
[0045] S130, using the monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image as a group of second training samples, and training the three-dimensional original detection model based on multiple groups of second training samples.
[0046] Wherein, the target annotation result of the known three-dimensional target may be included in the monocular vision image, and the target annotation result may include the target category (class) of the known three-dimensional target, and the location (location) and orientation (orientation) of the three-dimensional detection box (3D bounding box) that frames the known three-dimensional target. The monocular vision image and the target annotation result are used as a set of second training samples. The three-dimensional original detection model can be a machine learning model to be trained for detecting the target annotation result of the known three-dimensional target therein according to the monocular vision image, thereby the three-dimensional original detection model can be trained based on multiple sets of second training samples.
[0047] S140. When the target loss function corresponding to the three-dimensional original detection model satisfies the convergence condition, the three-dimensional original detection model is determined as a three-dimensional target detection model, wherein the three-dimensional target detection model is used to detect a known three-dimensional target from a monocular visual image.
[0048] Among them, when the target loss function corresponding to the 3D original detection model meets the convergence condition, that is, when the 3D original detection model training is completed, such a 3D original detection model can be used as a 3D target detection model. It should be noted that since the first feature extraction network has a certain depth perception ability, this means that the 3D original detection model also has a certain depth perception ability, then the 3D target detection model trained thereby can better detect the position (especially the depth) and orientation of the 3D detection frame that frames the known 3D target in the monocular vision image, thereby improving the detection accuracy of the known 3D target.
[0049] The technical solution of the embodiment of the present invention is that for the depth prediction model obtained by training based on the monocular vision image and the first depth image collected at the same viewing angle, the first feature extraction network obtained therefrom for feature extraction of the monocular vision image has a certain depth perception ability, and thus the second feature extraction network for feature extraction of the monocular vision image in the three-dimensional original detection model determined according to the network parameters of the first feature extraction network also has a certain depth perception ability, that is, the three-dimensional original detection model also has a certain depth perception ability; furthermore, the monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image are used as a group of second training samples, and the three-dimensional original detection model is trained based on multiple groups of second training samples, thereby, when the target loss function corresponding to the three-dimensional original detection model satisfies the convergence condition, the three-dimensional target detection model determined according to the three-dimensional original detection model also has a certain depth perception ability, which ensures the detection accuracy of the known three-dimensional target by accurately extracting the deep-level depth information in the monocular vision image. The above technical solution, when training a three-dimensional target detection model with monocular visual images as input data, transfers the depth prior knowledge to the three-dimensional original detection model based on the idea of cross-modal transfer learning, and improves the detection accuracy of the position and orientation of the three-dimensional detection box by supplementing the depth information, thereby achieving the effect of training a three-dimensional target detection model with high detection accuracy.
[0050] An optional technical solution, for each group of second training samples, training the three-dimensional original detection model based on multiple groups of second training samples, can include: inputting a monocular visual image into the three-dimensional original detection model, and obtaining the target detection result of the known three-dimensional target according to the output result of the three-dimensional original detection model; adjusting the network parameters of the second network to be trained in the three-dimensional original detection model according to the target detection result and the target labeling result, wherein the second network to be trained is a network other than the second feature extraction network. Wherein, the target detection result is the actual detection result of the three-dimensional original detection model for the known three-dimensional target during the training of the three-dimensional original detection model. Since the second feature extraction network can be understood as the first feature extraction network that has been trained and does not need to be trained again, when adjusting the network parameters in the three-dimensional original detection model according to the target detection result and the target labeling result, the network parameters in the second network to be trained that is not the second feature extraction network with network parameters can be adjusted, that is, there is no need to adjust the network parameters in the second feature extraction network, thereby better maintaining the depth perception ability of the second feature extraction network.
[0051] Embodiment 2
[0052] Figure 2It is a flow chart of a model training method provided in the second embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, for each group of first training samples, before the depth prediction model training is completed, the above-mentioned model training method may also include: inputting the monocular vision image into the first feature extraction network to obtain a first feature map; performing depth prediction on the first feature map to obtain a second depth image; and adjusting the network parameters of the first feature extraction network in the untrained depth prediction model according to the first depth image and the second depth image. Among them, the explanations of the terms that are the same as or corresponding to the above-mentioned embodiments are not repeated here.
[0053] See also Figure 2 The method of this embodiment may specifically include the following steps:
[0054] S210, obtaining an untrained depth prediction model, and a monocular visual image and a first depth image collected at the same viewing angle, and using the monocular visual image and the first depth image as a group of first training samples, wherein the depth prediction model includes an untrained first feature extraction network for extracting features from the monocular visual image.
[0055] Among them, the depth prediction model at this time can be an untrained machine learning model for depth prediction, and accordingly, the first feature extraction network at this time is the network for feature extraction in the depth prediction model.
[0056] S220: For each group of first training samples, input the monocular visual image into a first feature extraction network to obtain a first feature map, and perform depth prediction on the first feature map to obtain a second depth image.
[0057] The second depth image is the actual prediction result of the depth prediction model on the monocular vision image. In practical applications, optionally, in the process of depth prediction, in order to ensure prediction accuracy and reduce prediction complexity, the first feature map can be deconvolved and dimensioned.
[0058] S230: Adjust network parameters of a first feature extraction network in a depth prediction model according to the first depth image and the second depth image.
[0059] Among them, the first depth image is the expected output result, and the second depth image is the actual output result. Therefore, the network parameters of the first feature extraction network in the depth prediction model can be adjusted according to the two, so that the depth prediction model can predict the second depth image as close to the first depth image as possible.
[0060] S240. When the depth prediction model training is completed, obtain a first feature extraction network in the depth prediction model, and determine network parameters of a second feature extraction network in the three-dimensional original detection model according to the network parameters of the first feature extraction network, wherein the second feature extraction network is used to extract features from the monocular visual image.
[0061] The depth prediction model at this time may be a trained machine learning model for depth prediction.
[0062] S250, using the monocular vision image and the target annotation results of the known three-dimensional targets in the monocular vision image as a group of second training samples, and training the three-dimensional original detection model based on multiple groups of second training samples.
[0063] S260. When the target loss function corresponding to the three-dimensional original detection model satisfies the convergence condition, the three-dimensional original detection model is determined as a three-dimensional target detection model, wherein the three-dimensional target detection model is used to detect a known three-dimensional target from a monocular visual image.
[0064] The technical solution of the embodiment of the present invention obtains a first feature map by inputting a monocular vision image into a first feature extraction network; performs depth prediction on the first feature map to obtain a second depth image; and then adjusts the network parameters of the first feature extraction network in the depth prediction model according to the first depth image and the second depth image, thereby achieving the effect of effective training of the depth prediction model.
[0065] On this basis, an optional technical solution, which performs depth prediction on the first feature map to obtain a second depth image, may include: cropping a first feature map of interest from the first feature map, and performing depth prediction on the first feature map of interest to obtain a second image of interest; adjusting network parameters of a first feature extraction network in an untrained depth prediction model according to the first depth image and the second depth image, may include: cropping the first depth image according to the relative position of the first feature map of interest in the first feature map to obtain a first image of interest; adjusting network parameters of the first feature extraction network in the untrained depth prediction model according to the first image of interest and the second image of interest.
[0066] Among them, the first region of interest (ROI) feature map can be a part of the first feature map with significant features (i.e., interesting), and its number can be one, two, or more, which is not specifically limited here. Depth prediction is performed on each first feature map of interest to obtain a second image of interest that can represent the depth information in the corresponding first feature map of interest. Since the first feature map of interest is a part of the first feature map, the depth information at this time can be called local depth information. Further, for each first feature map of interest, the first depth image is cropped according to the relative position of the first feature map of interest in the first feature map to obtain a first image of interest corresponding to the second image of interest in the plane position, thereby adjusting the network parameters in the depth prediction model according to the first image of interest and the second image of interest. In the above technical solution, the training process of the depth prediction model is based on local depth information. Compared with the global depth information (i.e., the depth information of the entire first feature map), the amount of calculation in the model training process is smaller, thereby improving the model training speed; and because the local depth information is mostly the depth information of the known three-dimensional target in the first feature map, compared with the application of global depth information, this can improve the prediction accuracy in the model training process.
[0067] On this basis, an optional technical solution is that the three-dimensional original detection model can also include a third feature extraction network for extracting features from a monocular visual image. On this basis, for each group of second training samples, the three-dimensional original detection model is trained based on multiple groups of second training samples, which can include: inputting the monocular visual image into the second feature extraction network to obtain a second feature map, and inputting the monocular visual image into the third feature extraction network to obtain a third feature map; cropping a third feature map of interest from the third feature map; cropping the second feature map according to the relative position of the third feature map of interest in the third feature map to obtain a second feature map of interest; and adjusting the network parameters of the first network to be trained in the three-dimensional original detection model according to the second feature map of interest and the third feature map of interest.
[0068] Among them, compared with the second feature map with a certain depth perception ability, the third feature map can better reflect the visual features in the monocular visual image, so the third feature map of interest of ROI can be cropped from the third feature map, and then the second feature map can be cropped according to the relative position of the third feature map of interest in the third feature map to obtain the second feature map of interest; then, according to the second feature map of interest and the third feature map of interest corresponding to the plane position, the network parameters of the first network to be trained in the three-dimensional original detection model can be adjusted, wherein the first network to be trained can be a network to be trained with network parameters in the three-dimensional original detection model, which can be the same or different from the second network to be trained in the above text, and no specific limitation is made here. The above technical scheme, based on the training process of the three-dimensional original detection model based on local visual features, has a smaller amount of calculation in the model training process than the global visual features (i.e., the visual features of the entire monocular visual image), thereby improving the model training speed; and, because the local visual features are mostly the visual features of the known three-dimensional targets in the first feature map, compared with the application of global visual features, this can improve the detection accuracy in the model training process. In addition, the cooperation between the third feature extraction network with better visual feature extraction capability and the second feature extraction network with better deep-level depth information extraction capability due to its certain depth perception capability effectively ensures the inspection accuracy of the three-dimensional target detection model.
[0069] On this basis, an optional technical solution is that after obtaining the first feature map, the above-mentioned model training method may also include: upsampling the first feature map to obtain a first upsampling result consistent with the size of the monocular vision image, and updating the first feature map according to the first upsampling result; after obtaining the second feature map, the above-mentioned model training method may also include: upsampling the second feature map to obtain a second upsampling result consistent with the size of the monocular vision image, and updating the second feature map according to the second upsampling result; after obtaining the third feature map, the above-mentioned model training method may also include: upsampling the third feature map to obtain a third upsampling result consistent with the size of the monocular vision image, and updating the third feature map according to the third upsampling result. Among them, the size of the feature map obtained after feature extraction of the monocular vision image is smaller than the size of the monocular vision image. In order to ensure that the subsequent calculation process of the loss function (such as calculating the loss function according to the first image of interest and the second image of interest, and / or according to the second feature map of interest and the third feature map of interest, etc.) is targeted, the feature map (such as the first feature map, the second feature map or the third feature map) can be upsampled to obtain an upsampling result that is consistent in size with the monocular vision image, thereby better ensuring the accuracy of the model training process.
[0070] In order to better understand the specific implementation process of the above steps, the model training method of this embodiment is exemplarily described below with reference to specific examples. Figure 3a and Figure 3b ,in, Figure 3a On the left is the training process of the deep prediction model (which can also be called the deep auxiliary network model). Figure 3a On the right is the training and testing process of the 3D raw detection model; Figure 3b This is a schematic diagram of the training and testing of cross-modal transfer. Figure 3a The sub-network pre-training process (Sub Net Pre-training Outlines) shown on the left is introduced. The input data in the training process is multi-modal data (i.e., monocular visual image and first image of interest). Specifically, the depth prediction model can include the following network structure:
[0071] Backbone 1 (first feature extraction network): The backbone network in the feature extraction process, mainly used to extract high-level semantic information from the monocular visual image. That is, the monocular visual image is input into Backbone 1 to obtain the first feature map.
[0072] RPN&ROI pooling: RPN is the abbreviation of regional proposal network, which can be used to extract the first feature map of interest from the first feature map; ROI pooling is a network for size change, which can upsample the first feature map of interest to obtain a first feature map of interest with the same size as the monocular vision image (and the first depth image). That is, the first feature map is input into RPN&ROI pooling to obtain the first feature map of interest.
[0073] Deconvolution layers: A network used to perform deconvolution and dimensionality raising processing on the first feature map of interest to predict the second image of interest corresponding to the first feature map of interest. That is, the first feature map of interest is input into the Deconvolution layers to obtain the second image of interest. It should be noted that since the number of first feature maps of interest can be one, two or more, optionally, the weights in each Deconvolution layer can be the same (share weights) or different, that is, the process of local depth prediction for each first feature map of interest can be the same or different, which is not specifically limited here.
[0074] L2 loss: A network that calculates the loss function based on the L2 norm, which is used to calculate the loss function for the second image of interest and the first image of interest output by ROIExtract. That is, both are input into L2loss, and the network parameters in Backbone 1 are adjusted according to the calculation results output by L2 loss.
[0075] Dense Depth Map: The first depth image estimated based on the monocular vision image and the 3D point cloud data collected from the same perspective.
[0076] ROI Extract: It is a network used to crop the first depth image according to the relative position of the first feature map of interest in the first feature map. That is, the first depth image is input into ROI Extract to obtain the first image of interest.
[0077] Next, Figure 3a The main training and testing process (Main Training & Testing Outlines) shown on the right is introduced. The input data in the training process includes monocular visual images and target annotation results. Specifically, the 3D original detection model can include the following network structure:
[0078] Backbone1 (second feature extraction network, i.e. the trained first feature extraction network): Based on the idea of transfer learning, the network parameters in the trained first feature extraction network are initialized with the network parameters in the second feature extraction network to extract deep-level depth information in the monocular visual image. That is, the monocular visual image is input into Backbone1 to obtain the second feature map.
[0079] Backbone2 (third feature extraction network): used to extract visual features from monocular visual images. Backbone1 and Backbone2 can use the same network structure. That is, the monocular visual image is input into Backbone2 to obtain the third feature map.
[0080] RPN&ROI pooling: Backbone1 and Backbone2 can share a RPN and ROI pooling process, with Backbone2 as the main one. For each third feature map of interest extracted from the third feature map output by Backbone2, the second feature map is cropped according to its relative position in the third feature map. That is, the second feature map and the third feature map are input into RPN&ROI pooling to obtain the third feature map of interest and the second feature map of interest corresponding to the third feature map of interest.
[0081] Feature Extraction1 & Feature Extraction2: Extract features from the feature maps of interest generated by the two lines, concatenate the feature embedding results, and then perform prediction and regression on the concatenated results to obtain the target prediction results. That is, the second feature map of interest is input into Feature Extraction1 for feature extraction, and the third feature map of interest is input into Feature Extraction2 for feature extraction.
[0082] Back propagation: After the loss function is calculated according to the target prediction result and the target labeling result, it is used to perform back propagation based on the calculation result, and adjust the network parameters in the second network to be trained (such as Feature Extraction1, FeatureExtraction2, Backbone2, etc.), that is, the network parameters in Backbone1 are not adjusted. It should be noted that the loss function calculation network used to implement the loss function calculation can be set in the three-dimensional original detection model, and can also be set outside the three-dimensional original detection model, which is not specifically limited here.
[0083] The 3D target detection model trained based on the above steps can be Figure 3a The trained 3D original detection model on the right side is shown in Figure 1. Therefore, when testing and applying the 3D object detection model, only single-modal data (i.e., monocular vision image) can be used as input data, such as Figure 3b That is, since the local depth information has been transferred to the 3D target detection model, there is no need to use the depth image as input data during the testing and application phases of the model, thereby simplifying the data processing process and speeding up the target detection process.
[0084] Embodiment 3
[0085] Figure 4 It is a flow chart of a three-dimensional target detection method provided in the third embodiment of the present invention. This embodiment is applicable to the case where a three-dimensional target (i.e., a three-dimensional target to be detected) is detected with high precision from a monocular visual image. The method can be executed by a three-dimensional target detection device provided in an embodiment of the present invention, which can be implemented by software and / or hardware, and the device can be integrated in an electronic device, which can be various user terminals or servers.
[0086] See also Figure 4 The method of the embodiment of the present invention specifically includes the following steps:
[0087] S310, obtaining an image to be detected acquired by a monocular vision acquisition device and a three-dimensional target detection model trained according to the method provided in any embodiment of the present invention.
[0088] The image to be detected may be a monocular visual image from which a three-dimensional target is to be detected.
[0089] S320: Input the image to be detected into the three-dimensional object detection model, and obtain the object detection result of the three-dimensional object to be detected in the image to be detected according to the output result of the three-dimensional object detection model.
[0090] The technical solution of the embodiment of the present invention is to obtain an image to be detected acquired by a monocular vision acquisition device and a three-dimensional target detection model generated according to the method provided by any embodiment of the present invention; the image to be detected is input into the three-dimensional target detection model, and the target detection result of the three-dimensional target to be detected in the image to be detected is obtained according to the output result of the three-dimensional target detection model. The above technical solution achieves the effect of high-precision detection of the three-dimensional target to be detected in the image to be detected because the three-dimensional target detection model has a certain depth perception ability.
[0091] Embodiment 4
[0092] Figure 5 This is a structural block diagram of a model training device provided in Embodiment 4 of the present invention, and the device is used to execute the model training method provided in any of the above embodiments. The device and the model training method of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiment of the model training device can refer to the embodiment of the above model training method. Figure 5 The device may specifically include: a network acquisition module 410, a network parameter determination module 420, a model training module 430 and a model determination module 440.
[0093] Wherein, the network acquisition module 410 is used to obtain a first feature extraction network for extracting features from a monocular visual image in the depth prediction model when the depth prediction model training is completed, wherein the first training sample for training the depth prediction model includes a monocular visual image and a first depth image acquired at the same viewing angle;
[0094] A network parameter determination module 420, used to determine the network parameters of the second feature extraction network in the three-dimensional original detection model according to the network parameters of the first feature extraction network, wherein the second feature extraction network is used to extract features from the monocular vision image;
[0095] A model training module 430 is used to use the monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image as a group of second training samples, and train the three-dimensional original detection model based on multiple groups of second training samples;
[0096] The model determination module 440 is used to determine the three-dimensional original detection model as a three-dimensional target detection model when the target loss function corresponding to the three-dimensional original detection model meets the convergence condition, wherein the three-dimensional target detection model is used to detect a known three-dimensional target from a monocular visual image.
[0097] Optionally, for each group of first training samples, the model training device may further include:
[0098] A first feature map obtaining module is used to input the monocular visual image into a first feature extraction network to obtain a first feature map before the depth prediction model training is completed;
[0099] A second depth image obtaining module, used to perform depth prediction on the first feature map to obtain a second depth image;
[0100] The network parameter adjustment module is used to adjust the network parameters of the first feature extraction network in the untrained depth prediction model according to the first depth image and the second depth image.
[0101] On this basis, optionally, the second depth image obtaining module may include:
[0102] A second image of interest obtaining unit, used for cutting out a first feature map of interest from the first feature map, performing depth prediction on the first feature map of interest, and obtaining a second image of interest;
[0103] Accordingly, the network parameter adjustment module may include:
[0104] A first image of interest obtaining unit, configured to perform a cropping operation on the first depth image according to a relative position of the first feature map of interest in the first feature map, to obtain a first image of interest;
[0105] The first network parameter adjustment unit is used to adjust the network parameters of the first feature extraction network in the untrained depth prediction model according to the first image of interest and the second image of interest.
[0106] On this basis, optionally, the three-dimensional original detection model also includes a third feature extraction network for extracting features from the monocular vision image;
[0107] For each group of second training samples, the model training module 430 may include:
[0108] A third feature map obtaining unit is used to input the monocular vision image into the second feature extraction network to obtain a second feature map, and input the monocular vision image into the third feature extraction network to obtain a third feature map;
[0109] A third feature map of interest clipping unit, used for clipping a third feature map of interest from the third feature map;
[0110] A second feature map of interest obtaining unit is used to perform a cropping operation on the second feature map according to the relative position of the third feature map of interest in the third feature map to obtain a second feature map of interest;
[0111] The second network parameter adjustment unit is used to adjust the network parameters of the first network to be trained in the three-dimensional original detection model according to the second feature map of interest and the third feature map of interest.
[0112] On this basis, optionally, the above-mentioned model training device may further include:
[0113] A first feature map updating module is used to upsample the first feature map after obtaining the first feature map to obtain a first upsampling result consistent with the size of the monocular vision image, and update the first feature map according to the first upsampling result;
[0114] The above-mentioned model training module 430 may further include:
[0115] A second feature map updating unit is used to upsample the second feature map after obtaining the second feature map to obtain a second upsampling result consistent with the size of the monocular vision image, and update the second feature map according to the second upsampling result;
[0116] The third feature map updating unit is used to upsample the third feature map after obtaining the third feature map to obtain a third upsampling result consistent with the size of the monocular vision image, and update the third feature map according to the third upsampling result.
[0117] Optionally, for each group of second training samples, the model training module 430 may include:
[0118] The target detection result obtaining unit is used to input the monocular visual image into the three-dimensional original detection model, and obtain the target detection result of the known three-dimensional target according to the output result of the three-dimensional original detection model;
[0119] The third network parameter adjustment unit is used to adjust the network parameters of the second network to be trained in the three-dimensional original detection model according to the target detection result and the target labeling result, wherein the second network to be trained is a network other than the second feature extraction network.
[0120] The model training device provided in the fourth embodiment of the present invention is for a depth prediction model obtained by training based on a monocular vision image and a first depth image collected at the same viewing angle. The first feature extraction network obtained therefrom for feature extraction of the monocular vision image has a certain depth perception capability, and thus the second feature extraction network for feature extraction of the monocular vision image in the three-dimensional original detection model determined according to the network parameters of the first feature extraction network also has a certain depth perception capability, that is, the three-dimensional original detection model also has a certain depth perception capability; furthermore, the model training module and the model determination module cooperate with each other, the target annotation results of the monocular vision image and the known three-dimensional target in the monocular vision image are used as a group of second training samples, and the three-dimensional original detection model is trained based on multiple groups of second training samples, so that when the target loss function corresponding to the three-dimensional original detection model meets the convergence condition, the three-dimensional target detection model determined according to the three-dimensional original detection model also has a certain depth perception capability, which ensures the detection accuracy of the known three-dimensional target by accurately extracting the deep-level depth information in the monocular vision image. The above-mentioned device, when training a three-dimensional target detection model with a monocular visual image as input data, transfers the depth prior knowledge to the three-dimensional original detection model based on the idea of cross-modal transfer learning, and improves the detection accuracy of the position and orientation of the three-dimensional detection frame by supplementing the depth information, thereby achieving the effect of training a three-dimensional target detection model with higher detection accuracy.
[0121] The model training device provided in the embodiment of the present invention can execute the model training method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0122] It is worth noting that in the embodiment of the above-mentioned model training device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0123] Embodiment 5
[0124] Figure 6 This is a block diagram of the structure of a three-dimensional object detection device provided in Embodiment 5 of the present invention, and the device is used to execute the three-dimensional object detection method provided in any of the above embodiments. The device and the three-dimensional object detection method of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiments of the three-dimensional object detection device can refer to the embodiments of the above three-dimensional object detection method. Figure 6 As shown, the device may specifically include: a model acquisition module 510 and a target detection module 520.
[0125] The model acquisition module 510 is used to acquire the image to be detected acquired by the monocular vision acquisition device and the three-dimensional target detection model trained by the method provided by any embodiment of the present invention;
[0126] The target detection module 520 is used to input the image to be detected into the three-dimensional target detection model, and obtain the target detection result of the three-dimensional target to be detected in the image to be detected according to the output result of the three-dimensional target detection model.
[0127] The three-dimensional target detection device provided in the fifth embodiment of the present invention acquires the image to be detected acquired by the monocular vision acquisition device and the three-dimensional target detection model generated according to the method provided in any embodiment of the present invention through the model acquisition module; the image to be detected is input into the three-dimensional target detection model through the target detection module, and the target detection result of the three-dimensional target to be detected in the image to be detected is obtained according to the output result of the three-dimensional target detection model. The above device achieves the effect of high-precision detection of the three-dimensional target to be detected in the image to be detected because the three-dimensional target detection model has a certain depth perception ability.
[0128] The three-dimensional object detection device provided in the embodiment of the present invention can execute the three-dimensional object detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0129] It is worth noting that in the embodiment of the above-mentioned three-dimensional target detection device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0130] Embodiment 6
[0131] Figure 7 A schematic diagram of the structure of an electronic device provided in Embodiment 6 of the present invention is shown in FIG. Figure 7 As shown, the electronic device includes a memory 610, a processor 620, an input device 630, and an output device 640. The number of processors 620 in the electronic device can be one or more. Figure 7 A processor 620 is taken as an example; the memory 610, the processor 620, the input device 630 and the output device 640 in the electronic device can be connected via a bus or other means. Figure 7 The connection via bus 650 is taken as an example.
[0132] The memory 610, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the model training method in the embodiment of the present invention (for example, the network acquisition module 410, the network parameter determination module 420, the model training module 430 and the model determination module 440 in the model training device) or the program instructions / modules corresponding to the three-dimensional target detection method in the embodiment of the present invention (for example, the model acquisition module 510 and the target detection module 520 in the three-dimensional target detection device). The processor 620 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 610, that is, implements the above-mentioned model training method or three-dimensional target detection method.
[0133] The memory 610 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 610 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 610 may further include a memory remotely arranged relative to the processor 620, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0134] The input device 630 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 640 may include a display device such as a display screen.
[0135] Embodiment 7
[0136] Embodiment 7 of the present invention provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute a model training method when executed by a computer processor, the method comprising:
[0137] When the depth prediction model training is completed, obtaining a first feature extraction network in the depth prediction model for extracting features from the monocular visual image, wherein the first training sample for training the depth prediction model includes the monocular visual image and the first depth image collected at the same viewing angle;
[0138] Determining network parameters of a second feature extraction network in the three-dimensional original detection model according to network parameters of the first feature extraction network, wherein the second feature extraction network is used to extract features from the monocular vision image;
[0139] The monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image are used as a group of second training samples, and the three-dimensional original detection model is trained based on the multiple groups of second training samples;
[0140] When the target loss function corresponding to the three-dimensional original detection model meets the convergence condition, the three-dimensional original detection model is determined as a three-dimensional target detection model, wherein the three-dimensional target detection model is used to detect a known three-dimensional target from a monocular visual image.
[0141] Of course, the storage medium containing computer executable instructions provided in an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the model training method provided in any embodiment of the present invention.
[0142] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0143] Embodiment 8
[0144] Embodiment 8 of the present invention provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a three-dimensional object detection method when executed by a computer processor, the method comprising:
[0145] Acquire an image to be detected acquired by a monocular vision acquisition device and a three-dimensional target detection model trained according to the method provided in any embodiment of the present invention;
[0146] The image to be detected is input into the three-dimensional object detection model, and the object detection result of the three-dimensional object to be detected in the image to be detected is obtained according to the output result of the three-dimensional object detection model.
[0147] Of course, the storage medium containing computer executable instructions provided by an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the three-dimensional target detection method provided by any embodiment of the present invention.
[0148] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0149] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A model training method, characterized in that: include: When the depth prediction model training is completed, obtaining a first feature extraction network in the depth prediction model for extracting features from a monocular visual image, wherein a first training sample for training the depth prediction model includes the monocular visual image and a first depth image collected at the same viewing angle, and the first feature extraction network has depth perception capability; Determining network parameters of a second feature extraction network in the three-dimensional original detection model according to network parameters of the first feature extraction network, wherein the second feature extraction network is used to extract features from the monocular visual image, and the second feature extraction network has depth perception capability; Using the monocular vision image and the target annotation results of the known three-dimensional target in the monocular vision image as a group of second training samples, and training the three-dimensional original detection model based on multiple groups of the second training samples; When the target loss function corresponding to the three-dimensional original detection model satisfies the convergence condition, the three-dimensional original detection model is determined as a three-dimensional target detection model, wherein the three-dimensional target detection model is used to detect the known three-dimensional target from the monocular vision image.
2. The method according to claim 1, characterized in that: For each group of the first training samples, before the depth prediction model training is completed, the method further includes: Inputting the monocular visual image into the first feature extraction network to obtain a first feature map; Performing depth prediction on the first feature map to obtain a second depth image; According to the first depth image and the second depth image, network parameters of the first feature extraction network in the untrained depth prediction model are adjusted.
3. The method according to claim 2, characterized in that The performing depth prediction on the first feature map to obtain a second depth image includes: Cut out a first feature map of interest from the first feature map, and perform depth prediction on the first feature map of interest to obtain a second image of interest; The adjusting, according to the first depth image and the second depth image, network parameters of the first feature extraction network in the untrained depth prediction model includes: According to the relative position of the first feature map of interest in the first feature map, cropping the first depth image to obtain a first image of interest; According to the first image of interest and the second image of interest, network parameters of the first feature extraction network in the untrained depth prediction model are adjusted.
4. The method according to claim 3, characterized in that The three-dimensional original detection model also includes a third feature extraction network for extracting features from the monocular visual image. For each group of the second training samples, the three-dimensional original detection model is trained based on multiple groups of the second training samples, including: Inputting the monocular vision image into the second feature extraction network to obtain a second feature map, and inputting the monocular vision image into the third feature extraction network to obtain a third feature map; Cut out a third feature map of interest from the third feature map; According to the relative position of the third feature map of interest in the third feature map, a cropping operation is performed on the second feature map to obtain a second feature map of interest; According to the second feature map of interest and the third feature map of interest, network parameters of the first network to be trained in the three-dimensional original detection model are adjusted.
5. The method according to claim 4, characterized in that After obtaining the first feature map, the method further includes: Upsampling the first feature map to obtain a first upsampling result consistent with the size of the monocular visual image, and updating the first feature map according to the first upsampling result; After obtaining the second feature map, the method further includes: Upsampling the second feature map to obtain a second upsampling result consistent with the size of the monocular vision image, and updating the second feature map according to the second upsampling result; After obtaining the third characteristic map, the method further includes: The third feature map is upsampled to obtain a third upsampling result consistent with the size of the monocular vision image, and the third feature map is updated according to the third upsampling result.
6. The method according to claim 1, characterized in that For each group of the second training samples, the training of the three-dimensional original detection model based on the multiple groups of the second training samples includes: Inputting the monocular vision image into the three-dimensional original detection model, and obtaining the target detection result of the known three-dimensional target according to the output result of the three-dimensional original detection model; According to the target detection result and the target labeling result, network parameters of a second network to be trained in the three-dimensional original detection model are adjusted, wherein the second network to be trained includes a network other than the second feature extraction network.
7. A three-dimensional target detection method, characterized in that: include: Acquire an image to be detected acquired by a monocular vision acquisition device and a three-dimensional target detection model trained according to any one of claims 1 to 6; The image to be detected is input into the three-dimensional object detection model, and according to the output result of the three-dimensional object detection model, the object detection result of the three-dimensional object to be detected in the image to be detected is obtained.
8. A model training device, characterized in that: include: A network acquisition module, used for acquiring a first feature extraction network for extracting features from a monocular visual image in the depth prediction model when the depth prediction model training is completed, wherein a first training sample for training the depth prediction model includes the monocular visual image and the first depth image acquired at the same viewing angle, and the first feature extraction network has depth perception capability; A network parameter determination module, used to determine the network parameters of a second feature extraction network in the three-dimensional original detection model according to the network parameters of the first feature extraction network, wherein the second feature extraction network is used to extract features from the monocular visual image, and the second feature extraction network has depth perception capability; A model training module, used to use the monocular visual image and the target annotation results of the known three-dimensional targets in the monocular visual image as a group of second training samples, and train the three-dimensional original detection model based on multiple groups of the second training samples; A model determination module is used to determine the three-dimensional original detection model as a three-dimensional target detection model when the target loss function corresponding to the three-dimensional original detection model meets the convergence condition, wherein the three-dimensional target detection model is used to detect the known three-dimensional target from the monocular vision image.
9. A three-dimensional target detection device, characterized in that: include: A model acquisition module, used to acquire an image to be detected acquired by a monocular vision acquisition device and a three-dimensional target detection model trained according to any one of claims 1 to 6; The target detection module is used to input the image to be detected into the three-dimensional target detection model, and obtain the target detection result of the three-dimensional target to be detected in the image to be detected according to the output result of the three-dimensional target detection model.
10. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the model training method as described in any one of claims 1-6, or the three-dimensional target detection method as described in claim 7.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the model training method as described in any one of claims 1 to 6, or the three-dimensional target detection method as described in claim 7.
