Method and apparatus for adapting visual reinforcement learning agent and using the same
By using a mask model to filter distractions and optimize the mask model through adaptation losses, the performance of visual RL agents is enhanced in real-world environments, addressing the generalization challenge from idealized to cluttered settings.
Patent Information
- Application Number
- PCT/CN2024/089524
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-04-24
- Publication Date
- 2025-10-30
AI Technical Summary
Visual reinforcement learning (RL) agents struggle to generalize from idealized simulation environments to real-world environments with visual distractions, leading to degraded performance due to the inability to distinguish task-relevant from task-irrelevant information.
A mask model is used to filter out irrelevant visual distractions by generating masks for noisy observations, which are applied to pre-trained visual RL agents to adapt them to deployment environments, optimizing the mask model through adaptation losses and penalties to enhance performance.
The approach improves the performance of pre-trained visual RL agents in deployment environments by focusing on task-relevant visual features while ignoring distractions, without modifying the agents themselves.
Smart Images

Figure CN2024089524_30102025_PF_FP_ABST
Abstract
Description
METHOD AND APPARATUS FOR ADAPTING A VISUAL REINFORCEMENT LEARNING AGENT AND USING THE SAMEFIELD
[0001] Aspects of the present disclosure relate generally to artificial intelligence, and more particularly, to a method and apparatus for adapting a pre-trained visual reinforcement learning (RL) agent to a deployment environment. Additionally, aspects of the present disclosure relate to a method and apparatus for performing a task using a pre-trained visual RL agent adapted to a deployment environment.BACKGROUND
[0002] In recent years, visual RL agents have shown great potential in handling a wide range of challenging tasks, since the visual RL agents may master complex skills based on visual information such as images or videos.
[0003] Although the visual RL have achieved a certain success in learning complex behavior directly from visual information, it remains challenging to generalize or adapt the visual RL agents to real-world environments, which are generally visually complex environments with distractions. One main reason may be that the visual RL agents are generally trained for a task in idealized simulation environments, while the task-irrelevant distractions in the real-world environments might generally be unpredictable to the visual RL agents, so it may be hard for the visual RL agents to distinguish the distractions from useful information effectively. As such, the visual RL agents’ performance and capability may be significantly hampered in the real-world environments.SUMMARY
[0004] The following presents a simplified summary of one or more aspects to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.
[0005] In some aspects, a computer implemented method for adapting a pre-trained visual RL agent to a deployment environment is disclosed. The method may include obtaining a trajectory associated with the pre-trained visual RL agent performing a task during a time period in a deployment environment. The trajectory may include a set of observations, a set of rewards and a set of actions, each observation may include respective visual information of the deployment environment, the set of observations correspond to a set of masks and a set of masked observations, each masked observation may be obtained based on a respective mask, and each mask may be obtained by processing a respective observation using a mask model. Each action may be taken by the pre-trained visual RL agent for a respective masked observation, and each reward may correspond to a respective action. The method may include updating the mask model based at least on the trajectory and the set of masked observations to adapt the pre-trained visual RL agent to the deployment environment.
[0006] In some aspects, a computer implemented method for performing a task using a pre-trained visual RL agent adapted to a deployment environment is disclosed. The method may include generating, using an updated mask model, a current mask for a current observation of the deployment environment. The current observation may include current visual information of the deployment environment. The method may include applying the current mask to the current observation to obtain a current masked observation. The current masked observation may include at least one visual features for the task extracted from the current observation. The method may include performing, using the pre-trained visual RL agent, the task based on the current masked observation.
[0007] In some aspects, a computer system is disclosed. The computer system comprises one or more processors; and one or more storage devices coupled to the one or more processors and storing computer-executable instructions that, when executed, cause the one or more processors to perform any one of the methods disclosed herein.
[0008] In some aspects, one or more computer readable storage media storing computer-executable instructions are disclosed. The computer-executable instructions, when executed, cause one or more processors to perform any one of the methods disclosed herein.
[0009] In some aspects, a computer program product comprising computer-executable instructions is disclosed. The computer-executable instructions, when executed, cause one or more processors to perform any one of the methods disclosed herein.
[0010] In some aspects, an apparatus for performing a task in a deployment environment is disclosed. The apparatus may include: one or more sensors configured to obtain one or more observations of a deployment environment in which the apparatus is located; one or more processors; and one or more storage devices coupled to the one or more processors and storing computer-executable instructions that, when executed, cause the one or more processors to perform any one of the methods disclosed herein.
[0011] In various aspects of the present disclosure, the pre-trained visual RL agent may be adapted or generalized to the deployment environment effectively by updating or optimizing a mask model that may be used to help filter out irrelevant visual distractions from visual information of the deployment environment. In this way, the performance of the pre-trained visual RL agent would be greatly improved in the deployment environment, while the pre-trained visual RL agent may remain unmodified.BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The disclosed aspects will be described in connection with the appended drawings that are provided to illustrate and not to limit the disclosed aspects.
[0013] Fig. 1 illustrates an exemplary framework of a visual RL agent according to some aspects of the present disclosure.
[0014] Fig. 2 illustrates an exemplary framework for deploying a pre-trained visual RL agent and a mask model, according to some aspects of the present disclosure.
[0015] Fig. 3A illustrates an exemplary process for pre-training the visual RL agent and adapting the pre-trained visual RL agent using the mask model, according to some aspects of the present disclosure.
[0016] Fig. 3B illustrates some examples of a training environment and a deployment environment, according to some aspects of the present disclosure.
[0017] Fig. 4 illustrates some examples of visualization results of the framework shown in Fig. 2 in a deployment environment, according to some aspects of the present disclosure.
[0018] Fig. 5 illustrates examples of visualization of different loss components’ effect on the generated mask in a deployment environment.
[0019] Fig. 6 illustrates an example method for adapting a pre-trained visual RL agent to a deployment environment, according to some aspects of the present disclosure.
[0020] Fig. 7 illustrates an example method for performing a task using a pre-trained visual RL agent adapted to a deployment environment, according to some aspects of the present disclosure.
[0021] Fig. 8 illustrates a block diagram of an exemplary computer system according to some aspects of the present disclosure.
[0022] Fig. 9 illustrates a block diagram of an exemplary apparatus according to some aspects of the present disclosure.DETAILED DESCRIPTION
[0023] The present disclosure will now be discussed with reference to several example implementations. It is to be understood that these implementations are discussed only for enabling those skilled in the art to better understand and thus implement the embodiments of the present disclosure, rather than suggesting any limitations on the scope of the present disclosure.
[0024] Various embodiments will be described in detail with reference to the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts. References made to examples and embodiments are for illustrative purposes, and are not intended to limit the scope of the disclosure. It is noted that “based on” used in the disclosure should be understood as “based at least on” , rather than “solely based on” or “merely based on” .
[0025] Despite the success of visual RL agents in idealized training environments, they still struggle to generalize when transitioning to cluttered environments with visual distractions. Since these visual distractions may generally be unknown and unpredictable, it may be impractical to accurately model such visual distractions. Therefore, distinguishing task-relevant visual information from such distractions may be challenging for the visual RL agents, which may significantly degrade the performance of the visual RL agents, and lead to limited real-world applications.
[0026] In view of this, various aspects of the present disclosure provide some solutions for adapting a pre-trained visual RL agent to a deployment environment. Various aspects of the present disclosure further provide some solutions for using the pre-trained visual RL agent to perform a task in the deployment environment after the adaptation.
[0027] The deployment environment described herein may refer to an environment in which the pre-trained visual RL agent is deployed for performing a task, which may be generally a real-world environment. For example, the deployment environment may include an environment with visual distractions, such as the cluttered environments described above. The deployment environment may be different from a training environment described herein. The training environment may refer to an environment in which the visual RL agent is trained for performing the task (which is to be performed by the visual RL agent in the deployment environment, as described above) . The training environment may generally include an environment without any visual distractions, for example, an environment that may only have task-relevant visual information. Thus, compared to the deployment environment, the training environment is an idealized environment. In the description below, the training environment may sometimes be referred to as a clean environment, while the deployment environment may sometimes be referred to as a noisy environment.
[0028] As described above, the deployment environment might include some visual distractions, which may be task-irrelevant and unpredictable, thereby significantly hampering the visual RL agent’s performance. In some aspects of the present disclosure, a mask model may be optimized to adapt or generalize the pre-trained visual RL agent to the deployment environment. The mask model may be used for filtering out irrelevant visual distractions from visual input that otherwise would be directly provided to the pre-trained visual RL agent. As such, the pre-trained visual RL agent may concentrate on relatively or completely clean visual information related to the task. Thus, the performance of the pre-trained visual RL agent would be greatly improved in the deployment environment, while the pre-trained visual RL agent may not be modified.
[0029] The task described herein may include any of a wide range of tasks that may be described with visual information. For example, the task may include self-driving of a vehicle, robotic manipulation of a robotic device, embodied navigation, or the like.
[0030] Generally, the task with visual information may be described using Partially-Observed Markov Decision Process (POMDP)
[0031] In the POMDP, denotes a state space, which may be a complete description of the environment. denotes an n-dimensional observation space, which may include one or more observations of the environment. For example, an observation may include visual information of the environment, such as images or videos. Generally, a state belonging to the state space may be derived based on a respective observation.
[0032] denotes an action space, which may include one or more actions that may be taken. denotes a transition function, which may define a probability distribution over a next state given current state and action. denotes a reward function, which may return a reward after an action is taken on a state. γ is a discount factor and ρ0 is an initial state distribution. The goal for solving the POMDP is generally to obtain an optimal policy π* (at∣ot) maximizing a cumulative reward, which may be represented as The visual RL agent described herein may be implemented based on the POMDP.
[0033] Fig. 1 illustrates an exemplary framework of a visual RL agent according to some aspects of the present disclosure.
[0034] In the example provide in Fig. 1, a visual RL agent 100 may include a world model 110 and a policy model 120. The world model 110 may learn a compressed spatial and temporal representation of an environment from a dataset of past experience, for example, in an unsupervised manner. The world model 100 may be implemented using any suitable manners. For example, the world model 100 may be implemented by a reconstruction-based world model, such as Recurrent State-Space Model (RSSM) .
[0035] The world model 110 may be trained or optimized in any suitable manner. For example, the world model 110 may be trained or optimized based on an evidence lower bound (ELBO) of a training trajectory. Specifically, the world model 110 may be trained by optimizing the ELBO of an action-conditioned joint probability of observations and rewards.
[0036] For example, given a training trajectory τ= {o1, r1, a1, …, oT, rT, aT} , where at each time step t∈ [1, T] , there are three elements: ot denoting an observation, rtdenoting a reward, and at denoting an action. The training objective of the world model 110 may be to maximize the ELBO, which may be represented as follows:
[0037] In the above training objective, the KL-divergence objective may be created based on the observations, the actions and states (which may be derived based on the observations) . The KL-divergence objective may enables the world model 110 to “dream” by minimizing the distance between a prior distribution pψ (s1: T∣a1: T) and a posterior distribution qψ (s1: T∣o1: T, a1: T) . The reconstruction objective and the reward prediction objective may regularize the world model 110 to predict the subsequent observations and rewards, which would enforce the world model 110 to capture visual essence and reward criteria of the task.
[0038] In some embodiments of the present disclosure, the world model 100 may learn a spatial and temporal representation of a training environment based on a training trajectory for the training environment. The training trajectory may include a set of training observations, a set of training rewards and a set of training actions. As described above, the training environment may be a clean environment related to a task but without distractions. For example, the training environment may include only task-relevant visual information. As such, by training the world model 100 in the training environment, the world model 110 would capture essential visual features associated with the task.
[0039] The policy model 120 may learn a policy associated with a task to be performed in the environment, and predict an action for the task based on the learned policy, based on the learned spatial and temporal representation from the world model 110. The policy model 120 may be trained or optimized in any suitable manners. For example, the policy model 120 may be trained by improving a λ-return of an imagined trajectory from the trained world model 110.
[0040] In some cases, the visual RL agent 100 may be implemented as Dreamer proposed in some current studies. Of course, the framework provided in Fig. 1 may just be an example and other possible frameworks for the visual RL agent may be also used.
[0041] After the visual RL agent is pre-trained in the training environment, it may be deployed into a deployment environment with distractions. Assuming the policy model of the visual RL agent has learned a policy π, an action made by the pre-trained visual RL agent 100 for the task based on the policy π would be affected by the distractions, which may be represented as follows: at~π (·∣ot′) =π(·∣noise (ot) ) , (2)
[0042] where t denotes a time step, at denotes an action made at the time step t , o′t denotes an observation at the time step t in the deployment environment, and noise (·) is a noise function that maps an observation ot in the training environment to the observation o′t in the deployment environment. For clarity of description below, the observations in the training environment may sometimes be referred to as clean observations, while the observations in the deployment environment may sometimes be referred to as noisy observations or original observations.
[0043] As mentioned above, the distractions might significantly hamper the visual RL agent’s performance by misleading a decision-making process for a task. Thus, there is a need for addressing the distractions to improve the visual RL agent’s performance in the deployment environment.
[0044] In various aspects of the present disclosure, a mask model mφ is defined: Since the observations are generally in form of images and have the same size, n may be a quantity of pixels per observation. The mask model may help extract visual features associated with the task from the respective observation of the deployment environment.
[0045] Fig. 2 illustrates an exemplary framework for deploying a pre-trained visual RL agent and a mask model into a deployment environment.
[0046] As shown in Fig. 2, the framework 200 may include a mask model 230, a mask applying module 240 and a pre-trained visual RL agent 250. The visual RL agent 250 may be implemented through the structure for the visual RL agent 100 as described in Fig. 1, and may be pre-trained as described above.
[0047] The mask model 230 may be used for generating a mask for a respective noisy observation in the deployment environment. The mask may be used for extracting visual features associated with the task from the respective noisy observation. The mask model 230 may provide the generated mask to the mask applying module 240. The mask applying module 240 may apply the mask to the respective noisy observation to generate a masked observation. For example, the mask applying module 240 may determine the Hadamard product for the mask with the respective noisy observation, which may be represented as: mφ (o′t) ⊙o′t . In some aspects, the mask applying module 240 may be integrated into the mask model 230.
[0048] Accordingly, the masked observation may include visual features associated with the task, with less or no distractions. In an ideal case, the masked observation may only include visual features associated with the task. As such, the objective of mφ (o′t) ⊙o′t may be to effectively ignore the distractions, which may be represented as follows:
[0049] where θ may denote a parameter for the policy.
[0050] Additionally, in the description of some aspects below, the expression “mφ (o′t) ⊙o′t” and “mφ (o′t) ” may be used interchangeably, that is, the expression “mφ (o′t) ⊙o′t” may be considered to be equivalent to the expression “mφ (o′t) ” .
[0051] The mask applying module 240 may provide the masked observation to the pre-trained visual RL agent 250. The visual RL agent 250 may perform the task based on the masked observation. As described above, the masked observation is obtained by filtering out the distractions from the noisy observation, thus, the performance of the visual RL agent 250 can be greatly improved in the deployment environment. Additionally, by using such a mask model, the necessity for manually crafting augmented observations (i.e., images) or modeling task-irrelevant features may be circumvented.
[0052] Before the framework 200 is used in real-world applications in the deployment environment, the pre-trained visual RL agent 250 may need to be adapted to the deployment environment firstly. The adaptation of the pre-trained visual RL agent 250 may involve the optimization or the updating of the mask model 230. The mask model 230 may be optimized or updated by using, as a guidance to neglect the distractions, visual essence and reward signals captured by the pre-trained visual RL agent 250 (e.g., the pre-trained world model) in the training environment. For example, by propagating gradients through a differential trajectory associated with the pre-trained visual RL agent 250 in the deployment environment, sequential dynamics captured by the pre-trained world model may be utilized, thereby achieving better adaptation results. In this way, the pre-trained visual RL agent 250 may be adapted to various unknown distractions and may not need to be modified. For example, a pre-trained policy model of the pre-trained visual RL agent 250 may remain unmodified during the adaptation.
[0053] Fig. 3A illustrates an exemplary process for pre-training a visual RL agent and adapting the pre-trained visual RL agent using a mask model, according to some aspects of the present disclosure.
[0054] In Fig. 3, a denotes an action, s denotes a state, o denotes an observation, and tdenotes a time step. E denotes an encoder (for example, the encoder may be included in the world model of the visual RL agent, and may be a sequential variational encoder) , D denotes a decoder (for example, the decoder may be included in the world model of the visual RL agent) .
[0055] Stage 300 illustrates an exemplary process for pre-training the visual RL agent. The visual RL agent may be pre-trained in a training environment without distractions. For example, the visual RL agent may be trained based on a training trajectory {ot, rt, at, ot+1, rt+1, at+1, …} associated with a task. The observations (ot, ot+1, …) may only include task-relevant visual information. Such observations may also be referred to as clean observations. As shown in Fig . 3, the clean observations may be clean images with only task-relevant visual features. For the training trajectory, there are three corresponding elements at each time step: an observation, an action and a reward.
[0056] From the training trajectory, the visual RL agent may learn to encode the clean observations and the actions (at, ot+1, …) into the states (st, st+1, …) (e.g., compact latent states) , for example, via reconstruction by the decoder (e.g., reconstructed observation …) and predicts rewards Then, the visual RL agent may predict actions and other related metrics based on the learned states, to complete the training (including training the policy model of the visual RL agent) . The visual RL agent may be pre-trained for multiple time steps (e.g., about 106 time steps) to achieve a desired training result.
[0057] After the visual RL agent has been pre-trained at stage 300, the pre-trained visual RL agent may be frozen and deployed into a deployment environment. Stage 305 illustrates an exemplary process for adapting the pre-trained visual RL agent to the deployment environment using a mask model 330 and a mask applying module 340. The mask model 330 and the mask applying module 340 may be implemented similarly as the mask model 230 and the mask applying module 240 as shown in Fig. 2. Additionally, the dot pattern shown at stage 305 may represent that the pre-trained visual RL agent has been frozen. As described above, the mask model 330 may be represented as mφ.
[0058] When the pre-trained visual RL agent, the mask model 230 and the mask applying module 240 are deployed into the deployment environment, a trajectory may be collected through the pre-trained visual RL agent performing the same task as that in the training environment. For example, the collected trajectory may be represented as {o′t, rt, at, o′t+1, rt+1, at+1, …} , where at~πθ(·|mφ (o′t) ) , and πθ may represent the pre-trained policy obtained from stage 300. As described above, compared to the observations (ot, ot+1, …) in the training environment, the observations (o′t, o′t+1, …) collected in the deployment environment may be noisy. For ease of description, such observations (o′t, o′t+1, …) may also be referred to as noisy observations, and the collected trajectory may also be referred to a noisy trajectory, so as to distinguish from the clean observations and the training trajectory described above.
[0059] For each noisy observation, the pre-trained visual RL agent may take a respective action, and accordingly, a respective reward would be returned for this action. Thus, similar to the training trajectory, at each time step t, there are also three corresponding elements in the noisy trajectory: an observation, an action and a reward. For each noisy observation, the mask model 330 may generate a mask, and the mask applying model 340 may apply the mask to that noisy observation to generate a masked observation.
[0060] Taking the noisy observation o′t as an example. The mask model 330 may receive and process the noisy observation o′t to generate a mask mφ (o′t) . The mask mφ (o′t) may be input into the mask applying module 340. The mask applying module 340 may apply the mask to the noisy observation to generate a masked observation, which may be represented as mφ (o′t) ⊙o′t. As shown at stage 305, the distractions may be filtered out from the noisy observation o′t, and the resulted masked observation may include visual features for the task, with less or no distractions. The masked observation may also be an image. The masked observation may be then input into the pre-trained visual RL agent. The pre-trained visual RL agent may perform the task based on the masked observation, for example, take an action at, and then get a reward rt.
[0061] In order to adapt the pre-trained visual RL agent to the deployment environment, the mask model 330 needs to be optimized or updated, until an updated mask model that may satisfy an intended criterion is obtained. Since the visual RL agent is trained in training environments, it would favor observation sequences that obey the transition dynamics and facilitate reward prediction over the visual distractors. As such, by propagating a trajectory {mφ (o′t) , rt, at, mφ (o′t+1) , rt+1, at+1, …} through the pre-trained visual RL agent, the mask model 330 may be optimized. In some aspects, the mask model 330 may be optimized through at least an adaptation loss. Generally, the adaptation loss may represent a difference between the noisy trajectory and predictions generated by the pre-trained visual RL agent based on the masked observations.
[0062] In some aspects, the adaptation loss may include a visual loss and a reward loss.
[0063] The reward loss may represent a difference between the rewards in the noisy trajectory and predicated rewards. The predicated rewards may be generated by the pre-trained visual RL agent based on the masked observations. For example, for the masked observation mφ (o′t) ⊙o′t, the collected reward may be rt, and the predicated reward may be The reward loss may include a loss between the collected reward rt and the predicated reward The reward loss may encourage the mask model 330 to neglect reward-irrelevant features. In some aspects, the reward loss may be represented as follows:
[0064] The visual loss may represent a difference between the masked observations and reconstructed masked observations. The reconstructed masked observations may be generated by the pre-trained visual RL agent based on the masked observations. For example, as shown at stage 305 of Fig. 3, for the masked observation mφ (o′t) ⊙o′t, the pre-trained decoder of the pre-trained visual RL agent may obtain a reconstructed masked observation, which may be represented as (mφ (o′t) ⊙o′t) ″. The visual loss may include a loss between the masked observation (mφ (o′t) ⊙o′t and the reconstructed masked observation (mφ (o′t) ⊙o′t) ″.
[0065] In some aspects, the visual loss may include a reconstruction loss and a focal loss.
[0066] The reconstruction loss may indicate a fixed point of the pre-trained visual RL agent (more specifically, the pre-trained world model) that is closest to each masked observation. In other words, the reconstruction loss may be viewed as trying to find the fixed point of the pre-trained the world model that is closest to each masked observation. In some aspects, the reconstruction loss may be represented as follows:
[0067] where sg (·) denotes a stop-gradient function. The gradient in the expectation may be stopped so that the mask would be optimized in a bootstrap manner, for example.
[0068] The focal loss may represent contributions of preserved pixels of each masked observation to a respective noisy observation. Since the gradients are directly propagated through the noisy trajectory (which is differentiable) , the mask is also regularized by the learned sequential dynamics of the pre-trained visual RL agent (specifically, the world model) . The visual distractions may generally take up more pixels than the task-relevant features in the noisy observation, a focal loss may be introduced to handle such imbalance and encourage the mask model 330 to focus more on pixels it selects over those it neglects. In some aspects, the focal loss may be represented as follows:
[0069] where mφ, i (o′t) and pψ(o′t, i∣st, at) represent a mask and a probability of the i-th pixel respectively for the noisy observation o′t. γf denotes focal gamma. In some examples, γf = 2.
[0070] Accordingly, the visual loss may be represented as follows:
[0071] In some cases, there might be some problems. Loosely speaking, optimizing may be considered as trying to find the fixed point of the pre-trained encoder (which may be a sequential variational encoder) of the pre-trained visual RL agent. Therefore, naively optimizing might lead to some problems if there exist other fixed points aside from the clean observations. Unfortunately, the learned world model of the visual RL agent may sometimes treat observations (e.g., images) with task objects partially or completely covered as fixed points, which may be referred to as partially or completely collapsed solutions.
[0072] There may be various manners to mitigate or avoid completely collapsed solutions. In some aspects, the completely collapsed solutions may be mitigated or avoided during the adaptation. For example, a mask penalty regularizer may be added. The mask regularizer may be determined based at least on the masks. The mask penalty regularizer may represent a quantity of pixels to be retained / preserved per noisy observation. The mask penalty regularizer may prevent the mask model 330 from neglecting all pixels of a noisy observation. For example, the mask penalty regularizer may be represented as follows:
[0073] where n denotes the total quantity of pixels in the observation o′t , x is a scaling factor. Thus, may measure how many pixels are preserved per noisy observation. In such aspects, an overall loss may be determined based on the adaptation loss and the mask penalty regularizer. For example, the overall loss may be determined by weighted summing the adaptation loss and the mask penalty regularizer. To prevent completely collapsed solutions, it would be beneficial to balance between and with a ratio αt, and make dominant when no pixels are retained or preserved. For example, the overall loss may be represented as follows:
[0074] where αt denotes a weighting factor for balancing the adaptation loss and the mask penalty regularizer. In some examples, αt may be selected as:
[0075] where b is a hyper-parameter that control the regularization intensity.
[0076] As described above, there might be partially collapsed solutions in some cases. There may also be various approaches to mitigate or avoid partially collapsed solutions. In some aspects, in order to remove the partially collapsed solutions from the world model’s fixed points, the reconstruction objective (see equation (1) ) may be modified. For example, during the pre-training (stage 300) , the reconstruction objective may be created based at least on randomly-masked observations, rather than the clean observations. The randomly-masked observations may be obtained by randomly masking the clean observations. As such, the visual RL agent would be encouraged to reconstruct the complete image based on randomly masked inputs. The modified reconstruction objective may be represented as follows:
[0077] It can be seen that from the above embodiments, by propagating gradients through the pre-trained visual RL agent (especially, the differentiable world model) , various aspects of the present disclosure can effectively neglect distractions in the deployment environment through self-consistent reconstruction and reward prediction, while utilizing the sequential dynamics captured by the pre-trained visual RL agent.
[0078] Fig. 3B illustrates examples of a training environment and a deployment environment, according to some aspects of the present disclosure.
[0079] In Fig. 3B, the training environment 362 may be a clean environment including visual information for a task object, but without task-irrelevant distractions, while the deployment environment 364 may be a noisy environment, which may include visual information for the task object and also include some task-irrelevant distractions.
[0080] Fig. 4 illustrates some examples of visualization results according to some aspects of the present disclosure.
[0081] As shown in Fig. 4, an image 402-1 may represent a noisy observation from the deployment environment (which may be a Gaussian-noise environment in Fig. 4) , an image 402-2 may represent a mask for the image 402-1, an image 402-3 may represent a masked observation obtained by applying the image 402-2 to the image 402-1, and an image 402-4 may represent a reconstructed masked observation obtained by the pre-trained visual RL agent (e.g., the decoder shown in Fig. 3A) .
[0082] Similarly, an image 404-1 may represent a noisy observation from the deployment environment, an image 404-2 may represent a mask for the image 404-1, an image 404-3 may represent a masked observation obtained by applying the image 404-2 to the image 404-1, and an image 404-4 may represent a reconstructed observation obtained by the pre-trained visual RL agent (e.g., the decoder shown in Fig. 3A) .
[0083] From the examples of Fig. 4, it can be seen that although the Gaussian noise makes the task objects extremely hard to recognize, the mask model is still able to produce accurate masks. This may demonstrate that the approaches provided in the various aspects of the present disclosure exhibit strong generalization flexibility and can adapt the pre-trained visual RL agent to various distinct distractions. Moreover, the burden of manually constructing augmentations can be circumvented.
[0084] Fig. 5 illustrates some examples of visualization results of different loss components’ effect on a mask in a deployment environment.
[0085] As shown in Fig. 5, a group of noisy observations 502 may be obtained from the deployment environment with task-relevant visual information and various visual distractions.
[0086] A first group of images 504 may represent a first group of masks for the group of noisy observations 502, and the first group of masks may be generated by a mask model that is optimized based on the visual loss, the reward loss and the mask penalty regularizer.
[0087] A second group of images 506 may represent a second group of masks for the group of noisy observations 502, and the second group of masks may be generated by a mask model that is optimized based on the visual loss and the reward loss but without the mask penalty regularizer.
[0088] A third group of images 508 may represent a third group of masks for the group of noisy observations 502, and the third group of masks may be generated by a mask model that is optimized based on the reward loss and the mask penalty regularizer but without the visual loss.
[0089] A fourth group of images 510 may represent a fourth group of masks for the group of noisy observations 502, and the fourth group of masks may be generated by a mask model that is optimized based on the visual loss and the mask penalty regularizer but without the reward loss.
[0090] From the examples of Fig. 5, it can be seen that removing the visual loss leads to the most significant decrease in the generated masks (that is, adaptation results) , and the reward loss may serve as a valuable complementary component to the visual loss (for example, especially in scenarios with small objects where the visual loss alone may only provide limited signals) . Additionally, the mask penalty loss may mainly prevent the agent from collapsing to degenerated solutions where no pixels are retained.
[0091] Fig. 6 illustrates a flowchart of an example method for adapting a pre-trained visual RL agent to a deployment environment, according to some aspects of the present disclosure. As described below, some or all illustrated features may be omitted in some implementations within the scope of the present disclosure, and some illustrated features may not be required for implementation of all aspects or embodiments. Further, some of the blocks may be performed parallel or in a different order. In some examples, the method may be carried out by any suitable apparatus or means for carrying out the functions or algorithm described below.
[0092] The method 600 begins at block 610, with obtaining a trajectory associated with the pre-trained visual RL agent performing a task during a time period in a deployment environment.
[0093] The trajectory may include a set of observations, a set of rewards and a set of actions. For example, the set of observations may be a set of noisy observations described above. Each observation may include respective visual information of the deployment environment. The set of observations may correspond to a set of masks and a set of masked observations. Each masked observation may be obtained based on a respective mask. Each mask may be obtained by processing a respective observation using a mask model. Each action may be taken by the pre-trained visual RL agent for a respective masked observation, and each reward may correspond to a respective action.
[0094] The method proceeds to block 620, with updating the mask model based at least on the trajectory and the set of masked observations to adapt the pre-trained visual RL agent to the deployment environment.
[0095] For example, the pre-trained visual RL agent may be implemented using the framework shown in Fig. 1, and the pre-trained visual RL agent and the mask model may be deployed using the framework shown in Fig. 2.
[0096] In some aspects, each masked observation may include at least one visual feature for the task extracted using a respective mask from the respective observation.
[0097] In some aspects, the pre-trained visual RL agent may be pre-trained for the task in a training environment corresponding to the deployment environment but without visual distractions in the deployment environment.
[0098] In some aspects, updating the mask model may include: determining an adaptation loss based at least on the trajectory and the set of masked observations, where the adaptation loss may represent a difference between the trajectory and predictions generated by the pre-trained visual RL agent based at least on the set of masked observations; and updating the mask model based at least on the adaptation loss.
[0099] In some aspects, the adaptation loss may include a visual loss and a reward loss. The visual loss may represent a difference between the set of masked observations and a set of reconstructed observations generated by the pre-trained visual RL agent based on the set of masked observations. The reward loss may represent a difference between the set of rewards and a set of predicated rewards generated by the visual RL agent based at least on the set of masked observations.
[0100] In some aspects, the visual loss may include a reconstruction loss and a focal loss. The reconstruction loss may indicate a fixed point of the pre-trained visual RL agent that is closest to each masked observation. The focal loss may represent contributions of preserved pixels of each masked observation to a respective observation.
[0101] In some aspects, updating the mask model based at least on the adaptation loss may include: determining a mask penalty regularizer based at least on the set of masks, where the mask penalty regularizer may represent a quantity of pixels to be preserved per observation; and updating the mask model based at least on the adaptation loss and the mask penalty regularizer.
[0102] In some aspects, updating the mask model based at least on the adaptation loss and the mask penalty regularizer may include: determining an overall loss by weighted summing the adaptation loss and the mask penalty regularizer; and updating the mask model by minimizing the overall loss.
[0103] In some aspects, the pre-trained visual RL agent may include a pre-trained world model and a pre-trained policy model. The pre-trained world model may be used for receiving and processing a respective masked observation, and the pre-trained policy model may be used for determining a respective action based at least on output of the pre-trained world model.
[0104] In some aspects, the pre-trained world model may be pre-trained based at least on an ELBO for a training trajectory, and the training trajectory may include a set of training observations, a set of training rewards and a set of training actions. The ELBO may include a reconstruction objective, a reward prediction objective and a KL-divergence objective. The reconstruction objective may be created based at least on a set of randomly-masked observations and the set of training actions, and the set of randomly-masked observations may be obtained by randomly masking the set of training observation. The reward prediction objective may be created based at least on the set of training rewards and the set of training actions. The KL-divergence objective may be created based at least on the set of training observations, the set of training rewards and the set of training actions.
[0105] In some aspects, the pre-trained visual RL agent may be adapted to the deployment environment after an updated mask model that satisfy a specified criterion is obtained.
[0106] Fig. 7 illustrates a flowchart of an example method for performing a task using a pre-trained visual RL agent adapted to a deployment environment, according to some aspects of the present disclosure. As described below, some or all illustrated features may be omitted in some implementations within the scope of the present disclosure, and some illustrated features may not be required for implementation of all embodiments. Further, some of the blocks may be performed parallel or in a different order. In some examples, the method may be carried out by any suitable apparatus or means for carrying out the functions or algorithm described below.
[0107] The method 700 begins at block 710, with generating, using an updated mask model, a current mask for a current observation of the deployment environment. The current observation may include current visual information of the deployment environment.
[0108] The method proceeds to block 720, with applying the current mask to the current observation to obtain a current masked observation. The current masked observation may include at least one visual features for the task extracted from the current observation.
[0109] The method proceeds to block 730, with performing, using the pre-trained visual RL agent, the task based on the current masked observation.
[0110] For example, the updated mask model may be obtained by performing the operations described above, for example, the operations described with regard to Fig. 3A or Fig. 6. The updated mask model may satisfy a specified criterion. The pre-trained visual RL agent may be adapted to the deployment environment after the updated mask model. In this case, the operations in Fig. 7 may be performed after the operations of Fig. 6.
[0111] Fig. 8 illustrates a block diagram of an exemplary computer system according to some aspects of the present disclosure.
[0112] The computer system 800 may include one or more processors 810. The computer system 800 may further include one or more storage device 820 coupled to the one or more processors 810. The storage device 820 may store computer-executable instructions that, when executed, cause the one or more processors 810 to perform any operations or methods described above, for example, the operations described with regard to Fig. 3A, Figs. 6 or Fig. 7.
[0113] Various aspects of the present disclosure may be embodied in one or more computer readable storage media such as one or more non-transitory computer readable storage media. The one or more computer readable storage media may store instructions that, when executed, cause one or more processors to perform any operations or methods described above, for example, the operations described with regard to Fig. 3A, Fig. 6 or Fig. 7.
[0114] Various aspects of the present disclosure may be embodied in a computer program product including computer-executable instructions that, when executed, cause one or more processors to perform any operations or methods described above, for example, the operations described with regard to Fig. 3A, Fig. 6 or Fig. 7.
[0115] Various aspects of the present disclosure may be embodied in an apparatus including one or more means for performing any operations or methods described above, for example, the operations described with regard to Fig. 3A, Fig. 6 or Fig. 7.
[0116] For example, the apparatus may include means for obtaining a trajectory associated with the pre-trained visual RL agent performing a task during a time period in a deployment environment. The trajectory may include a set of observations, a set of rewards and a set of actions. Each observation may include respective visual information of the deployment environment, the set of observations correspond to a set of masks and a set of masked observations, each masked observation may be obtained based on a respective mask and each mask may be obtained by processing a respective observation using a mask model. Each action may be taken by the pre-trained visual RL agent for a respective masked observation, and each reward corresponds to a respective action. The apparatus may also include means for updating the mask model based at least on the trajectory and the set of masked observations to adapt the pre-trained visual RL agent to the deployment environment.
[0117] For example, the apparatus may include means for generating, using an updated mask model, a current mask for a current observation of the deployment environment. The current observation may include current visual information of the deployment environment. The apparatus may also include means for applying the current mask to the current observation to obtain a current masked observation. The current masked observation may include at least one visual features for the task extracted from the current observation. The apparatus may also include means for performing, using the pre-trained visual RL agent, the task based on the current masked observation.
[0118] Fig. 9 illustrates a block diagram of an exemplary apparatus according to some aspects of the present disclosure.
[0119] The apparatus 900 may be configured with one or more sensors 910 to obtain one or more observations of a deployment environment in which the apparatus 900 is located. For example, the one or more sensors 910 may include an imaging sensor. The apparatus 900 may be configured with one or more processors 920 and one or more storage devices 930. The one or more storage devices 930 may be coupled to the one or more processors 920 and store computer-executable instructions. The computer-executable instructions, when executed, may cause the one or more processors 920 to perform any operations described above, such as the operations described with regard to Fig. 7.
[0120] In some aspects, the one or more storage devices 930 may include the framework shown in Fig. 2. The one more processors 910 may run the pre-trained visual RL agent, the mask model and the mask applying module to process the current observation of the deployment environment to perform an intended task.
[0121] In some aspects, the apparatus 900 may be implemented in a vehicle. For example, the vehicle may be capable of self-driving, in this case, the task to be performed by the visual RL agent may include controlling self-driving of the vehicle. For another example, the vehicle may be configured with an Advanced Driving Assistance System (ADAS) , and the apparatus 900 may be at least a part of the ADAS. In this case, the task may include various functions associated with the ADAS.
[0122] In some aspects, the apparatus 900 may be implemented in a robotic device. In this case, the task may include robotic manipulation for the robotic device.
[0123] It should be appreciated that all the operations in the methods described above are merely exemplary, and the present disclosure is not limited to any operations in the methods or sequence orders of these operations, and should cover all other equivalents under the same or similar concepts.
[0124] It should also be appreciated that all the modules in the apparatuses described above may be implemented in various approaches. These modules may be implemented as hardware, software, or a combination thereof. Moreover, any of these modules may be further functionally divided into sub-modules or combined together.
[0125] The previous description is provided to enable any person skilled in the art to practice the various aspects described herein. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. Thus, the claims are not intended to be limited to the aspects shown herein. All structural and functional equivalents to the elements of the various aspects described throughout the present disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims.
Claims
1.A computer implemented method for adapting a pre-trained visual reinforcement learning (RL) agent to a deployment environment, comprising:obtaining a trajectory associated with the pre-trained visual RL agent performing a task during a time period in a deployment environment, wherein:the trajectory comprises a set of observations, a set of rewards and a set of actions,each observation comprises respective visual information of the deployment environment, the set of observations correspond to a set of masks and a set of masked observations, each masked observation is obtained based on a respective mask and each mask is obtained by processing a respective observation using a mask model, andeach action is taken by the pre-trained visual RL agent for a respective masked observation, and each reward corresponds to a respective action; andupdating the mask model based at least on the trajectory and the set of masked observations to adapt the pre-trained visual RL agent to the deployment environment.2.The computer implemented method of claim 1, wherein each masked observation comprises at least one visual feature for the task extracted using the respective mask from the respective observation.3.The computer implemented method of claim 1, wherein the pre-trained visual RL agent is pre-trained for the task in a training environment corresponding to the deployment environment but without visual distractions in the deployment environment.4.The computer implemented method of claim 1, wherein updating the mask model comprises:determining an adaptation loss based at least on the trajectory and the set of masked observations, wherein the adaptation loss represents a difference between the trajectory and predictions generated by the pre-trained visual RL agent based at least on the set of masked observations; andupdating the mask model based at least on the adaptation loss.5.The computer implemented method of claim 4, wherein the adaptation loss comprises a visual loss and a reward loss, and wherein:the visual loss represents a difference between the set of masked observations and a set of reconstructed observations generated by the pre-trained visual RL agent based on the set of masked observations, andthe reward loss represents a difference between the set of rewards and a set of predicated rewards generated by the visual RL agent based at least on the set of masked observations.6.The computer implemented method of claim 5, wherein the visual loss comprises a reconstruction loss and a focal loss, and wherein:the reconstruction loss indicates a fixed point of the pre-trained visual RL agent that is closest to each masked observation, andthe focal loss represents contributions of preserved pixels of each masked observation to a respective observation.7.The computer implemented method of claim 4, wherein updating the mask model based at least on the adaptation loss comprises:determining a mask penalty regularizer based at least on the set of masks, wherein the mask penalty regularizer represents a quantity of pixels to be preserved per observation; andupdating the mask model based at least on the adaptation loss and the mask penalty regularizer.8.The computer implemented method of claim 7, wherein updating the mask model based at least on the adaptation loss and the mask penalty regularizer comprises:determining an overall loss by weighted summing the adaptation loss and the mask penalty regularizer; andupdating the mask model by minimizing the overall loss.9.The computer implemented method of claim 1, wherein the pre-trained visual RL agent comprises a pre-trained world model and a pre-trained policy model, andwherein the pre-trained world model is used for receiving and processing a respective masked observation, and the pre-trained policy model is used for determining a respective action based at least on output of the pre-trained world model.10.The computer implemented method of claim 9, wherein the pre-trained world model is pre-trained based at least on an evidence lower bound (ELBO) for a training trajectory, and the training trajectory comprises a set of training observations, a set of training rewards and a set of training actions, andwherein the ELBO comprises a reconstruction objective, a reward prediction objective and a KL-divergence objective,the reconstruction objective is created based at least on a set of randomly-masked observations and the set of training actions, and the set of randomly-masked observations is obtained by randomly masking the set of training observation,the reward prediction objective is created based at least on the set of training rewards and the set of training actions, andthe KL-divergence objective is created based at least on the set of training observations, the set of training rewards and the set of training actions.11.The computer implemented method of claim 1, wherein the pre-trained visual RL agent is adapted to the deployment environment after an updated mask model that satisfy a specified criterion is obtained.12.A computer implemented method for performing a task using a pre-trained visual reinforcement learning (RL) agent adapted to a deployment environment, comprising:generating, using an updated mask model, a current mask for a current observation of the deployment environment, wherein the current observation comprises current visual information of the deployment environment;applying the current mask to the current observation to obtain a current masked observation, wherein the current masked observation comprises at least one visual features for the task extracted from the current observation;performing, using the pre-trained visual RL agent, the task based on the current masked observation.13.A computer system, comprising:one or more processors; andone or more storage devices coupled to the one or more processors and storing computer-executable instructions that, when executed, cause the one or more processors to perform the method of any one of claims 1-12.14.One or more computer-readable storage media storing computer-executable instructions that, when executed, cause one or more processors to perform the method of any one of claims 1-12.15.A computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform the method of any one of claims 1-12.16.An apparatus for performing a task in a deployment environment, comprising:one or more sensors configured to obtain one or more observations of a deployment environment in which the apparatus is located;one or more processors; andone or more storage devices coupled to the one or more processors and storing computer-executable instructions that, when executed, cause the one or more processors to perform the method of claim 12.17.The apparatus of claim 16, wherein:the apparatus is implemented in a vehicle, and the task comprises controlling self-driving of the vehicle; orthe apparatus is implemented in a robotic device, and the task comprises robotic manipulation.
Citation Information
Patent Citations
Anti-shielding target tracking method based on attention mask
CN113850842A
Dynamic interactive representation-based dexterous manipulator grabbing method
CN117798919A
End-to-end multimodal gait recognition method based on deep learning
US20220343686A1
Learning device and method for generating image
US20220351348A1