Embodiments of the present disclosure relate generally to the field of computer technology, and more particularly, to a method, apparatus, and computer-readable storage medium for determining a destination on a map.
In human-robot interaction, natural language is one of the most desirable forms of communication between users and robots. However, the interpretation of natural language remains an extremely hard problem for robots. One major issue is that even with the successful conversion of speech to text, there is still a considerable gap between text and its appropriate interpretation.
In a first aspect, a method for determining a destination on a map is provided. The method includes: acquiring N segments of a text, where N is an integer greater than 1; determining a recursive order of the N segments based on a grammatical relationship between the N segments of the text; selecting, for each of the N segments, a matching model from a plurality of models based on a meaning of the each segment, where the matching model for each segment is configured to use an input text and an input region of the map as an input, and output an update region of the map based on the meaning of the input text and the input region; inputting, in the recursive order, each segment with an initial region of the map or an update region output by the matching model for the last segment prior to the segment in the recursive order, into the matching model of the segment; and using the update region output by the matching model for the last segment in the recursive order as the destination in the map.
In a second aspect, an apparatus for determining a destination on a map is provided. The apparatus includes one or more processors; and a storage for storing one or more programs executable by the one or more processors to cause the apparatus to perform operations including: acquiring N segments of a text, where N is an integer greater than 1; determining a recursive order of the N segments based on a grammatical relationship between the N segments of the text; selecting, for each of the N segments, a matching model from a plurality of models based on a meaning of each segment, where the matching model for the segment is configured to use an input text and an input region of the map as an input, and output an update region of the map based on the meaning of the input text and the input region; inputting, in the recursive order, each segment with an initial region of the map or an update region output by the matching model for the last segment prior to the segment in the recursive order, into the matching model of the segment; and using the update region output by the matching model for the last segment in the recursive order as the destination in the map.
In a third aspect, a non-transitory computer readable storage medium storing instructions is provided, where the instructions is executable by a processor to perform operations including: acquiring N segments of a text, where N is an integer greater than 1; determining a recursive order of the N segments based on a grammatical relationship between the N segments of the text; selecting, for each of the N segments, a matching model from a plurality of models based on a meaning of the segment, where the matching model for the segment is configured to use an input text and an input region of the map as an input, and output an update region of the map based on the meaning of the input text and the input region; inputting, in the recursive order, each segment with an initial region of the map or an update region output by the matching model for the last segment prior to the segment in the recursive order, into the matching model of the segment; and using the update region output by the matching model for the last segment in the recursive order as the destination in the map.
The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent from the following detailed description in conjunction with the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar elements:
The present disclosure will be further described below in detail in combination with the accompanying drawings and the embodiments. It should be appreciated that the specific embodiments described herein are merely used for explaining the relevant disclosure, rather than limiting the disclosure. In addition, it should be noted that, for the ease of description, only the parts related to the relevant disclosure are shown in the accompanying drawings.
It should also be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other on a non-conflict basis. The present disclosure will be described below in detail with reference to the accompanying drawings and in combination with the embodiments.
Most of the current robot language addressing algorithms maintain a limited strategy set for a fixed scene, and establish the mapping between image or geographic information and natural language through a large amount of data training. Most of the existing technologies use the learning ability of neural network to memorize the mapping relationship between language and target location from large amount of data. This approach does not make full use of the structure of language and ignores the inference nature of destination description in natural language. Its disadvantages include the huge demand for data, the lack of universality of unrecorded language structure, and the difficulty in understanding the description of the location that needs reasoning, which causes the inconveniences of the robot control.
Step 101 includes: acquiring N segments of a text, where N is an integer greater than 1.
In some embodiments, the text is acquired based on a user input. The user input may be any input receivable by a machine or a computer. In some embodiments, the user input includes at least one of a voice, an input from a keyboard, an input from a sensor, or an input from a touch screen.
In some embodiments, the N segments include a segment indicating a position and a segment indicating a position relationship.
In some embodiments, the user says “Go to the meeting room near the north exit”, a voice is received by a robot, and a text “Go to the meeting room near the north exit” is acquired from the voice. In some embodiments, a semantic analysis is performed on the text to acquire a text regarding position description, e.g., “meeting room near the north exit.” Then, multiple segments of the text, i.e., noun segments (e.g., “meeting room” and “the north exit”) and a preposition segment (e.g., “near”) are acquired.
Step 102 includes: determining a recursive order of the N segments based on a grammatical relationship between the N segments of the text.
In some embodiments, step 102 includes steps 1021 and 1022, which is shown in
In some embodiments, a natural language processing (NLP) tool is used to parse the text into a dependency structure with head words uh, prepositions uprep, and objective of preposition upobj.
Step 1022 includes: determining the head noun segment in front of the preposition segment as the first segment in the recursive order, determining the preposition segment as the second segment in the recursive order and determining the objective segment as the third segment in the recursive order.
Step 103 includes: selecting, for each of the N segments, a matching model from a plurality of models based on a meaning of the each segment, where the matching model for each segment is configured to use an input text and an input region of the map as an input, and output an update region of the map based on the meaning of the input text and the input region.
In some embodiments, the plurality of models includes a first-type model and a second-type model, where the first-type model is configured to use a first map region and a first-type text indicating the position as an input, and output a first update region within the first map region, where the second-type model is configured to use a second map region and a second-type text indicating a position relationship as an input, and output a second update region based on the second map region and the position relationship.
In some embodiments, the position relationship include a proximity relationship, and the second-type model includes a proximity-model configured to use the second map region and a second-type text indicating the proximity relationship as the input, and output the second update region in proximity to the second map region.
In some embodiments, the position relationship includes a directional relationship, and the second-type model includes a directional-model configured to use the second map region and a second-type text indicating the directional relationship as the input, and output the second update region in a direction of the second map region.
In some embodiments, the models matching the noun segment in front of the preposition segment, the preposition segment and the objective noun segment can use the following equations respectively:
b
pobj
=f
θ
h(upobj,b0) (1)
b
prep
=f
θ
preph(uprep,bpobj) (2)
b
h
=f
θ
h(uh,prep) (3)
where fθ* represents grounding functions with θ as parameters, b0 represents the dummy belief or an initial distribution spanning the whole map m. In some embodiments, Eq. (1) and Eq. (3) shares the same function.
Step 104 includes: inputting, in the recursive order, each segment with an initial region of the map or an update region output by the matching model for the last segment prior to the segment in the recursive order, into the matching model of each segment.
In some embodiments, step 104 includes step 1041 and step 1042, which is shown in
Step 1041 includes inputting the first segment in the recursive order and the initial region of the map to the matching model of the first segment to acquire a first update region.
Step 1042 includes inputting, for each of the second to N segments in the recursive order, the segment and the update region output by the matching model for the last segment prior to the segment in the recursive order, into the matching model for the segment to acquire an update region for the segment.
Step 105 includes: using the update region output by the matching model for the last segment in the recursive order as the destination in the map.
In some embodiments, the output of the third model in
The method according to some embodiments of the disclosure makes maximum use of the structural features of natural language, decomposes the complete addressing task into several independent language understanding tasks according to the instruction structure, and transmits the extracted information in the form of probability distribution. In the initial state, the target probability is evenly distributed in the whole map range. The probability distribution is understood and updated one by one through independent language, and points to the final target location.
The method according to some embodiments of the disclosure has the characteristics of being interpretable, easy to optimize and requiring less data. With the method according to some embodiments of the disclosure, coordinates of a destination in a map can be easily determined by a robot based on an input of a user, thus the user is assisted in controlling the robot.
Step 501 includes acquiring N segments of the text, the N segments including a segment indicating a position, a segment indicating a direction, a segment indicating proximity, and a segment that does not indicate any position or any position relationship.
Step 502 includes determining a recursive order of the N segments based on a grammatical relationship between the N segments of the text. Step 502 is the same as step 102, and relevant descriptions may be referred to descriptions of step 102.
Step 503 includes selecting a matching model for each of the N segments, the selecting including selecting the first-type model as the matching model for the segment indicating the position, selecting the direction-model as a matching model for the segment indicating the direction, selecting the proximity-model as a matching model for the segment indicating proximity and selecting the third-type model as a matching model for the segment that does not indicate any position or any position relationship.
In following descriptions of the disclosure, the segments of the text are also referred as modifiers, and the input and output of the model are also referred to as prior and posterior respectively. Table I shows an example of first-type model (i.e., precise model), proximity model, directional model, and the third-type model (i.e., dummy model), and their available inputs, outputs and rules according to some embodiments.
In some embodiments, Equations (1) to (3) are unified and viewed as a chain of general belief updates as:
where k refers to the total number of upobj and uprep. In some embodiments, the text is decomposed into a sequence of grammatically associated segments (uk) and recursively apply each of them to update a notion of belief b.
In some embodiments, a set of learnable functions {fθt:×
→
}, ∀t∈
and a classifier c:
→
are constructed. The update function in equation (4) can be written as
where (⋅) is the indicator function. The classifier c is represented as a neural network, defined as follows:
where Φc represents the hidden state extraction by a gated recurrent unit (GRU) layer, and Wc refers to the weights of a linear layer that maps the GRU hidden state to raw classification weights.
Precise Model
In some embodiments, the map m E M is segmented into a set of areas of interest {ai}i=1S, each having boundary Bi within the map boundary B0. Each area ai is associated with a tuple of strings that are commonly mentioned, such as unique area id, area category, and area name if applicable, and at most N words are assigned to each area of interest.
In some embodiments, each word in the area information is converted to fixed length embeddings and then the length embeddings are concatenated. The result is a matrix representation of the map information, denoted by S×N×H. S is the number of area of interest. N refers to the number of tokens in area descriptors. H is the dimension of word embedding. In some embodiments, the modifier uk is encoded as an embedding matrix ūk∈
N×H. In some embodiments, the precise model is formed as a S-level classification problem which generates a discrete distribution wk defined on all areas in the map. The calculation for each area ai is as follows:
where γk,
The use of γk is triggered by the common use of directions as adjective of the head word (see Table. I). The equation is as follows:
where σ is the sigmoid function, xi is the centroid of area ai, B0 is the boundary of the map, eαk is the unit directional vector of the predicted direction αk∈[−π, π), κk∈[0, 1] is a trainable variable indicating whether a direction is used in uk, βk is a shaping factor adjusting the scaling power of γk, and ϵ is a positive constant. When a directional adjective is used, κk is labeled as 1, rendering γk in an exponential form that weighs each area ai according to the projection of their centroids along a predicted direction. βk is added as an offset to provide additional flexibility. When no directional adjective is involved, κk is labeled as 0 and pushes γk(i) to ϵ for all ai, effectively cancelling this discriminative term. All terms in Eq. (9) except xi and bi are shared by all area weights and calculated by learnable functions as
where Φ* represents the hidden state extracted by GRU layers and W* are the weights of linear layers that generate scalar outputs.
The attention term
where {circumflex over (η)} is the normalization factor,
Finally, the area prior wk-1(i) is calculated by gathering the weights of each area ai from prior belief as follows
where u, v refers to map coordinates and ηk-1 is the normalization factor.
Proximity Model
When encountering prepositions referring to proximity relation, the posterior is represented as a Gaussian distribution centered at the prior and assign a variance proportional to the prior area size. The update function is then written as
b
k
=f
θ
t(uk,bk-1)=(xk-1,diag(ρ|Bk-1|,ρ|Bk-1|)) (13)
where xk-1 and |Bk-1| are the centroid coordinate and size of the area indicated by prior bk-1, and ρ is a scaling constant.
Directional Model
Besides being used as an adjective, direction words (e.g., “north”) can also be directly used as head words, e.g., “the north of meeting room 202.” In some embodiments, a Gaussian distribution is used to represent the prior, but the distribution is set with an additional mask that only preserves the belief consistent with uk. See
b
k
=f
θ
t(uk,bk-1)=k-1|cos(x−xk-1,eα
where eαk is the unit direction vector of the valid direction αk. Nk-1 takes the same form as in Eq. (13). Cos(⋅,⋅) is the cosine similarity. In some embodiments, αk is represented as a learnable variable similarly to Eq. 10 as
αk=tanh(WαTΦα(uk))·π (15)
Dummy Model
In some embodiments, the function of the dummy model is an identical mapping.
In some embodiments, the learnable functions are trained by minimizing type-specific losses through back-propagation. In some embodiments, the map used for training is a floor plane of an office consisting of general working areas, meeting rooms and designated areas such as entertainment area. In some embodiments, besides reusing existing spatial structures such as rooms and designated areas, general common spaces such as corridors are also segmented. In some embodiments, the whole map is segmented into 80 areas with assigned attributes. See Table II for summarized area attributes.
For each update type t, K=10 modifiers u are randomly generated according to predefined dictionary (see Table. II) and each area ai is taken as the key area.
In some embodiments, 3200 update samples are used for training. The procedure to generate essential training sample for each update function is described as below.
For the dummy model, prior and posterior believes are omitted and each training sample is a singleton (uk,) with type label t*=0.
For a proximity model: the prior b0 is uniformly distributed within the key area, and the posterior b1 is a Gaussian centered at the key area with standard deviation proportional to key area size. Each training sample is a tuple (b0, b1, uk) with type label t*=1.
For the directional model: the prior b0 is uniformly distributed within the key area, a direction angle αk is sampled from uniform [−π, π), and the posterior b1 is generated by taking the Gaussian similar to that in proximity update, but with half of it masked out using a dividing line perpendicular to the direction represented by ak. Finally, the modifier uk is determined based on ak. Each training sample is a tuple (b0, b1, uk, ak) with type label t*=2.
For the precise model: the prior b0 is first randomly generated as the output of proximity or directional update based on the key area. Then, map locations are sampled from b0 and the top two areas a1, a2 in which most of these sampled locations fall are selected. Then modifiers uk that uniquely locates a1 based on a minimal rule set (see Table III, brackets indicate optional usage) are generated. Additionally, κk is labeled as 1 if a direction word is used as adjective, or 0 otherwise. The posterior b1 is uniformly distributed within ai. Each training sample is a tuple (b0, b1, uk, αk, κk) with type label t*=3.
The update function set in Eq. (6) is trained by minimizing the total losses of all supervised terms that are applicable for each update function type. The losses are defined for all supervised terms as follows. For classifier c, cross entropy loss Lc is used as
L
c=−log(softmax(WcTΦc(uk))[t*]);
For direction αk, marginal l2 loss is sued as
For indicator κk, cross entropy loss LK is used as
L
κ=−log(softmax(WκTΦκ(uk))[κk*]).
In some embodiments, in training phase, 10% of the data is hold as testing set and training is performed on the remaining samples. Text instructions are encoded using Bert embedding separately on each word and generate word embeddings of length H=768. In some embodiments, GRU hidden sizes are set with 8 and optimization is performed using Adam with 1e-4 learning rate for 10 epochs.
In some embodiments, in each of the belief updates, the input is a prior-modifier tuple (b0, u). Each input tuple is paired with a ground true update type t* as well as the required output terms as described above.
Step 504 includes inputting, in the recursive order, each of the N segments with an initial region of the map or an update region output by the matching model for the last segment prior to the segment in the recursive order, into the matching model of each segment.
Step 505 includes using the update region output by the matching model for the last segment in the recursive order as the destination in the map.
Step 505 is the same as step 105, relevant descriptions may be referred to descriptions of step 105.
As shown in
The memory 902 is a non-transitory computer readable storage medium provided by the present disclosure. The memory stores instructions executable by at least one processor, so that the at least one processor performs the method for determining a destination on a map according to some embodiments of disclosure. The non-transitory computer readable storage medium of the present disclosure stores computer instructions for causing a computer to perform the method for determining a destination on a map according to some embodiments of disclosure.
The memory 902, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions/modules corresponding to the method for determining a destination on a map according to some embodiments of disclosure. The processor 901 executes the non-transitory software programs, instructions, and modules stored in the memory 902 to execute various functional applications and data processing of the server, that is, to implement the method for determining a destination on a map according to some embodiments of disclosure.
The memory 902 may include a storage program area and a storage data area, where the storage program area may store an operating system and at least one function required application program; and the storage data area may store data created by the use of the apparatus of the method for determining a destination on a map according to some embodiments of disclosure. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory 902 may optionally include memories remotely disposed with respect to the processor 901, and these remote memories may be connected to the apparatus of the method for determining a destination on a map according to some embodiments of disclosure. Examples of the above network include but are not limited to the Internet, intranet, local area network, mobile communication network, and combinations thereof.
The apparatus performing the method for determining a destination on a map according to some embodiments of disclosure may further include: an input apparatus 903 and an output apparatus 904. The processor 901, the memory 902, the input apparatus 903, and the output apparatus 904 may be connected through a bus or in other methods. In
The input apparatus 903 may receive input digital or character information, and generate key signal inputs related to user settings and function control of the apparatus of the method for learning a knowledge representation, such as touch screen, keypad, mouse, trackpad, touchpad, pointing stick, one or more mouse buttons, trackball, joystick and other input apparatuses. The output apparatus 904 may include a display device, an auxiliary lighting apparatus (for example, LED), a tactile feedback apparatus (for example, a vibration motor), and the like. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.
It should be understood that the various forms of processes shown above may be used to reorder, add, or delete steps. For example, the steps described in the present disclosure may be performed in parallel, sequentially, or in different orders. As long as the desired results of the technical solution disclosed in the present disclosure can be achieved, no limitation is made herein.
The above specific embodiments do not constitute limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions may be made according to design requirements and other factors. Any modification, equivalent replacement and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.