This U.S. patent application claims priority under 35 U.S.C. § 119 to: Indian Patent Application No. 202121052813, filed on Nov. 17, 2021. The entire contents of the aforementioned application are incorporated herein by reference.
The disclosure herein generally relates to the field of machine learning and, more particular, to a method and system for attentive one shot meta imitation learning from visual demonstration.
Imitation learning (IL) aims at enabling robots to learn skills from a human or a robot teacher efficiently by avoiding rigorous task specific robot programming which lacks adaptability, Due to the recent success of deep learning in the field of computer vision, there is a growing trend in the current IL research to learn control policy directly from video demonstrations which is otherwise known as visual imitation learning. The Meta-Imitation Learning (MIL) is a significant method in this field that allows a policy learned during training to be adapted quickly to solve a new task during the testing phase given one or more demonstrations. It, however, has the limitation of losing its meta-learning ability after learning a specific task.
Conventional methods improve the performance of various machine learning models by focusing on task-relevant aspects of the input observations. This, in turn, provides increased learning efficiency and robustness to distractors (e.g., background clutter). These have been successfully used to solve a wide range of problems such as language modeling, machine translation, image captioning and the like. However, application of attention to visual imitation has been very limited. Few conventional visual imitation methods utilize a transformer-based attention model to extract features from input images which are then used for learning the policy function. Hence, there is a challenge in investigating the effect of attention on the meta-learning models for visual imitation.
Embodiments of the present disclosure present technological improvements as solutions to one or more of the above-mentioned technical problems recognized by the inventors in conventional systems. For example, in one embodiment, a method for attentive one shot meta imitation learning from visual demonstration is provided. The method includes receiving, by one or more hardware processors, a plurality of images pertaining to a visual demonstration for a robot, wherein the plurality of images are sequential. The method further includes computing, by the one or more hardware processors, a plurality of vector embeddings based on the plurality of images using a pretrained attentive embedding network. he pretrained attentive embedding network comprises a first Convolutional Neural Network (CNN), a fully connected layer and a plurality of spatial attention modules, and wherein computing the plurality of vector embeddings comprises; (i) computing a plurality of local contextual feature vectors based on the plurality of images by the first CNN (ii) computing a plurality of attention vectors based on the plurality of local contextual feature vectors and a current global feature vector using a corresponding spatial attention module among the plurality of spatial attention modules (iii) computing a plurality of elementwise dot products comprising an elementwise dot product between each of the plurality of attention vectors and each a corresponding plurality of local contextual feature vector (iv) generating a new global vector by concatenating the plurality of elementwise dot products and (v) computing the plurality of vector embeddings based on the new global vector using the fully connected layer of the attentive embedding network. The method finally includes computing, by the one or more hardware processors, a control action based on the plurality of vector embeddings, an image from the plurality of images, a robot joint state vector and a robot joint velocity vector using a control network, wherein the control network comprises a second CNN and a plurality of fully connected layers, and wherein the control network is connected to the attentive embedding using multiplicative spatial skip connections.
In another aspect, a system for attentive one shot meta imitation learning from visual demonstration is provided. The system includes at least one memory storing programmed instructions, one or more Input/Output (I/O) interfaces, and one or more hardware processors operatively coupled to the at least one memory, wherein the one or more hardware processors are configured by the programmed instructions to receive a plurality of images pertaining to a visual demonstration for a robot, wherein the plurality of images are sequential. The one or more hardware processors are configured by the programmed instructions to compute a plurality of vector embeddings based on the plurality of images using a pretrained attentive embedding network. he pretrained attentive embedding network comprises a first Convolutional Neural Network (CNN), a fully connected layer and a plurality of spatial attention modules, and wherein computing the plurality of vector embeddings comprises; (i) computing a plurality of local contextual feature vectors based on the plurality of images by the first CNN (ii) computing a plurality of attention vectors based on the plurality of local contextual feature vectors and a current global feature vector using a corresponding spatial attention module among the plurality of spatial attention modules (iii) computing a plurality of elementwise dot products comprising an elementwise dot product between each of the plurality of attention vectors and each a corresponding plurality of local contextual feature vector (iv) generating a new global vector by concatenating the plurality of elementwise dot products and (v) computing the plurality of vector embeddings based on the new global vector using the fully connected layer of the attentive embedding network. Finally, the one or more hardware processors are configured by the programmed instructions to compute a control action based on the plurality of vector embeddings, an image from the plurality of images, a robot joint state vector and a robot joint velocity vector using a control network, wherein the control network comprises a second CNN and a plurality of fully connected layers, and wherein the control network is connected to the attentive embedding using multiplicative spatial skip connections.
In yet another aspect, a computer program product including a non-transitory computer-readable medium having embodied therein a computer program for attentive one shot meta imitation learning from visual demonstration is provided. The computer readable program, when executed on a computing device, causes the computing device to receive a plurality of images pertaining to a visual demonstration for a robot, wherein the plurality of images are sequential. The computer readable program, when executed on a computing device, causes the computing device to compute a plurality of vector embeddings based on the plurality of images using a pretrained attentive embedding network. he pretrained attentive embedding network comprises a first Convolutional Neural Network (CNN), a fully connected layer and a plurality of spatial attention modules, and wherein computing the plurality of vector embeddings comprises; (i) computing a plurality of local contextual feature vectors based on the plurality of images by the first CNN (ii) computing a plurality of attention vectors based on the plurality of local contextual feature vectors and a current global feature vector using a corresponding spatial attention module among the plurality of spatial attention modules (iii) computing a plurality of elementwise dot products comprising an elementwise dot product between each of the plurality of attention vectors and each a corresponding plurality of local contextual feature vector (iv) generating a new global vector by concatenating the plurality of elementwise dot products and (v) computing the plurality of vector embeddings based on the new global vector using the fully connected layer of the attentive embedding network. Finally, computer readable program, when executed on a computing device, causes the computing device to compute a control action based on the plurality of vector embeddings, an image from the plurality of images, a robot joint state vector and a robot joint velocity vector using a control network, wherein the control network comprises a second CNN and a plurality of fully connected layers, and wherein the control network is connected to the attentive embedding using multiplicative spatial skip connections.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate exemplary embodiments and, together with the description, serve to explain the disclosed principles:
Exemplary embodiments are described with reference to the accompanying drawings. In the figures, the left-most digit(s) of a reference number identifies the figure in which the reference number first appears. Wherever convenient, the same reference numbers are used throughout the drawings to refer to the same or like parts. While examples and features of disclosed principles are described herein, modifications, adaptations, and other implementations are possible without departing from the spirit and scope of the disclosed embodiments.
Embodiments herein provide a method and system for attentive one shot meta imitation learning from visual demonstration for applying a previously learned skill to a new task context by a robot. Initially, a plurality of images pertaining to a visual demonstration for a robot are received by the system. The plurality of images are sequential. Further, a plurality of vector embeddings are computed based on the plurality of images using a pretrained attentive embedding network. The pretrained attentive embedding network includes a first Convolutional Neural Network (CNN), a fully connected layer and a plurality of spatial attention modules. Finally, a control action is computed based on the plurality of vector embeddings, an image from the plurality of images, a robot joint state vector and robot joint velocity vector using a control network. The control network comprises a second CNN and a plurality of fully connected layers. The control network is connected to the attentive embedding using multiplicative spatial skip connections.
Referring now to the drawings, and more particularly to
The I/O interface 112 may include a variety of software and hardware interfaces, for example, a web interface, a graphical user interface, and the like. The I/O interface 112 may include a variety of software and hardware interfaces, for example, interfaces for peripheral device(s), such as a keyboard, a mouse, an external memory, a printer and the like. Further, the I/O interface 112 may enable the system 100 to communicate with other devices, such as web servers, and external databases.
The I/O interface 112 can facilitate multiple communications within a wide variety of networks and protocol types, including wired networks, for example, local area network (LAN), cable, etc., and wireless networks, such as Wireless LAN (WLAN), cellular, or satellite. For the purpose, the I/O interface 112 may include one or more ports for connecting several computing systems with one another or to another server computer. The I/O interface 112 may include one or more ports for connecting several devices to one another or to another server.
The one or more hardware processors 102 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, node machines, logic circuitries, and/or any devices that manipulate signals based on operational instructions. Among other capabilities, the one or more hardware processors 102 is configured to fetch and execute computer-readable instructions stored in the memory 104.
The memory 104 may include any computer-readable medium known in the art including, for example, volatile memory, such as static random access memory (SRAM) and dynamic random access memory (DRAM), and/or non-volatile memory, such as read only memory (ROM), erasable programmable ROM flash memories, hard disks, optical disks, and magnetic tapes. In an embodiment, the memory 104 includes a plurality of modules 106. The memory 104 also includes a data repository (or repository) 110 for storing data processed, received, and generated by the plurality of modules 106.
The plurality of modules 106 include programs or coded instructions that supplement applications or functions performed by the system 100 for attentive one shot meta imitation learning from visual demonstration. The plurality of modules 106, amongst other things, can include routines, programs, objects, components, and data structures, which performs particular tasks or implement particular abstract data types. The plurality of modules 106 may also be used as, signal processor(s), node machine(s), logic circuitries, and/or any other device or component that manipulates signals based on operational instructions. Further, the plurality of modules 106 can be used by hardware, by computer-readable instructions executed by the one or more hardware processors 102, or by a combination thereof. The plurality of modules 106 can include various sub-modules (not shown). The plurality of modules 106 may include computer-readable instructions that supplement applications or functions performed by the system 100 for attentive one shot meta imitation learning from visual demonstration. In an embodiment, plurality of modules 106 includes an attentive embedding network (shown in
The data repository (or repository) 110 may include a plurality of abstracted piece of code for refinement and data that is processed, received, or generated as a result of the execution of the plurality of modules in the module(s) 106.
Although the data repository 110 is shown internal to the system 100, it will be noted that, in alternate embodiments, the data repository 110 can also be implemented external to the system 100, where the data repository 110 may be stored within a database (repository 110) communicatively coupled to the system 100. The data contained within such external database may be periodically updated. For example, new data may be added into the database (not shown in
At step 202 of the method 200, the one or more hardware processors 102 are configured by the programmed instructions to receive a plurality of images pertaining to a visual demonstration for a robot. The plurality of images are sequential demonstrating a corresponding action at each time stamp. For example, a plurality of image frames from a video demonstration are received as input.
At step 204 of the method 200, the one or more hardware processors 102 are configured by the programmed instructions to compute a plurality of vector embeddings based on the plurality of images using a pretrained attentive embedding network. The pretrained attentive embedding network includes a first Convolutional Neural Network (CNN), a fully connected layer and a plurality of spatial attention modules. The plurality of vector embeddings are computed by the pretrained attentive embedding network as follows. Initially, a plurality of local contextual feature vectors are computed based on the plurality of images by the first CNN. Further, a plurality of attention vectors are computed based on the corresponding plurality of local contextual feature vectors and a current global vector using a corresponding spatial attention module among the plurality of spatial attention modules. Further, a plurality of elementwise dot products comprising an elementwise dot product is computed between the plurality of local contextual feature vectors and each of a corresponding plurality of attention vectors. Further, a new global vector is generated by concatenating the plurality of elementwise dot products. Finally, the plurality of vector embeddings are computed based on the new global vector using the fully connected layer of the attentive embedding network.
In an embodiment, each of the plurality of spatial attention modules includes an addition unit, a convolution unit and a sigmoid activation function. The global vector is obtained from the final layer of the first CNN, The spatial attention module is illustrated in
In an embodiment, the method of training the attentive embedding network is explained below: In an embodiment, the dataset D is divided into subset of datasets D1, D2, . . . Dk where, each subset of datasets {D} has a support set DU and a query set DQ. The support set DU includes a different category of tasks {TUi, TUj} and the query set DQ includes a set of tasks {TQ′j} belonging to one of the categories from the support set. Each task has M number of demonstrations. A first plurality of vector embeddings corresponding to each of the plurality of tasks associated with the support dataset are computed using the attentive embedding network fθ:RD→RN which estimates an N-dimensional embedding vector εkj∈RN for a given demonstration Tk where Tk∈Tj. The normalized mean embeddings εj∈RN is calculated using all M demonstrations of the task Tj. The first plurality of vector embeddings associated with the support dataset are normalized using a normalization technique. The normalized mean embeddings εj∈RN is calculated using all M demonstrations of the task Tj as shown in equation (1).
where
Further, a second plurality of vector embeddings corresponding to each of the plurality of tasks associated with the query dataset are computed using the attentive embedding network. Further, the dot product similarity is computed between the first plurality of normalized vector embeddings and the second plurality of vector embeddings. Further, the attentive embedding network is trained based on the computed dot product similarity. The training is continued until the dot product similarity between the first plurality of normalized vector embeddings and the second plurality of vector embeddings are greater than a predefined similarity threshold.
The embedding loss Lemb used to train the attentive embedding network is given in equation 2.
L
emb=ΣT
where εk,Qj is an embedding vector for kth demonstration of the task {TQj} for the query set and εUj, εUj are the normalized embeddings for the task {TUi,TUj} taken from the support set. The model is trained to produce a higher dot-product similarity between a task's demonstration εK,Qj and its average embeddings εijj than to from other tasks each of the sampled tasks chosen at the time of training are unique. AH the other tasks in the support set are considered to be negative Ti. Therefore, each task within a support set, is compared to every other task. The value of margin in Lemb is varied from 0.1 to 1.
In an embodiment, the spatial attention module of the attentive embedding network is incorporated to make the embeddings more robust by extracting features from multiple layers of the attentive-embedding network. The local feature vector Ls is defined as Ls={l1s, l2s, . . . lns}, where lis are the local contextual features extracted from the convolution layer at the ith spatial location. Let g be the global feature vector which is the output of the final convolutional layer. In order to integrate attention in the global feature vector g, the compatibility score is given inequation (3).
c({circumflex over (L)}s,g)={l1s,l2s, . . . lns} (3)
where, ({circumflex over (L)}s) is a set of vectors after it is linearly mapped to the dimensionality of g. The compatibility function used here is calculated between Ls and g as given in equation (4).
c
i
s
=<u,l
i
s
+g>,i∈{1 . . . n} (4)
where u is the weight vector learned by 1×1 convolutional layer that takes the sum of components as input and gives the compatibility scores as output. The compatibility scores are further passed through the sigmoid activation function to get normalized compatibility scores As={A1s, A2s, . . . Ans}. In an embodiment, the normalized compatibility score can be alternatively represented as attention vector. These normalized compatibility scores are then used to compute the vector gas for each layers by using elementwise dot product (gaa=Σi=1nais·lis. These vectors are then concatenated. The concatenated feature vector replaces the original vector g to get the attention integrated global vector ga={ga1, ga2, . . . gan}. This vector ga is further passed through the fully connected layers to get the embedding vector ε.
At step 206 of the method 200, the one or more hardware processors 102 are configured by the programmed instructions to compute a control action based on the plurality of vector embeddings, a robot joint state vector, a robot joint velocity vector and the image from the plurality of images, using a control network. In an embodiment, the control action is a robotic torque. The control network includes a second CNN and a plurality of fully connected layers. The control network is connected to the attentive embedding using multiplicative spatial skip connections. For example, the robot joint state vector and the robot joint velocity vector are N×1 vectors. For example, N can be 20.
In an embodiment, the method of computing the plurality of control actions based on the plurality of vector embeddings, the image selected at random from the plurality of images, the robot joint state vector and the robot joint velocity vector using the pretrained control network is explained as follows: Initially, the plurality of vector embeddings, the image from plurality of images, the robot joint state vector and the robot joint velocity vector are received as input by the control network. Further, tiling of the plurality of vector embeddings are performed corresponding to a size associated with the image. The image is selected randomly from the plurality of images. After tiling, a concatenated data is obtained by concatenating the plurality of tiled vector embeddings and the image. After concatenation, a plurality of element-wise feature maps are computed based on the concatenated data using the second CNN. Further, a plurality of fusion feature maps are computed by multiplying each of the plurality of element-wise feature maps with a corresponding feature maps of the attentive embedding network. After computing fusion maps, a flattened feature map is computed based on the plurality of fusion feature maps using the second CNN. Further, a composite feature vector is generated by concatenating the flattened feature map, the robot joint state vector and the robot joint velocity vector. Finally, the control action are computed based on the composite feature vector by using the plurality of fully connected layers of the control network.
In an embodiment, the method of training the control network is explained as follows: The plurality of vector embeddings, the image from the query dataset, the robot joint state vector and the robot joint velocity vector are received as input. Further, tiling is performed on the plurality of vector embeddings corresponding to the size associated with the image. The image is randomly selected from the query dataset, After tiling, the concatenated data is obtained by concatenating the plurality of tiled vector embeddings and the image. Further, the plurality of feature maps are computed based on the concatenated data using the second CNN. After computing feature maps, the plurality of fusion feature maps are computed by multiplying each of the plurality of element-wise feature maps with the corresponding feature maps of the attentive embedding network. Further, a flattened feature map is computed based on the plurality of fusion feature maps using the second CNN. The composite feature vector is generated by concatenating the flattened feature map, the robot joint state vector and the robot joint velocity vector. Further, a first control action is computed based on the composite feature vector by using Fully connected layers. Similarly, a second control action is computed based on the composite feature vector by using Fully connected layers. Further, a total behavioral cloning loss function is computed based on the first control action and the second control action. Finally, the control network is trained based on the total behavioral cloning loss function. In an embodiment, the first control action and the second control actions are robotic torques.
In an embodiment, the control loss Lctr of the control network is defined as given in equations (5) through (7).
L
ctr
=L
ctr
U
+L
ctr
Q (5)
L
ctr
Q=ΣT∈T
L
ctr
U=ΣT∈T
Let LctrQ and LctrU are the control loss for the demonstration from query and support set respectively. The control loss Lctr also helps to learn the embeddings. Total loss LTotal which is used to train the attentive-embedding network and control network is jointly defined as given in equation (8):
L
Total=ΣτλembLemb+λctrULctrU+λctrQLctrQ (8)
where, λemb, λctrQ and λctrU are the hyperparameters. The input to the attentive embedding network is of dimension, (width, height, 3*|T|). where 3 is for RGB channels. Given a demonstration T we consider only the first and last frame for computing the embeddings. Therefore, input dimension to the attentive-embedding network is (width, height, 6). The embeddings are then tiled and concatenated with the current observation resulting into an input image for the control network of size (width, height, 3+N), where N is the size of embedding vector.
The attentive embedding network 302 is further explained with
The spatial attention modules are explained further with reference to
In an embodiment, the present disclosure is experimented as follows: The proposed framework is implemented in TensorFlow on a GTX (Giga Texel Shader eXtreme) 1080 GPU (Graphics Processing Unit) machine. An augmentation of the data including changes in brightness, saturation and contrast in a range of [0.5, 2.0], [0.6, 1.6] and [0.7, 1.3] respectively is carried out to preclude aver-fitting. Other hyper-parameters such as learning rate, batch size, lambda weights λ(emb,ctr) in the total loss function all are appropriately tuned while training the model. The present disclosure is evaluated using the simulated Pushing and simulated reaching. Further, the present disclosure is tested on a custom dataset created using our new pushing environment created in Pybullet based simulator. The performance of the present disclosure is increased by more than 60% when compared with the conventional methods.
The training set includes 1650 tasks and the test set has 15 tasks which are never given to the network during training. Input to the attentive embedding network is a 80×64 RGB images and the input to the control network is embeddings, joint angles, end effector position and the RGB Image. During testing, the task is considered a success if the end-effector comes within 0.05 meters of the goal within the last 10 timesteps. Quantitative results and comparison with state-of-the-art techniques and the present disclosure outperforms the conventional methods.
In an embodiment, the simulated pushing is explained further as follows: The aim of the simulated pushing task is to place the target object at a specific location by pushing in the presence of a distractor. The manipulator is allowed to operate in the 3D environment with an action space formed by the 7-DoF torque control vector. The observation space includes RGB images of resolution of 125×125 captured using an external camera as shown in
Now referring to
In an embodiment, the efficiency of the attentive embedding network is evaluated by visualizing the embeddings estimated for different demonstrations of a task using t-SNE (t-distributed Stochastic Neighbor Embedding). Five demonstrations were plotted from each of the 10 randomly sampled pushing tasks in the test set and the results are depicted in
In an embodiment, rigorous ablation studies were performed to validate the proficiency of the proposed framework. Regarding the ablation studies, the present disclosure utilizes multiplicative skip connections coming from the attentive embedding network with the control network as shown in
The written description describes the subject matter herein to enable any person skilled in the art to make and use the embodiments. The scope of the subject matter embodiments is defined by the claims and may include other modifications that occur to those skilled in the art. Such other modifications are intended to be within the scope of the claims if they have similar elements that do not differ from the literal language of the claims or if they include equivalent dements with insubstantial differences from the literal language of the claims.
The embodiments of present disclosure herein address the unresolved problem of computing a control action for robotic arms using machine learning. The present disclosure utilizes spatial skip connections between the attentive embedding network and the control network which increases the accuracy of the present disclosure. Further, the attentive module of the attentive embedding network increases the performance of the present disclosure. Further, the present disclosure is performing better when tested using custom dataset including demonstrations with ambiguous background.
It is to be understood that the scope of the protection is extended to such a program and in addition to a computer-readable means having a message therein such computer-readable storage means contain program-code means for implementation of one or more steps of the method when the program runs on a server or mobile device or any suitable programmable device. The hardware device can be any kind of device which can be programmed including e.g. any kind of computer like a server or a personal computer, or the like, or any combination thereof. The device may also include means which could be e.g. hardware means like e.g, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a combination of hardware and software means, e.g. an ASIC and an FPGA, or at least one microprocessor and at least one memory with software modules located therein. Thus, the means can include both hardware means and software means. The method embodiments described herein could be implemented in hardware and software. The device may also include software means. Alternatively, the embodiments may be implemented on different hardware devices, e.g, using a plurality of CPUs, GPUs and edge computing devices.
The embodiments herein can comprise hardware and software elements. The embodiments that are implemented in software include but are not limited to, firmware, resident software, microcode, etc. The functions performed by various modules described herein may be implemented in other modules or combinations of other modules. For the purposes of this description, a computer-usable or computer readable medium can be any apparatus that can comprise, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The illustrated steps are set out to explain the exemplary embodiments shown, and it should be anticipated that ongoing technological development will change the manner in which particular functions are performed. These examples are presented herein for purposes of illustration, and not limitation. Further, the boundaries of the functional building blocks have been arbitrarily defined herein for the convenience of the description. Alternative boundaries can be defined so long as the specified functions and relationships thereof are appropriately performed. Alternatives (including equivalents, extensions, variations, deviations, etc., of those described herein) will be apparent to persons skilled in the relevant art(s) based on the teachings contained herein. Such alternatives fall within the scope and spirit of the disclosed embodiments. Also, the words “comprising,” “having,” “containing,” and “including,” and other similar forms are intended to be equivalent in meaning and be open ended in that an item or items following any one of these words is not meant to be an exhaustive listing of such item or items, or meant to be limited to only the listed item or items. It must also be noted that as used herein and in the appended claims, the singular forms “a”, “an,” and “the” include plural references unless the context clearly dictates otherwise. Furthermore, one or more computer-readable storage media may be utilized in implementing embodiments consistent with the present disclosure. A computer-readable storage medium refers to any type of physical memory on which information or data readable by a processor may be stored. Thus, a computer-readable storage medium may store instructions for execution by one or more processors, including instructions for causing the processor(s) to perform steps or stages consistent with the embodiments described herein. The term “computer-readable medium” should be understood to include tangible items and exclude carrier waves and transient signals, i.e. non-transitory. Examples include random access memory (RAM), read-only memory (ROM), volatile memory, nonvolatile memory, hard drives, CD ROMs, DVDs, flash drives, disks, and any other known physical storage media.
It is intended that the disclosure and examples be considered as exemplary only, with a true scope of disclosed embodiments being indicated by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
202121052813 | Nov 2021 | IN | national |