Three-dimensional reconstruction model generation method, three-dimensional reconstruction method, device and related equipment
By acquiring and processing the pose information of multiple images and training the neural radiation field model, incremental three-dimensional reconstruction is achieved, which solves the problem of user difficulty in shooting in the existing technology and improves the efficiency and accuracy of three-dimensional reconstruction.
Patent Information
- Application Number
- CN202410214424.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-27
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-02-27
AI Technical Summary
Existing NeRF methods require users to collect all data at one time during 3D scene reconstruction and have high requirements on shooting trajectories, making shooting difficult for users.
By obtaining a collection of multiple images, the pose information and scale of each image are determined, and this information is used to train the neural radiation field model, generate a target model, achieve incremental three-dimensional reconstruction, and reduce the user's shooting difficulty.
There is no need to upload all data at once, which reduces the user's difficulty in shooting 3D scene reconstruction and improves the efficiency and accuracy of 3D reconstruction.
Smart Images

Figure CN117974904B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of three-dimensional scene reconstruction, and in particular to a three-dimensional reconstruction model generation method, a three-dimensional reconstruction method, a device and related equipment. Background Art
[0002] Neural Radiance Fields (NeRF) is an advanced technology that uses multilayer perceptrons (MLPs) to represent three-dimensional scenes in an implicit way. It maps the 3D position and direction of each point in the scene to density and radiance, and then synthesizes new views through volume rendering technology. This method has reached the state-of-the-art level in image visual quality and has attracted widespread attention in the fields of new view synthesis and three-dimensional scene reconstruction. The uniqueness of NeRF lies in its high-precision modeling of scenes, which can capture details such as lighting, reflections, and shadows to present realistic images in virtual environments. It has broad application potential in fields such as urban mapping, virtual reality, augmented reality, and robotics. Its high-quality image generation and accurate three-dimensional reconstruction provide innovative solutions for many applications and promote research and development in related fields.
[0003] However, when using NeRF-like methods to reconstruct 3D scenes, the existing technology requires users to collect all data at once and solve the poses of all images. In addition, the current NeRF method has very high requirements for shooting trajectories and generally only supports forward shooting and circular shooting. This method forces users to shoot the scene to be reconstructed in a specified shooting method at once, which makes it difficult for users to shoot. Summary of the invention
[0004] The embodiments of the present application provide a 3D reconstruction model generation method, a 3D reconstruction method, an apparatus and related equipment to solve the problem in the prior art that it is difficult for users to shoot when reconstructing a 3D scene.
[0005] To solve the above technical problems, this application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for generating a three-dimensional reconstruction model, comprising:
[0007] Acquire a first image set, where the first image set includes a plurality of first images, and the plurality of first images are images obtained by photographing a target scene;
[0008] Determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model, wherein the first pose set includes a plurality of first pose information corresponding one-to-one to the plurality of first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity;
[0009] Training a second model using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model;
[0010] The model structure and model parameters of the second model are the same as those of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene.
[0011] In a second aspect, an embodiment of the present application provides a three-dimensional reconstruction method, comprising:
[0012] Get the pose of the target scene;
[0013] Based on the pose of the target scene and the target model, a rendered image of the pose of the target scene is generated, wherein the target model is a model generated based on the three-dimensional reconstruction model generation method described in the first aspect above.
[0014] In a third aspect, an embodiment of the present application provides a three-dimensional reconstruction model generation device, comprising:
[0015] A first acquisition module is used to acquire a first image set, where the first image set includes a plurality of first images, and the plurality of first images are images obtained by photographing a target scene;
[0016] A determination module, used to determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model, wherein the first pose set includes a plurality of first pose information corresponding one-to-one to the plurality of first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity;
[0017] A first training module is used to train a second model using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model;
[0018] The model structure and model parameters of the second model are the same as those of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene.
[0019] In a fourth aspect, an embodiment of the present application provides a three-dimensional reconstruction device, including:
[0020] The third acquisition module is used to obtain the position and posture of the target scene;
[0021] A generation module is used to generate a rendered image of the pose of the target scene based on the pose of the target scene and a target model, wherein the target model is a model generated based on the three-dimensional reconstruction model generation method described in the first aspect above.
[0022] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the three-dimensional reconstruction model generation method as described in the first aspect are implemented; or, when the program is executed by the processor, the steps of the three-dimensional reconstruction method as described in the second aspect are implemented.
[0023] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the three-dimensional reconstruction model generation method as described in the first aspect above are implemented; or, when the computer program is executed by a processor, the steps of the three-dimensional reconstruction method as described in the second aspect above are implemented.
[0024] In the seventh aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the three-dimensional reconstruction model generation method as described in the first aspect above; or, when executed by a processor, implement the steps of the three-dimensional reconstruction method as described in the second aspect above.
[0025] In an embodiment of the present application, the above-mentioned three-dimensional reconstruction model generation method includes obtaining a first image set, the first image set includes multiple first images, and the multiple first images are images obtained by shooting the target scene; determining the first pose set of the first image set in the first base coordinate system and the first scale corresponding to the first model, wherein the first pose set includes multiple first pose information corresponding to the multiple first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity; using the first image set, the first pose set and the first model to render the first rendering image set on the preset multiple poses to train the second model to obtain the target model; wherein the model structure and model parameters of the second model are the same as the model structure and model parameters of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene. In this way, the first image set can be used to train the existing first model to obtain a new representation of the target scene, and then incremental three-dimensional reconstruction can be achieved for the same target scene, so that the user does not need to upload all the data at one time, thereby reducing the difficulty of shooting when the user performs three-dimensional scene reconstruction. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0027] Figure 1 This is one of the flow charts of a method for generating a three-dimensional reconstruction model provided in an embodiment of the present application;
[0028] Figure 2 This is the second flowchart of a method for generating a three-dimensional reconstruction model provided in an embodiment of the present application;
[0029] Figure 3 is a flow chart of a three-dimensional reconstruction method provided in an embodiment of the present application;
[0030] Figure 4 It is a structural schematic diagram of a three-dimensional reconstruction model generation device provided in an embodiment of the present application;
[0031] Figure 5 It is a structural schematic diagram of a three-dimensional reconstruction device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] In the embodiments of the present application, a 3D reconstruction model generation method, a 3D reconstruction method, an apparatus and related equipment are proposed to solve the problem in the prior art that it is difficult for users to shoot when reconstructing a 3D scene.
[0034] See also Figure 1 , Figure 1 is one of the flow charts of a method for generating a three-dimensional reconstruction model provided in an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0035] Step 101: Acquire a first image set, where the first image set includes a plurality of first images, and the plurality of first images are images obtained by photographing a target scene.
[0036] Specifically, the plurality of first images may be two-dimensional images obtained by the first user taking pictures of the target scene using an image capturing device. The target scene may be any three-dimensional scene, for example, a room, a building, an object, and the like.
[0037] Step 102: determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model, wherein the first pose set includes a plurality of first pose information corresponding one-to-one to the plurality of first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity.
[0038] It should be noted that the first model may be a neural radiation field for characterizing the target scene, the first base coordinate system and the first scale correspond to the first model, and the first base coordinate system may be a coordinate for describing all spatial points corresponding to the first model. The multiple first images correspond one-to-one to the multiple first pose information.
[0039] Step 103: training a second model using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model;
[0040] The model structure and model parameters of the second model are the same as those of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene.
[0041] Specifically, the preset multiple poses may be poses corresponding to the original training perspective of the first model, that is, using the first model to render images at the original training perspective to train the second model can prevent catastrophic forgetting. The target model may be a new representation of the target scene.
[0042] Specifically, the target model can be obtained by using the teacher-student distillation architecture, that is, the first model mentioned above is used as the teacher model, and the second model is used as the student model. The second model can directly copy the structure and parameters of the first model. During the training process, the second model is continuously optimized, and the model parameters of the second model during the training process will change. The target model obtained after the training is completed is the optimized second model. It should be noted that during the training process, the parameters of the first model are fixed.
[0043] In an embodiment of the present application, the above-mentioned three-dimensional reconstruction model generation method includes obtaining a first image set, the first image set includes multiple first images, and the multiple first images are images obtained by shooting the target scene; determining the first pose set of the first image set in the first base coordinate system and the first scale corresponding to the first model, wherein the first pose set includes multiple first pose information corresponding to the multiple first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity; using the first image set, the first pose set and the first model to render the first rendering image set on the preset multiple poses to train the second model to obtain the target model; wherein the model structure and model parameters of the second model are the same as the model structure and model parameters of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene. In this way, the first image set can be used to train the existing first model to obtain a new representation of the target scene, and then incremental three-dimensional reconstruction can be achieved for the same target scene, so that the user does not need to upload all the data at one time, thereby reducing the difficulty of shooting when the user performs three-dimensional scene reconstruction.
[0044] Optionally, before acquiring the first image set, the method further includes:
[0045] Acquire a second image set, where the second image set includes a plurality of second images, where the plurality of second images are images obtained by photographing the target scene, and the plurality of second images include training images in the training image set;
[0046] Solving the pose of the second image set to obtain a second pose set in the first base coordinate system and the first scale, wherein the second pose set includes a plurality of second pose information corresponding one-to-one to the plurality of second images, and the second pose information is used to characterize the pose of the entity in the corresponding second image in the target scene;
[0047] The initial model is trained using the training image set and the pose set corresponding to the training image set to obtain the first model, which is used to perform three-dimensional reconstruction of the target scene.
[0048] Specifically, the plurality of second images may be two-dimensional images obtained by a second user photographing a target scene through an image capturing device, and the first user and the second user may be the same user. Some of the plurality of second images may be used as training images in a training image set to train the first model. The plurality of second images correspond one-to-one to the plurality of second pose information.
[0049] Specifically, the pose solving of the second image set may be to use the colmap method on the second image set, and obtain the first camera model parameter K1 of the second user and the second pose set T1 of the image under the first base coordinate system B1 and the first scale Scale1 through steps such as feature extraction, feature matching, and pose solving. The initial model is trained using the training image set and the pose set corresponding to the training image set to obtain the first model, that is, the neural radiation field is trained using the partial pose set corresponding to the training image set in the second pose set, that is, the first model.
[0050] It can be understood that the base coordinate system of the first model and the base coordinate system of the second pose set are consistent, and the scale of the first model and the scale corresponding to the second pose set are also consistent.
[0051] In this embodiment, the above-mentioned three-dimensional reconstruction model generation method includes obtaining a second image set, the second image set includes multiple second images, the multiple second images are images obtained by photographing the target scene, the multiple second images include training images in a training image set, performing pose solving on the second image set to obtain a second pose set in the first base coordinate system and the first scale, the second pose set includes multiple second pose information corresponding one-to-one to the multiple second images, the second pose information is used to characterize the pose of the entity in the corresponding second image in the target scene, the initial model is trained using the training image set and the pose set corresponding to the training image set to obtain the first model, and the first model is used to perform three-dimensional reconstruction of the target scene, so that the first model can be obtained by performing pose solving on the second image set and training with the obtained pose set to characterize the target scene, without having to store the second image set, thereby reducing storage occupancy.
[0052] Optionally, determining a first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model includes:
[0053] Solving the poses of the second image set and the first image set to obtain a third pose set of the second image set in a second base coordinate system and a second scale, and a fourth pose set of the first image set in the second base coordinate system and the second scale, wherein the second scale is used to characterize the ratio of the second image to the corresponding entity, the third pose set includes a plurality of third pose information corresponding one-to-one to the plurality of second images, the third pose information is used to characterize the pose of the entity in the corresponding second image in the target scene, and the fourth pose set includes a plurality of fourth pose information corresponding one-to-one to the plurality of first images, the fourth pose information is used to characterize the pose of the entity in the corresponding first image in the target scene;
[0054] A first pose set of the first image set in a first base coordinate system and a first scale corresponding to a first model is determined according to the second pose set, the third pose set and the fourth pose set.
[0055] Specifically, the pose solving of the second image set and the first image set can obtain the pose sets of the second image set and the first image set in the same base coordinate system and the same scale, respectively. The relationship between the scale and the base coordinate system can be obtained based on the second pose set and the third pose set, so as to obtain the first pose set of the first image set in the first base coordinate system and the first scale.
[0056] Exemplarily, the pose solving of the second image set and the first image set is performed to obtain a third pose set of the second image set in the second base coordinate system and the second scale, and a fourth pose set of the first image set in the second base coordinate system and the second scale. The process of determining the first pose set of the first image set in the first base coordinate system and the first scale corresponding to the first model according to the second pose set, the third pose set, and the fourth pose set may be:
[0057] The colmap method is used to extract the feature points of the first image set and the feature points of the second image set and put them together for feature matching. In the process of posture solution, the first camera model parameter K1, the first base coordinate system B1 and the second pose set T1 of the image under the first scale Scale1 of the existing second image set are fixed, and the second camera model parameter K2, the first base coordinate system B and the first pose set T2 of the image under the first scale Scale1 corresponding to the first image set are solved. However, in the process of solving the above parameters, since the images taken by the user may have scale uncertainty, that is, the true scale of the object is unknown, so in the process of colmap solving the second camera model parameter K2, the first base coordinate system B1 and the first pose set T2 of the image under the first scale Scale1 corresponding to the first image set, in order to prevent the collapse caused by scale uncertainty, the scale and the base coordinate system will keep changing during the global BA process.
[0058] In short, after the above processing, the pose set of the second image set is and the pose set of the first image set Already in the same coordinate system, but because the scale and base coordinate system are constantly changing during the pose solution process, There is a Sim3 transformation matrix between the second pose set T1
[0059]
[0060] Among them, R is a 3*3 rotation matrix, α is the scale factor, and u is a 3*1 translation matrix.
[0061] After calculating the Sim3 transformation matrix, the first pose set T2 of the first image set in the first base coordinate system B1 and the first scale Scale1 can also be calculated:
[0062]
[0063] In this embodiment, the above-mentioned three-dimensional reconstruction model generation method includes solving the pose of the second image set and the first image set to obtain a third pose set of the second image set in the second base coordinate system and the second scale, and a fourth pose set of the first image set in the second base coordinate system and the second scale. According to the second pose set, the third pose set and the fourth pose set, the first pose set of the first image set in the first base coordinate system and the first scale corresponding to the first model is determined. The change relationship between the scale and the base coordinate system can be obtained according to the second pose set and the third pose set, and then the first pose set of the first image set in the first base coordinate system and the first scale can be obtained, so that the base coordinate system and scale of the first pose set are consistent with the first model, and then the first image set can be used to participate in model training, so that the pose of the image uploaded by the new user can be solved and aligned to the scale and base coordinate system of the current reconstructed scene.
[0064] Optionally, the plurality of second images further include a test image in a test image set, and after the initial model is trained using the training image set and the pose set corresponding to the training image set to obtain the first model, the method further includes:
[0065] Testing the first model using the test image set and the pose set corresponding to the test image set to obtain a first index value of the first model, the first index value comprising a first peak signal-to-noise ratio and a first structural similarity index, the first index value being used to characterize a rendering quality of the first model on the pose set corresponding to the test image set;
[0066] The method of training the second model by using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model includes:
[0067] Rendering on a pose set corresponding to a sample image set using the first model to obtain a second rendering image set, wherein the first image set includes the sample image set;
[0068] Determine a second index value according to the second rendering image set and the sample image set, where the second index value is used to characterize the rendering quality of the first model on the pose set corresponding to the sample image set, and the second index value includes a second peak signal-to-noise ratio and a second structural similarity index;
[0069] calculating the first peak signal-to-noise ratio and the second peak signal-to-noise ratio to obtain a first value, where when the first peak signal-to-noise ratio is greater than the second peak signal-to-noise ratio, the first value is 1, and when the first peak signal-to-noise ratio is less than or equal to the second peak signal-to-noise ratio, the first value is a ratio of the first peak signal-to-noise ratio to the second peak signal-to-noise ratio;
[0070] Calculating the first structural similarity index and the second structural similarity index to obtain a second value, where the second value is 1 when the first structural similarity index is greater than the second structural similarity index, and the second value is a ratio of the first structural similarity index to the second structural similarity index when the first structural similarity index is less than or equal to the second structural similarity index;
[0071] Calculating the first value and the second value to obtain a target value, where the target value is equal to the sum of the product of the first value and a first preset weight and the product of the second value and a second preset weight;
[0072] When the target value is less than a first preset value, the second model is trained using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model.
[0073] It can be understood that the above-mentioned test image set can be used to test the rendering quality of the first model. The above-mentioned first Peak Signal-to-Noise Ratio (PSNR) can be used as an indicator to measure the quality of an image or video, and can be used to evaluate the similarity between an original image and a compressed or processed image. The above-mentioned first structural similarity index (Structural Similarity Index Measure, SSIM) can be used to measure the similarity between two images and evaluate the similarity of images in brightness, contrast and structure. The above-mentioned sample image set can be a set consisting of some images selected from the first image set.
[0074] Specifically, the sum of the first preset weight and the second preset weight can be equal to 1, and can be set according to specific needs. For example, the first preset weight and the second preset weight can be 0.5. The first preset value can also be set according to specific needs. According to the test results of the laboratory, it can be determined that when the first preset value is 0.9, the technical effect of the training model is better.
[0075] Exemplarily, assuming that the first peak signal-to-noise ratio is PSNR_test, the first structural similarity index is SSIM_test, the second peak signal-to-noise ratio is PSNR, and the second structural similarity index is SSIM, the target value can be calculated using the following formula:
[0076] Score=0.5*trun(PSNR,PSNR_test)+0.5*trun(SSIM,SSIM_test)
[0077] Among them, the tr() function is defined as follows:
[0078]
[0079] Using the above formula, we can get a normalized score, that is, the full score is 1 and the lowest score is 0.
[0080] Assuming that the first preset value is 0.9, when the target value is greater than or equal to 0.9, it means that the newly uploaded first image set does not contain more information, and knowledge cannot be acquired from the newly uploaded images, so it is impossible to optimize the model through incremental methods to achieve better scene representation; if the target value is less than 0.9, it means that the newly uploaded images contain some new knowledge that has not been learned in the first model, and an incremental method is needed to learn this new knowledge.
[0081] In this embodiment, the above-mentioned three-dimensional reconstruction model generation method includes testing the first model using the test image set and the pose set corresponding to the test image set to obtain a first index value of the first model, the first index value includes a first peak signal-to-noise ratio and a first structural similarity index, and using the first model to render on the pose set corresponding to the sample image set to obtain a second rendering image set, the first image set includes the sample image set, according to the second rendering image set and the sample image set, determine a second index value, the second index value includes a second peak signal-to-noise ratio and a second structural similarity index, calculate the first index value and the second index value to obtain a target value, when the target value is less than a first preset value, use the first image set, the first pose set and the first rendering image set obtained by rendering the first model on a preset plurality of poses to train the second model to obtain a target model, so that by comparing the rendering quality of the first model on the pose set corresponding to the test image set and the rendering quality on the pose set corresponding to the sample image set, when the first image set includes new knowledge not learned in the first model, the target model can be obtained by training using the first image set, thereby reducing unnecessary model training, thereby improving the efficiency of model training.
[0082] Optionally, before using the first model to render on a pose set corresponding to the sample image set to obtain a second rendering image set, the method further includes:
[0083] Performing feature extraction on the first image set to obtain image features of each image in the first image set;
[0084] Perform n-times iterative screening on the first image set to obtain the sample image set, wherein the i-th iterative screening in the n-times iterative screening includes:
[0085] When i is equal to 1, the first image in the first image set is added to the sample image set to obtain a first intermediate sample image set, and the first image is deleted from the first image set to obtain a first intermediate image set, wherein the first image is any image in the first image set;
[0086] In the case that i is greater than 1, the second image in the i-1th intermediate image set is added to the i-1th intermediate sample image set to obtain the i-th intermediate sample image set, and the second image is deleted from the i-1th intermediate image set to obtain the i-th intermediate image set, wherein the second image is the image in the i-1th intermediate image set with the largest image difference value with the image in the i-1th intermediate sample image set;
[0087] The sample image set is the nth intermediate sample image set.
[0088] Specifically, the feature extraction of the first image set may be to use a pre-trained neural network Resnet50 to extract high-dimensional features of each image in the first image set. The first image set is screened n times by iteration, that is, n images are selected from the first image set to form the sample image set. The image difference value may be used to characterize the image feature difference and image posture difference between two images, which may be calculated by image features and posture.
[0089] In this embodiment, the above-mentioned three-dimensional reconstruction model generation method includes extracting features from the first image set to obtain image features of each image in the first image set, performing n-times iterative screening on the first image set to obtain the sample image set, wherein the i-th iterative screening in the n-times iterative screening includes: when i is equal to 1, adding the first image in the first image set to the sample image set to obtain the first intermediate sample image set, and deleting the first image from the first image set to obtain the first intermediate image set, and when i is greater than 1, adding the second image in the i-1th intermediate image set to the i-1th intermediate sample image set to obtain the i-1th intermediate sample image set. i intermediate sample image sets, and the second image is deleted from the i-1th intermediate image set to obtain the i-th intermediate image set, wherein the second image is the image in the i-1th intermediate image set with the largest image difference value with the images in the i-1th intermediate sample image set, and the sample image set is the nth intermediate sample image set, so that n images with large differences from each other can be selected from the first image set to form the sample image set, and then the sample image set can include representative images in the first image set, so that the accuracy of judgment can be improved while improving the efficiency of judging whether the first image set includes new knowledge not learned in the first model.
[0090] Optionally, the calculation formula of the image difference value is:
[0091]
[0092] Wherein, F is the image feature of the candidate image in the i-1th intermediate image set, and F i is the image feature of the i-th image in the i-1th intermediate sample image set, q is the quaternion corresponding to the pose of the candidate image, q i is the quaternion corresponding to the pose of the i-th image, t is the translation vector extracted from the pose of the candidate image, t i is the translation vector extracted from the pose of the i-th image, N sample is the number of images in the i-1th intermediate sample image set, λ1 is the third preset weight, λ2 is the fourth preset weight, λ3 is the fifth preset weight, and the candidate image is any image in the i-1th intermediate image set.
[0093] Exemplarily, the first image set is subjected to n iterative screening to obtain the sample image set, which may be:
[0094] Randomly select an image from the first image set and put it into the sample image set and remove the image from the first image set I2;
[0095] Traverse each remaining image in the first image set I2 and calculate the priority score priority_score. The specific formula is as follows:
[0096]
[0097] Where F is the image feature of the candidate image in the first image set I2, F i is a set of sample images The image feature of the i-th image in , q is the quaternion corresponding to the pose of the candidate image, q i is a set of sample images The quaternion corresponding to the pose of the i-th image in , t is the translation vector extracted from the pose of the candidate image, t i is a set of sample images The translation vector N extracted from the pose of the i-th image in sample is a set of sample images, , λ1 is the third preset weight, λ2 is the fourth preset weight, and λ3 is the fifth preset weight.
[0098] It should be noted that the first term in the above formula measures the difference in network extracted features, the second term measures the difference between angles, and the third term measures the difference between positions, so the greater the difference, the higher the score. Among them, the third preset weight λ1, the fourth preset weight λ2, and the fifth preset weight λ3 can be used to measure the contribution of each term in the above formula to priority_score, and the specific value can be determined based on a large number of tests.
[0099] Select the image with the highest priority_score and add it to the sample image collection The essence is to select the most distinctive pictures and add them to the sample image collection and delete the image from the first image set I2.
[0100] Repeat the above steps until the sample image collection There are n pictures in .
[0101] In this embodiment, the above-mentioned three-dimensional reconstruction model generation method can calculate the image difference values between each candidate image and all the images in the intermediate sample image set based on the image features of the candidate images in the intermediate image set and the images in the intermediate sample image set, as well as the quaternions and translation vectors corresponding to the postures, and then more accurately determine the degree of difference between the images, thereby improving the accuracy of selecting n images with large differences from each other in the first image set.
[0102] Optionally, the training of the second model using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model includes:
[0103] Randomly extracting a first preset number of images from a first set to be trained to obtain a second set to be trained, wherein the first set to be trained includes the first image set and the first rendering;
[0104] Using the first model and the second model to render on a fifth pose set corresponding to the second set to be trained, respectively, to obtain a third rendering image set and a fourth rendering image set, wherein the fifth pose set includes the first pose set and the plurality of preset poses;
[0105] Sequentially obtain a first rendering image and a second rendering image of the same posture in the fifth posture set from the third rendering image set and the fourth rendering image set respectively;
[0106] Determining color differences of all light rays between the first rendering and the second rendering;
[0107] Add the N first light rays with larger color differences to the first light set until all renderings corresponding to the third rendering set and the fourth rendering set in the fifth pose set are traversed, where N is an integer greater than 0;
[0108] When the number of light rays in the first light set is greater than a third preset value, deleting N first light rays with higher peak signal-to-noise ratios in the first light set;
[0109] Randomly extracting a second preset number of second light rays from the images in the second to-be-trained set to obtain a second light set;
[0110] The second model is trained a preset number of times using the first light set and the second light set.
[0111] Specifically, the first preset number can be set according to specific needs. The third rendering image set can be a set of images rendered by the first model at the pose in the fifth pose set, and the fourth rendering image set can be a set of images rendered by the second model at the pose in the fifth pose set.
[0112] Exemplarily, the first preset number of images are randomly selected from the first set to be trained to obtain the second set to be trained, and the first set to be trained includes the first image set and the first rendering image, which may be:
[0113] At the beginning of training, use the first model as the teacher model I tea Render some images at the original training perspective, i.e., multiple preset poses, i.e., the first rendering image set I tea , and then together with the first image set I2 form the first to-be-trained set Set = {I tea , I2}, each time randomly extracting a first preset number of images, such as 100 images, from the first set to be trained Set to form a second set to be trained Train_Set, which is used to train the second model, i.e., the student model M stu .
[0114] The above-mentioned method uses the first model and the second model to render on the fifth pose set corresponding to the second set to be trained, respectively, to obtain a third rendering image set and a fourth rendering image set; sequentially obtains the first rendering image and the second rendering image of the same pose in the fifth pose set of the third rendering image set and the fourth rendering image set; determines the color difference of all lights between the first rendering image and the second rendering image; and adds the N first lights with larger color differences to the first light set, which can be:
[0115] Maintain a new first ray set Set during training ray , assuming that the first ray set Set ray The maximum length of is 2000, which can be used to store up to 2000 rays that have not been learned.
[0116] The specific operation is as follows: During the training process, select the light with the larger light difference (rgb_loss) and store it in the first light set, which can be specifically expressed by the following equation:
[0117] Important_Rays=f ir (RGB tea ,RGB stu ,N ir )
[0118] Among them, f irIndicates the criteria for selecting important rays, according to the teacher model M tea and Student Model M stu The difference (loss) of the final color of the rendered light is selected as N ir The first ray of light.
[0119] In the case where the number of light rays in the first light set is greater than the third preset value, the process of deleting N first light rays with higher peak signal-to-noise ratios in the first light set may be:
[0120] In selecting N ir After the first ray, if Set ray N ir rays, then directly change N ir Add the line to the set, otherwise first add Set ray The rays in Set are sorted from low to high according to the peak signal-to-noise ratio PSNR. ray Middle and back N ir The line is replaced by the newly selected N ir A ray of light.
[0121] The process of randomly extracting a second preset number of second light rays from the images in the second set to be trained to obtain a second light set, and training the second model a preset number of times using the first light set and the second light set may be:
[0122] Train the student model M stu , 8000 rays and Set are randomly selected from Train_Set ray All the rays in are combined and shuffled together to train the student model M stu .
[0123] It should be noted that after each 100 generations of training, 100 pictures can be randomly selected from the first training set Set to form Train_Set, and Set ray to update.
[0124] In this embodiment, the above-mentioned three-dimensional reconstruction model generation method includes randomly extracting a first preset number of images from a first set to be trained to obtain a second set to be trained, the first set to be trained includes the first image set and the first rendering image, and using the first model and the second model to render on the fifth pose set corresponding to the second set to be trained to obtain a third rendering image set and a fourth rendering image set; sequentially obtaining the first rendering image and the second rendering image of the third rendering image set and the fourth rendering image set in the same pose in the fifth pose set; adding N first light rays with a large color difference between the first rendering image and the second rendering image to the first light set; when the number of light rays in the first light set is greater than a third preset value, deleting N first light rays with a high peak signal-to-noise ratio in the first light set; randomly extracting a second preset number of second light rays from the images in the second set to be trained to obtain a second light set; and using the first light set and the second light set to train the second model for a preset number of times, so that important knowledge can be marked in the process of training the second model, so that the second model can learn more focusedly, thereby further improving the accuracy and efficiency of model training.
[0125] Optionally, after adding the N first light rays with larger color differences to the first light set, the method further includes:
[0126] When a target pose of a target rendering image corresponding to the first light ray is a pose in the first pose set, determining a target image in the first image set corresponding to the target pose;
[0127] Extracting a target light ray at the same position as the first light ray in the target image;
[0128] The first ray is replaced by the target ray.
[0129] In this embodiment, the above-mentioned three-dimensional reconstruction model generation method includes determining the target image corresponding to the target pose in the first image set when the target pose of the target rendering image corresponding to the first ray is the pose in the first pose set, extracting the target ray at the same position as the first ray in the target image, and replacing the first ray with the target ray, so that when the ray in the image corresponding to the pose in the first pose set is extracted, the ray is replaced with the ray corresponding to the target image in the first image set. Since the images in the first image set are obtained by shooting and collecting the target scenes, the accuracy of model training can be further improved.
[0130] For example, Figure 2This is a second flow chart of a method for generating a three-dimensional reconstruction model provided in an embodiment of the present application. Figure 2 As shown, the specific process is as follows:
[0131] The new user collects images of the target scene to obtain a first image set, solves the poses of all images in the first image set, and uses the scale and base coordinate system alignment module to obtain the pose set of the images in the first image set in the first base coordinate system and the first scale corresponding to the first model; uses the quality assessment module to assess whether the first image set uploaded by the new user contains some new knowledge that has not been learned in the first model; when the first image set contains new knowledge that has not been learned in the first model, loads the first model as the teacher model, and the parameters of the teacher model are fixed during the training process, while the second model, i.e., the student model, directly copies the structure and parameters of the teacher model; uses the data fusion module to fuse new and old data, i.e., the teacher model uses a playback-based method, and uses the teacher model to render some images at the original training perspective to train the student model; and uses an active learning strategy to help quickly train the student model, i.e., during the training process, select light with a large light difference to train the student model; the trained student model, i.e., the target model, is a new representation of the target scene.
[0132] See also Figure 3 , Figure 3 is a flow chart of a three-dimensional reconstruction method provided in an embodiment of the present application. Figure 3 As shown, the method comprises the following steps:
[0133] Step 301: Obtain the position and posture of the target scene;
[0134] Step 302: Generate a rendered image of the pose of the target scene based on the pose of the target scene and the target model, wherein the target model is a model generated based on the above-mentioned three-dimensional reconstruction model generation method.
[0135] In this embodiment, the above-mentioned three-dimensional reconstruction method includes obtaining the posture of the target scene, and generating a rendered image of the posture of the target scene based on the posture of the target scene and the target model, wherein the target model is a model generated based on the above-mentioned three-dimensional reconstruction model generation method, so that a rendered image of the target scene in a specified posture can be generated. Since the target model is a model generated based on the above-mentioned three-dimensional reconstruction model generation method, the efficiency and accuracy of the three-dimensional reconstruction can be improved.
[0136] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a three-dimensional reconstruction model generation device provided in an embodiment of the present application, such as Figure 4 As shown, the 3D reconstruction model generating device 400 includes:
[0137] A first acquisition module 401 is used to acquire a first image set, where the first image set includes a plurality of first images, and the plurality of first images are images obtained by photographing a target scene;
[0138] A determination module 402 is used to determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model, wherein the first pose set includes a plurality of first pose information corresponding one-to-one to the plurality of first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity;
[0139] A first training module 403 is used to train a second model using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model;
[0140] The model structure and model parameters of the second model are the same as those of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene.
[0141] Optionally, the device further comprises:
[0142] a second acquisition module, configured to acquire a second image set, wherein the second image set includes a plurality of second images, the plurality of second images are images obtained by photographing the target scene, and the plurality of second images include training images in the training image set;
[0143] A solution module, used for performing pose solution on the second image set to obtain a second pose set in the first base coordinate system and the first scale, wherein the second pose set includes a plurality of second pose information corresponding one-to-one to the plurality of second images, and the second pose information is used to characterize the pose of the entity in the corresponding second image in the target scene;
[0144] The second training module is used to train the initial model using the training image set and the pose set corresponding to the training image set to obtain the first model, and the first model is used to perform three-dimensional reconstruction of the target scene.
[0145] Optionally, the determining module includes:
[0146] A solving unit, used for solving the pose of the second image set and the first image set to obtain a third pose set of the second image set in a second base coordinate system and a second scale, and a fourth pose set of the first image set in the second base coordinate system and the second scale, wherein the second scale is used to characterize the ratio of the second image to the corresponding entity, the third pose set includes a plurality of third pose information corresponding to the plurality of second images one by one, the third pose information is used to characterize the pose of the entity in the corresponding second image in the target scene, and the fourth pose set includes a plurality of fourth pose information corresponding to the plurality of first images one by one, the fourth pose information is used to characterize the pose of the entity in the corresponding first image in the target scene;
[0147] The first determining unit is used to determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to a first model according to the second pose set, the third pose set and the fourth pose set.
[0148] Optionally, the plurality of second images further include a test image in a test image set, and the device further includes:
[0149] A testing module, configured to test the first model using the test image set and a pose set corresponding to the test image set, to obtain a first index value of the first model, wherein the first index value includes a first peak signal-to-noise ratio and a first structural similarity index, and the first index value is used to characterize a rendering quality of the first model on the pose set corresponding to the test image set;
[0150] The first training module includes:
[0151] A first rendering unit, configured to use the first model to render on a pose set corresponding to a sample image set to obtain a second rendering image set, wherein the first image set includes the sample image set;
[0152] A second determining unit, configured to determine a second index value according to the second rendering image set and the sample image set, wherein the second index value is used to characterize a rendering quality of the first model on a pose set corresponding to the sample image set, and the second index value includes a second peak signal-to-noise ratio and a second structural similarity index;
[0153] a first calculating unit, configured to calculate the first peak signal-to-noise ratio and the second peak signal-to-noise ratio to obtain a first value, where when the first peak signal-to-noise ratio is greater than the second peak signal-to-noise ratio, the first value is 1, and when the first peak signal-to-noise ratio is less than or equal to the second peak signal-to-noise ratio, the first value is a ratio of the first peak signal-to-noise ratio to the second peak signal-to-noise ratio;
[0154] a second calculation unit, configured to calculate the first structural similarity index and the second structural similarity index to obtain a second value, wherein when the first structural similarity index is greater than the second structural similarity index, the second value is 1, and when the first structural similarity index is less than or equal to the second structural similarity index, the second value is a ratio of the first structural similarity index to the second structural similarity index;
[0155] a third calculation unit, configured to calculate the first value and the second value to obtain a target value, wherein the target value is equal to the sum of the product of the first value and a first preset weight and the product of the second value and a second preset weight;
[0156] The first training unit is used to train the second model using the first image set, the first pose set and the first rendering image set rendered by the first model at multiple preset poses to obtain a target model when the target value is less than a first preset value.
[0157] Optionally, the first training module further includes:
[0158] an extraction unit, configured to perform feature extraction on the first image set to obtain image features of each image in the first image set;
[0159] A screening unit is used to perform n-times iterative screening on the first image set to obtain the sample image set, wherein the i-th iterative screening in the n-times iterative screening includes:
[0160] When i is equal to 1, the first image in the first image set is added to the sample image set to obtain a first intermediate sample image set, and the first image is deleted from the first image set to obtain a first intermediate image set, wherein the first image is any image in the first image set;
[0161] In the case that i is greater than 1, the second image in the i-1th intermediate image set is added to the i-1th intermediate sample image set to obtain the i-th intermediate sample image set, and the second image is deleted from the i-1th intermediate image set to obtain the i-th intermediate image set, wherein the second image is the image in the i-1th intermediate image set with the largest image difference value with the image in the i-1th intermediate sample image set;
[0162] The sample image set is the nth intermediate sample image set.
[0163] Optionally, the first training module includes:
[0164] A first extraction unit is used to randomly extract a first preset number of images from a first set to be trained to obtain a second set to be trained, wherein the first set to be trained includes the first image set and the first rendering;
[0165] A second rendering unit is used to render on a fifth pose set corresponding to the second set to be trained using the first model and the second model respectively, to obtain a third rendering image set and a fourth rendering image set, wherein the fifth pose set includes the first pose set and the preset multiple poses;
[0166] An acquiring unit, configured to sequentially acquire a first rendering image and a second rendering image of the same posture in the fifth posture set from the third rendering image set and the fourth rendering image set respectively;
[0167] a third determining unit, configured to determine a color difference of all light rays between the first rendering and the second rendering;
[0168] an adding unit, configured to add the N first light rays with larger color differences to the first light set, until all renderings corresponding to the third rendering image set and the fourth rendering image set in all postures of the fifth posture set are traversed, where N is an integer greater than 0;
[0169] a deleting unit, configured to delete N first light rays with higher peak signal-to-noise ratios in the first light set when the number of light rays in the first light set is greater than a third preset value;
[0170] A second extraction unit, configured to randomly extract a second preset number of second light rays from the images in the second to-be-trained set to obtain a second light set;
[0171] The second training unit is used to train the second model a preset number of times using the first light set and the second light set.
[0172] Optionally, the first training module further includes:
[0173] A fourth determining unit, configured to determine a target image in the first image set corresponding to the target pose when a target pose of the target rendering image corresponding to the first light is a pose in the first pose set;
[0174] A third extraction unit, used for extracting a target light ray at the same position as the first light ray in the target image;
[0175] A replacement unit is used to replace the first light with the target light.
[0176] It should be noted that the 3D reconstruction model generation device provided in the embodiment of the present application is a device capable of executing the above-mentioned 3D reconstruction model generation method, and all implementation methods in the above-mentioned 3D reconstruction model generation method embodiment are applicable to the device and can achieve the same or similar beneficial effects. To avoid repeated description, this embodiment will not be described in detail.
[0177] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a three-dimensional reconstruction device provided in an embodiment of the present application, such as Figure 5 As shown, the 3D reconstruction device 500 includes:
[0178] The third acquisition module 501 is used to acquire the position and posture of the target scene;
[0179] The generating module 502 is used to generate a rendering image of the pose of the target scene based on the pose of the target scene and the target model, wherein the target model is a model generated based on the above-mentioned 3D reconstruction model generating method.
[0180] It should be noted that the 3D reconstruction device provided in the embodiment of the present application is a device capable of executing the above 3D reconstruction method, and all implementations in the above 3D reconstruction method embodiment are applicable to the device and can achieve the same or similar beneficial effects. To avoid repeated description, this embodiment will not be described in detail.
[0181] An embodiment of the present application also provides an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor. When the program is executed by the processor, the program implements the above-mentioned three-dimensional reconstruction model generation method or each process of the three-dimensional reconstruction method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0182] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned three-dimensional reconstruction model generation method or three-dimensional reconstruction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0183] An embodiment of the present application also provides a computer program product, including computer instructions. When the computer instructions are executed by a processor, the various processes of the above-mentioned three-dimensional reconstruction model generation method or the three-dimensional reconstruction method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0184] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0185] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0186] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for generating a three-dimensional reconstruction model, characterized in that: include: Acquire a first image set, where the first image set includes a plurality of first images, and the plurality of first images are images obtained by photographing a target scene; Determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model, wherein the first pose set includes a plurality of first pose information corresponding one-to-one to the plurality of first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity; Training a second model using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model; The model structure and model parameters of the second model are the same as those of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene; before acquiring the first image set, the method further includes: Acquire a second image set, where the second image set includes a plurality of second images, where the plurality of second images are images obtained by photographing the target scene, and the plurality of second images include training images in the training image set; Solving the pose of the second image set to obtain a second pose set in the first base coordinate system and the first scale, wherein the second pose set includes a plurality of second pose information corresponding one-to-one to the plurality of second images, and the second pose information is used to characterize the pose of the entity in the corresponding second image in the target scene; The initial model is trained by using the training image set and the pose set corresponding to the training image set to obtain the first model, where the first model is used to perform three-dimensional reconstruction of the target scene; and the first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model is determined, including: Solving the poses of the second image set and the first image set to obtain a third pose set of the second image set in a second base coordinate system and a second scale, and a fourth pose set of the first image set in the second base coordinate system and the second scale, wherein the second scale is used to characterize the ratio of the second image to the corresponding entity, the third pose set includes a plurality of third pose information corresponding one-to-one to the plurality of second images, the third pose information is used to characterize the pose of the entity in the corresponding second image in the target scene, and the fourth pose set includes a plurality of fourth pose information corresponding one-to-one to the plurality of first images, the fourth pose information is used to characterize the pose of the entity in the corresponding first image in the target scene; A first pose set of the first image set in a first base coordinate system and a first scale corresponding to a first model is determined according to the second pose set, the third pose set and the fourth pose set.
2. The method according to claim 1, characterized in that The plurality of second images also include a test image in a test image set. After the initial model is trained using the training image set and a pose set corresponding to the training image set to obtain the first model, the method further includes: Testing the first model using the test image set and the pose set corresponding to the test image set to obtain a first index value of the first model, the first index value comprising a first peak signal-to-noise ratio and a first structural similarity index, the first index value being used to characterize a rendering quality of the first model on the pose set corresponding to the test image set; The method of training the second model by using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model includes: Rendering on a pose set corresponding to a sample image set using the first model to obtain a second rendering image set, wherein the first image set includes the sample image set; Determine a second index value according to the second rendering image set and the sample image set, where the second index value is used to characterize the rendering quality of the first model on the pose set corresponding to the sample image set, and the second index value includes a second peak signal-to-noise ratio and a second structural similarity index; calculating the first peak signal-to-noise ratio and the second peak signal-to-noise ratio to obtain a first value, where when the first peak signal-to-noise ratio is greater than the second peak signal-to-noise ratio, the first value is 1, and when the first peak signal-to-noise ratio is less than or equal to the second peak signal-to-noise ratio, the first value is a ratio of the first peak signal-to-noise ratio to the second peak signal-to-noise ratio; Calculating the first structural similarity index and the second structural similarity index to obtain a second value, where the second value is 1 when the first structural similarity index is greater than the second structural similarity index, and the second value is a ratio of the first structural similarity index to the second structural similarity index when the first structural similarity index is less than or equal to the second structural similarity index; Calculating the first value and the second value to obtain a target value, where the target value is equal to the sum of the product of the first value and a first preset weight and the product of the second value and a second preset weight; When the target value is less than a first preset value, the second model is trained using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model.
3. The method according to claim 2, characterized in that Before rendering on the pose set corresponding to the sample image set using the first model to obtain a second rendering image set, the method further includes: Performing feature extraction on the first image set to obtain image features of each image in the first image set; Perform n-times iterative screening on the first image set to obtain the sample image set, wherein the i-th iterative screening in the n-times iterative screening includes: When i is equal to 1, the first image in the first image set is added to the sample image set to obtain a first intermediate sample image set, and the first image is deleted from the first image set to obtain a first intermediate image set, wherein the first image is any image in the first image set; In the case that i is greater than 1, the second image in the i-1th intermediate image set is added to the i-1th intermediate sample image set to obtain the i-th intermediate sample image set, and the second image is deleted from the i-1th intermediate image set to obtain the i-th intermediate image set, wherein the second image is the image in the i-1th intermediate image set with the largest image difference value with the image in the i-1th intermediate sample image set; The sample image set is the nth intermediate sample image set.
4. The method according to claim 3, characterized in that The calculation formula of the image difference value is: Wherein, F is the image feature of the candidate image in the i-1th intermediate image set, and F i is the image feature of the i-th image in the i-1th intermediate sample image set, q is the quaternion corresponding to the pose of the candidate image, q i is the quaternion corresponding to the pose of the i-th image, t is the translation vector extracted from the pose of the candidate image, t i is the translation vector extracted from the pose of the i-th image, N sample is the number of images in the i-1th intermediate sample image set, λ1 is the third preset weight, λ2 is the fourth preset weight, λ3 is the fifth preset weight, and the candidate image is any image in the i-1th intermediate image set.
5. The method according to claim 1, characterized in that The training of the second model using the first image set, the first pose set, and the first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model includes: Randomly extracting a first preset number of images from a first set to be trained to obtain a second set to be trained, wherein the first set to be trained includes the first image set and the first rendering; Using the first model and the second model to render on a fifth pose set corresponding to the second set to be trained, respectively, to obtain a third rendering image set and a fourth rendering image set, wherein the fifth pose set includes the first pose set and the plurality of preset poses; Sequentially obtain a first rendering image and a second rendering image of the same posture in the fifth posture set from the third rendering image set and the fourth rendering image set respectively; Determining color differences of all light rays between the first rendering and the second rendering; Add the N first light rays with larger color differences to the first light set until all renderings corresponding to the third rendering set and the fourth rendering set in the fifth pose set are traversed, where N is an integer greater than 0; When the number of light rays in the first light set is greater than a third preset value, deleting N first light rays with higher peak signal-to-noise ratios in the first light set; Randomly extracting a second preset number of second light rays from the images in the second to-be-trained set to obtain a second light set; The second model is trained a preset number of times using the first light set and the second light set.
6. The method according to claim 5, characterized in that After adding the N first light rays with larger color differences to the first light set, the method further includes: When a target pose of a target rendering image corresponding to the first light ray is a pose in the first pose set, determining a target image in the first image set corresponding to the target pose; Extracting a target light ray at the same position as the first light ray in the target image; The first ray is replaced by the target ray.
7. A three-dimensional reconstruction method, characterized in that: include: Get the pose of the target scene; Based on the pose of the target scene and the target model, a rendered image of the pose of the target scene is generated, wherein the target model is a model generated based on any one of claims 1 to 6.
8. A three-dimensional reconstruction model generation device, characterized in that: include: A first acquisition module is used to acquire a first image set, where the first image set includes a plurality of first images, and the plurality of first images are images obtained by photographing a target scene; A determination module, used to determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to the first model, wherein the first pose set includes a plurality of first pose information corresponding one-to-one to the plurality of first images, the first pose information is used to characterize the pose of the entity in the corresponding first image in the target scene, and the first scale is used to characterize the ratio of the first image to the corresponding entity; A first training module is used to train a second model using the first image set, the first pose set, and a first rendering image set obtained by rendering the first model at a plurality of preset poses to obtain a target model; The model structure and model parameters of the second model are the same as those of the first model, and the target model is used to perform three-dimensional reconstruction of the target scene; The device also includes: a second acquisition module, configured to acquire a second image set, wherein the second image set includes a plurality of second images, the plurality of second images are images obtained by photographing the target scene, and the plurality of second images include training images in the training image set; A solution module, used for performing pose solution on the second image set to obtain a second pose set in the first base coordinate system and the first scale, wherein the second pose set includes a plurality of second pose information corresponding one-to-one to the plurality of second images, and the second pose information is used to characterize the pose of the entity in the corresponding second image in the target scene; A second training module is used to train an initial model using the training image set and a pose set corresponding to the training image set to obtain the first model, where the first model is used to perform three-dimensional reconstruction of the target scene; The determination module comprises: A solving unit, used for solving the pose of the second image set and the first image set to obtain a third pose set of the second image set in a second base coordinate system and a second scale, and a fourth pose set of the first image set in the second base coordinate system and the second scale, wherein the second scale is used to characterize the ratio of the second image to the corresponding entity, the third pose set includes a plurality of third pose information corresponding to the plurality of second images one by one, the third pose information is used to characterize the pose of the entity in the corresponding second image in the target scene, and the fourth pose set includes a plurality of fourth pose information corresponding to the plurality of first images one by one, the fourth pose information is used to characterize the pose of the entity in the corresponding first image in the target scene; The first determining unit is used to determine a first pose set of the first image set in a first base coordinate system and a first scale corresponding to a first model according to the second pose set, the third pose set and the fourth pose set.
9. A three-dimensional reconstruction device, characterized in that: include: The third acquisition module is used to obtain the position and posture of the target scene; A generation module, used to generate a rendered image of the pose of the target scene based on the pose of the target scene and a target model, wherein the target model is a model generated based on any one of claims 1 to 8.
10. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the three-dimensional reconstruction model generation method as described in any one of claims 1 to 6; or, when executed by the processor, the program implements the steps of the three-dimensional reconstruction method as described in claim 7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the three-dimensional reconstruction model generation method as described in any one of claims 1 to 6; or, when executed by a processor, implements the steps of the three-dimensional reconstruction method as described in claim 7.
12. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the three-dimensional reconstruction model generation method as described in any one of claims 1 to 6; or, when executed by a processor, implement the steps of the three-dimensional reconstruction method as described in claim 7.
