Method, apparatus, device and storage medium for map generation
By adjusting the association between the encoding and positional relationships of map elements, the problem that one-hot encoding cannot depict the positional relationships of map elements is solved, resulting in more reasonable maps and improving the efficiency and quality of map generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2022-08-01
- Publication Date
- 2026-07-07
AI Technical Summary
In existing technologies, one-hot encoding of map elements cannot effectively depict the positional relationships between different types of map elements, resulting in wasted system resources and unreasonable generated maps.
By adjusting the encoding of map elements to associate them with location relationships, machine learning models, such as skip-gram-based models, can be used to update the encoding based on the location relationships of map elements, thereby reflecting the similarity and distance relationships between map elements.
The generated map can more reasonably reflect the positional relationships of map elements, improve the efficiency and quality of map generation, and reduce design costs.
Smart Images

Figure CN115294240B_ABST
Abstract
Description
Technical Field
[0001] The exemplary embodiments disclosed herein generally relate to the field of computers, and particularly to methods, apparatus, devices, and computer-readable storage media for map generation. Background Technology
[0002] With the development of computer technology, various types of interactive applications have emerged. For example, in many fields such as games, simulations, and virtual reality, systems are already able to provide users with rich game scenarios. Typically, the basis of these scenarios is a map. For many applications, a map consists of map tiles or regions filled with different map elements. Maps need to be encoded, which is achieved by encoding the map elements within each map region. Summary of the Invention
[0003] In a first aspect of this disclosure, a method for map generation is provided. The method includes obtaining a first initial code and a second initial code, respectively, for a first type of map element and a second type of map element in a training map, wherein a first region and a second region in the training map are respectively composed of the first type of map element and the second type of map element; obtaining an indication of the positional relationship between the first region and the second region in the training map; and generating a first code and a second code, respectively, for the first type of map element and the second type of map element by updating the first initial code and the second initial code at least once based on the positional relationship indication, such that the similarity between the first code and the second code is associated with the positional relationship.
[0004] In a second aspect of this disclosure, a method for map generation is provided. The method includes: obtaining a first code for a first type of map element already filled in a first target region on a map to be generated; for a second target region on the map to be filled, determining a first fit degree of each candidate map element relative to the second target region based on the first code, the positional relationship between the second target region and the first target region, and the respective codes of the candidate map elements; and selecting a second type of map element from the candidate map elements for filling the second target region, at least based on the first fit degree.
[0005] In a third aspect of this disclosure, an apparatus for map generation is provided. The apparatus includes an initial encoding acquisition module configured to acquire a first initial encoding and a second initial encoding, respectively, for a first type of map element and a second type of map element in a training map, wherein a first region and a second region in the training map are respectively composed of the first type of map element and the second type of map element; a positional relationship acquisition module configured to acquire an indication of the positional relationship between the first region and the second region in the training map; and an encoding update module configured to update the first initial encoding and the second initial encoding at least once based on the positional relationship indication, to generate the first initial encoding and the second initial encoding, respectively, for the first type of map element and the second type of map element, such that the similarity between the first encoding and the second encoding is associated with the positional relationship.
[0006] In a fourth aspect of this disclosure, an apparatus for map generation is provided. The apparatus includes: an encoding acquisition module configured to acquire a first encoding of a first type of map element already filled in a first target region on a map to be generated; an adaptation determination module configured to, for a second target region on the map to be filled, determine a first adaptation degree of each candidate map element relative to the second target region based on the first encoding, the positional relationship between the second target region and the first target region, and the respective encodings of the candidate map elements; and a map element determination module configured to select a second type of map element from the candidate map elements for filling the second target region, based at least on the first adaptation degree.
[0007] In a fifth aspect of this disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method described in the first aspect.
[0008] In a sixth aspect of this disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method described in the second aspect.
[0009] In a seventh aspect of this disclosure, a computer-readable storage medium is provided. A computer program is stored on the medium, which, when executed by a processor, implements the method of the first aspect.
[0010] In an eighth aspect of this disclosure, a computer-readable storage medium is provided. A computer program is stored on the medium, which, when executed by a processor, implements the method of the second aspect.
[0011] It should be understood that the content described in this summary section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0013] Figure 1 A schematic diagram of an example environment in which embodiments of the present disclosure can be implemented is shown;
[0014] Figure 2 A schematic diagram of an example environment in which embodiments of the present disclosure can be implemented is shown;
[0015] Figure 3 A flowchart of a process for map generation according to some embodiments of the present disclosure is shown;
[0016] Figures 4A to 4C A schematic diagram illustrating an example of an encoding process according to some embodiments of the present disclosure;
[0017] Figure 5 A flowchart of a process for map generation according to some embodiments of the present disclosure is shown;
[0018] Figures 6A to 6E A schematic diagram illustrating an example of a map generation process according to some embodiments of the present disclosure is shown;
[0019] Figure 7 A block diagram of an apparatus for map generation according to some embodiments of the present disclosure is shown;
[0020] Figure 8 A block diagram of an apparatus for map generation according to some embodiments of the present disclosure is shown; and
[0021] Figure 9 A block diagram of an apparatus capable of implementing several embodiments of the present disclosure is shown. Detailed Implementation
[0022] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0023] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0024] In traditional map coding, one-hot encoding is typically used to generate vector representations of map tiles filled with different types of map elements. Since one-hot encoding is a one-to-one mapping method, the vector representations generated by this encoding method cannot depict the relationships between map tiles filled with different types of map elements. Furthermore, the length of the vector representations generated using this encoding increases linearly with the number of map element types involved in the map tile, leading to a waste of system resources.
[0025] According to various embodiments of this disclosure, a scheme for map generation is proposed. For example, on a reference map, based on the positional relationship between a first region filled with a first type of map element and a second region filled with a second type of map element, a first code for a first type of map element and a second code for a second type of map element are adjusted such that the adjusted codes can indicate the positional relationship of different types of map elements in the reference map. In other words, if the first region filled with a first type of map element and the second region filled with a second type of map element are close in position on the reference map, the generated codes for the first type of map element and the codes for the second type of map element will have a higher similarity.
[0026] According to the implementation of this disclosure, since the adjusted encoding for map elements can characterize the positional relationship of areas filled with different types of map elements on the map, the encoding can be used to predict the filling of map elements corresponding to different areas of the target map during the generation of the target map.
[0027] To illustrate the principles and ideas of the embodiments of this disclosure, some descriptions below will refer to the gaming industry. However, it will be understood that this is merely exemplary and is not intended to limit the scope of this disclosure in any way. Embodiments of this disclosure can be applied to various fields such as simulation, modeling, virtual reality, and augmented reality.
[0028] Example Environment
[0029] First see Figure 1 The illustration schematically shows a sample environment 100 in which exemplary implementations according to this disclosure may be implemented. Figure 1 As shown, example environment 100 may include encoding device 130.
[0030] Encoding device 130 can be used to acquire training map 120. For example, training map 120 may be a map from a game or other scenario created or constructed by a designer. Alternatively, training map 120 may also be a publicly available map already used in a published game or other application.
[0031] like Figure 1 As shown, the training map 120 can be composed of different types of map elements, such as map elements 110-1 to map elements 110-5 (referred to individually or collectively as map element 110). Depending on the form of the training map 120, map element 110 can be a graphic element with different dimensions.
[0032] For example, for such Figure 1 In the case of the two-dimensional training map 120 shown, map element 110 can correspond to a two-dimensional region in the two-dimensional training map 120. In another example, the training map 120 can also correspond to a three-dimensional space, in which case map element 110 can correspond to a three-dimensional space in the three-dimensional training map 120.
[0033] In some examples, each map element 110 may have a corresponding pattern or texture to represent the corresponding substance in the map scene. For example, in Figure 1 In the examples, map element 110-1 may represent a desert in the map scene, map element 110-2 may represent grassland in the map scene, map element 110-3 may represent mountains in the map scene, map element 110-4 may represent water in the map scene, and map element 110-5 may represent woodland in the map scene. It should be understood that the substances represented by the above map elements are merely exemplary and are not intended to constitute a limitation of this disclosure.
[0034] In other examples, such a map element 110 may be used solely to present pattern or texture information, rather than being intended to correspond to a specific substance. Alternatively, a map element 110 may also correspond to a combination of multiple substances or multiple patterns or textures.
[0035] like Figure 1As shown, the encoding device 130 can acquire a training map 120 constructed from different map elements 110 and determine the encoding 150 of at least one map element 110 involved in the training map 120. For example, if the training map 120 is constructed from map elements 110-1 to 110-5, the encoding device 130 can determine the encodings 150-1 to 150-5 (referred to individually or collectively as encoding 150) involved in map elements 110-1 to 110-5.
[0036] In some embodiments, such encoding 150 can be represented by vector embedding. The detailed process of determining the encoding of map element 110 will be described in detail below, and will not be elaborated here.
[0037] In a map context, the encoding 150 of map element 110 can be applied to various types of downstream tasks. For example, the encoding 150 of map element 110 can be used to determine the overall encoding of other maps and for machine learning tasks such as AI game control.
[0038] As another representative example, the encoding 150 of map element 110 can be applied to map generation tasks. Figure 2 A schematic diagram of yet another example environment 200 in which exemplary implementations according to this disclosure may be implemented is shown.
[0039] like Figure 2 As shown, the example environment 200 may include a generation device 210. The generation device 210 can obtain the code 150 corresponding to at least one map element 110. Further, the generation device 210 can determine the map elements 110 that can be filled in each area of the map 220 to be generated based on the code 150, and finally generate a complete map 220.
[0040] According to embodiments of this disclosure, during the encoding process of the encoding device 130 encoding different types of map elements, the similarity between the encodings of different types of map elements is related to the positional relationships between these map elements. For example, suppose the distance between woodland and grassland in the training map 120 is different from the distance between woodland and desert. According to embodiments of this disclosure, this difference in distance can be reflected through the encoding of map elements of different types: woodland, grassland, and desert.
[0041] Accordingly, during map generation, embodiments of this disclosure can select other elements with the most reasonable positional relationships to fill other parts of the map based on existing map elements and their corresponding codes. For example, suppose a certain area on the map to be generated is already filled with a map element like grassland. In this case, when filling the area next to the grassland, the code can be used to determine whether woodland or desert has a higher matching degree with grassland (e.g., which map element is more likely to appear around grassland). Thus, reasonable and practical maps can be generated for various scenarios such as games, simulations, and policy applications.
[0042] The generated map 220 can be directly deployed for use in games or other interactive scenarios. Alternatively, the generated map 220 can be sent to map designers for modification or detail optimization to obtain a higher quality map. This automated map generation process can effectively reduce the time cost of map design and improve the efficiency of map construction.
[0043] The detailed process of how to populate map 220 based on the code 150 of map element 110 will be described similarly below, and will not be elaborated here.
[0044] Example of map generation process
[0045] Figure 3 A flowchart of a process 300 for map encoding according to some embodiments of the present disclosure is shown. Process 300 may be implemented at encoding device 130. Figure 4A A schematic diagram illustrating an example of an encoding process according to some embodiments of the present disclosure is provided. For ease of discussion, reference will be made to... Figure 1 Environment 100 and Figure 4A The process 300 is described by an example of the encoding process.
[0046] As in Figure 1 As shown, the encoding device 130 can acquire the training map 120. The training map 120 can be divided into multiple map tiles with the same area. This map tile can be regarded as the basic unit for constructing the training map 120. In the following text, the map tile is referred to as a region.
[0047] The regions defined on the training map 120 can correspond to map elements of the same or different types. In some embodiments, the selected training map 120 may include all map elements associated with the construction of the target map to be generated. The map elements involved in the training map 120 have their own element identifiers.
[0048] For example in Figure 4AIn the training map 120, a first region 401, a second region 402, and a third region 403 may be included. The first region 401 is filled with map elements 110-2, which may represent, for example, grassland in the map scene. The second region 402 is filled with map elements 110-5, which may represent, for example, woodland in the map scene. The third region 403 is filled with map elements 110-3, which may represent, for example, mountains in the map scene. Please note that examples such as "woodland," "grassland," and "mountains" are merely to facilitate the reader's understanding of the ideas and principles of the embodiments of this disclosure and are not intended to impose any limitation on the scope of this disclosure.
[0049] In block 310, encoding device 130 acquires a first initial code for a first type of map element 110-2 constituting a first region 401 in training map 120 and a second initial code for a second type of map element 110-5 constituting a second region 402 in the training map 120. In some embodiments, the initial code for each type of map element may each be an initialized fixed-length random vector.
[0050] In box 320, encoding device 130 obtains an indication of the positional relationship between first region 401 and second region 402 in training map 120.
[0051] In some embodiments, the positional relationship may include, for example, the distance between the first region 401 and the second region 402 on the training map 120. Alternatively or additionally, in some embodiments, the positional relationship may also include, for example, the coordinates of the relative position of the second region 402 on the training map 120 with respect to the first region 401. This allows the initial encoding to be adjusted not only based on the proximity of different types of map elements, but also based on the spatial positional relationships of different types of map elements on the map during subsequent encoding updates.
[0052] In some embodiments, the indication of the positional relationship can be a binary label, the value of which is determined based on a comparison of the distance between the first region 401 and the second region 402 with a threshold distance. For example, when the distance between the first region 401 and the second region 402 is less than the threshold distance, the value of the binary label can be set to a first value, and if the distance between the first region and the second region is not less than the threshold distance, the value of the binary label can be set to a second value. As an example, the first value is, for example, 1. The second value is, for example, 0.
[0053] In some embodiments, the threshold distance can be determined based on the size of the divided area, i.e., the region. For example, the threshold distance can be set to 5 to 10 times the length or width of the map tile.
[0054] For example, in Figure 4AIn the training map, if the first region 401 filled with grassland and the second region 402 filled with woodland are sufficiently close, the corresponding positional relationship indicator can be set to 1. Similarly, in Figure 4A In the map, if the first area 401 filled with grassland and the third area 403 filled with mountains are far apart, the corresponding positional relationship indicator can be set to 0.
[0055] Specifically, assuming a first region 401 filled with grassland is denoted as x, and a second region 402 filled with woodland is denoted as y, the positional relationship between the first region 401 and the second region 402 can be indicated, for example, as (x, y, 1). In other embodiments, if the coordinates of the relative position of the second region 402 with respect to the first region 401 are denoted as p1, the positional relationship between the first region 401 and the second region 402 can be indicated, for example, as (x, y, p1, 1).
[0056] Similarly, assuming a first region 401 filled with grass is denoted as x, and a third region 403 filled with hills is denoted as z, the positional relationship between the first region 401 and the third region 403 can be indicated, for example, as (x, z, 0). In other embodiments, if the coordinates of the relative position of the second region 402 with respect to the first region 401 are denoted as p1, the positional relationship between the first region 401 and the third region 403 can be indicated, for example, as (x, z, p1, 0).
[0057] In some embodiments, x, y and z mentioned above may refer to the element identifiers of map elements 110-2, 110-5 and 110-3 corresponding to regions 401, 402 and 403, respectively.
[0058] It should be understood that the values of the binary labels described above are for illustrative purposes only. The values of these binary labels can also be set to other numerical values.
[0059] In box 330, the encoding device 130 updates at least once the first initial code of the first type map element 110-2 constituting the first region 401 and the second initial code of the second type map element 110-5 constituting the second region 402, based on the indication of the positional relationship, to generate the first code and the second code respectively for the first type map element and the second type map element.
[0060] Specifically, as described above, for example, the first initial encoding can be a first initial vector for a first type of map element 110-2, and the second initial encoding can be a second initial vector. During training, the encoding device 130 can update the first initial vector and the second initial vector respectively based on the indication of the positional relationship between the first region 401 corresponding to map element 110-2 and the second region 402 corresponding to map element 110-5, such that the similarity between the updated encoding of map element 110-2 and the encoding of map element 110-5 is adjusted based on the distance between the first region 401 and the second region 402.
[0061] In some embodiments, the encoding device 130 may include, for example, a model for performing a training process. The model for learning map element encodings from a training map may employ a skip-gram-based machine learning model. This machine learning model can be used, for example, in natural language processing to perform predictions of the context of a target word / character within a predetermined window.
[0062] During training, the inner product of the first and second initial vectors can be determined, and then the cross-entropy between this inner product and the binary label can be determined. This cross-entropy can be used to update the first and second initial vectors to generate updated first and second vectors for map elements 110-2 and 110-5, respectively. These first and second vectors can be understood as the first code and the second code.
[0063] In some embodiments, for example, when the distance between the first region 401 and the second region 402 is less than a threshold distance, each update of the first initial code and the second initial code can increase the similarity between the updated first code and the updated second code. Conversely, for example, when the distance between the first region 401 and the second region 402 is greater than a threshold distance, each update of the first initial code and the second initial code can decrease the similarity between the updated first code and the updated second code.
[0064] In this regard, let's consider the example mentioned above, where the first region is filled with grassland and the second region is filled with woodland. If the grassland and woodland regions are close together, the updated encodings for the grassland and woodland will become more similar.
[0065] For example, suppose the first area is filled with a grassland map element, while the second area is filled with a mountain map element. Since the grassland and mountain areas are far apart on the map, the similarity between the encodings of these two map elements becomes lower after the update.
[0066] The following continues to combine Figure 4AThis describes, in principle, the update of the initial encoding for map elements 110-2 and 110-5.
[0067] During training, the dot product of a first initial vector corresponding to map element 110-5 in the first region 401 and a second initial vector corresponding to map element 110-2 in the second region 402 is calculated. An indication of the positional relationship between the first region 401 and the second region 402, such as (x, y, p1, 1), is input into the training model. By calculating the cross-entropy between this dot product and the binary labels of the indications, the encoding device 130 can generate updated vector representations of map element 110-5 and map element 110-2 by adjusting the first and second initial vectors.
[0068] In some embodiments, the inner product l of the first initial vector and the second initial vector can be expressed as:
[0069]
[0070] Where v x v represents the first initial vector of map element 110-5. y v represents the second initial vector of map element 110-2. p1 W1 and W2 are vectors representing the coordinates of the relative position of region 402 with respect to region 401, and are parameters for training the model.
[0071] In some embodiments, the vector v representing the coordinates of the relative position of region 402 with respect to region 401 p It can be represented as:
[0072] v p1 =(sin(2 0 p1),…,sin(2 k p1),cos(2 0 p1),…,cos(2 k p1)) (2)
[0073] In some embodiments, the cross-entropy calculation between the inner product and the indicated binary label can be implemented using the sigmoid cross-entropy function, which can be expressed as:
[0074] loss=-label*logl-(1-label)*logl (3) where loss represents the cross entropy, label represents the binary label, and l represents the inner product of the first random vector and the second random vector.
[0075] In some embodiments, the updated encoded representation 150-2 of map element 110-2 and the updated encoded representation 150-5 of map element 110-5 can be obtained by minimizing the cross-entropy function. In some embodiments, the encoding device 130 can obtain the updated encoded representation by minimizing the cross-entropy function using gradient descent.
[0076] During training, if the indication of the positional relationship between the first region 401 corresponding to map element 110-2 and the second region 402 corresponding to map element 110-5 indicates that the distance between the first region 401 and the second region 402 is small enough (e.g., less than a threshold distance), then the updated encoding similarity between map element 110-2 and map element 110-5 is improved compared to before the update.
[0077] For map element 110-2 corresponding to region 401 and map element 110-3 corresponding to region 403, the updated encoding representation 150-2 of map element 110-2 and the updated encoding representation 150-3 of map element 110-3 can be derived from the initial encoding of map element 110-5 corresponding to region 401 and map element 110-3 corresponding to region 403, and from the indication used to characterize the positional relationship between region 401 and region 403, such as (x,z,p2,0).
[0078] During training, if the positional relationship between the first region 401 corresponding to map element 110-2 and the third region 403 corresponding to map element 110-3 indicates that the distance between the first region 401 and the third region 403 is large enough (e.g., exceeding a threshold distance), then the updated encoding similarity between map element 110-2 and map element 110-5 is lower than before the update.
[0079] After updating the encoding of map elements involved in training map 120 once or multiple times based on multiple region pairs in training map 120, the training process can be stopped and the updated encoding of each map element can be recorded.
[0080] The above text has already combined Figure 3 and Figure 4A The map encoding process is described in detail. The following exemplary map encoding process can be combined with... Figure 4B and Figure 4C It is further presented and explained, among which Figure 4B An exemplary process for generating training data is shown, while Figure 4C It shows the use of Figure 4B An exemplary process for generating codes from the obtained training data. It should be understood that, in Figure 4B and Figure 4CThe process shown is merely an example, and one or more steps involved in the process may be modified or omitted.
[0081] like Figure 4B As shown, in box 412, one or more training maps 120 that have already been filled with map elements can be collected. In box 414, the collected training maps 120 can be divided into multiple map regions with the same area. This map region is the basic unit that makes up the collected training maps 120. In box 416, the map regions can be numbered according to the type of map elements filled in each map region.
[0082] In box 418, a first region 401 is sampled from the collected training map 120. In box 420, multiple adjacent map regions whose distance from the first region 401 is less than a threshold distance can be identified. In box 422, a second region 402 is sampled from the identified multiple adjacent regions. In box 424, the relative positional relationship of the second region 402 with respect to the first region can be determined. In box 426, based on the numbering of the sampled first region 401 and second region 402 and the determined relative positional relationship of the second region 402 with respect to the first region, an indication of the positional relationship between the first region 401 and the second region 402 can be generated, such as the indication (x, y, p1, 1) of the positional relationship between the first region 401 and the second region 402 already schematically given above.
[0083] One or more third regions 403 are sampled from the collected training map 120. The distance between the third region 403 and the first region 401 is not guaranteed to be less than a threshold distance. In box 430, an indication of the positional relationship between the first region 401 and the second region 403 can be generated based on the numbering of the sampled first region 401 and the third region 403 and the determined relative positional relationship of the second region 402 with respect to the first region. For example, the indication of the positional relationship between the first region 401 and the third region 403 (x,z,p1,0) has been schematically given above.
[0084] In box 432, the positional relationship indications between the first region 401 and the second region 402 and between the first region 401 and the third region 403 can be output as training data.
[0085] It should be understood that Figure 4B The exemplary process shown can be repeated iteratively. For example, after the training data is output in box 432, the process already described in conjunction with boxes 418 to 432 can continue to be executed.
[0086] The generated training data can be input into encoding device 130 to generate codes for different map element types. For example... Figure 4CAs shown, in box 434, vector representations of different types of map elements can be initialized, and in box 436, the initial vector representations of these map element types are recorded in the encoding device 130. In box 438, the training data generated in box 432 is obtained, such as a schematic indication (x, y, p1, 1) of the positional relationship between the first region 401 and the second region 402. In box 440, the encoding device 130 reads the first initial vector representation of the map element type filled in the first region 401 and the second initial vector representation of the map element type filled in the second region 402. In box 442, the inner product between the first initial vector representation and the second initial vector representation can be calculated. In box 444, the cross-entropy is calculated on the calculated inner product based on the positional relationship between the first region 401 and the second region 402. In box 446, the result of the calculated cross-entropy can be further optimized by, for example, gradient descent. In box 438, the vector representations of the map element types filled in the first region 401 and the second region 402 can be updated based on the optimized result.
[0087] In this way, when the distance between the first region 401 and the second region 402 is less than a threshold distance, the similarity between the updated vector representation of the map element type filled for the first region 401 and the vector representation of the map element type filled for the second region 402 becomes higher.
[0088] It should be understood that Figure 4C The exemplary process shown can be repeated iteratively to progressively update the vector representation for each map element type.
[0089] The map encoding method proposed through embodiments of this disclosure can obtain encodings for different types of map elements, which can characterize the possible positional relationships of different types of map elements on the map, thereby optimizing map generation. The use of the encodings for different types of map elements obtained according to embodiments of this disclosure will be further described below.
[0090] Example of map generation process
[0091] Based on combination Figures 1 to 3 and Figures 4A to 4C The map element encoding generated by the described embodiments is capable of generating maps associated with the positional relationships of different types of map elements on a map. As mentioned above, according to embodiments of this disclosure, the encoding of map elements can reflect the positional relationships, such as distances, of the corresponding map elements on the training map. Such positional relationships can ensure rationality and usability during map generation. For example, it can prevent two map elements that should not be adjacent (e.g., desert and woodland) from being filled into adjacent areas of the map.
[0092] Figure 5 A flowchart of a process 500 for mapping according to some embodiments of the present disclosure is shown. Process 500 may be implemented at generating device 210. Figures 6A to 6D Schematic diagrams illustrating examples of a map generation process according to some embodiments of the present disclosure are shown. For ease of discussion, reference will be made to... Figure 2 Environment 200 and Figures 6A to 6D The example in the document describes process 500.
[0093] See Figure 6A The first region 601 on the target map 600 to be generated has been filled with the first type of map element 110-2, such as grassland.
[0094] In box 510, the generating device 210 acquires the first code 150-2 of a first type of map element 110-2 already filled in a first region 601 on the map to be generated. It should be understood that the location of the first region and its filling elements can be randomly determined. Alternatively, in other embodiments, the location of the first region and / or the map elements filling it can be specified by user input.
[0095] exist Figure 6A In this context, the second region 602 is the area to be filled on the target map 600 to be generated. In some embodiments, the second region on the target map 600 to be generated can be arbitrarily selected. Alternatively, in other embodiments, the second region can also be selected based on the location of the first region according to predetermined rules. For example, the second region can be within a predetermined direction and / or predetermined distance of the first region, etc.
[0096] In frame 520, for the second region 602, based on the first code 150-2 of the first region 601, the codes of the candidate map elements, and the positional relationship between the first region 601 and the second region 602, the generating device 210 determines the adaptation degree of each candidate map element relative to the second region 602.
[0097] Candidate map elements can be, for example, possible map elements on the target map 600 to be generated, such as one or more of map elements 110-1 to 110-5. The candidate codes for each candidate map element are combined. Figures 1 to 3 and Figures 4A to 4C The map elements generated by the described embodiments are coded 150-1 to 150-5.
[0098] For example, during map generation, assuming the first region 601 is filled with grassland, the most suitable map element to be filled into the second region 602 can be determined based on the encoding of different image elements that may be filled into the second region 602 and the relative positional relationship between the first region 601 and the second region 602 on the target map 600 to be generated. For example, when the first region 601 and the second region 602 are close in position, it can be determined that the probability of filling the second region 602 with map element 110-5 (woodland) is higher than the probability of filling the second region with map element 110-3 (mountain).
[0099] For example, the first code of map element 110-2 that fills the first region 601 is the first vector, and the candidate codes of each candidate map element are multiple candidate vectors.
[0100] Suppose we denote the first region 601 that fills map element 110-2 as 'a', and the positional relationship between the first region 601 and the second region 602 as 'p', then the probability 'b' of filling the second region 602 with a candidate map element can be expressed as:
[0101] probablity=f(b;a,p)=sigmoid(l) (4)
[0102]
[0103] v p =(sin(2 0 p),…,sin(2 k p),cos(2 0 p),…,cos(2 k p)) (6)
[0104] Where v a This represents the first vector representation corresponding to the first code of map element 110-2, v b v represents the candidate vector representation corresponding to the encoding of a candidate element. p A vector representation of the positional relationship between the first region 601 and the second region 602.
[0105] The probabilities calculated using the above method can indicate the fit between a candidate map element and the second region 602. For example, if the probability that map element 110-5 is filled in the second region 602 is greater than the probability that map element 110-3 is filled in the second region 602, it indicates that map element 110-5 (woodland) and map element 110-2 (grassland) are relatively close in the training map, while map element 110-5 (woodland) and map element 110-3 (mountain) are relatively far apart in the training map.
[0106] In box 530, the generating device 210 selects second-type map elements from the candidate map elements for filling the second region 602, based at least on their respective fit. For example, as Figure 6B As shown, if the probability of filling the second region 602 with map element 110-5 (woodland) exceeds the threshold probability when the first region 601 is filled with map element 110-2 (grassland), then map element 110-5 will be filled with the second region 602.
[0107] In some embodiments, an area not filled on the map 600 can also be determined based on more than one area that has already been filled on the map 600 to be generated. (See reference) Figure 6C For example, the third region 603 on the map to be generated 600 is filled with the third type of map element 110-3.
[0108] Similarly, for the second region 602, the generating device 210 can determine the fit of each candidate map element relative to the second region 602 based on the first code 150-3 of the third region 603, the codes of each candidate map element, and the positional relationship between the third region 603 and the second region 602.
[0109] For example, if the probability of filling map element 110-3 in the second region 602, determined based on the first region 601 filled with map element 110-2, is Pro1, and the probability of filling map element 110-3 in the second region 602, determined based on the third region 603 filled with map element 110-3, is Pro2, then the final probability of filling map element 110-3 in the second region 602 can be Pro1*Pro2. This method can determine the most suitable map element to fill the second region.
[0110] For example, such as Figure 6D As shown, when map element 110-2 (grassland) is filled in the first region 601 and map element 110-3 (mountain) is filled in the third region 603, if the probability of filling map element 110-5 (woodland) in the second region 602 exceeds the threshold probability, then map element 110-5 will be filled in the second region 602.
[0111] The above text has already combined Figure 5 and Figures 6A to 6D The map encoding process is described in detail. The following exemplary map generation process can be combined with... Figure 6E To further present and explain. It should be understood that, in Figure 6E The process shown is merely an example, and one or more steps involved in the process may be modified or omitted.
[0112] like Figure 6EAs shown, in box 612, the generating device 210 can obtain... Figure 4C The bounding box 448 generates vector representations for each map element type.
[0113] In box 614, the target map 600 can be initialized. In box 616, the generating device 210 determines a reference area 601 that has been filled with the corresponding map elements. In box 618, the generating device 210 determines the target area 602 and in box 620, determines whether the target area 602 has been filled with map elements. If it is determined that the target area 602 has been filled with the corresponding map elements, a new reference area is selected. If it is determined that the target area 602 has not yet been filled with the corresponding map elements, the target area 602 is determined as an area to be filled.
[0114] In box 622, the generating device 210 can also identify other map areas that have already been filled with map element types as other reference areas. In box 624, the generating device 210 can determine the probability of filling multiple candidate type map elements in the target area by using the vector representations of the map elements already filled in these reference areas and the positional relationship between the target area to be filled and these reference areas. If the probability of filling a candidate type map element exceeds a threshold probability, then in box 626, the candidate type map element is filled into the target area. The probability calculation process has been described above in conjunction with... Figure 5 and Figures 6A to 6D As described in detail, it will not be repeated here.
[0115] It should be understood that Figure 6E The exemplary process shown can be repeated iteratively until all map areas in the target map 600 are filled with map elements of the appropriate type.
[0116] Based on the map generation process proposed according to embodiments of this disclosure, the correlation between map elements in terms of their positions on the map can be taken into account, thereby enabling the construction of a map that is more consistent with map logic and thus improving the usability of the generated map.
[0117] Furthermore, in some embodiments, the encodings for different types of map elements generated according to embodiments of this disclosure can also be applied to other scenarios, such as training reinforcement learning agents. When training a reinforcement learning agent, the encodings generated according to embodiments of this disclosure can be used to represent terrain states. If the terrain modules surrounding the current agent are represented as a two-dimensional matrix, these map regions can be replaced with the encodings generated according to embodiments of this disclosure based on the vector of the current agent and the positional relationship between the map regions at all locations in the two-dimensional matrix and the current agent, thus constructing a three-dimensional tensor representing the terrain state surrounding the agent.
[0118] Example devices and equipment
[0119] Embodiments of this disclosure also provide corresponding apparatus for implementing the above methods or processes. Figure 7 A schematic structural block diagram of an apparatus 700 for map encoding according to some embodiments of the present disclosure is shown.
[0120] like Figure 7 As shown, the device 700 may include an initial encoding acquisition module 710. This initial encoding acquisition module 710 is configured to acquire a first initial encoding and a second initial encoding, respectively, for a first type of map element and a second type of map element in a training map. The first region and the second region in the training map are respectively composed of the first type of map element and the second type of map element. Furthermore, the device 700 may also include a positional relationship acquisition module 720. This positional relationship acquisition module is configured to acquire an indication of the positional relationship between the first region and the second region in the training map. The device 700 may also include an encoding update module 730. This encoding update module 730 is configured to update the first initial encoding and the second initial encoding at least once based on the positional relationship indication to generate the first initial encoding and the second initial encoding, respectively, for the first type of map element and the second type of map element, such that the similarity between the first encoding and the second encoding is associated with the positional relationship.
[0121] In some embodiments, the positional relationship indication is used to indicate at least one of the following: the distance between the first region and the second region, or the coordinates of the second region's relative position on the map with respect to the first region.
[0122] In some embodiments, the positional relationship is indicated by a binary label whose value is determined based on a comparison of the distance between the first region and the second region with a threshold distance.
[0123] In some embodiments, the encoding update module 730 is further configured to increase the similarity between the first encoding and the second encoding in response to the distance between the first region and the second region being less than a threshold distance; or to decrease the similarity between the first encoding and the second encoding in response to the distance between the first region and the second region being greater than a threshold distance.
[0124] In some embodiments, the first initial encoding is a first vector, the second initial encoding is a second vector, and the encoding update module 730 is further configured to obtain the inner product of the first vector and the second vector; determine the cross-entropy between the inner product and the binary label; and update the first initial encoding and the second initial encoding based on the cross-entropy.
[0125] Figure 8 A schematic structural block diagram of an apparatus 800 for map generation according to some embodiments of the present disclosure is shown.
[0126] like Figure 8 As shown, the device 800 may include an encoding acquisition module 810. This encoding acquisition module 810 is configured to acquire a first encoding of a first type of map element already filled in a first target area on the map to be generated. The device 800 may include an adaptation determination module 820. This adaptation determination module 820 is configured to, for a second target area to be filled on the map, determine a first adaptation degree of each candidate map element relative to the second target area based on the first encoding, the positional relationship between the second target area and the first target area, and the respective encodings of the candidate map elements. Furthermore, the device 800 may also include a map element determination module 830. This map element determination module 830 is configured to select a second type of map element from the candidate map elements for filling the second target area, based at least on the first adaptation degree.
[0127] In some embodiments, at least one of the first encoding and the respective encodings of the candidate map elements is generated by the method according to any one of claims 1-6.
[0128] In some embodiments, the apparatus 800 may also be configured to acquire a third code of a third type of map element already filled in a third target region on a map. Based on the third code, the positional relationship between the third target region and the second target region, and the respective codes of the candidate map elements, a second fit degree of each candidate map element relative to the second target region is determined. Furthermore, the map element determination module 830 may also be configured to select a second type of map element from the candidate map elements based on a first fit degree and a second fit degree.
[0129] The units included in device 700 and / or device 800 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units can be implemented using software and / or firmware, such as machine-executable instructions stored on a storage medium. In addition to or as an alternative to machine-executable instructions, some or all of the units in device 700 and / or device 800 can be implemented at least partially by one or more hardware logic components. By way of example and not limitation, exemplary types of hardware logic components that can be used include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chips (SoCs), complex programmable logic devices (CPLDs), and so on.
[0130] Figure 9 A block diagram of a computing device / server 900 in which one or more embodiments of the present disclosure may be implemented is shown. It should be understood that... Figure 9The computing device / server 900 shown is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein.
[0131] like Figure 9 As shown, the computing device / server 900 is in the form of a general-purpose computing device. Components of the computing device / server 900 may include, but are not limited to, one or more processors or processing units 910, memory 920, storage devices 930, one or more communication units 940, one or more input devices 960, and one or more output devices 960. The processing unit 910 may be a physical or virtual processor and is capable of performing various processes according to programs stored in the memory 920. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capabilities of the computing device / server 900.
[0132] The computing device / server 900 typically includes multiple computer storage media. Such media can be any available media accessible to the computing device / server 900, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 920 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 930 can be removable or non-removable media and can include machine-readable media, such as flash drives, disks, or any other media capable of storing information and / or data (e.g., training data for training) and accessible within the computing device / server 900.
[0133] The computing device / server 900 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not explicitly stated... Figure 9 As shown, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks can be provided. In these cases, each drive can be connected to a bus (not shown) via one or more data media interfaces. Memory 920 may include computer program product 925 having one or more program modules configured to perform various methods or actions of various embodiments of this disclosure.
[0134] The communication unit 940 enables communication with other computing devices via a communication medium. Additionally, the functionality of the components of the computing device / server 900 can be implemented as a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, the computing device / server 900 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.
[0135] Input device 950 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 960 can be one or more output devices, such as a monitor, speaker, printer, etc. The computing device / server 900 can also communicate with one or more external devices (not shown) via communication unit 940 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with the computing device / server 900, or with any device (e.g., network card, modem, etc.) that enables the computing device / server 900 to communicate with one or more other computing devices. Such communication can be performed via input / output (I / O) interfaces (not shown).
[0136] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores one or more computer instructions, wherein one or more computer instructions are executed by a processor to implement the methods described above.
[0137] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0138] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0139] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0140] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0141] Various implementations of this disclosure have been described above. The foregoing description is exemplary and not exhaustive, nor is it limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the implementations disclosed herein.
Claims
1. A method for map generation, comprising: Obtain a first initial code and a second initial code for a first type of map element and a second type of map element in the training map, respectively, wherein the first region and the second region in the training map are respectively composed of the first type of map element and the second type of map element; Obtain an indication of the positional relationship between the first region and the second region in the training map; By updating the first initial code and the second initial code at least once based on the indication of the location relationship, a first code and a second code for the first type of map element and the second type of map element, respectively, are generated, such that the similarity between the first code and the second code is associated with the location relationship; Obtain the first code of the first type of map element that has been filled in the first target area on the map to be generated; For the second target area to be filled on the map, based on the first encoding, the positional relationship between the second target area and the first target area, and the encodings of the candidate map elements, a first fit degree of each candidate map element relative to the second target area is determined; and At least based on the first fit, a second type of map element is selected from the candidate map elements to fill the second target area.
2. The method of claim 1, wherein the indication of the positional relationship is used to indicate at least one of the following: The distance between the first region and the second region, or The coordinates of the second region's relative position to the first region on the map.
3. The method of claim 1, wherein the indication of the positional relationship is a binary label, the value of which is determined based on a comparison of the distance between the first region and the second region with a threshold distance.
4. The method of claim 1, wherein generating the first code and the second code for the first type of map element and the second type of map element, respectively, comprises: In response to the distance between the first region and the second region being less than a threshold distance, the similarity between the first code and the second code is increased; or In response to the distance between the first region and the second region being greater than a threshold distance, the similarity between the first code and the second code is reduced.
5. The method of claim 3, wherein the first initial encoding is a first vector, the second initial encoding is a second vector, and wherein generating the first encoding and the second encoding for the first type of map element and the second type of map element, respectively, comprises: Obtain the dot product of the first vector and the second vector; Determine the cross-entropy between the inner product and the binary label; as well as The first initial code and the second initial code are updated based on the cross-entropy.
6. The method of claim 1, wherein the first region and the second region have the same area.
7. The method according to claim 1, further comprising: Obtain the third code of the third type of map element that has been filled in the third target area on the map; as well as Based on the third encoding, the positional relationship between the third target area and the second target area, and the encoding of each candidate map element, the second fit degree of each candidate map element relative to the second target area is determined. as well as The selection of a second type of map element for filling the second target area includes: selecting a second type of map element from the candidate map elements based on the first fit and the second fit.
8. An apparatus for map generation, comprising: The initial encoding acquisition module is configured to acquire a first initial encoding and a second initial encoding for a first type of map element and a second type of map element in the training map, respectively, wherein the first region and the second region in the training map are respectively composed of the first type of map element and the second type of map element; The positional relationship acquisition module is configured to acquire an indication of the positional relationship between the first region and the second region in the training map; The encoding update module is configured to update the first initial encoding and the second initial encoding at least once based on the indication of the location relationship, to generate a first encoding and a second encoding for the first type of map element and the second type of map element, respectively, such that the similarity between the first encoding and the second encoding is associated with the location relationship; The encoding acquisition module is configured to acquire the first encoding of a first type of map element that has been filled in the first target area on the map to be generated; The adaptation determination module is configured to determine the first adaptation degree of each candidate map element relative to the second target area for filling the second target area on the map, based on the first encoding, the positional relationship between the second target area and the first target area, and the encoding of each candidate map element. as well as The map element determination module is configured to select a second type of map element from the candidate map elements for filling the second target area, based at least on the first fit.
9. The apparatus of claim 8, wherein the indication of the positional relationship is used to indicate at least one of the following: The distance between the first region and the second region, or The coordinates of the second region's relative position to the first region on the map.
10. The apparatus of claim 8, wherein the indication of the positional relationship is a binary label, the value of which is determined based on a comparison of the distance between the first region and the second region with a threshold distance.
11. The apparatus of claim 8, wherein the encoding update module is further configured to: In response to the distance between the first region and the second region being less than a threshold distance, the similarity between the first code and the second code is increased; or In response to the distance between the first region and the second region being greater than a threshold distance, the similarity between the first code and the second code is reduced.
12. The apparatus of claim 10, wherein the first initial encoding is a first vector, the second initial encoding is a second vector, and the encoding update module is further configured to: Obtain the dot product of the first vector and the second vector; Determine the cross-entropy between the inner product and the binary label; and The first initial code and the second initial code are updated based on the cross-entropy.
13. An electronic device, comprising: At least one processing unit; as well as At least one memory, coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1 to 7.
14. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method according to any one of claims 1 to 7.