Topographic map generation method and device, equipment and storage medium
By dividing the color-coded map into regions and performing masking, and combining it with terrain cues to generate a terrain mask map, which is then input into a preset network model, the problems of low efficiency and insufficient accuracy in terrain map generation are solved, achieving efficient and accurate generation of complex terrain.
Patent Information
- Application Number
- CN202510738737.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-11-04
AI Technical Summary
Existing technologies have low efficiency in generating topographic maps, making it difficult to meet the needs of generating complex terrain, and their accuracy is low, with terrain orientation prone to significant deviations.
By acquiring color-coded maps, performing regional division and masking processes to generate terrain mask maps, and combining terrain cue words with a preset network model, a target terrain map is generated.
It improves the efficiency and accuracy of topographic map generation, and the relative orientation between topographic regions is accurate, which can meet the generation needs of complex terrain.
Smart Images

Figure CN120894445A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a terrain map generation method and device, equipment and storage medium. BACKGROUND
[0002] In the game development process, the terrain map is the core infrastructure for building a virtual world. Among them, the terrain map can define the movement rules and interaction boundaries of the player through physical properties such as terrain height, obstacle distribution, path planning, etc. Therefore, the generation of the terrain map is an important part of game development, which can diversify different scenes of the game and help enrich the visual experience of the player.
[0003] In related technologies, the terrain map is drawn by manual editing or directly generated based on a description text according to a large model. The former has low generation efficiency and is difficult to meet the generation needs of complex terrain, while the latter has low accuracy of the generated terrain map and the terrain orientation is prone to large deviation. SUMMARY
[0004] Embodiments of the present application provide a terrain map generation method, device, equipment and storage medium, which solves the problems of low generation efficiency of the terrain map in related technologies, difficulty to meet the generation needs of complex terrain, and low accuracy and large deviation of the terrain orientation, can distinguish different terrain regions by combining color annotation maps, and generate target terrain maps based on input terrain mask maps and terrain prompt words by using a preset network model, which has high generation efficiency and accuracy and accurate relative orientation between terrain regions, and can meet the generation needs of complex terrain.
[0005] In a first aspect, embodiments of the present application provide a terrain map generation method, which comprises: Obtaining a color annotation map, and dividing the color annotation map into a plurality of color regions according to different preset color categories to obtain a plurality of color regions; Mask processing the plurality of color regions to obtain a terrain mask map corresponding to the color annotation map; Querying a terrain region code corresponding to each mask region in the terrain mask map to obtain an associated terrain prompt word; Inputting the terrain mask map and the associated terrain prompt word into a preset network model trained to obtain a target terrain map.
[0006] In a second aspect, embodiments of the present application further provide a terrain map generation device, which comprises: A color region determination module configured to obtain a color annotation map, and divide the color annotation map into a plurality of color regions according to different preset color categories to obtain a plurality of color regions; a mask map generation module configured to perform mask processing on the plurality of color regions to obtain a terrain mask map corresponding to the color annotation map; a prompt word determination module configured to query a terrain region code corresponding to each mask region in the terrain mask map to obtain an associated terrain prompt word; a terrain map generation module configured to input the terrain mask map and the associated terrain prompt word into a preset network model trained to obtain a target terrain map.
[0007] In a third aspect, an apparatus for generating a terrain map is provided. The apparatus includes: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the terrain map generation method provided in the embodiments of the present application.
[0008] In a fourth aspect, a non-transitory storage medium storing computer executable instructions is provided. When the computer executable instructions are executed by a computer processor, the computer executable instructions are configured to perform the terrain map generation method provided in the embodiments of the present application.
[0009] In the embodiments of the present application, the color annotation map is divided into a plurality of color regions according to different preset color categories, and the plurality of color regions are subjected to mask processing to obtain a terrain mask map corresponding to the color annotation map, which can isolate and identify the spatial distribution of different terrains. The terrain region code corresponding to each mask region in the terrain mask map is queried to obtain an associated terrain prompt word, which can provide a detailed description of the terrain. The terrain mask map and the associated terrain prompt word are input into a preset network model trained to provide a clear structured input for the preset network model, so that the preset network model can output a target terrain map that meets the spatial layout requirements and has rich visual details. The above scheme can distinguish different terrain regions based on the color annotation map, and generate a target terrain map based on the input terrain mask map and terrain prompt word using the preset network model, which has high generation efficiency and accuracy, accurate relative positions between terrain regions, and can meet the generation requirements of complex terrains. BRIEF DESCRIPTION OF DRAWINGS
[0010] Figure 1 a flowchart of a terrain map generation method provided in the embodiments of the present application; Figure 2 a schematic diagram of a data processing process of a terrain map generation method provided in the embodiments of the present application; Figure 3A flowchart of a process of generating a target terrain map by using a preset network model is provided for the embodiments of the present application. Figure 4 A flowchart of a process of determining a terrain feature map based on a backbone network is provided for the embodiments of the present application. Figure 5 A flowchart of a training process of a preset network model is provided for the embodiments of the present application. Figure 6 A flowchart of a terrain map generation method including a process of determining a plurality of color regions is provided for the embodiments of the present application. Figure 7 A flowchart of a terrain map generation method including a process of determining a terrain mask map is provided for the embodiments of the present application. Figure 8 A flowchart of a terrain map generation method including a process of adjusting a target terrain map is provided for the embodiments of the present application. Figure 9 A structural block diagram of a terrain map generation apparatus is provided for the embodiments of the present application. Figure 10 A structural schematic diagram of a terrain map generation device is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0011] The embodiments of the present application will be further described below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, but not to limit the embodiments of the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the embodiments of the present application are shown in the drawings, but not all the structures.
[0012] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be exchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually a class, not limited to the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally indicates that the front and rear associated objects are in an "or" relationship.
[0013] The terrain map generation method provided by the embodiments of the present application can be executed by a computer device as the execution subject of each step, which refers to any electronic device with data computing, processing and storage capabilities, such as servers and other devices. The embodiments of the present application do not limit this.
[0014] Figure 1A flowchart of a topographic map generation method provided by an embodiment of the present application is shown in Figure 1 The topographic map generation method specifically includes the following steps: In step S101, a color-labeled map is obtained, and the color-labeled map is regionally divided according to different preset color categories to obtain a plurality of color regions.
[0015] The color-labeled map can be obtained by manually pre-painting colors in a blank region. Different color categories represent different terrains, and the region covered by each color category corresponds to the terrain region labeled by the corresponding color category. For example, red represents mountains, blue represents water, and green represents forests. Of course, the foregoing is only an example, and the color categories can be further refined, and other mapping relationships between color categories and terrain types can be set, which are not limited herein. Thus, relevant personnel can design different terrain layouts through simple color painting operations, thereby reducing the design threshold. The color-labeled map contains color regions corresponding to different preset color categories, so that the color categories contained in the color-labeled map can be identified, and the color-labeled map can be regionally divided according to different preset color categories to obtain a plurality of color regions, which is equivalent to distinguishing different terrain regions.
[0016] In step S102, the plurality of color regions are subjected to mask processing to obtain a topographic mask map corresponding to the color-labeled map.
[0017] Each preset color category can be pre-assigned a corresponding terrain region code. The mask processing can convert the pixel color value of each color region in the color-labeled map into a terrain region code, which is equivalent to forming an independent region identifier for each color region, thereby facilitating the isolation and identification of the spatial distribution of different terrains. For example, red represents mountains, and the corresponding terrain region code is 01; blue represents water, and the corresponding terrain region code is 02; and green represents forests, and the corresponding terrain region code is 03. The mask regions in the topographic mask map correspond one-to-one to the color regions in the color-labeled map, and different mask regions represent different terrains, which can provide accurate terrain division information for a preset network model.
[0018] In step S103, the terrain region code corresponding to each mask region in the topographic mask map is queried to obtain an associated terrain prompt word.
[0019] Each terrain region code can represent a type of terrain, and each type of terrain can be set with different terrain details according to the business requirements of the actual application scenario. Thus, the associated terrain prompt word can be determined according to the terrain region code involved in the terrain mask map, and the terrain prompt word can be a natural language text describing specific terrain details. For example, the terrain region code representing a forest is 02, and the corresponding terrain prompt word queried can be “a patch of pine trees”, “brown tree trunks”, “ground covered with pine needles”, “a small amount of rocks”, and the like. For another example, the terrain region code representing a water area is 03, and the corresponding terrain prompt word queried can be “a small pond”, “clear water”, “with lotus leaves and small fish”, “surrounded by weeds”, and the like. Of course, the foregoing terrain prompt words are only exemplary descriptions, and the developer can set the content of the terrain prompt word according to the business requirements of the actual application scenario for different terrain region codes, which is not limited herein. The developer can flexibly control the details of the terrain by modifying the terrain prompt word, which is suitable for various needs such as game scene design and virtual map generation. In addition, the terrain prompt word can provide the semantic details of the expected terrain for the preset network model, so that the preset network model can accurately understand and generate a terrain map consistent with the semantics, improving the semantic consistency of the generated result.
[0020] In step S104, the terrain mask map and the associated terrain prompt word are input into the trained preset network model to obtain a target terrain map.
[0021] The preset network model can be a diffusion model Stable Diffusion, an autoregressive model VQ-VAE2, or other custom neural network models, which are not limited herein. The trained preset network model can locate the spatial position of the terrain according to the input terrain mask map, and can generate a target terrain map meeting the business requirements in combination with the semantic details supplemented by the terrain prompt word.
[0022] The color annotation map is regionally divided according to different preset color categories to obtain a plurality of color regions, and the plurality of color regions are mask processed to obtain a topographic mask map corresponding to the color annotation map, so as to isolate and identify the spatial distribution of different terrains; the corresponding terrain region code of each mask region in the topographic mask map is queried to obtain an associated terrain prompt word, which can provide a detailed description of the terrain; the topographic mask map and the associated terrain prompt word are input into a preset network model trained to provide a clear structured input for the preset network model, so that the preset network model can output a target terrain map that meets the spatial layout requirements and has rich visual details. The above scheme can distinguish different terrain regions based on the color annotation map, and generate a target terrain map based on the input topographic mask map and terrain prompt word by using the preset network model, which has high generation efficiency and accuracy, and the relative positions between terrain regions are accurate, which can meet the generation requirements of complex terrains.
[0023] Figure 2 A schematic diagram of a data processing process of a terrain map generation method provided by an embodiment of the present application is shown in Figure 2 The color annotation map 201 is regionally divided according to different preset color categories to obtain a plurality of color regions 202, and the plurality of color regions 202 are mask processed to obtain a topographic mask map 203 corresponding to the color annotation map. Then, the corresponding terrain region code of each mask region in the topographic mask map is queried to obtain an associated terrain prompt word 204. Finally, the topographic mask map 203 and the associated terrain prompt word 204 are input into a preset network model 205 trained to obtain a target terrain map 206.
[0024] In one embodiment, Figure 3 A flowchart of a process of generating a target terrain map by using a preset network model provided by an embodiment of the present application. The preset network model can include a control network, a text encoder, a terrain rule module, a backbone network and a graph decoder. As shown in Figure 3 The specific process of inputting the topographic mask map and the associated terrain prompt word into the trained preset network model to obtain the target terrain map includes the following steps: Step S301, inputting the topographic mask map into the control network to obtain a spatial control vector, and inputting the associated terrain prompt word into the text encoder to obtain a text embedding vector.
[0025] The terrain mask map defines the basic spatial layout and structural constraints of the target terrain. The control network can encode the spatial structure, geometric shape, regional division, and other key information in the terrain mask map to obtain a high-dimensional spatial control vector, providing spatial skeleton and layout constraints for subsequent generation of the target terrain map. The terrain prompt word describes the natural language text of the desired generated terrain. The text encoder can convert the text sequence corresponding to the natural language text into a vector representation in a high-dimensional space to obtain a text embedding vector. The text embedding vector captures the semantic, conceptual, style, and attribute information in the prompt word, which can provide semantic description and detail guidance for the subsequent generation of the target terrain map. The text encoder can be a CLIP (Contrastive Language-Image Pre-training) model, or a BERT (Bidirectional Encoder Representations from Transformers) model, etc., which are not limited herein.
[0026] In step S302, the text embedding vector is input into the terrain rule module to obtain a terrain weight matrix.
[0027] The terrain rule module can be an MLP (Multilayer Perceptron), or a lightweight CNN (Convolutional Neural Network), etc., which are not limited herein. The terrain rule module can convert the terrain rules, constraints, or preferences contained in the text embedding vector into a spatial perception weight that can modulate the behavior of the backbone network, i.e., a terrain weight matrix. The terrain weight matrix can be a tensor that matches the spatial dimension of the intermediate feature map in the backbone network, which is used to adjust the activation strength of the backbone network at different spatial positions and different feature channels according to the text semantics, so that the backbone network can generate unique features of the terrain.
[0028] In step S303, the spatial control vector and the terrain weight matrix are input into the backbone network to obtain a terrain feature map.
[0029] The backbone network can be a U-net or a GANs (Generative Adversarial Networks), etc., which are not limited herein. The backbone network can fuse the spatial structure provided by the spatial control vector and the semantic weight provided by the terrain weight matrix to generate a terrain feature map containing rich terrain details. The terrain feature map is a high-dimensional feature tensor that will be decoded into the final terrain.
[0030] Step S304, inputting the terrain feature map into a graph decoder to obtain a target terrain map.
[0031] The graph decoder can be a generative model that decodes and reconstructs the terrain feature map back to the image space.
[0032] In one embodiment, Figure 4 A flowchart of a process for determining a terrain feature map based on a backbone network is provided for the embodiments of the present application. As Figure 4 shown, the specific process of inputting the spatial control vector and the terrain weight matrix into the backbone network to obtain the terrain feature map includes the following steps: Step S401, aligning the dimensions of the spatial control vector and the terrain weight matrix.
[0033] The spatial control vector and the terrain weight matrix can be projected to the same dimension through the convolution layer or the fully connected layer in the backbone network, keeping the dimensions consistent, avoiding dimension mismatch or distribution difference.
[0034] Step S402, attention-weighted fusion of the spatial control vector based on the aligned terrain weight matrix to obtain an initial feature map, and multi-level sampling of the initial feature map to obtain a semantic feature tensor.
[0035] The aligned terrain weight matrix and the spatial control vector can be beneficially captured long-distance semantic dependence after attention-weighted fusion, improving the global consistency of the features. The initial feature map can be encoded by down-sampling and decoded by up-sampling through multi-level sampling, gradually refining the multi-scale semantic feature tensor.
[0036] Step S403, mapping and converting the semantic feature tensor to obtain the terrain feature map.
[0037] The semantic feature tensor can be mapped to the terrain-related semantic space through mapping and conversion to obtain the terrain feature map.
[0038] In one embodiment, Figure 5 A flowchart of a training process of a preset network model is provided for the embodiments of the present application. As Figure 5 shown, the specific process includes the following steps: Step S501, obtaining a sample labeled map, a corresponding sample prompt word, and a reference terrain map.
[0039] The sample labeled map can be a terrain distribution map obtained by artificial or random color labeling. The sample prompt word can be a natural language text describing the terrain feature, used to guide the model to generate the corresponding terrain morphology through semantic information. The reference terrain map can be a real or preset standard terrain map, which can provide a target output for training, used to calculate the difference between the prediction result and the real terrain, and drive the model optimization.
[0040] Step S502, generate a terrain mask map based on the sample label map, input the terrain mask map and the sample prompt into a pre-constructed preset network model, and obtain a predicted terrain map.
[0041] The terrain mask map can be a multi-channel mask for identifying the spatial distribution of different terrains. The pre-constructed preset network model can be a diffusion model Stable Diffusion, an autoregressive model VQ-VAE2, or other custom neural network models, etc.
[0042] Step S503, calculate a loss value based on the reference terrain map and the predicted terrain map using a preset loss function, and iteratively optimize the parameters of the preset network model based on the loss value until the preset network model converges to obtain a trained preset network model.
[0043] The preset loss function can be MAE (Mean Absolute Error), MSE (Mean Squared Error), or SSIM (Structural Similarity Index Measure), etc., which is not limited herein. By using an optimizer, the loss value can be back-propagated to update the parameters of the preset network model, and the model can learn the real terrain features. Thus, the difference between the prediction and the real terrain can be quantified by the loss function, the model parameters can be iteratively driven, and the generation accuracy can be gradually improved, so as to finally obtain a preset network model that can accurately respond to the input.
[0044] Figure 6 A flowchart of a terrain map generation method provided by an embodiment of the present application is shown in FIG. 6, which specifically includes the following steps: Figure 6 Step S601, obtain a color label map, perform clustering processing on the color label map according to a preset color category to obtain a color quantization map, perform mask processing on the color quantization map according to different color categories to obtain a binary mask map, and identify connected regions of the color quantization map based on the binary mask map to obtain a plurality of color regions.
[0045] The preset color category can be a color classification standard pre-set according to an actual business scenario, and different color categories represent different terrains. Due to the influence of label noise or slight color difference in the original color label map, the area expected to be labeled with the same terrain may be covered with different but similar colors. Therefore, a clustering algorithm can be used to group the pixel color values of the color label map, and similar colors can be classified into the same class to generate a corresponding color quantization map. The clustering algorithm can be K-means clustering or Gaussian mixture model, which is not limited herein. For each color category in the color quantization map, a corresponding binary mask map can be generated to realize spatial isolation of the color category. Each binary mask map can identify the continuous and connected same-value pixel region by scanning the pixels and judging the field connectivity, so as to divide the color quantization map into multiple color regions.
[0046] Step S602, performing mask processing on the multiple color regions to obtain a terrain mask map corresponding to the color label map.
[0047] Step S603, querying the terrain region code corresponding to each mask region in the terrain mask map to obtain an associated terrain prompt word.
[0048] Step S604, inputting the terrain mask map and the associated terrain prompt word into the preset network model trained to obtain a target terrain map.
[0049] The above, the color label map is subjected to clustering processing of the preset color category to obtain a color quantization map, which can eliminate the influence of label noise or slight color difference, so that the color distribution is more concentrated and the semantics is more explicit; the color quantization map is subjected to mask processing of different color categories to obtain a binary mask map, the color information is converted into a spatial mask, which is convenient for subsequent separate analysis or operation of a specific color region; the color quantization map is subjected to connected region identification based on the binary mask map to obtain multiple color regions, which can accurately segment the independent color regions, and is convenient for subsequent terrain generation processing.
[0050] Figure 7 A flowchart of a terrain map generation method provided by an embodiment of the present application is shown in FIG. 1, which specifically includes the following steps: Figure 7 Step S701, obtaining a color label map, and dividing the color label map into multiple color regions according to different preset color categories.
[0051] Step S702, performing hash calculation on the color value corresponding to each color region to obtain a hash value; querying the terrain region code based on the hash value; and generating a terrain mask map according to the region position of each color region and the corresponding terrain region code.
[0052] The hash calculation can be performed by using MD5 (Message-Digest Algorithm 5), SHA (Secure Hash Algorithm), or the like, which is not limited in the present application. The color value corresponding to each color region is subjected to hash calculation, and can be converted into a hash value with a fixed length. The hash value can be used as a query key to quickly locate the corresponding terrain region code in a predefined hash table. In combination with the region position of each color region, each terrain region code can be accurately mapped to the coordinate range of the color region to identify the region distribution corresponding to different terrains.
[0053] In step S703, the terrain region code corresponding to each mask region in the terrain mask map is queried to obtain an associated terrain prompt word.
[0054] In step S704, the terrain mask map and the associated terrain prompt word are input into a preset network model trained to obtain a target terrain map.
[0055] The hash value can be obtained by performing hash calculation on the color value corresponding to each color region. The terrain region code can be obtained by querying the hash value. The terrain mask map can be generated according to the region position of each color region and the corresponding terrain region code. The color visual information can be converted into terrain semantic information, and the structured spatial constraint is provided for subsequent terrain generation.
[0056] Figure 8 A flowchart of a terrain map generation method provided by the embodiment of the present application is shown in FIG. 8, which includes the following steps: Figure 8 In step S801, a color annotation map is obtained, and the color annotation map is divided into a plurality of color regions according to different preset color categories.
[0057] In step S802, the plurality of color regions are subjected to mask processing to obtain a terrain mask map corresponding to the color annotation map.
[0058] In step S803, the terrain region code corresponding to each mask region in the terrain mask map is queried to obtain an associated terrain prompt word.
[0059] In step S804, the terrain mask map and the associated terrain prompt word are input into a preset network model trained to obtain a target terrain map.
[0060] In step S805, contour recognition is performed on the target terrain map, and a boundary transition region is divided; a target transition terrain is determined according to terrain features adjacent to the boundary transition region; and the boundary transition region in the target terrain map is adjusted to the target transition terrain.
[0061] The contour recognition on the target terrain map can detect the boundary lines of different terrain regions, thereby positioning and dividing the regions that need to be transitioned. The contour recognition can use Canny edge detection, Sobel operators, or Prewitt operators, which are not limited herein. The boundary transition region can be regarded as an edge zone at the junction of different terrain types, and needs to be smoothed to avoid terrain mutation. Specifically, it can be a region range of a preset number of pixels away from the boundary line. The target transition terrain can be a natural transition terrain generated by fusing adjacent terrain features, for example, an "uphill grassland" can be generated between "grassland" and "mountainous area".
[0062] The contour recognition on the target terrain map can detect the boundary lines of different terrain regions, thereby positioning and dividing the regions that need to be transitioned. The contour recognition can use Canny edge detection, Sobel operators, or Prewitt operators, which are not limited herein. The boundary transition region can be regarded as an edge zone at the junction of different terrain types, and needs to be smoothed to avoid terrain mutation. Specifically, it can be a region range of a preset number of pixels away from the boundary line. The target transition terrain can be a natural transition terrain generated by fusing adjacent terrain features, for example, an "uphill grassland" can be generated between "grassland" and "mountainous area".
[0063] Figure 9 A structural block diagram of a terrain map generation device provided by an embodiment of the present application is provided. The device is configured to execute the terrain map generation method provided by the above-mentioned embodiment, and has function modules and beneficial effects corresponding to the execution method. As shown in Figure 9 The device specifically includes: A color region determination module 901 is configured to obtain a color labeling map, divide the color labeling map into a plurality of color regions according to different preset color categories, and obtain the color labeling map.
[0064] A mask map generation module 902 is configured to perform mask processing on the plurality of color regions to obtain a terrain mask map corresponding to the color labeling map.
[0065] A prompt word determination module 903 is configured to query a terrain region code corresponding to each mask region in the terrain mask map to obtain an associated terrain prompt word.
[0066] A terrain map generation module 904 is configured to input the terrain mask map and the associated terrain prompt word into a preset network model trained to obtain a target terrain map.
[0067] According to the above, the color annotation map is regionally divided into multiple color regions according to different preset color categories, and the multiple color regions are subjected to mask processing to obtain a terrain mask map corresponding to the color annotation map, so as to isolate and identify the spatial distribution of different terrains; the terrain region code corresponding to each mask region in the terrain mask map is queried to obtain an associated terrain prompt word, so as to provide a detailed description of the terrain; and the terrain mask map and the associated terrain prompt word are input into a preset network model that has been trained, so as to provide clear structured input for the preset network model, so that the preset network model can output a target terrain map that meets the spatial layout requirements and has rich visual details. The above scheme can distinguish different terrain regions in combination with the color annotation map, and generate a target terrain map based on the input terrain mask map and terrain prompt word by using the preset network model, so that the generation efficiency and accuracy are high, the relative positions between the terrain regions are accurate, and the generation demand of complex terrain can be met.
[0068] In one possible embodiment, the preset network model includes a control network, a text encoder, a terrain rule module, a backbone network, and a graph decoder, and the terrain map generation module 904 is further configured to: input the terrain mask map into the control network to obtain a spatial control vector, and input the associated terrain prompt word into the text encoder to obtain a text embedding vector; input the text embedding vector into the terrain rule module to obtain a terrain weight matrix; input the spatial control vector and the terrain weight matrix into the backbone network to obtain a terrain feature map; input the terrain feature map into the graph decoder to obtain a target terrain map.
[0069] In one possible embodiment, the terrain map generation module 904 is further configured to: align the spatial control vector and the terrain weight matrix in dimension; perform attention weighted fusion on the spatial control vector based on the aligned terrain weight matrix to obtain an initial feature map, and perform multi-level sampling on the initial feature map to obtain a semantic feature tensor; map and convert the semantic feature tensor to obtain the terrain feature map.
[0070] In one possible embodiment, the training process of the preset network model includes: obtain a sample annotation map, a corresponding sample prompt word, and a reference terrain map; generate a terrain mask map based on the sample annotation map, and input the terrain mask map and the sample prompt word into a preset network model that has been pre-constructed to obtain a predicted terrain map; The loss value is obtained by calculating the preset loss function based on the reference topographic map and the predicted topographic map, and the parameter iterative optimization of the preset network model is performed based on the loss value, until the preset network model converges to obtain the trained preset network model.
[0071] In one possible embodiment, the color region determination module 901 is further configured to: perform clustering processing on the color annotation map to obtain a color quantization map; perform mask processing on the color quantization map to obtain a binary mask map; identify a plurality of color regions based on the binary mask map and the color quantization map.
[0072] In one possible embodiment, the mask map generation module 902 is further configured to: perform hash calculation on the color value corresponding to each color region to obtain a hash value; query based on the hash value to obtain a topographic region code; generate a topographic mask map according to the region position of each color region and the corresponding topographic region code.
[0073] In one possible embodiment, the device further comprises a topographic map adjustment module configured to: perform contour recognition on the target topographic map and divide a boundary transition region; determine a target transition topography according to the adjacent topographic features of the boundary transition region; adjust the boundary transition region in the target topographic map to the target transition topography.
[0074] Figure 10 A structural schematic diagram of a topographic map generation device provided by an embodiment of the present application is shown in Figure 10 The device includes a processor 101, a memory 102, an input device 103, and an output device 104; the number of processors 101 in the device can be one or more, Figure 10 and the processor 101 in the device is taken as an example; the processor 101, the memory 102, the input device 103, and the output device 104 in the device can be connected through a bus or other means, Figure 10The bus is taken as an example. The memory 102 is configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the terrain map generation method in the embodiments of the present application. The processor 101 executes the software programs, instructions and modules stored in the memory 102, thereby performing various function applications and data processing of the device, that is, implementing the terrain map generation method described above. The input device 103 is configured to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 104 can include a display device such as a display screen.
[0075] The terrain map generation device provided above can be used to execute the terrain map generation method provided in any of the above embodiments, and has corresponding functions and advantages.
[0076] The embodiments of the present application also provide a non-volatile storage medium containing computer executable instructions, which are configured to execute a terrain map generation method described in the above embodiments when executed by a computer processor, and the method comprises: obtaining a color annotation map, and dividing the color annotation map into a plurality of color regions according to different preset color categories; performing mask processing on the plurality of color regions to obtain a terrain mask map corresponding to the color annotation map; querying the terrain region code corresponding to each mask region in the terrain mask map to obtain an associated terrain prompt word; and inputting the terrain mask map and the associated terrain prompt word into a preset network model trained to obtain a target terrain map.
[0077] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include an installation medium, e.g., a CD-ROM, floppy disks, or tape device; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; or a non-volatile memory such as a magnetic medium, e.g., a hard drive; optical storage, e.g., a CD; flash memory devices; registers, other similar types of storage, etc. The storage medium can also be, or include a combination of, different types of storage. In addition, the storage medium can be located in a first computer system in which the programs are executed, or it can be located in a second different computer system which connects to the first computer system over a network, such as the Internet. The second computer system can provide program instructions to the first computer for execution. The term "storage medium" can include two or more storage mediums that reside in different locations, e.g., in different computer systems that are connected over a network. The storage medium can store program instructions (e.g., as an installed program) that are executable by one or more processors.
[0078] Of course, the computer executable instructions of the storage medium provided by the embodiment of the present application are not limited to the above terrain map generation method, and can also perform the related operations in the terrain map generation method provided by any embodiment of the present application.
[0079] It should be noted that the numbering of each step in the present scheme is only used to describe the overall design framework of the present scheme, and does not indicate the inevitable sequence between the steps. As long as the overall implementation process conforms to the overall design framework of the present scheme, it belongs to the protection scope of the present scheme, and the sequence in the description is not an exclusive limitation on the specific implementation process of the present scheme. Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memories. The memory can include non-persistent memory in a computer readable medium, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer readable medium.
[0080] It should also be noted that the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, product or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, product or device including the element.
[0081] Note that the above is only the preferred embodiment of the present application and the applied technical principles. Those skilled in the art will understand that the present application is not limited to the specific embodiments herein, and those skilled in the art can make various obvious changes, readjustments and substitutions without departing from the scope of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for generating topographic maps, characterized in that, include: Obtain a color chart and divide the color chart into multiple color regions according to different preset color categories; The multiple color regions are masked to obtain the terrain mask map corresponding to the color-annotated map; Based on the terrain region code corresponding to each mask region in the terrain mask map, the associated terrain hint words are obtained by querying. The terrain mask and the associated terrain cue words are input into the trained preset network model to obtain the target terrain map.
2. The topographic map generation method according to claim 1, characterized in that, The preset network model includes a control network, a text encoder, a terrain rule module, a backbone network, and a graphics decoder. The step of inputting the terrain mask image and the associated terrain cue words into the trained preset network model to obtain the target terrain map includes: The terrain mask image is input into the control network to obtain a spatial control vector, and the associated terrain cue words are input into the text encoder to obtain a text embedding vector; The text embedding vector is input into the terrain rule module to obtain the terrain weight matrix; The spatial control vector and the terrain weight matrix are input into the backbone network to obtain the terrain feature map; The terrain feature map is input into the graphics decoder to obtain the target terrain map.
3. The topographic map generation method according to claim 2, characterized in that, The step of inputting the spatial control vector and the terrain weight matrix into the backbone network to obtain the terrain feature map includes: Align the spatial control vector and the terrain weight matrix dimensionally; Based on the aligned terrain weight matrix, the spatial control vector is fused with attention weights to obtain an initial feature map, and the initial feature map is then sampled at multiple levels to obtain a semantic feature tensor. The semantic feature tensor is mapped and transformed to obtain a terrain feature map.
4. The topographic map generation method according to claim 1, characterized in that, The training process of the preset network model includes: Obtain the sample annotation map, corresponding sample prompt words, and reference topographic map; A terrain mask map is generated based on the sample annotation map, and the terrain mask map and the sample prompts are input into a pre-built preset network model to obtain a predicted terrain map; The loss value is calculated based on the reference topographic map and the predicted topographic map using a preset loss function. The parameters of the preset network model are iteratively optimized based on the loss value until the preset network model converges to obtain the trained preset network model.
5. The topographic map generation method according to claim 1, characterized in that, The step of dividing the color-coded map into multiple color regions according to different preset color categories includes: The color-coded map is clustered according to a preset color category to obtain a color quantization map; The color quantization image is processed by masking different color categories to obtain a binary mask image; Based on the binary mask image, connected component identification is performed on the color quantization image to obtain multiple color regions.
6. The topographic map generation method according to claim 1, characterized in that, The process of masking the multiple color regions to obtain the terrain mask map corresponding to the color-coded map includes: A hash value is obtained by performing a hash calculation on the color value corresponding to each color region. The terrain region code is obtained by querying based on the hash value; A terrain mask map is generated based on the regional location of each color region and the corresponding terrain region encoding.
7. The topographic map generation method according to claim 1, characterized in that, After inputting the terrain mask image and the associated terrain cue words into the trained preset network model to obtain the target terrain map, the method further includes: The target terrain map is subjected to contour recognition, and boundary transition areas are delineated; The target transition terrain is determined based on the terrain features adjacent to the boundary transition area; Adjust the boundary transition area in the target topographic map to the target transition terrain.
8. A topographic map generation device, characterized in that, include: The color region determination module is configured to acquire a color annotation map and divide the color annotation map into multiple color regions according to different preset color categories. The mask image generation module is configured to perform masking processing on the multiple color regions to obtain the terrain mask image corresponding to the color-annotated image; The prompt word determination module is configured to query the associated terrain prompt words based on the terrain region code corresponding to each mask region in the terrain mask map; The terrain map generation module is configured to input the terrain mask image and the associated terrain cue words into a pre-trained preset network model to obtain the target terrain map.
9. A topographic map generation device, the device comprising: One or more processors; A storage device configured to store one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the topographic map generation method according to any one of claims 1-7.
10. A non-volatile storage medium storing computer-executable instructions, which, when executed by a computer processor, are configured to perform the topographic map generation method of any one of claims 1-7.