Package: virtualhome
VirtualHomeVirtualHomeis an interactive platform to simulate complex household activities via programs. Key aspect of VirtualHome is that it allows complex interactions with the environment, such as picking up objects, switching on/off appliances, opening appliances, etc. Our simulator can easily be called with a Python API: write the activity as a simple sequence of instructions which then get rendered in VirtualHome. You can choose between different agents and environments, as well as modify environments on the fly. You can also stream different ground-truth such as time-stamped actions, instance/semantic segmentation, and optical flow and depth. The platform allows to simulate multi-agent activities and can serve as an environment to train agents fro embodied AI tasks.Check out more details of the environmnent and platform atvirtual-home.org.What is NewVirtualHome 2.3 is out! Here are the latest updates:Added Procedural Generation Capabilities to allow agents to explore a infinite possibility of unique environments!We added more custom designed environments!Enhanced simulated physics with the environmentsTime management system with synchronized day/nightNew outdoor terrain with accurate sunlight/shadowsImproved indoor realtime lightingMore realistic roomsSignificant performance enhancements, asset optimizations, stability improvementsUpdated documentationGeneral bug fixes for existing environmentsPast updates[August 2020] Added RL Environment Demo, and example to combine Environments with Ray.[April 2020] We added new documentation! Check it out athttp://virtual-home.org/documentationWe include OpenAI Gym like environments to train RL agents with VirtualHome. Check out the unity_environment.py class.API to add characters in the scene and fixed cameras, and record from those camerasCurrently in DevelopmentEnhancements for Procedural Generation CapabilitiesPhotorealism capabilitiesMore actions and object interactionsHuman interactionContentsOverviewSet UpGenerating Videos/KeyframesVirtualHome RL EnvDatasetModify VirtualHomeCitationContributorsOverviewActivities in VirtualHome are represented through two components:programsrepresenting the sequence of actions that compose an activity, andgraphsrepresenting a definition of the environment where the activity takes place. Given a program and a graph, the simulator executes the program, generating a video of the activity or a sequence of graphs representing how the environment evolves as the activity takes place. To this end, VirtualHome includes two simulators: theUnity SimulatorandEvolving Graph. You can find a more complete documentation with examples and the different executables athttp://virtual-home.org/documentation.Unity SimulatorThis simulator is built in Unity and allows generating videos of activities. To use this simulator, you will need to download the appropiate executable and run it with thePython API. You can check a demo of the simulator indemo/unity_demo.ipynbEvolving GraphThis simulator runs fully in python and allows to generate a sequence of graphs when a program is executed. You can run it insimulation/evolving_graph. Note that some of the objects and actions in this simulator are not supported yet in Unity Simulator.Set UpInstall$pipinstallvirtualhomeWe also provide aJupyternotebook with a demo and starting code. If you want to run the demo,install Jupyterand run it on your host. If you are new to Jupyter, seeRunning the Jupyter Notebookfor a walkthrough of how to use this tool.Download Unity SimulatorDownload the VirtualHome UnitySimulator executable and move it undersimulation/unity_simulator.DownloadLinux x86-64 version.DownloadMac OS X version.DownloadWindows version.Test simulatorTo test the simulator in a local machine, double click the executable, or run it via terminal. When running it via the temrinal, we recommend setting windowed mode (so that the simulator does not take the full screen), as such:./path_to_exec-screen-fullscreen0-screen-quality4Once the simulator has started, run the demo indemo/unity_demo.ipynb.If you do not have a monitor or want to test the simulator remotely, you can either useDockeror use an X server (find the installation instructions inthis medium post). When running the executable with an X server, use -batchmode. For Linux, you would do:First run the X server on a terminal. You will have to specify which display you want to use, and on which GPUs. By default it will use all the gpus availablesudopythonhelper_scripts/startx.py$display_numOn a separate terminal, launch the executableDISPLAY=:display_num./{path_sim}/{exec_file}.x86_64-batchmodeFor Linux, you can also launch the UnityCommunication specifying an executable file. This will directly open the executable on the right sceen. You can do it as follows:After running the X server, run:fromsimulation.unity_simulatorimportcomm_unitycomm=comm_unity.UnityCommunication(file_name=file_name,port={your_port},x_display={your_display})It will open an executable and create a communication object to render scripts or simulate actvities. You can open multiple executables at the same time, to train models or generate data using multiple processes.DockerYou can also run Unity Simulator using Docker. You can find how to set it uphere.Generating Videos and SnapshotsVirtualHomeUnity Simulatorallows generating videos corresponding to household activities. In addition, it is possible to useEvolving Graphsimulator to obtain the environment for each execution step and useUnitySimulatorto generate snapshots of the environment at each step.Generate videosOpen the simulator and run:cddemo/
pythongenerate_video.pyGenerate snapshotsOpen the simulator and run:cddemo/
pythongenerate_snapshots.pyA grid of snapshots for the given script will be generated and saved indemo/snapshot_test.png.VirtualHome RL EnvVirtualHome can be used as an environment for Reinforcement Learning. We provide a base classUnityEnvironmentinsimulation/environment/unity_environment.py. You can test how the class works by runningcddemo
pythontest_unity_environment.pyThe provided environment can be combined withRay, to run multiple environments in parallel, allowing to scale your Reinforcement Learning algorithms. You can test parallel environments by running:cddemo
pythontest_unity_environment_mp.pyDatasetWe collected a dataset of programs and augmented them with graphs using the Evolving Graph simulator. You can download themhere.
Once downloaded and unzipped, move the programs into thedatasetfolder. You can do all this by executing the script./helper_scripts/download_dataset.shThe dataset should follow the following structure:dataset
└── programs_processed_precond_nograb_morepreconds
	|── initstate
	├── withoutconds
	├── executable_programs
	|   ├── TrimmedTestScene7_graph
	|	└── ...
	└── state_list
		├── TrimmedTestScene7_graph
	   	└── ...The folderswithoutcondsandinitstatecontain the original programs and pre-conditions.When a script is executed in an environment, the script changes by aligning the original objects with instances in the environment. You can view the resulting script inexecutable_programs/{environment}/{script_name}.txt.To view the graph of the environment, and how it changes throughout the script execution of a program, checkstate_list/{environment}/{script_name}.json.You can find more details of the programs and environment graphs indataset/README.md.Script AugmentationInSynthesizing Environment-Aware Activities via Activity Sketches,
