Visualization in AllenAct is managed by the VizSuite class (defined in allenact.utils.viz_utils). You can customize visualizations by instantiating different visualization types as plugins to the VizSuite within your ExperimentConfig when in test mode.
Data Sources
VizSuite can pull data from several sources:
- Task output: e.g., 2D trajectories.
- Vector task: e.g., egocentric views.
- Rollout storage: e.g., recurrent memory, taken action logprobs, episode masks.
ActorCriticOutput: e.g., action probabilities.
Available Visualization Types
TrajectoryViz: Generic 2D trajectory view.AgentViewViz: RGB egocentric view.ActorViz: Action probabilities from ActorCriticOutput[CategoricalDistr].TensorViz1D: Evolution of a 1D point from RolloutStorage over time.TensorViz2D: Evolution of a 2D vector from RolloutStorage over time.ThorViz: Specialized 2D trajectory view for RoboThor.
To enable these, override the machine_params method in your ExperimentConfig to call res.set_visualizer(self.get_viz(mode)) when mode == "test".
class PointNavRoboThorRGBPPOVizExperimentConfig(PointNavRoboThorRGBPPOExperimentConfig):
viz_ep_ids = ["FloorPlan_Train1_1_3", "FloorPlan_Train1_1_4"]
viz_video_ids = [["FloorPlan_Train1_1_3"], ["FloorPlan_Train1_1_4"]]
viz: Optional[VizSuite] = None
def get_viz(self, mode):
if self.viz is not None:
return self.viz
self.viz = VizSuite(
episode_ids=self.viz_ep_ids,
mode=mode,
base_trajectory=TrajectoryViz(path_to_target_location=("task_info", "target",)),
egeocentric=AgentViewViz(max_video_length=100, episode_ids=self.viz_video_ids),
action_probs=ActorViz(figsize=(3.25, 10), fontsize=18),
taken_action_logprobs=TensorViz1D(),
episode_mask=TensorViz1D(rollout_source=("masks",)),
rnn_memory=TensorViz2D(rollout_source=("memory", "single_belief")),
thor_trajectory=ThorViz(figsize=(16, 8), viz_rows_cols=(448, 448), scenes=("FloorPlan_Train{}_{}", 1, 1, 1, 1)),
)
return self.viz
def machine_params(self, mode="train", **kwargs):
res = super().machine_params(mode, **kwargs)
if mode == "test":
res.set_visualizer(self.get_viz(mode))
return res