A three-dimensional terrain generation method, device, system and storage medium
By constructing a many-to-many relationship model of encoder, generator, discriminator and distinguisher, the problems of difficult generation and mesh artifacts in 3D terrain generation are solved, and accurate 3D terrain generation is achieved, saving manpower and material resources and capturing the real structured condition distribution.
Patent Information
- Application Number
- CN202211184067.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-09-27
AI Technical Summary
Existing 3D terrain generation algorithms suffer from a lack of user control, difficulty in predicting generated terrain, the need for extensive computation, the appearance of regular grid-like artifacts in the generated terrain, and the fact that CycleGAN's underlying domains are a one-to-one mapping, failing to accurately capture the true structured conditional distribution.
An encoder, generator, discriminator, and classifier are constructed. The encoder and generator are trained using multiple original topographic maps. The loss function is used for analysis and parameter updates. The generator, discriminator, and classifier generate 3D terrain from the topographic maps. The cycleGAN is extended to a many-to-many relationship model to generate 3D terrain in multiple styles.
It solves the problems of unpredictable terrain generation and grid-like artifacts, requires no human intervention, saves manpower and resources, can accurately capture the distribution of real structured conditions, and solves the optimization cycle consistency barrier.
Smart Images

Figure CN115564907B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application mainly relates to the technical field of image processing, and particularly relates to a three-dimensional terrain generation method, device, system and storage medium. BACKGROUND
[0002] The earth surface is the space for human survival. Three-dimensional terrain generation technology is widely used in tourism, agriculture, construction, games and film industry. However, there are still problems such as tediousness and inconsistency with natural form in three-dimensional terrain generation. The existing three-dimensional terrain generation algorithm has the problems of lack of user control to generate terrain, difficulty in prediction, need for a large number of operations, appearance of regular grid-like artifacts in generated terrain, and artificial trace. The existing cycleGAN has the problems of one-to-one mapping between the underlying domains, inability to accurately capture the real structured conditional distribution, and optimization cycle consistency barrier when the complexity of the domains is greatly different. SUMMARY
[0003] The present application mainly relates to the technical field of image processing, and particularly relates to a three-dimensional terrain generation method, device, system and storage medium.
[0004] The technical scheme for solving the above technical problem is as follows: a three-dimensional terrain generation method, comprising the following steps:
[0005] constructing an encoder, a generator, a discriminator and a discriminator;
[0006] importing a plurality of original terrain maps, and encoding each of the original terrain maps through the encoder to obtain original latent space domain samples of each of the original terrain maps;
[0007] training each of the original terrain maps and the original latent space domain samples of each of the original terrain maps through the encoder and the generator to obtain original mapping terrain maps and mapping latent space domain samples of each of the original terrain maps;
[0008] training each of the original terrain maps, the original mapping terrain maps and the mapping latent space domain samples of each of the original terrain maps through the encoder and the generator to obtain target terrain maps and target latent space domain samples of each of the original terrain maps;
[0009] analyzing the loss function of all the original terrain maps, the original latent space domain samples, the original mapping terrain maps, the mapping latent space domain samples, the target terrain maps and the target latent space domain samples through the generator, the discriminator and the discriminator to obtain a target optimization loss function;
[0010] The parameter updating module is configured to update parameters of the encoder, the generator, the discriminator and the discriminator according to the target optimization loss function, to obtain an updated encoder, an updated generator, an updated discriminator and an updated discriminator.
[0011] The terrain generation device is configured to import a to-be-generated terrain map and generate a three-dimensional terrain for the to-be-generated terrain map by using the updated encoder, the updated generator, the updated discriminator and the updated discriminator, to obtain a three-dimensional terrain generation result.
[0012] Another technical solution of the present application for solving the above technical problems is as follows: a three-dimensional terrain generation device, comprising:
[0013] The construction module is configured to construct an encoder, a generator, a discriminator and a discriminator.
[0014] The encoding module is configured to import a plurality of original terrain maps and encode each of the original terrain maps by using the encoder, to obtain original latent space domain samples of each of the original terrain maps.
[0015] The original terrain map training module is configured to train each of the original terrain maps and the original latent space domain samples of each of the original terrain maps by using the encoder and the generator, to obtain original mapping terrain maps and mapping latent space domain samples of each of the original terrain maps.
[0016] The mapping terrain map training module is configured to train each of the original terrain maps, the original mapping terrain maps and the mapping latent space domain samples of each of the original terrain maps by using the encoder and the generator, to obtain target terrain maps and target latent space domain samples of each of the original terrain maps.
[0017] The loss function analysis module is configured to perform loss function analysis on all of the original terrain maps, the original latent space domain samples, the original mapping terrain maps, the mapping latent space domain samples, the target terrain maps and the target latent space domain samples of all of the original terrain maps by using the generator, the discriminator and the discriminator, to obtain a target optimization loss function.
[0018] The parameter updating module is configured to update parameters of the encoder, the generator, the discriminator and the discriminator according to the target optimization loss function, to obtain an updated encoder, an updated generator, an updated discriminator and an updated discriminator.
[0019] The terrain generation result obtaining module is configured to import a terrain map to be generated, and generate a three-dimensional terrain for the terrain map to be generated by using the updated encoder, the updated generator, the updated discriminator and the updated discriminator, so as to obtain a three-dimensional terrain generation result.
[0020] Based on the three-dimensional terrain generation method, the application further provides a three-dimensional terrain generation system.
[0021] The three-dimensional terrain generation system comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the three-dimensional terrain generation method is realized.
[0022] Based on the three-dimensional terrain generation method, the application further provides a computer readable storage medium.
[0023] The computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the three-dimensional terrain generation method is realized.
[0024] The application has the following beneficial effects: the original terrain map is encoded by the encoder to obtain original latent space domain samples, the original terrain map and the original latent space domain samples are trained by the encoder and the generator to obtain an original mapping terrain map and mapping latent space domain samples, the original terrain map, the original mapping terrain map and the mapping latent space domain samples are trained by the encoder and the generator to obtain a target terrain map and target latent space domain samples, the loss function of the original terrain map, the original latent space domain samples, the original mapping terrain map, the mapping latent space domain samples, the target terrain map and the target latent space domain samples is analyzed by the generator, the discriminator and the discriminator to obtain a target optimization loss function, the parameters of the encoder, the generator, the discriminator and the discriminator are updated according to the target optimization loss function to obtain an updated encoder, an updated generator, an updated discriminator and an updated discriminator, and the three-dimensional terrain of the terrain map to be generated is generated by the updated encoder, the updated generator, the updated discriminator and the updated discriminator to obtain a three-dimensional terrain generation result. The application solves the problems of difficult prediction of user-controlled generated terrain, large amount of calculation and regular grid-like artifacts in generated terrain, does not need human intervention, saves manpower and resources, accurately captures real structured conditional distribution, and solves the problem of optimization cycle consistency obstacle. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 A flowchart of a three-dimensional terrain generation method provided by an embodiment of the application is shown.
[0026] Figure 2 A three-dimensional terrain generation method provided by an embodiment of the present application is shown in the flowchart.
[0027] Figure 3 A three-dimensional terrain generation device provided by an embodiment of the present application is shown in the block diagram. DETAILED DESCRIPTION
[0028] The principles and features of the present application are described below in conjunction with the accompanying drawings, which are only used to explain the present application and not intended to limit the scope of the present application.
[0029] Figure 1 A three-dimensional terrain generation method provided by an embodiment of the present application is shown in the flowchart.
[0030] As shown in Figure 1 A three-dimensional terrain generation method includes the following steps:
[0031] Construct an encoder, a generator, a discriminator and a discriminator;
[0032] Import a plurality of original terrain maps, and encode each of the original terrain maps through the encoder to obtain original latent space domain samples of each of the original terrain maps;
[0033] Train each of the original terrain maps and the original latent space domain samples of each of the original terrain maps through the encoder and the generator to obtain original mapping terrain maps and mapping latent space domain samples of each of the original terrain maps;
[0034] Train each of the original terrain maps, the original mapping terrain maps and the mapping latent space domain samples of each of the original terrain maps through the encoder and the generator to obtain target terrain maps and target latent space domain samples of each of the original terrain maps;
[0035] Perform loss function analysis on all of the original terrain maps, the original latent space domain samples, the original mapping terrain maps, the mapping latent space domain samples, the target terrain maps and the target latent space domain samples of all of the original terrain maps through the generator, the discriminator and the discriminator to obtain a target optimization loss function;
[0036] According to the target optimization loss function, update the parameters of the encoder, the generator, the discriminator and the discriminator to obtain an updated encoder, an updated generator, an updated discriminator and an updated discriminator;
[0037] Import a to-be-generated topographic map, and generate a three-dimensional terrain for the to-be-generated topographic map through the updated encoder, the updated generator, the updated discriminator and the updated discriminator to obtain a three-dimensional terrain generation result.
[0038] In the above embodiment, the original latent space domain sample is obtained by encoding the original topographic map through the encoder, the original mapping topographic map and the mapping latent space domain sample are obtained by training the original topographic map and the original latent space domain sample through the encoder and the generator, the target topographic map and the target latent space domain sample are obtained by training the original topographic map, the original mapping topographic map and the mapping latent space domain sample through the encoder and the generator, the target optimization loss function is obtained by analyzing the loss function of the original topographic map, the original latent space domain sample, the original mapping topographic map, the mapping latent space domain sample, the target topographic map and the target latent space domain sample through the generator, the discriminator and the discriminator, and the updated encoder, the updated generator, the updated discriminator and the updated discriminator are obtained by updating the parameters of the encoder, the generator, the discriminator and the discriminator according to the target optimization loss function, and the three-dimensional terrain generation result is obtained by generating the three-dimensional terrain for the to-be-generated topographic map through the updated encoder, the updated generator, the updated discriminator and the updated discriminator. The present application solves the problems of lack of user control in generating terrain, difficulty in predicting, need for a large number of operations and appearance of regular grid-like artifacts in generated terrain, without human intervention, saving manpower and resources, accurately capturing real structured conditional distribution and solving the problem of optimization cycle consistency obstacle.
[0039] Optionally, as one embodiment of the present application, as shown in Figure 1 and 2 The original topographic map includes an original boundary line topographic map and an original three-dimensional topographic map corresponding to the original boundary line topographic map, and the encoder includes an encoder E X and an encoder E Y ,
[0040] The process of encoding each of the original topographic maps through the encoder to obtain the original latent space domain sample of each of the original topographic maps includes:
[0041] Each of the original boundary line topographic maps and the original three-dimensional topographic map corresponding to each of the original boundary line topographic maps is encoded through the encoder E X to obtain the original boundary line latent space domain sample of each of the original boundary line topographic maps.
[0042] Each of the original boundary line topographic maps and the original three-dimensional topographic map corresponding to each of the original boundary line topographic maps is encoded through the encoder E YEncode each of the original boundary line topographic maps and each of the original three-dimensional topographic maps corresponding to the original boundary line topographic maps to obtain original three-dimensional topographic latent space domain samples of each of the original three-dimensional topographic maps;
[0043] The original latent space domain samples of the original topographic maps include original boundary line latent space domain samples of the original boundary line topographic maps and original three-dimensional topographic latent space domain samples of the original three-dimensional topographic maps.
[0044] It should be understood that the original boundary line topographic maps include ridge line maps and valley line maps.
[0045] It should be understood that the ridge line, valley line map data set (i.e., a plurality of the original boundary line topographic maps) is made as an X domain, and the three-dimensional topographic map data set (i.e., a plurality of the original three-dimensional topographic maps) is made as a Y domain. Two latent space domain samples Z X 、Z Y (i.e., the original boundary line latent space domain samples and the original three-dimensional topographic latent space domain samples) with standard Gaussian priors are introduced at the same time.
[0046] Specifically, the latent space domain samples Z X 、Z Y are introduced to capture any missing information when elements are converted from the X domain Y domain to each other for many-to-many mapping. The latent space domain samples Z X (i.e., the original boundary line latent space domain samples) and Z Y (i.e., the original three-dimensional topographic latent space domain samples) are generated by an encoder E X 、E Y (i.e., the encoder E X and the encoder E Y ) as follows:
[0047] Z X =E X (x,y),x∈X,y∈Y,
[0048] Z Y =E Y (x,y),x∈X,y∈Y。
[0049] In the above embodiment, the original latent space domain samples are obtained by encoding the original topographic maps by the encoder, the latent space domain samples with standard Gaussian priors are introduced, and the problems of difficult prediction of user-controlled generated topography, the need for a large number of operations, and the appearance of regular grid-like artifacts in the generated topography are solved.
[0050] Optionally, as an embodiment of the present application, the generator includes a generator G X and a generator G Y ,
[0051] The process of training each of the original terrain maps and the original latent space domain samples of each of the original terrain maps by the encoder and the generator respectively, to obtain the original mapped terrain maps of each of the original terrain maps and the mapped latent space domain samples comprises:
[0052] By the generator G X Mapping the original three-dimensional terrain latent space domain samples of each of the original three-dimensional terrain maps and each of the original boundary line terrain maps respectively, to obtain the original three-dimensional mapped terrain maps of each of the original three-dimensional terrain maps;
[0053] By the encoder E X Encoding the original three-dimensional mapped terrain maps of each of the original three-dimensional terrain maps and each of the original boundary line terrain maps respectively, to obtain the boundary line mapped latent space domain samples of each of the original boundary line terrain maps;
[0054] By the generator G Y Mapping the original boundary line latent space domain samples of each of the original boundary line terrain maps and each of the original three-dimensional terrain maps respectively, to obtain the original boundary line mapped terrain maps of each of the original boundary line terrain maps;
[0055] By the encoder E Y Encoding the original boundary line mapped terrain maps of each of the original boundary line terrain maps and each of the original three-dimensional terrain maps respectively, to obtain the three-dimensional terrain mapped latent space domain samples of each of the original three-dimensional terrain maps;
[0056] The original mapped terrain maps of the original terrain maps comprise the original boundary line mapped terrain maps of the original boundary line terrain maps and the original three-dimensional mapped terrain maps of the original three-dimensional terrain maps;
[0057] The mapped latent space domain samples of the original terrain maps comprise the boundary line mapped latent space domain samples of the original boundary line terrain maps and the three-dimensional terrain mapped latent space domain samples of the original three-dimensional terrain maps.
[0058] It should be understood that by the generator G X The X domain (i.e. the original boundary line terrain maps) and the latent space domain samples Z Y (i.e. the original three-dimensional terrain latent space domain samples) are mapped together with auxiliary noise in the Y domain, and three-dimensional terrain samples (i.e. the original three-dimensional mapped terrain maps) are generated. Then the plotted ridge line, valley line map x of the X domain (i.e. the original boundary line terrain maps) and (i.e. the original three-dimensional mapped terrain maps) are encoded by the encoder E XGenerate latent spatial domain samples (That is, the boundary line maps to the latent spatial domain sample.)
[0059] Specifically, CycleGAN is extended to a many-to-many relationship model to generate multi-style 3D terrain, which is a random mapping configured between the X and Y domains, where Z is a latent space with a standard Gaussian prior on its elements. For the generator G... X 3D terrain samples generated by mapping (i.e., the original three-dimensional mapped terrain map), is determined by the following formula:
[0060]
[0061] For the generated latent spatial domain samples (i.e., the boundary line maps to the latent spatial domain samples), as determined by the following formula:
[0062]
[0063] Similarly, for the sample Z in the Y domain × latent spatial domain... X To X domain × potential spatial domain sample Z Y Direction, through the generator G Y The ridgeline and valleyline samples generated by the mapping (i.e., the original boundary line mapping topographic map) and the generated potential spatial domain samples (i.e., the potential spatial domain samples of the three-dimensional terrain mapping) are determined by the following formulas:
[0064]
[0065]
[0066] It should be understood that the present invention expands the spatial mapping on the basis of the original cycGAN model by cyclically using samples from two potential spatial domains.
[0067] It should be understood that, through the generator (i.e., the generator G) X The auxiliary noise in the ridgeline, valley line map (i.e., the original boundary topographic map) and the potential spatial domain sample (i.e., the original three-dimensional topographic potential spatial domain sample) is mapped to the three-dimensional topographic map domain to generate a three-dimensional topographic map sample (i.e., the original three-dimensional mapped topographic map). Then, the encoder generates a potential spatial domain sample auxiliary noise sample (i.e., the boundary mapping potential spatial domain sample) from the ridgeline, valley line map (i.e., the original boundary topographic map) and the three-dimensional topographic map sample (i.e., the original three-dimensional mapped topographic map).
[0068] In the above embodiment, the original mapping terrain map and the mapping latent space domain sample are obtained by training the original terrain map and the original latent space domain sample by the encoder and the generator, the cycleGAN can be extended into a many-to-many relationship model, and a many-style three-dimensional terrain can be generated, missing information can be captured, and many-to-many mapping can be performed.
[0069] Optionally, as an embodiment of the present application, the process of training each of the original terrain maps, the original mapping terrain map of each of the original terrain maps, and the mapping latent space domain sample by the encoder and the generator respectively to obtain the target terrain map of each of the original terrain maps and the target latent space domain sample comprises:
[0070] mapping the original three-dimensional mapping terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of the original boundary line terrain map by the generator G Y mapping the original three-dimensional mapping terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of the original boundary line terrain map by the generator G
[0071] encoding the original three-dimensional terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of each of the original boundary line terrain maps by the encoder E Y encoding the original three-dimensional terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of each of the original boundary line terrain maps by the encoder E
[0072] mapping the original three-dimensional mapping terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of each of the original boundary line terrain maps by the generator G X mapping the original three-dimensional mapping terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of each of the original boundary line terrain maps by the generator G
[0073] encoding the original three-dimensional terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of each of the original boundary line terrain maps by the encoder E X encoding the original three-dimensional terrain map of each of the original three-dimensional terrain maps and the original boundary line mapping terrain map of each of the original boundary line terrain maps by the encoder E
[0074] The target terrain map of the original terrain map comprises the target boundary line terrain map of the original boundary line terrain map and the target three-dimensional terrain map of the original three-dimensional terrain map.
[0075] The target latent space domain sample of the original terrain map comprises the target three-dimensional terrain latent space domain sample of the original three-dimensional terrain map and the target boundary line latent space domain sample of the original boundary line terrain map.
[0076] It should be understood that the generator G Y generating a three-dimensional terrain sample in the Y domain (i.e. the original three-dimensional mapped terrain map) and the encoder E X generated latent space domain samples (i.e. the boundary line mapped latent space domain samples) together map to X domain to generate back ridge line, valley line map x' (i.e. the target boundary line terrain map). Meanwhile through the encoder E Y ridge line, valley line map x (i.e. the original boundary line terrain map) and Y domain generated three-dimensional terrain samples (i.e. the original three-dimensional mapped terrain map) to generate back latent space domain samples Z' Y (i.e. the target three-dimensional terrain latent space domain samples).
[0077] In particular, the ridge line, valley line map x' (i.e. the target boundary line terrain map) and the latent space domain samples Z' (i.e. the target three-dimensional terrain latent space domain samples) generated back Y are determined by the following two equations respectively:
[0078]
[0079]
[0080] Similarly, for Y domain x latent space domain samples Z X to X domain x latent space domain samples Z Y direction, back three-dimensional terrain map y' (i.e. the target three-dimensional terrain map) and latent space domain samples Z' (i.e. the target boundary line latent space domain samples) X are determined by the following two equations respectively:
[0081]
[0082]
[0083] It should be understood that the three-dimensional terrain map samples (i.e. the original three-dimensional mapped terrain map) and the latent space domain samples auxiliary noise samples (i.e. the boundary line mapped latent space domain samples) are generated back ridge line, valley line map (i.e. the target boundary line terrain map) through the generator (i.e. the generator G Y ), and the ridge line, valley line map (i.e. the original boundary line terrain map) and the three-dimensional terrain map samples (i.e. the original three-dimensional mapped terrain map) are generated back latent space domain samples auxiliary noise (i.e. the target three-dimensional terrain latent space domain samples) through the encoder (i.e. the encoder E Y ).
[0084] In the above embodiment, the training of the original terrain map, the original mapped terrain map and the mapped latent space domain sample by the encoder and the generator obtains the target terrain map and the target latent space domain sample, which provides data support for subsequent data processing without human intervention, saves manpower and resources, accurately captures the real structured conditional distribution and solves the problem of optimization cycle consistency barrier.
[0085] Optionally, as an embodiment of the present application, the process of obtaining the target optimization loss function by loss function analysis of all the original terrain maps, the original latent space domain samples of all the original terrain maps, the original mapped terrain maps, the mapped latent space domain samples, the target terrain maps and the target latent space domain samples by the generator, the discriminator and the discriminator includes:
[0086] calculating the first boundary edge matching loss function and the second boundary edge matching loss function by the generator G X , the discriminator and the discriminator on all the original boundary line terrain maps, all the original three-dimensional terrain maps, the original boundary line latent space domain samples of all the original terrain maps, the boundary line mapped latent space domain samples and the original three-dimensional terrain latent space domain samples of all the original three-dimensional terrain maps;
[0087] calculating the first three-dimensional terrain edge matching loss function and the second three-dimensional terrain edge matching loss function by the generator G Y , the discriminator and the discriminator on all the original boundary line terrain maps, all the original three-dimensional terrain maps, the original boundary line latent space domain samples of all the original terrain maps, the original three-dimensional terrain latent space domain samples of all the original three-dimensional terrain maps and the three-dimensional terrain mapped latent space domain samples;
[0088] respectively, the target boundary line terrain map of each original boundary line terrain map is subtracted from the original boundary line terrain map to obtain the first difference value of each original boundary line terrain map; the absolute value of the first difference value of each original boundary line terrain map is calculated to obtain the first absolute value of each original boundary line terrain map; the sum of the first absolute values of all the original boundary line terrain maps is calculated to obtain the sum of the first absolute values; and the mathematical expectation of the sum of the first absolute values is calculated to obtain the first cycle consistency loss function;
[0089] respectively, to obtain a second absolute value of each of the original three-dimensional terrain maps; and summing all the second absolute values of the original three-dimensional terrain maps to obtain a sum of the second absolute values; and calculating a mathematical expectation of the sum of the second absolute values to obtain a second cyclic consistent loss function;
[0090] respectively, to obtain a third absolute value of each of the original three-dimensional terrain maps; and summing all the third absolute values of the original three-dimensional terrain maps to obtain a sum of the third absolute values; and calculating a mathematical expectation of the sum of the third absolute values to obtain a third cyclic consistent loss function;
[0091] respectively, to obtain a fourth absolute value of each of the original boundary line terrain maps; and summing all the fourth absolute values of the original boundary line terrain maps to obtain a sum of the fourth absolute values; and calculating a mathematical expectation of the sum of the fourth absolute values to obtain a fourth cyclic consistent loss function;
[0092] Importing a first weight coefficient and a second weight coefficient, and multiplying the first cyclic consistent loss function by the first weight coefficient to obtain a first product; multiplying the second cyclic consistent loss function by the second weight coefficient to obtain a second product; summing the first boundary line edge matching loss function, the second boundary line edge matching loss function, the first product, and the second product to obtain a first total loss function;
[0093] Importing a third weight coefficient and a fourth weight coefficient, and multiplying the third cyclic consistent loss function by the third weight coefficient to obtain a third product; multiplying the fourth cyclic consistent loss function by the fourth weight coefficient to obtain a fourth product; summing the first three-dimensional terrain edge matching loss function, the second three-dimensional terrain edge matching loss function, the third product, and the fourth product to obtain a second total loss function;
[0094] Based on the first equation, the objective optimization loss function is calculated according to the first total loss function and the second total loss function, resulting in the objective optimization loss function. The first equation is:
[0095]
[0096] in, Optimize the loss function for the objective. For the first total loss function, This is the second total loss function.
[0097] It should be understood that, through the generator G X The Y domain (i.e., the original 3D topographic map) and the potential spatial domain sample Z X The auxiliary noise in the (i.e., the original boundary potential space domain sample) is mapped together with the generator G in the X domain. Y and the encoder E X Calculate the cycle-consistent loss used to reconstruct the ridgeline and valleyline map x. (i.e., the first cycle-consistent loss function), through the generator G X and the encoder E Y Calculate the latent spatial domain sample Z Y Cyclic consistent loss of (i.e., the original three-dimensional terrain potential spatial domain sample) (i.e., the second cycle-consistent loss function).
[0098] It should be understood that the cycle-consistent loss is obtained by using the generator and encoder for samples from the 3D topographic map domain and the latent spatial domain, respectively.
[0099] Specifically, in CycleGAN, cycle consistency encourages mapping while ignoring auxiliary noise in the latent spatial domain samples, resulting in a forced many-to-one mapping between ridgeline, valleyline, and 3D topographic domains. This invention introduces a boundary on the conditional log-likelihood to mitigate this degradation. The ridgeline and valleyline map x (i.e., the original boundary topographic map) in the X domain and the reconstructed latent spatial domain sample Z... Y Cyclic consistent loss resulting from auxiliary noise in (i.e., the original three-dimensional terrain latent spatial domain sample) (i.e., the first cycle-consistent loss function) and (That is, the second cyclic consistent loss function) is determined by the following two equations, where |||1 represents the first normal form:
[0100]
[0101]
[0102] Similarly, for the sample Z in the Y domain × latent spatial domain... XTo X domain × potential spatial domain sample Z Y Direction, reconstruct the 3D topographic map y in the Y domain (i.e., the original 3D topographic map) and reconstruct the potential spatial domain sample Z. X The cycle-consistent loss generated by auxiliary noise in (i.e., the original boundary potential spatial domain sample) (i.e., the third cyclic consistent loss function) and (i.e., the fourth cyclic consistent loss function) is determined by the following two equations:
[0103]
[0104]
[0105] It should be understood that for samples Z of the X domain × potential spatial domain... Y Sample Z from Y domain × potential spatial domain X All losses in the training direction are optimized holistically.
[0106] Specifically, X domain × potential spatial domain sample Z Y Sample Z from Y domain × latent spatial domain X The orientation optimization value function is based on the loss function L1 of CycleGAN. The improved loss function L1 in the CycleGAN model includes samples from the Y-domain and the latent space domain Z. X Edge matching loss (i.e., the first boundary edge matching loss function) and (i.e., the second boundary edge matching loss function), X domain and latent spatial domain samples Z Y Cyclic consistent loss (i.e., the first cycle-consistent loss function) and (That is, the second cycle-consistent loss function). The loss function L1 (that is, the first total loss function) is shown in the following equation:
[0107]
[0108] Where λ1 and λ2 are samples Z from the X domain and the latent spatial domain, respectively. Y The weighting coefficients of the cycle-consistent loss function are adjusted to achieve the minimum loss.
[0109] Specifically, the sample Z of the Y domain × potential spatial domain X To X domain × potential spatial domain sample Z Y The directional loss function L2 includes samples from the X domain and the latent spatial domain Z. Y Edge matching loss (i.e., the first 3D terrain edge matching loss function) and (i.e. the second three-dimensional terrain edge matching loss function), Y domain and latent space domain sample Z X on the cycle consistency loss (i.e. the third cycle consistency loss function) and (i.e. the fourth cycle consistency loss function), the loss function L2 (i.e. the second total loss function) is as follows:
[0110]
[0111] Wherein, λ3 and λ4 are the weight coefficients of the cycle consistency loss function on the Y domain and latent space domain sample Z X , respectively, the adjustment ratio is to achieve the minimum loss.
[0112] Specifically, while training the model for the two targets, the overall optimization function (i.e. the target optimization loss function) is optimized according to the loss function L1 (i.e. the first total loss function) and L2 (i.e. the second total loss function) in the two directions in the cycle iteration process, and the overall optimization function (i.e. the target optimization loss function) is as follows:
[0113]
[0114] In the above embodiment, the target optimization loss function is obtained by analyzing the loss function of the original terrain map, the original latent space domain sample, the original mapped terrain map, the mapped latent space domain sample, the target terrain map and the target latent space domain sample by the generator, the discriminator and the discriminator. The problem of forced many-to-one mapping in the mutual mapping between the ridge line, valley line domain and three-dimensional terrain domain is solved, the problems of lack of user control in generating terrain, difficulty in prediction, need for a large number of operations and appearance of regular grid-like artifacts in generated terrain are solved, manual intervention is not required, manpower and resources are saved, real structured conditional distribution can be accurately captured, and the problem of optimization cycle consistency barrier is solved.
[0115] Optionally, as an embodiment of the present application, the discriminator includes a discriminator D Y , and the discriminator includes a discriminator
[0116] The process of calculating the boundary edge matching loss function by the generator G X , the discriminator and the discriminator on all the original boundary line terrain maps, all the original three-dimensional terrain maps, the original boundary line latent space domain samples of all the original terrain maps, the boundary line mapped latent space domain samples and the original three-dimensional terrain latent space domain samples of all the original three-dimensional terrain maps includes:
[0117] Based on the generator GX Based on the original boundary topographic maps and the original three-dimensional topographic potential spatial domain samples of each original boundary topographic map, a first mapped topographic map of each original boundary topographic map is obtained; based on the discriminator D Y The method involves predicting the first and second predicted values of each original 3D topographic map based on the original 3D topographic map and the first mapped topographic map of the original boundary topographic map, respectively. The logarithm of the first predicted value of each original 3D topographic map is then calculated to obtain the first logarithmic value of each original 3D topographic map. The second predicted value of each original 3D topographic map is then complemented to obtain the first complementary value of each original 3D topographic map. The logarithm of the first complementary value of each original 3D topographic map is then calculated to obtain the second logarithmic value of each original 3D topographic map. The expected values of the first and second logarithmic values of each original 3D topographic map are then calculated to obtain the first and second expected values of the original 3D topographic map. Finally, the first and second expected values of the original 3D topographic map are summed to obtain the first boundary edge matching loss function.
[0118] Based on the discriminator Based on the original boundary potential spatial domain samples and boundary mapping potential spatial domain samples of each original boundary topographic map, predictions are made to obtain the third and fourth predicted values of each original boundary topographic map. The logarithm of the third predicted value of each original boundary topographic map is calculated to obtain the third logarithmic value of each original boundary topographic map. The fourth predicted value of each original boundary topographic map is then complemented to obtain the second complementary value of each original boundary topographic map. The logarithm of the second complementary value of each original boundary topographic map is then calculated to obtain the fourth logarithmic value of each original boundary topographic map. The expected values of the third and fourth logarithmic values of each original boundary topographic map are then calculated to obtain the third and fourth expected values. Finally, the third and fourth expected values are summed to obtain the second boundary edge matching loss function.
[0119] It should be understood that the discriminator D in the Y domain Y (i.e., the discriminator D) Y ) and the generator G X Calculate the edge matching loss in the Y domain (i.e., the first boundary edge matching loss function), through the latent spatial domain samples Z X The discriminator (i.e., the original boundary potential space domain sample) The encoder E X and the generator G XCalculate the latent spatial domain sample Z X Edge matching loss (i.e., the second boundary edge matching loss function).
[0120] Specifically, the Y-domain (i.e., the original 3D topographic map) and the potential spatial domain sample Z are calculated. X Edge matching loss on (i.e., the original boundary potential spatial domain samples). Based on the edge matching loss function... (i.e., the first boundary edge matching loss function) constrained discriminator D Y (i.e., the discriminator D) Y ) and the generator G X In the X and Z domains Y To the Y domain and Z X Consistency of image feature attributes. Edge matching loss function. (That is, the second boundary edge matching loss function) serves as the regularizer for the encoder, stimulating the edge-coding distribution to match simple priors. Edge matching loss function (i.e., the first boundary edge matching loss function) and edge matching loss function (That is, the second boundary edge matching loss function) is as follows:
[0121]
[0122]
[0123] Where E represents the mathematical expectation, data(x) is the actual ridgeline and valley line map (i.e., the actual boundary topographic map), data(y) is the actual 3D topographic map, and P... data Represents the data distribution. p(Z) X Z is a latent spatial domain sample. X (i.e., the original boundary potential spatial domain sample) marginalization distribution matching prior, p(Z) Y Z is a latent spatial domain sample. Y (i.e., the original three-dimensional terrain potential spatial domain sample) marginalized distribution matching prior. Mathematical expectation representing the distribution of real 3D topographic map data. Representing the true ridgeline, valleyline maps (i.e., the true boundary topographic maps) and potential spatial domain sample Z. Y The mathematical expectation of the data distribution (i.e., the original three-dimensional terrain potential spatial domain sample) together with the data. X (x) represents the input generator G of the ridgeline and valley line map (i.e., the original boundary topographic map). X Generate pseudo-3D terrain maps, D Y(y) is a discriminator that determines whether an image mapped to the Y domain possesses features in the Y domain. The output value [0, 1] represents the probability that the input comes from real data. D Y (G X (x,Z Y )) represents the generated 3D topographic map sample, in the discriminator D Y In the X domain, the ridgeline and valley line map x (i.e., the original boundary topographic map) and the potential spatial domain sample Z are distinguished. Y The probability of whether the auxiliary noise in the original three-dimensional terrain potential spatial domain sample (i.e., the original three-dimensional terrain potential spatial domain sample) is mapped to the three-dimensional terrain map sample generated in the Y domain comes from real data. The map representing the true ridgeline and valley line (i.e., the true boundary topographic map) in the potential spatial domain sample Z X The marginalization distribution of the sample (i.e., the original boundary potential spatial domain sample) matches the mathematical expectation of the prior. Representing the true ridgeline and valley line maps (i.e., the true boundary topographic maps) and the potential spatial domain sample Z Y The mathematical expectation of the data distribution that works together. Z represents the latent spatial domain sample X Discriminator on (i.e., the original three-dimensional terrain potential spatial domain sample) Discrimination of latent spatial domain samples. Z represents the latent spatial domain sample X Discriminator on (i.e., the original three-dimensional terrain potential spatial domain sample) Discrimination of latent spatial domain samples.
[0124] In the above embodiments, the first boundary edge matching loss function and the second boundary edge matching loss function are calculated by the generator, discriminator and distinguisher for the boundary edge matching loss function of the original boundary topographic map, the original three-dimensional topographic map, the original boundary latent spatial domain sample, the boundary mapping latent spatial domain sample and the original three-dimensional topographic latent spatial domain sample. This can constrain the consistency of the discriminator and the generator in the in-photon image feature attributes and encourage the edge coding distribution to match the simple prior.
[0125] Optionally, as an embodiment of the present invention, the discriminator includes discriminator D. X The discriminator includes a discriminator.
[0126] The generator G Y, the discriminator and the authenticator perform the calculation of the three-dimensional terrain edge matching loss function on all the original boundary line terrain maps, all the original three-dimensional terrain maps, all the original boundary line terrain latent space domain samples of the original boundary line terrain maps, all the original three-dimensional terrain latent space domain samples of the original three-dimensional terrain maps and the three-dimensional terrain mapping latent space domain samples, to obtain the process of obtaining the first three-dimensional terrain edge matching loss function and the second three-dimensional terrain edge matching loss function:
[0127] based on the generator G Y , respectively according to the original boundary line terrain latent space domain samples of each original boundary line terrain map and each original three-dimensional terrain map, to obtain the second mapping terrain map of each original three-dimensional terrain map; based on the discriminator D X , respectively according to each original boundary line terrain map and the second mapping terrain map of each original three-dimensional terrain map, to obtain the fifth prediction value and the sixth prediction value of each original boundary line terrain map; respectively calculate the logarithm of the fifth prediction value of each original boundary line terrain map, to obtain the fifth logarithm value of each original boundary line terrain map; respectively calculate the complement of the sixth prediction value of each original boundary line terrain map, to obtain the third complement value of each original boundary line terrain map; respectively calculate the logarithm of the third complement value of each original boundary line terrain map, to obtain the sixth logarithm value of each original boundary line terrain map; respectively calculate the mathematical expectation of the fifth logarithm value and the sixth logarithm value of each original boundary line terrain map, to obtain the fifth expectation value and the sixth expectation value; process the fifth expectation value and the sixth expectation value by sum, to obtain the first three-dimensional terrain edge matching loss function;
[0128] based on the authenticator , respectively according to the original three-dimensional terrain latent space domain samples and the three-dimensional terrain mapping latent space domain samples of each original three-dimensional terrain map, to obtain the seventh prediction value and the eighth prediction value of each original three-dimensional terrain map; respectively calculate the logarithm of the seventh prediction value of each original three-dimensional terrain map, to obtain the seventh logarithm value of each original three-dimensional terrain map; respectively calculate the complement of the eighth prediction value of each original three-dimensional terrain map, to obtain the fourth complement value of each original three-dimensional terrain map; respectively calculate the logarithm of the fourth complement value of each original three-dimensional terrain map, to obtain the eighth logarithm value of each original three-dimensional terrain map; respectively calculate the mathematical expectation of the seventh logarithm value and the eighth logarithm value of each original three-dimensional terrain map, to obtain the seventh expectation value and the eighth expectation value; process the seventh expectation value and the eighth expectation value by sum, to obtain the second three-dimensional terrain edge matching loss function.
[0129] It should be understood that, for Y domain x latent space domain sample Z XTo X domain × potential spatial domain sample Z Y Direction, X domain (i.e., the original boundary topographic map) and potential spatial domain sample Z Y The edge matching loss on (i.e., the original 3D terrain latent spatial domain sample) defines a similar loss function. (i.e., the first 3D terrain edge matching loss function) and (That is, the second three-dimensional terrain edge matching loss function) is shown in the following two equations:
[0130]
[0131]
[0132] In the above embodiments, through generator G Y The discriminator and the evaluator calculate the first and second three-dimensional terrain edge matching loss functions for the original boundary topographic map, the original three-dimensional topographic map, the original boundary latent spatial domain sample, the original three-dimensional terrain latent spatial domain sample, and the three-dimensional terrain mapping latent spatial domain sample. These functions can constrain the consistency of the discriminator and the generator in the in-pilot image feature attributes and encourage the edge coding distribution to match simple priors.
[0133] Optionally, as another embodiment of the present invention, the present invention introduces two potential spatial domain samples. When performing domain adaptation on the unpaired feature line map dataset and the 3D terrain map dataset, missing information is captured, many-to-many mapping is performed, and multi-style 3D terrain maps are generated.
[0134] Alternatively, as another embodiment of the present invention, the neural network model of the present invention, which reflects the terrain morphology, can serve as a general framework for three-dimensional terrain representation and can be used for multi-style three-dimensional terrain reconstruction.
[0135] Optionally, as another embodiment of the present invention, the present invention uses an improved cycle GAN model to generate a three-dimensional topographic map. A dataset of plotted ridgelines and valley lines is used as the X domain, and a dataset of three-dimensional topographic maps is used as the Y domain. Simultaneously, two latent spatial domain samples Z with standard Gaussian priors are introduced. X Z Y The training process of CycleGAN is extended to an expanded space. Samples from the latent space domain are used cyclically on the original domain to assist in learning many-to-many mappings. During this process, edge matching loss and cycle consistency loss are calculated separately. Overall optimization is performed by optimizing the value function. Once a threshold is set, the model can be used to generate multi-style 3D terrain maps.
[0136] Optionally, as another embodiment of the present invention, the present invention uses an improved cycle GAN model to generate multi-style 3D topographic maps. A dataset of plotted ridgelines and valley lines is used as the X domain, and a 3D topographic map dataset is used as the Y domain. Simultaneously, two latent spatial domain samples with standard Gaussian priors are introduced to extend the training process of cycleGAN to an expanded space. The latent spatial domain samples are cyclically used on the original domain to assist in learning many-to-many mappings, and they can capture any missing information. An encoder E is introduced. X The latent spatial domain samples for generating the dataset of plotted ridgelines and valley lines are Z. X Introducing encoder E Y The latent spatial domain samples for generating the 3D topographic map dataset are Z. Y X domain plus latent spatial domain sample Z Y Add latent spatial domain samples Z to the Y domain X Direction via generator G X Samples Z from the X domain and the potential spatial domain Y The auxiliary noise is mapped together with the Y domain, and three-dimensional terrain samples are generated in the Y domain. Subsequently, the ridgeline and valley lines of the X region were plotted, along with three-dimensional terrain samples. via encoder E X Generate latent spatial domain samples And through the discriminator D in the Y domain Y and generator G X Calculate the edge matching loss in the Y domain Through latent spatial domain sample Z X Discriminator Encoder E X and generator G X Calculate the latent spatial domain sample Z X Edge matching loss Through generator G Y Generate 3D terrain samples in the Y domain and encoder E X Generated latent spatial domain samples Together, they are mapped to the X domain to generate the ridgeline and valley line maps x′, and the ridgeline and valley line maps x′ are reconstructed. Simultaneously, encoder E... Y Generate 3D terrain samples from the ridgeline and valley lines in the X domain and the x and Y domains. Generate and return latent spatial domain sample Z′ Y For latent spatial domain samples Z Y Reconstruction is performed using generator G. X Samples Z from the Y domain and the latent spatial domain X Generator G in the X domain mapped together with auxiliary noise Y and encoder E XCalculate the loss used to reconstruct the ridgeline and valleyline map x. Through generator G X and encoder E Y Calculate the latent spatial domain sample Z Y loss For samples Z in the X domain × potential spatial domain Y Sample Z from Y domain × potential spatial domain X The overall loss is optimized across all directions. Y domain × latent spatial domain sample Z X To X domain × potential spatial domain sample Z Y The direction is set, similar targets are identified, and the model pair is trained for both targets simultaneously until the loop iteration ends. The trained model is then used for multi-style 3D terrain generation.
[0137] Optionally, as another embodiment of the present invention, terrain features are important characteristics of the spatial distribution of terrain. Ridge lines and valley lines are important terrain features that effectively reflect the morphology of ground undulations and the skeletal structure of the terrain, providing a reliable basis for selecting ridge line and valley line maps to generate multi-style 3D terrain maps. In reality, finding strictly corresponding images in two domains is quite difficult. By improving the CycleGAN model and introducing two latent spatial domain samples, auxiliary noise from the latent spatial domain samples is used cyclically during the mapping process between the ridge line / valley line domain and the 3D terrain map domain. By marginalizing auxiliary variables, multi-style 3D terrain maps are generated.
[0138] Alternatively, as another embodiment of the present invention, the Y-domain × latent spatial domain sample Z of the present invention X To X domain × potential spatial domain sample Z Y The direction is set, similar targets are set, and the model is trained for both targets simultaneously until the end of the loop iteration. The trained model is then used for multi-style 3D terrain generation.
[0139] Figure 3 This is a block diagram of a three-dimensional terrain generation device provided in an embodiment of the present invention.
[0140] Alternatively, as another embodiment of the present invention, such as Figure 3 As shown, a three-dimensional terrain generation device includes:
[0141] The building blocks are used to build encoders, generators, discriminators, and distinguishers;
[0142] The encoding module is used to import multiple original topographic maps and encode each original topographic map separately using the encoder to obtain the original potential spatial domain samples of each original topographic map.
[0143] The original topographic map training module is configured to train each of the original topographic maps and original latent space domain samples of each of the original topographic maps by the encoder and the generator respectively to obtain original mapping topographic maps of each of the original topographic maps and mapping latent space domain samples.
[0144] The mapping topographic map training module is configured to train each of the original topographic maps, original mapping topographic maps of each of the original topographic maps and mapping latent space domain samples by the encoder and the generator respectively to obtain target topographic maps of each of the original topographic maps and target latent space domain samples.
[0145] The loss function analysis module is configured to perform loss function analysis on all of the original topographic maps, original latent space domain samples of all of the original topographic maps, original mapping topographic maps, mapping latent space domain samples, target topographic maps and target latent space domain samples by the generator, the discriminator and the discriminator to obtain a target optimization loss function.
[0146] The parameter updating module is configured to perform parameter updating on the encoder, the generator, the discriminator and the discriminator respectively according to the target optimization loss function to obtain an updated encoder, an updated generator, an updated discriminator and an updated discriminator.
[0147] The topographic generation result obtaining module is configured to import a to-be-generated topographic map and perform three-dimensional topographic generation on the to-be-generated topographic map by the updated encoder, the updated generator, the updated discriminator and the updated discriminator to obtain a three-dimensional topographic generation result.
[0148] Optionally, another embodiment of the present application provides a three-dimensional topographic generation system, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the three-dimensional topographic generation method as described above is realized. The system can be a computer or the like.
[0149] Optionally, another embodiment of the present application provides a computer readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the three-dimensional topographic generation method as described above is realized.
[0150] It should be noted that, in the specification, the terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply there is any such actual relationship or order between these entities or operations. In addition, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device.
[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
[0152] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0153] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment of the present application.
[0154] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0155] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0156] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method of generating a three-dimensional terrain, characterized by, The method comprises the following steps: constructing an encoder, a generator, a discriminator and a verifier; importing a plurality of original topographic maps and encoding each of the original topographic maps through the encoder to obtain original latent space domain samples of each of the original topographic maps; training each of the original topographic maps and the original latent space domain samples of each of the original topographic maps through the encoder and the generator to obtain original mapped topographic maps and mapped latent space domain samples of each of the original topographic maps; training each of the original topographic maps, the original mapped topographic maps and the mapped latent space domain samples of each of the original topographic maps through the encoder and the generator to obtain target topographic maps and target latent space domain samples of each of the original topographic maps; performing loss function analysis on all of the original topographic maps, the original latent space domain samples, the original mapped topographic maps, the mapped latent space domain samples, the target topographic maps and the target latent space domain samples of all of the original topographic maps through the generator, the discriminator and the verifier to obtain a target optimization loss function; updating the parameters of the encoder, the generator, the discriminator and the verifier according to the target optimization loss function to obtain an updated encoder, an updated generator, an updated discriminator and an updated verifier; importing a to-be-generated topographic map and generating a three-dimensional terrain of the to-be-generated topographic map through the updated encoder, the updated generator, the updated discriminator and the updated verifier to obtain a three-dimensional terrain generation result; The original topographic map includes an original boundary line topographic map and an original three-dimensional topographic map corresponding to the original boundary line topographic map, and the encoder includes an encoder and an encoder , the process of encoding each of the original topographic maps through the encoder to obtain original latent space domain samples of each of the original topographic maps comprises: by the encoder Encode each of the original boundary line topographic map and the original three-dimensional topographic map corresponding to each of the original boundary line topographic map respectively to obtain original boundary line latent space domain samples of each of the original boundary line topographic map. by the encoder Encode each of the original boundary line topographic map and the original three-dimensional terrain map corresponding to each of the original boundary line topographic map respectively to obtain an original three-dimensional terrain latent space domain sample of each of the original three-dimensional terrain map. the original latent space domain samples of the original topographic maps comprise original boundary line latent space domain samples of the original boundary line topographic maps and original three-dimensional terrain latent space domain samples of the original three-dimensional topographic maps; The generator comprises a generator and a generator , the process of training each of the original topographic maps and the original latent space domain samples of each of the original topographic maps through the encoder and the generator to obtain original mapped topographic maps and mapped latent space domain samples of each of the original topographic maps comprises: by the generator mapping the original three-dimensional terrain potential space domain samples of each of the original boundary line topographic maps and each of the original three-dimensional topographic maps respectively to obtain original three-dimensional mapping topographic maps of each of the original three-dimensional topographic maps; by the encoder encoding the original three-dimensional mapping topography of each of the original three-dimensional topography maps and each of the original boundary line topography maps respectively to obtain boundary line mapping latent space domain samples of each of the original boundary line topography maps; by the generator mapping the original boundary line latent space domain samples of each of the original three-dimensional terrain maps and each of the original boundary line terrain maps respectively to obtain original boundary line mapped terrain maps of each of the original boundary line terrain maps; by the encoder encoding the original demarcation line mapping topographic map of each of the original demarcation line topographic maps, to obtain a three-dimensional topographic mapping latent space domain sample of each of the original three-dimensional topographic maps; the original mapped topographic maps of the original topographic maps comprise original boundary line mapped topographic maps of the original boundary line topographic maps and original three-dimensional mapped topographic maps of the original three-dimensional topographic maps; the mapped latent space domain samples of the original topographic maps comprise boundary line mapped latent space domain samples of the original boundary line topographic maps and three-dimensional terrain mapped latent space domain samples of the original three-dimensional topographic maps; the process of training each of the original topographic maps, the original mapped topographic maps and the mapped latent space domain samples of each of the original topographic maps through the encoder and the generator to obtain target topographic maps and target latent space domain samples of each of the original topographic maps comprises: by the generator mapping the original three-dimensional mapping topographic map of each of the original three-dimensional topographic maps and the boundary line mapping potential space domain samples of the original boundary line topographic maps, respectively, to obtain target boundary line topographic maps of the original boundary line topographic maps; by the encoder encoding the original three-dimensional mapping topography of each of the original three-dimensional topography maps and each of the original boundary line topography maps respectively to obtain target three-dimensional topography latent space samples of each of the original three-dimensional topography maps; by the generator mapping the original boundary line mapping topographic map of each of the original boundary line topographic map and the three-dimensional terrain mapping potential space domain sample of each of the original three-dimensional topographic map, to obtain the target three-dimensional topographic map of each of the original three-dimensional topographic map; by the encoder encoding the original demarcation line mapping topographic map of each of the original demarcation line topographic maps, to obtain target demarcation line latent space samples of each of the original demarcation line topographic maps; the target topographic maps of the original topographic maps comprise target boundary line topographic maps of the original boundary line topographic maps and target three-dimensional topographic maps of the original three-dimensional topographic maps; The target latent space domain sample of the original terrain map includes a target three-dimensional terrain latent space domain sample of the original three-dimensional terrain map and a target boundary line latent space domain sample of the original boundary line terrain map; The process of loss function analysis on all the original terrain maps, original latent space domain samples of all the original terrain maps, original mapping terrain maps, mapping latent space domain samples, target terrain maps and target latent space domain samples by the generator, the discriminator and the discriminator includes: by the generator , the discriminator and the discriminator to all the original boundary line topographic maps, all the original three-dimensional topographic maps, all the original boundary line potential space domain samples of the original topographic maps, boundary line mapping potential space domain samples and all the original three-dimensional topographic potential space domain samples of the original three-dimensional topographic maps. The calculation of the boundary line edge matching loss function is obtained. The first boundary line edge matching loss function and the second boundary line edge matching loss function are obtained. by the generator , the discriminator and the discriminator to all the original boundary line topographic maps, all the original three-dimensional topographic maps, all the original boundary line potential space domain samples of the original topographic maps, all the original three-dimensional topographic potential space domain samples of the original three-dimensional topographic maps and three-dimensional topographic mapping potential space domain samples. The first absolute value sum of all the first absolute values of the original boundary line terrain maps is obtained by summing all the first absolute values of the original boundary line terrain maps, and the mathematical expectation of the first absolute value sum is calculated to obtain the first cyclic consistent loss function. The second absolute value sum of all the second absolute values of the original three-dimensional terrain maps is obtained by summing all the second absolute values of the original three-dimensional terrain maps, and the mathematical expectation of the second absolute value sum is calculated to obtain the second cyclic consistent loss function. The third absolute value sum of all the third absolute values of the original three-dimensional terrain maps is obtained by summing all the third absolute values of the original three-dimensional terrain maps, and the mathematical expectation of the third absolute value sum is calculated to obtain the third cyclic consistent loss function. The fourth absolute value sum of all the fourth absolute values of the original boundary line terrain maps is obtained by summing all the fourth absolute values of the original boundary line terrain maps, and the mathematical expectation of the fourth absolute value sum is calculated to obtain the fourth cyclic consistent loss function. The fourth absolute value sum of all the fourth absolute values of the original boundary line terrain maps is obtained by summing all the fourth absolute values of the original boundary line terrain maps, and the mathematical expectation of the fourth absolute value sum is calculated to obtain the fourth cyclic consistent loss function. The first weight coefficient and the second weight coefficient are introduced, and the first cyclic consistency loss function is multiplied by the first weight coefficient to obtain a first product; the second cyclic consistency loss function is multiplied by the second weight coefficient to obtain a second product; the first boundary line edge matching loss function, the second boundary line edge matching loss function, the first product, and the second product are summed to obtain a first total loss function; The third weight coefficient and the fourth weight coefficient are introduced, and the third cyclic consistency loss function is multiplied by the third weight coefficient to obtain a third product; the fourth cyclic consistency loss function is multiplied by the fourth weight coefficient to obtain a fourth product; the first three-dimensional terrain edge matching loss function, the second three-dimensional terrain edge matching loss function, the third product, and the fourth product are summed to obtain a second total loss function; Based on the first formula, the target optimization loss function is calculated according to the first total loss function and the second total loss function, and the target optimization loss function is obtained, wherein the first formula is: , wherein, is a target optimization loss function, is a first total loss function, is a second total loss function.
2. The three-dimensional terrain generation method of claim 1, wherein, The discriminator includes a discriminator The discriminator includes a discriminator , the generator the discriminator and the discriminator to all the original boundary line topography, all the original three-dimensional topography, all the original boundary line latent space domain samples of the original topography, boundary line mapping latent space domain samples and all the original three-dimensional topography of the original three-dimensional topography latent space domain samples, the process of calculating the boundary line edge matching loss function, obtaining the first boundary line edge matching loss function and the second boundary line edge matching loss function includes: based on the generator , respectively according to each of the original boundary line terrain map and the original three-dimensional terrain potential space domain sample of each of the original three-dimensional terrain map, a first mapping terrain map of each of the original boundary line terrain map is obtained; based on the discriminator , respectively according to each of the original three-dimensional terrain map and the first mapping terrain map of the original boundary line terrain map, a first prediction value and a second prediction value of each of the original three-dimensional terrain map are obtained; the logarithm of the first prediction value of each of the original three-dimensional terrain map is calculated respectively to obtain a first logarithm value of each of the original three-dimensional terrain map; the second prediction value of each of the original three-dimensional terrain map is calculated respectively to obtain a first complementary value of each of the original three-dimensional terrain map; the logarithm of the first complementary value of each of the original three-dimensional terrain map is calculated respectively to obtain a second logarithm value of each of the original three-dimensional terrain map; the mathematical expectation of the first logarithm value and the second logarithm value of each of the original three-dimensional terrain map is calculated respectively to obtain a first expectation value and a second expectation value of the original three-dimensional terrain map; the first expectation value and the second expectation value of the original three-dimensional terrain map are summed to obtain a first boundary line edge matching loss function; based on the discriminator , respectively according to the original boundary line latent space domain sample and the boundary line mapping latent space domain sample of each original boundary line topographic map, to obtain third prediction values and fourth prediction values of each original boundary line topographic map; respectively calculate the logarithm of the third prediction value of each original boundary line topographic map to obtain third logarithm values of each original boundary line topographic map; respectively calculate the complement of the fourth prediction value of each original boundary line topographic map to obtain second complementary values of each original boundary line topographic map; respectively calculate the logarithm of the second complementary value of each original boundary line topographic map to obtain fourth logarithm values of each original boundary line topographic map; respectively calculate the mathematical expectation of the third logarithm value and the fourth logarithm value of each original boundary line topographic map to obtain third expectation values and fourth expectation values; sum the third expectation values and the fourth expectation values to obtain a second boundary line edge matching loss function.
3. The three-dimensional terrain generation method of claim 1, wherein, The discriminator includes a discriminator The discriminator includes a discriminator , the generator the discriminator and the discriminator to all the original boundary line topographic maps, all the original three-dimensional topographic maps, all the original boundary line potential space domain samples of the original topographic maps, all the original three-dimensional topographic potential space domain samples of the original three-dimensional topographic maps, and the three-dimensional topographic mapping potential space domain samples, a process of calculating a three-dimensional topographic edge matching loss function, obtaining a first three-dimensional topographic edge matching loss function and a second three-dimensional topographic edge matching loss function, includes: based on the generator , respectively according to the original three-dimensional terrain map and the original boundary line potential space domain sample of each original boundary line terrain map, a second mapping terrain map of each original three-dimensional terrain map is obtained; based on the discriminator , respectively according to each original boundary line terrain map and the second mapping terrain map of each original three-dimensional terrain map, a fifth predicted value and a sixth predicted value of each original boundary line terrain map are obtained; the logarithm of the fifth predicted value of each original boundary line terrain map is calculated respectively to obtain a fifth logarithmic value of each original boundary line terrain map; the sixth predicted value of each original boundary line terrain map is complemented respectively to obtain a third complementary value of each original boundary line terrain map; the logarithm of the third complementary value of each original boundary line terrain map is calculated respectively to obtain a sixth logarithmic value of each original boundary line terrain map; the mathematical expectation of the fifth logarithmic value and the sixth logarithmic value of each original boundary line terrain map is calculated respectively to obtain a fifth expected value and a sixth expected value; the fifth expected value and the sixth expected value are summed to obtain a first three-dimensional terrain edge matching loss function; based on the discriminator , respectively according to the original three-dimensional terrain potential space domain sample of each original three-dimensional terrain map and the three-dimensional terrain mapping potential space domain sample, obtain the seventh prediction value and the eighth prediction value of each original three-dimensional terrain map; respectively calculate the logarithm of the seventh prediction value of each original three-dimensional terrain map, obtain the seventh logarithm value of each original three-dimensional terrain map; respectively calculate the complement of the eighth prediction value of each original three-dimensional terrain map, obtain the fourth complement value of each original three-dimensional terrain map; respectively calculate the logarithm of the fourth complement value of each original three-dimensional terrain map, obtain the eighth logarithm value of each original three-dimensional terrain map; respectively calculate the mathematical expectation of the seventh logarithm value and the eighth logarithm value of each original three-dimensional terrain map, obtain the seventh expectation value and the eighth expectation value; sum process the seventh expectation value and the eighth expectation value, obtain the second three-dimensional terrain edge matching loss function.
4. A three-dimensional terrain generation apparatus characterized by comprising: Comprise: The construction module is used for constructing an encoder, a generator, a discriminator, and a verifier. The encoding module is used for introducing a plurality of original terrain maps, and encoding each original terrain map through the encoder to obtain an original latent space domain sample of each original terrain map. The original terrain map training module is used for training each original terrain map and the original latent space domain sample of each original terrain map through the encoder and the generator to obtain an original mapping terrain map and a mapping latent space domain sample of each original terrain map. The mapping terrain map training module is used for training each original terrain map, the original mapping terrain map, and the mapping latent space domain sample of each original terrain map through the encoder and the generator to obtain a target terrain map and a target latent space domain sample of each original terrain map. The loss function analysis module is used for performing loss function analysis on all original terrain maps, original latent space domain samples, original mapping terrain maps, mapping latent space domain samples, target terrain maps, and target latent space domain samples through the generator, the discriminator, and the verifier to obtain a target optimization loss function. The parameter updating module is used for updating the parameters of the encoder, the generator, the discriminator, and the verifier according to the target optimization loss function to obtain an updated encoder, an updated generator, an updated discriminator, and an updated verifier. The terrain generation result obtaining module is used for introducing a to-be-generated terrain map, and generating a three-dimensional terrain through the updated encoder, the updated generator, the updated discriminator, and the updated verifier to obtain a three-dimensional terrain generation result. The original topographic map includes an original boundary line topographic map and an original three-dimensional topographic map corresponding to the original boundary line topographic map, and the encoder includes an encoder and an encoder , In the encoding module, the process that the encoder encodes each original terrain map respectively to obtain original latent space domain samples of each original terrain map includes: by the encoder respectively, each of the original boundary line topographic maps and the original three-dimensional topographic maps corresponding to each of the original boundary line topographic maps are encoded to obtain original boundary line latent space samples of each of the original boundary line topographic maps; by the encoder respectively, each of the original boundary line topographic maps and each of the original three-dimensional topographic maps corresponding to the original boundary line topographic maps is encoded to obtain an original three-dimensional topographic latent space domain sample of each of the original three-dimensional topographic maps; The original latent space domain samples of the original terrain map include original boundary line latent space domain samples of the original boundary line terrain map and original three-dimensional terrain latent space domain samples of the original three-dimensional terrain map; The generator comprises a generator and a generator , In the original terrain map training module, the process that the encoder and the generator train each original terrain map and original latent space domain samples of each original terrain map respectively to obtain original mapped terrain maps of each original terrain map and mapped latent space domain samples includes: by the generator mapping the original three-dimensional terrain potential space domain samples of each of the original boundary line topographic maps and each of the original three-dimensional topographic maps respectively to obtain original three-dimensional mapping topographic maps of each of the original three-dimensional topographic maps; by the encoder encoding the original three-dimensional mapping topography of each of the original three-dimensional topography maps and each of the original boundary line topography maps respectively to obtain boundary line mapping latent space domain samples of each of the original boundary line topography maps; by the generator mapping the original boundary line latent space domain samples of each of the original three-dimensional terrain maps and each of the original boundary line terrain maps respectively to obtain original boundary line mapped terrain maps of each of the original boundary line terrain maps; by the encoder encoding the original demarcation line mapping topographic map of each of the original demarcation line topographic maps, to obtain a three-dimensional topographic mapping latent space domain sample of each of the original three-dimensional topographic maps; The original mapped terrain maps of the original terrain map include original boundary line mapped terrain maps of the original boundary line terrain map and original three-dimensional mapped terrain maps of the original three-dimensional terrain map; The mapped latent space domain samples of the original terrain map include boundary line mapped latent space domain samples of the original boundary line terrain map and three-dimensional terrain mapped latent space domain samples of the original three-dimensional terrain map; In the mapped terrain map training module, the process that the encoder and the generator train each original terrain map, original mapped terrain maps and mapped latent space domain samples of each original terrain map respectively to obtain target terrain maps of each original terrain map and target latent space domain samples includes: by the generator mapping the original three-dimensional mapping topographic map of each of the original three-dimensional topographic maps and the boundary line mapping potential space domain samples of the original boundary line topographic maps, respectively, to obtain target boundary line topographic maps of the original boundary line topographic maps; by the encoder encoding the original three-dimensional mapping topography of each of the original three-dimensional topography maps and each of the original boundary line topography maps respectively to obtain target three-dimensional topography latent space samples of each of the original three-dimensional topography maps; by the generator mapping the original boundary line mapping topographic map of each of the original boundary line topographic map and the three-dimensional terrain mapping potential space domain sample of each of the original three-dimensional topographic map, to obtain the target three-dimensional topographic map of each of the original three-dimensional topographic map; by the encoder encoding the original demarcation line mapping topographic map of each of the original demarcation line topographic maps, to obtain target demarcation line latent space samples of each of the original demarcation line topographic maps; The target terrain maps of the original terrain map include target boundary line terrain maps of the original boundary line terrain map and target three-dimensional terrain maps of the original three-dimensional terrain map; The target latent space domain samples of the original terrain map include target three-dimensional terrain latent space domain samples of the original three-dimensional terrain map and target boundary line latent space domain samples of the original boundary line terrain map; In the loss function analysis module, the process that the generator, the discriminator and the discriminator perform loss function analysis on all original terrain maps, original latent space domain samples, original mapped terrain maps, mapped latent space domain samples, target terrain maps and target latent space domain samples of all original terrain maps to obtain a target optimization loss function includes: by the generator , the discriminator and the discriminator to all the original boundary line topographic maps, all the original three-dimensional topographic maps, all the original boundary line potential space domain samples of the original topographic maps, boundary line mapping potential space domain samples and all the original three-dimensional topographic potential space domain samples of the original three-dimensional topographic maps. The calculation of the boundary line edge matching loss function is obtained. The first boundary line edge matching loss function and the second boundary line edge matching loss function are obtained. by the generator , the discriminator and the discriminator to all the original boundary line topographic maps, all the original three-dimensional topographic maps, all the original boundary line potential space domain samples of the original topographic maps, all the original three-dimensional topographic potential space domain samples of the original three-dimensional topographic maps and three-dimensional topographic mapping potential space domain samples. The target boundary line terrain maps of each original boundary line terrain map are subtracted from the original boundary line terrain maps respectively to obtain first difference values of each original boundary line terrain map; absolute values of the first difference values of each original boundary line terrain map are calculated respectively to obtain first absolute values of each original boundary line terrain map; the first absolute values of all original boundary line terrain maps are summed to obtain a first absolute value sum; and a mathematical expectation of the first absolute value sum is calculated to obtain a first cyclic consistent loss function; respectively, to obtain second absolute values of the original three-dimensional terrain maps; and summing the second absolute values of all the original three-dimensional terrain maps to obtain a sum of second absolute values; and calculating a mathematical expectation of the sum of second absolute values to obtain a second cyclic consistent loss function; respectively, to obtain third absolute values of the original three-dimensional terrain maps; and summing the third absolute values of all the original three-dimensional terrain maps to obtain a sum of third absolute values; and calculating a mathematical expectation of the sum of third absolute values to obtain a third cyclic consistent loss function; respectively, to obtain fourth absolute values of the original boundary line terrain maps; and summing the fourth absolute values of all the original boundary line terrain maps to obtain a sum of fourth absolute values; and calculating a mathematical expectation of the sum of fourth absolute values to obtain a fourth cyclic consistent loss function; The first weight coefficient and the second weight coefficient are imported, and the first cyclic consistent loss function is multiplied by the first weight coefficient to obtain a first product; the second cyclic consistent loss function is multiplied by the second weight coefficient to obtain a second product; the first boundary line edge matching loss function, the second boundary line edge matching loss function, the first product, and the second product are summed to obtain a first total loss function; The third weight coefficient and the fourth weight coefficient are imported, and the third cyclic consistent loss function is multiplied by the third weight coefficient to obtain a third product; the fourth cyclic consistent loss function is multiplied by the fourth weight coefficient to obtain a fourth product; the first three-dimensional terrain edge matching loss function, the second three-dimensional terrain edge matching loss function, the third product, and the fourth product are summed to obtain a second total loss function; Based on the first formula, the target optimization loss function is calculated according to the first total loss function and the second total loss function, to obtain the target optimization loss function, and the first formula is: , wherein, is a target optimization loss function, is a first total loss function, is a second total loss function.
5. A three-dimensional terrain generation system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, the three-dimensional terrain generation method according to any one of claims 1 to 3 is realized.
6. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 5. When the computer program is executed by the processor, the three-dimensional terrain generation method according to any one of claims 1 to 3 is realized.
Citation Information
Patent Citations
Infinite terrain generation method, system, storage medium and terminal based on cGAN
CN109215123A
Abrasive particle morphology database creation method based on conditional generative adversarial network
CN110263192A