we augment the scripts with two knowledge bases:KB-RealEnvandKB-ExceptonHandler.
You can download the augmented scripts inKB-RealEnvandKB-ExceptionHandler.Here, we provide the code to augment the sripts:Augment withKB-RealEnvcddataset_utils
pythonaugment_dataset_locations.pyAugment withKB-ExceptionHandlercddataset_utils
pythonaugment_dataset_exceptions.pyOriginal Collected and Scripted ProgramsWe originally collected a set of programs to predict from language descriptions, and generated a larger of programs via a scripted language. Those programs are describedhereas VirtualHome Activity (collected programs) ActivityPrograms (scripted programs). You can download them here:DownloadVirtualHome Activity.DownloadActivityPrograms.ResourcesTo do the above generation and augmentation, some valuable resource files are used to set the properties of objects, set the affordance of objects, etc.
Checkresources/README.mdfor more details.DocumentationTo learn more about VirtualHome, please check outVirtualHome Docs.Modify VirtualHomeIf you would like to contribute to VirtualHome, or modify the simulator for your research needs. Check out the repository with theUnity Source Code. You will need to download the Unity Editor and build your own executable after having made the updates.CitationVirtualHome has been used in:VirtualHome: Simulating HouseHold Activities via Programs.PDFX. Puig*, K. Ra*, M. Boben*, J. Li, T. Wang, S. Fidler, A. Torralba.CVPR2018.Synthesizing Environment-Aware Activities via Activity Sketches.A. Liao*, X. Puig*, M. Boben, A. Torralba, S. Fidler.CVPR2019.Watch-and-Help: A Challenge for Social Perception and Human-AI Collaboration.X. Puig, T. Shu, S. Li, Z. Wang, J. Tenenbaum, S. Fidler, A. Torralba.ICLR2021, spotlight.NeurIPS Cooperative AI Workshop 2020, Best Paper Award.If you plan to use the simulator, please consider citing this.@inproceedings{puig2018virtualhome,
  title={Virtualhome: Simulating household activities via programs},
  author={Puig, Xavier and Ra, Kevin and Boben, Marko and Li, Jiaman and Wang, Tingwu and Fidler, Sanja and Torralba, Antonio},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  pages={8494--8502},
  year={2018}
}@InProceedings{Liao_2019_CVPR,
author = {Liao, Yuan-Hong and Puig, Xavier and Boben, Marko and Torralba, Antonio and Fidler, Sanja},
title = {Synthesizing Environment-Aware Activities via Activity Sketches},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}@misc{puig2020watchandhelp,
      title={Watch-And-Help: A Challenge for Social Perception and Human-AI Collaboration}, 
      author={Xavier Puig and Tianmin Shu and Shuang Li and Zilin Wang and Joshua B. Tenenbaum and Sanja Fidler and Antonio Torralba},
      year={2020},
      eprint={2010.09890},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}ContributorsThe VirtualHome API and code has been developed by the following people.Xavier PuigMarko BobenKabir SwainJordan RenKevin RaZilin WangShuang LiTianmin ShuAndrew Liao