Log In Sign Up

SAILenv: Learning in Virtual Visual Environments Made Simple

Recently, researchers in Machine Learning algorithms, Computer Vision scientists, engineers and others, showed a growing interest in 3D simulators as a mean to artificially create experimental settings that are very close to those in the real world. However, most of the existing platforms to interface algorithms with 3D environments are often designed to setup navigation-related experiments, to study physical interactions, or to handle ad-hoc cases that are not thought to be customized, sometimes lacking a strong photorealistic appearance and an easy-to-use software interface. In this paper, we present a novel platform, SAILenv, that is specifically designed to be simple and customizable, and that allows researchers to experiment visual recognition in virtual 3D scenes. A few lines of code are needed to interface every algorithm with the virtual world, and non-3D-graphics experts can easily customize the 3D environment itself, exploiting a collection of photorealistic objects. Our framework yields pixel-level semantic and instance labeling, depth, and, to the best of our knowledge, it is the only one that provides motion-related information directly inherited from the 3D engine. The client-server communication operates at a low level, avoiding the overhead of HTTP-based data exchanges. We perform experiments using a state-of-the-art object detector trained on real-world images, showing that it is able to recognize the photorealistic 3D objects of our environment. The computational burden of the optical flow compares favourably with the estimation performed using modern GPU-based convolutional networks or more classic implementations. We believe that the scientific community will benefit from the easiness and high-quality of our framework to evaluate newly proposed algorithms in their own customized realistic conditions.


page 1

page 3

page 4

page 6


iGibson, a Simulation Environment for Interactive Tasks in Large Realistic Scenes

We present iGibson, a novel simulation environment to develop robotic so...

Evaluating Continual Learning Algorithms by Generating 3D Virtual Environments

Continual learning refers to the ability of humans and animals to increm...

Virtual Worlds as Proxy for Multi-Object Tracking Analysis

Modern computer vision algorithms typically require expensive data acqui...

Messing Up 3D Virtual Environments: Transferable Adversarial 3D Objects

In the last few years, the scientific community showed a remarkable and ...

VRKitchen: an Interactive 3D Virtual Environment for Task-oriented Learning

One of the main challenges of advancing task-oriented learning such as v...

Optical flow-based branch segmentation for complex orchard environments

Machine vision is a critical subsystem for enabling robots to be able to...

VPS: Excavating High-Level C++ Constructs from Low-Level Binaries to Protect Dynamic Dispatching

Polymorphism and inheritance make C++ suitable for writing complex softw...

Code Repositories


Python HTTP Client for interfacing with Unity Virtual Environment.

view repo

I Introduction

Developing Machine Learning algorithms to solve a target task usually follows a well-established offline process in which data are collected from the real-world operational environment and then used to learn the models parameters and to evaluate the quality of the trained model. Recently, the scientific literature started to focus on the precious role of realistic 3D virtual environments that simulate the real-world setting, allowing researchers to perform a variety of controlled tests that would be very costly if directly performed in the real-world [14]. Models learned in the simulated environment might need to be adjusted to compensate the differences between the simulated and the real world, thus high-quality virtual environments are commonly needed to reduce the compensation effort [11, 14].

If we depart from the case of the most popular benchmarks shared by the scientific community, such as the ones aimed at showing the quality of visual navigation algorithms [20, 7], visual QA [6], and others [4, 1], each research project has its own characteristic features, and it actually requires to design the 3D environment that correctly resembles the target working conditions. Moreover, the way a virtual agent will exploit the information coming from the virtual world, and how it will react to it, need to be designed coherently with the target setting. This clearly suggests that there is the need of providing flexible and easy-to-use tools to encourage the use of virtual environments and to favour the development of those research activities that exploit them. Another important consideration to remark is that not all researchers have robust skills in creating 3D scenes, and this aspect might discourage the use of virtual environments.

With the aim of providing a simple and customizable platform to perform visual recognition experiments in 3D virtual environments, in this paper we present SAILenv

, the Siena Artificial Intelligence Laboratory

111SAILab, environment, that can be freely downloaded following the instructions at, where an extended tutorial is also included. SAILenv is based on Unity, a popular game engine that supports several platforms, developed by Unity Technologies222See for further details., and that includes advanced 3D modeling and state-of-the art quality real-time rendering. SAILenv provides a Python interface that, with a few lines of code, allows every algorithm to get data from the 3D world handled by Unity. To the best of our knowledge, SAILenv is the only platform that yields real-time motion-related information inherited from the 3D engine (thus being extremely accurate), and not computed afterwards from multiple 2D observations, as commonly done in optical flow algorithms [10, 5]. This is an important feature when developing Computer Vision algorithms that benefit from the motion field. Moreover, differently from other popular platforms [11], the data in SAILenv are transferred without relying on any higher-level communication protocols (such as HTTP), thus without introducing further overhead in the transmission. Unity provides a powerful editor to customize the 3D environment, that, however, might discourage researchers when starting from scratch. To overcome this issue, SAILenv includes a ready-to-use Unity project with a set of objects that were initially taken from AI2-THOR 2.1.0 [11], and that we augmented adding realistic textures and lighting effects by means of state-of-the art texturing software, making them strongly photorealistic. Assembling a scene using the provided Unity assets can be done in a few steps, making the virtual environment ready to be queried by the Python code.

[Bed] [Cabinet] [Couch] [Laptop] [Table]

Fig. 1: Samples of objects available in SAILenv.

We provide experimental evidence on the quality of the scenes/objects included in SAILenv, showing that a state-of-the art neural model [9]

trained on real-world data can easily recognize the SAILenv objects. We also measure and compare the speed in computing motion features, showing that SAILenv leads to smaller running times than the ones of popular optical flow estimators (including the ones based on convolutional neural networks

[10]), being intrinsically more accurate.

This paper is organized as follows. Section II describes related 3D frameworks, emphasizing the differences with SAILenv. The structure of SAILenv is discussed in Section III, while usage examples are in Section IV. Section V is about our experimental activity while Section VI concludes the paper.

Ii Related Platforms

Several environments and simulators have been developed by the scientific community in the last few years. Some simulators are not photorealistic, or they are specifically designed to handle specific tasks. Some examples are DeepMind Lab [1], UETorch [12], Scene [8]. Amongst the virtual environments with visual-realistic appearance we mostly focus on the recent AI2-THOR [11] and Habitat [14]. Other existing frameworks are Home [2], Chalet [19], Gibson [18], SceneNet RGBD [15]. These environments are used to study embodied agents [18]

, to instantiate tasks that are about visual navigation with reinforcement learning

[20, 7], interactive VQA [6], task-oriented language grounding [4] or vision-and-language navigation [17].

SAILenv, coherently with what is commonly done in related platforms, captures RGB representations with or without depth information, acquired from the agent camera position and orientation. Similarly to what we propose, also AI2-THOR [11] is based on the Unity engine, but it focuses on the interaction with the environment, so that actions can be attached to objects. Differently, SAILenv focuses on visual recognition, and it simplifies the addiction of new semantic categories to objects, an operation that does not require knowledge of the code structure, and that can be done through the Unity GUI. Moreover, the client-server architecture of AI2-THOR is based on HTTP communication between Unity and the Python API, where the 3D engine acts as a client while the server is implemented on the Python side of the architecture. SAILenv, as we will describe in Section III, implements a more natural organization in which the virtual world is a server to which a Python client gets connected to retrieve data that will be processed by the target algorithm. Habitat [14] is mostly focused in allowing the access to different 3D datasets (such as [16, 3]) by a uniform interface, and it includes its own (fast) simulation engine. While in principle the direct customization or the creation of 3D environments is possible, it is not straightforward. Differently, SAILenv is built around the Unity engine, that is a very popular and multi-platform software solution. In Table I we summarize a comparison of the main features of SAILenv with some of the aforementioned frameworks. Notice that only SAILenv includes optical flow and lightweight communication over the network, and that, differently from AI2-THOR and Habitat, it can also run on a Windows machine.

Platform Photoreal Depth OptFlow LightNet OS
DeepMind Lab [1] n.a. Unix
Habitat [14] n.a. Unix
AI2-THOR [11] Unix
SAILenv Win+Unix
TABLE I: Comparison of the main features of SAILenv with other popular platforms. LightNet refers to lightweight communication over the network (n.a. means network communication is not directly provided).

Iii Architecture and Main Features

Fig. 2: Organization of the SAILenv architecture.

SAILenv is organized following a client-server architecture that naturally implements the idea of having a virtual scene (server) and an agent that explores it (manipulated by the client). The agent position and orientation are changed by means of the client commands, implemented in a simple Python API, also referred to as agent API. Whenever the client queries the environment for information, the agent returns a number of views that capture different properties of what the agent is observing, i.e., annotated frames. The view data can then be processed by the target Computer Vision algorithm, or fed to existing Machine Learning frameworks, libraries or other software. The overall architecture of SAILenv is summarized in Fig. 2.

We implemented the server within the Unity framework, creating an ad-hoc Unity server that waits for client requests. The Unity server is more than just a network interface layer, since it is a computational module that is responsible of creating the virtual environment, managing the physics simulation and the real-time rendering, fully exploiting the Unity infrastructure. It also generates and packs the data attached to the views requested by the client. Thanks to the power of the Unity environment, the physics simulation runs at real-time speed on most of nowadays servers or laptops. The Unity instance that is running on the server allows the server screen to show what the agent camera is currently capturing (for debug purposes) and, as it will become clearer in the rest of this section, it supports some special server-side interactions. The Python client includes a lightweight cross-platform API with a small dependency tree, and it is in fact a tiny interface that exposes high-level commands over the virtual environment, such as creating a new agent, moving the agent or obtaining views of the current state of the environment through the “eyes” of the agent. In particular, SAILenv yields the classic RGB view, depth information, optical flow, semantic segmentation, instance labeling, as shown in Fig. 3 and Fig. 4. Each view includes information for all the pixels acquired by the camera. The RGB view is straightforwardly implemented representing each pixel (in each channel) with the classic 8-bit encoding, while depth information is inherited by the Unity engine, through a gray-scale texture representing the distance of the observed rendered objects from the camera view. In the depth example of Fig. 3c, lighter pixels indicate elements that are closer to the agent. Each pixel is fully annotated with a category identifier (semantic labeling) and an instance identifier, that are encoded in the category and instance views, respectively, as show in Fig. 3a-b. While the instance identifier is implicitly given by the unique Unity identifier of each object in the scene, categories can be added or edited using the Unity editor GUI, without any code-level operations. In particular, categories are represented as Unity objects, and they can be attached to every other object by a drag-and-drop operation. SAILenv also includes a “category holder” to organize sets of categories and to allow the user to quickly add them to the current scene. We post-pone the description of the view associated to optical flow to Section III-A. Whenever all the views requested by the client are ready, they are sent over a network communication as raw bytes or GZip encoded bytes. This makes the communication efficient, avoiding possible overhead caused by HTTP-based communication or other higher-level data-packing and transmission protocols, as we will describe in Section III-B.

[Category View] [Instance View] [Depth View]

Fig. 3: Pixel-wise annotations yielded by SAILenv (Optical flow is reported in Fig. 4)

SAILenv allows users to have access to a collection of photo-realistic objects to simplify the development of novel scenes, whose visual quality has been enhanced using modern effects and shaders, that will be discussed in Section III-C. Movement dynamics can be attached to the objects of the scene with a few operations, eventually using the movement templates of Section III-D, while the way the agent movement is controlled is due to the mover element of Fig. 2, that will be the subject of Section III-E.

Iii-a Realistic Optical Flow

SAILenv also yields highly precise and dense motion information about the environment. Differently from what is done by the most common optical flow algorithms, the SAILenv optical flow is not due to an estimation obtained by observing consecutive frames, and it is fully computed by the physics engine of Unity. Unity has access to the information about the motion of the objects in the scene and the agent viewpoint, and it uses them to drive the simulation of physics of the environment. SAILenv inherits such information and adapts it to generate a view that includes the motion vectors for all the pixels of the frame. In detail, such view is a

tensor of single-precision floating point numbers, being and the height and width of the frame, respectively. For each pixel, a pair of floats describes the velocity of the pixel (pixels per second). An example of such motion field, represented in the HSV color space, is reported in Fig. 4(a).333Cartesian coordinates are first converted into polar coordinates where is the magnitude and is the phase. Then, then we set , , and .

In Fig. 4b-d, we report three examples of the optical flow computed in a scene populated solely by a rotating cube. The cube has no special textures, and it has a uniform color. This clearly makes it hard to estimate the pixel-level motion using classic algorithms, while SAILenv can correctly capture the rotation of the cube (Fig. 4b). Widely used implementations, such as the Farneback algorithm implemented in OpenCV444, or modern approaches based on convolutional neural networks [10] fail in correctly capturing the motion, as noticeable in Fig. 4c-d. Despite its very high precision, the optical flow has almost null computational burden on the Unity server. Of course, some overhead is due to data normalization operations, that is still negligible with respect to what is commonly needed to infer motion from pairs of static frames, as we will experiment in Section V.

[Camera Motion Optical Flow] [Rotating Object Optical Flow] [LiteFlowNet Optical Flow] [OpenCV Optical Flow]

Fig. 4: Optical flow yielded by SAILenv. In Figure 4 we see the optical flow given by the agent motion. In Figure 4 we see the optical flow given by the objects motion, while the agent stands still. In Figure 4 we show how LiteFlowNet [10] estimates the optical flow in the same conditions, while in Figure 4 we show the estimation of the OpenCV implementation of the Farneback Optical Flow.

Iii-B Lightweight Network Transmission

The Unity environment awaits for incoming connections on a target port. By the time the Python client connects to the socket, calling the apposite API, the generation of an agent inside the 3D environment is triggered. The agent is associated with a worker background thread which listens and replies to further requests. Even if the worker thread is implemented within the Unity framework, it is not synchronous with respect to the physics engine, in order to avoid network-related slowdowns or communication issues to lock the simulation engine. Instead of using any higher-level protocols to serialize the data and send it through the network, SAILenv either sends the raw data or GZipped data (customizable), reducing at its minimum the communication overhead. This is different from other popular solutions that rely on other software stacks to handle the data management [11].

Iii-C Photo-realistic Objects and Scenes

Relying on the Unity engine to handle the virtual environments allows SAILenv to exploit all the facilities of the powerful 3D editor that comes with Unity. However, creating new scenes in virtual environments might quickly become a time consuming procedure that requires experience in 3D graphics. This is even more evident when preparing photo-realistic objects, that requires the user to pay attention to a large number of aspects in order to reach a certain target appearance for the object.

In order to partially mitigate these issues, SAILenv comes with more than 65 objects that can be placed in any scene, plus some objects related to the structure of the sample scenes (walls, windows, etc.). See Fig. 1 for some examples of available objects. Most object meshes were originally taken from the AI2-THOR project, and strongly re-worked in order to improve the quality of their appearance, reaching a more advanced photo-realistic level. In particular, we employed Physically Based Rendering (PBR), a state-of-the-art technique to define 3D mesh materials which correctly simulates the light on the mesh. Standard PBR shaders from the Unity built-in rendering pipeline were used to handle all the objects materials, and we manually tuned the “Albedo, Metallic, Specular, Normal” textures555See the full descriptions in the Unity documentation, Object models were properly edited for texturing, adding UV coordinates to them. To generate textures, we used the Substance666 suite.

In order to build the basic conditions for the global illumination of the environment, we used different HDRI (High Dynamic Range Imaging) skyboxes, a set of textures wrapped in cube-maps applied to the surrounding of a 3D scenes. HDRI skyboxes provide realistic environmental global illumination and static reflections on all objects materials. Each one of them is based on real-world pictures. Static reflection probes777 and lights were added to generate additional objects reflections and to provide further illumination888At the time we are writing, the only limitation we report is that moving objects do not appear in reflections. We are working to improve this aspect without sacrificing too much the performance of the application.. Finally, we applied a set of post-processing effects, using Unity Post-Processing Stack v2 package999, that we found to be a good trade-off between quality and impact in performance.

SAILenv currently includes a ready-to-go Unity project with all the photo-realistic elements and 4 sample scenes based on them, meant to demonstrate the capabilities of the framework and to run some experiments in simple contexts, as we will describe in Section V. The user can either edit one of these scenes or create a new one either using the SAILenv objects or other 3D elements. The sample scenes are about different rooms, and they are based on a variety of objects, and they also include moving objects to evaluate motion-based algorithms. The agent has a predefined motion pattern such that it automatically moves around the scenes exploring the available areas (for the full descriptions on how to inject object and agent motion see Section III-D and Section III-E, respectively). In detail:

  • Room 01: Bedroom. Main objects: laptop, bed, desk, chairs and writing materials. See Fig. 5a.

  • Room 02: Sitting and dining areas. Main objects: chairs, couches, dining table, paintings. Object movement: a toy rusty plane flies around the room. See Fig. 5b.

  • Room 03: Bathroom. Main object: toilet, bathtub, cleaning supplies and hands towels. Object movement: many of the objects inside the scene will occasionally be pushed in a random direction, moving from their original position. See Fig. 5c.

  • Optical: It includes rotating cubes and a cylinder. This scene is not realistic and is meant to be used for debugging purposes (for example, to test the optical flow feature). See Fig. 5d.

[Room 01] [Room 02] [Room 03] [Optical]

Fig. 5: Sample scenes in SAILenv

Iii-D Making Objects Move

Object movement is handled by the Unity physics engine, exploiting “rigidbody” components101010 In particular, only those objects that have a rigidbody component attached to them can move, differently from the ones that are marked as “full static”. Moving objects must define a mass value, which is not supposed to be completely realistic, but appropriate enough to generate a seemingly realistic behaviour.

The concrete movement behaviour can be scripted within the Unity engine, using the C# language. SAILenv includes three sample movement scripts that can be attached to multiple objects, and that were briefly mentioned when describing Room 02, Room 03, and Optical in Section III-C. The first movement behaviour is formalized in the SAILenv script named “poltergeist”, that randomly moves an object by applying both a force and a torque in random direction, at random time instants. The second movement behaviour is modeled by the “wander plane” script, that moves the rigidbody of an object along a configurable set of waypoints. Such waypoints are switched at random time intervals, and the resulting movement can be used, for instance, to emulate a flying airplane. There are a set of parameters that are configurable in the object inspector, to better customize this behaviour. The last movement example included in SAILenv, “rotate rigidbody”, is about the rotating elements of the Optical scene, that is indeed very simple and a useful reference for beginners.

Iii-E Handling Agent Movement

Whenever an agent is created in the virtual environment, the Python client allows the user to define the position and the orientation of the agent. Of course, the user could develop his own Python routines to move the agent accordingly to some custom criteria. However, each SAILenv scene also includes a Unity object acting as track for the agents to follow. This object is called mover within the Unity server, as shown in Fig. 2. This object is subject to the Unity physics engine, and all the agents that are active in the considered scene implicitly “follows” it, i.e., they inherit its position and orientation. This is implemented activating the “follow rigidbody” behaviour. In other words, the Python client asks a Unity agent to change its position, and this request is passed to the mover object that is the one that is actually moved to the new position. The outcome of this operation is that the agent will inherit the new position of the mover, thus the client will observe the agent moving. At a first glance, this organization might seem over-structured. However, SAILenv includes another facility that actually motivates such organization, that is the possibility of interacting with the virtual environment directly through the running instance of Unity in the server (thus not using the client at all). In detail, whenever a SAILenv scene is created, a default agent, named debug agent, can be added to the scene, whose properties are set in order to instruct him to mimic the mover object. Since both the debug agent and the client-manipulated agent follow the same mover, as shown in Fig. 2, the debug agent actually becomes a proxy of the client-manipulated agent (and vice-versa).

SAILenv implements a “rigidbody controller” that allows the mover to be guided by means of the keyboard and mouse of the machine hosting the Unity server, in a 3D-shooter-like fashion. This is particularly useful for debug purposes, allowing the user to freely explore and see how the algorithm processing the client data will react. The mover can also be controlled by an alternative policy the is implemented in the “waypoint controller”. In this case, the mover will follow a trajectory defined by a set of customizable “waypoints”, that are placeholder objects with a given position/orientation. For each pair of consecutive waypoints, the mover will linearly interpolate their positions/orientations and it will apply the interpolated transformation parameters to itself. The set of waypoints is configurable in each scene, as well as the total time to run across all the waypoints. When the last waypoint is reached, the mover will consider the first one and it will start another cycle. To switch between the two movement policies during the execution, the user can press the tab key on the Unity instance running on the server.

Iv Using SAILenv

In this section we describe concrete examples of how to use the SAILenv platform, discussing both server and client-related operations. For an extended tutorial, documentation, and downloads, please refer to the project website, that is

Iv-a Interfacing an Algorithm with SAILenv

The users aiming at interfacing an algorithm with SAILenv have to take care of running the Unity server first, and then to import the package with the Python API in their own code, in order to generate a valid client. The Unity editor allows the user either to directly run the current scene(s), thus activating the SAILenv Unity server as well, or to build the 3D scenes into valid executables for a target operative system, so that running an instance of the Unity server is trivial and it does not depend on the Unity editor. SAILenv comes with the scenes described in Section III-C that are pre-built and ready to be executed (we provide builds for the most common operative systems). Once the scene is running, the Unity server listens for connections on port 8085 (by default). The Python code needed to create a valid client and get data from the virtual environment is minimal, as shown in the snippet of Fig. 6.

Fig. 6: Code that runs the Python client and get data to process.

The code initially creates and registers an agent on the Unity server. We assumed that the Unity Server is running the sample scenes of Section III-C on IP . Notice that the resolution at which the agent will perceive the virtual environment is fully customizable when creating a new Agent. Also the views that are expected to be returned by the environment can be customized by using specific arguments. The server runs a batch of scenes, that can be selected by calling the agent.change_scene(scene_id) method. The indices of the available scenes are in the agent.scenes array of the agent instance, so that in the code snippet we are selecting Room 02. This array is created after having registered the agent. The agent.get_frame() method fetches the current views from the environment, that are returned in the dictionary frame. Such dictionary is composed by the following key-value pairs:

  • main: – RGB view in OpenCV format (BGR).

  • category: – semantic labeling, in which each element at coordinates of the tensor is an integer containing the category ID associated to the object to which the pixel belongs.

  • object: – instance labeling, that is a BGR image in which each pixel color is the unique identifier of the scene object to which the pixel belongs.

  • flow: – optical flow, composed of , velocities of the flow.

  • depth: – the depth of each of the pixels of the agent camera, in .

The final call to agent.delete() removes the agent from the server, releasing resources.

Going beyond the example of Fig. 6, another important property to mention is agent.categories, that is set when the agent registers or when the scene is changed, and that contains a dictionary that maps category numeric IDs to their respective names. By default, the agent will move in the virtual environments following the waypoints of the scene, as described in Section III-E. We can toggle this behaviour by calling agent.toggle_follow(). Finally, we can change the position and orientation of the agent by agent.set_position((x,y,z)) and agent.set_rotation((rx,ry,rz)), respectively.

Iv-B Creating Scenes in SAILenv

Once the SAILenv Unity project has been downloaded and opened in the Unity editor, the sample scenes are ready to be edited, or the user can trivially create a new scene from scratch. Adding each of the photo-realistic objects described in Section III-C to the current scene can be easily done by a drag-and-drop operation from the Unity project tab to the current scene or to the Unity hierarchy tab. Making an object move (Section III-D) requires to remove any full-static flags from the object and ensuring it has a rigidbody component attached to it. In order to trigger the existing movement patterns described in Section III-D, it is necessary to add and/or turn on either the “poltergeist” or “wander plane” behaviour on an object with an attached rigidbody. Of course, it is possible to also make new behaviours by coding them directly, but this is outside the scope of this paper.

In the case of creation of new scenes from scratch, in order to make them compliant with the SAILenv framework, it is strongly suggested (even if not explicitly mandatory) to add a debug agent to it (Fig. 2), while the client-related agent will be automatically created on the fly while registering the client. A very important element to add to the scene is the mover object (drag-and-drop), without which the agent (being it a debug or a client-related agent) cannot move. The debug agent, if present, must be connected to the mover, dragging the mover object into the Unity inspector of the debug agent (specifically into the “target rigidbody” field of the “follow rigidbody” component). The mover already comes with the behaviours of Section III-E, i.e., “rigidbody controller” and “waypoint controller”. In order to design a trajectory along which the agent should move when the scene is running, several waypoints must be added to the scene. This can be easily done creating empty objects (placeholders) in positions and with rotations that we want the agent to visit, and then drag all these objects in the “waypoints” field of the “waypoint controller” behaviour inspector.

V Experimental evaluation

We evaluated the concrete quality of SAILenv photo-realism (Section V-A) and optical flow (Section V-B) exploiting state-of-the-art neural architectures.

V-a Photo-realism

We prepared an experimental setting in which a state-of-the-art object detector (that also returns object masks), pretrained on real-world data, is interfaced with SAILenv. Focusing on the sample scenes of SAILEnv, we evaluated the capability of such model to correctly recognize the object categories it is aware of, thus indirectly measuring how strongly the appearance of SAILenv objects resembles the one of the corresponding real-world objects. In particular, we exploited a Mask R-CNN model based on the popular ResNet-50 backbone [9], pretrained on the COCO-train2017 data [13]. We focused on a subset of the categories of the COCO data, in particular in classes that are shared with SAILenv objects. For each SAILenv object, we collected 5 frames using the SAILenv client, in different viewing conditions. The list selected categories is reported in the first column of Table II.

For each class, we measured the average Intersection over Union (IoU) between the pixel-wise predictions obtained through the Mask R-CNN mask branch and the ground truth categories returned by SAILenv. Results are reported in second column of Table II. Mask R-CNN is able to identify in a very robust way a large portion of the objects, despite the different viewing condition and the virtual setting. The produced masks mostly overlap the ground truths returned by SAILenv, with some mild exceptions that are due to the labeling criteria that are followed in the COCO training data, slightly different from the ones in SAILenv. For example, in tennis racket and potted plant, the masks predicted by Mask R-CNN tend to occupy all the area of the object, differently from the highly detailed pixel-wise labels produced by SAILenv, in which the spaces among the leaves of the plant, or within the net of the racket, are not marked with the object label. In the case of dining table, chair and, more generally, when there are some occlusions, we observed a related behaviour. The book in SAILenv is different from the ones used in the training data of COCO, while spoon and fork are frequently in different viewing conditions with respect to the ones in the COCO data. To further investigate these intuitions, we also computed a measure that took care of evaluating how strongly the bounding box of the predicted regions matched the ones of the ground truth, leading to the third column of Table II

(bounding box IoU). In this case, we observed that the prediction quality increased, on average, overcoming some of the aforementioned issues (see, e.g., potted plant, tennis racket). We clearly see large standard deviations around some other critical categories (spoon, fork, dining table, chair), confirming that the recognition succeeded in some of the viewing conditions and failed in others, as previously claimed.

Category Pixel-wise IoU Bounding Box IoU
bed 0.7830 0.0879 0.8201 0.0894
book 0.3347 0.2749 0.3506 0.2870
chair 0.6235 0.0566 0.5557 0.4162
couch 0.8742 0.0533 0.9121 0.0561
dining table 0.6891 0.0398 0.4553 0.4096
fork 0.4599 0.1274 0.4800 0.4294
laptop 0.9551 0.0098 0.9476 0.0207
airplane 0.7193 0.0314 0.7865 0.1005
potted plant 0.6106 0.0499 0.8894 0.0656
remote 0.8980 0.0400 0.9534 0.0127
spoon 0.4036 0.1984 0.3787 0.3611
tennis racket 0.5120 0.0475 0.9548 0.0127
toilet 0.9274 0.0178 0.9623 0.0201
tv 0.9641 0.0171 0.9673 0.0135
TABLE II: Mean and standard deviation of the predictions of the Mask R-CNN model (pretrained on COCO2017 dataset) on a dataset obtained from the SAILenv sample scenes. Two measures are considered: Pixel-wise IoU and Bounding Box IoU (see the paper text for details).

V-B Optical Flow Computation

In Section III-A we described how SAILenv generates a dense optical flow that is not an estimation performed observing pairs of frames, but it is about the real motion information coming from the 3D environment. Of course, this leads to the most accurate motion estimation one could have. However, we are left with the open question on the computational burden with respect to competing algorithms, such as the popular OpenCV implementation of the Farneback algorithm [5], and one of the fastest models based on convolutional neural networks, that is LiteFlowNet [10].

The first competitor exploits the OpenCV tools to speed up the computation, which, in the default Python distribution, is performed using the CPU. Differently, in the case of LiteFlowNet, we considered a PyTorch implementation

111111 which leverages GPU-based computations (CUDA). For each compared method, we measured the time needed to produce the flow at six different resolutions, reported in the x-axis of Fig. 7. On the y-axis we reported the average time over 100 sampled frames, with confidence intervals.

In our experimental setting, when considering the OpenCV implementation and LiteFlowNet, SAILenv returns only the RGB frame from the virtual environment, turning off all the internal optical flow computation facilities. Then, the optical flow is computed using one of the competitors, exploiting the current frame and the one returned at the previous time step. The time needed to transfer data to/from the GPU was subtracted from our measurements. We used a Windows desktop machine equipped with an Intel Core i9 9900K, GHz, 64 GB of RAM and an NVIDIA GTX 1080 GPU with 8 GB of VRAM. We also performed experiments on two other machines with different configurations, obtaining results with an analogous trend. SAILenv outperforms the competitors, sometimes reaching almost real-time performances, thanks to the direct access to the physics engine of Unity that is strongly optimized and GPU-based. The gap with the competitors is pretty evident especially at high resolutions.

Fig. 7: Average time (seconds) needed to compute the optical flow associated to a frame sampled from the SAILenv scenes. We compare the SAILenv performances with an OpenCV-based implementation of the Farneback algorithm and the neural model LiteFlowNet[10].

Vi Conclusions and Future Work

We presented SAILenv, the Siena Artificial Intelligence Lab environment, a software platform that makes it easy to create, run, and get data from realistic 3D virtual environments, on which visual recognition or other vision-related algorithms can be efficiently evaluated. SAILenv is based on a server that exploits the Unity engine, performing real-time rendering. SAILenv comes with a Python client and a collection of ready-to-use photorealistic 3D elements that can be easily assembled to create new scenes within the Unity editor, whose quality has been assessed by an experimentation based on a state-of-the art object detector. To the best of our knowledge, SAILenv is the first platform that allows researchers to have access to motion information inherited by the 3D engine, thus extremely accurate and efficiently computed, as we evaluated in a comparison with other popular optical flow algorithms. Due to its simplicity, we believe that SAILenv will provide several researches an efficient entry point to 3D virtual environments. Future work will include the extension to multi-agent systems and new photorealistic objects and scenes.


  • [1] C. Beattie, J. Z. Leibo, D. Teplyashin, T. Ward, M. Wainwright, H. Küttler, A. Lefrancq, S. Green, V. Valdés, A. Sadik, et al. (2016) Deepmind lab. arXiv preprint arXiv:1612.03801. Cited by: §I, TABLE I, §II.
  • [2] S. Brodeur, E. Perez, A. Anand, F. Golemo, L. Celotti, F. Strub, J. Rouat, H. Larochelle, and A. Courville (2017) Home: a household multimodal environment. arXiv preprint arXiv:1711.11017. Cited by: §II.
  • [3] A. Chang, A. Dai, T. Funkhouser, M. Halber, M. Niessner, M. Savva, S. Song, A. Zeng, and Y. Zhang (2017) Matterport3d: learning from rgb-d data in indoor environments. arXiv preprint arXiv:1709.06158. Cited by: §II.
  • [4] D. S. Chaplot, K. M. Sathyendra, R. K. Pasumarthi, D. Rajagopal, and R. Salakhutdinov (2018) Gated-attention architectures for task-oriented language grounding. In Thirty-Second AAAI Conference on Artificial Intelligence, Cited by: §I, §II.
  • [5] G. Farnebäck (2003) Two-frame motion estimation based on polynomial expansion. In Scandinavian conference on Image analysis, pp. 363–370. Cited by: §I, §V-B.
  • [6] D. Gordon, A. Kembhavi, M. Rastegari, J. Redmon, D. Fox, and A. Farhadi (2018) Iqa: visual question answering in interactive environments. In

    Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition

    pp. 4089–4098. Cited by: §I, §II.
  • [7] S. Gupta, J. Davidson, S. Levine, R. Sukthankar, and J. Malik (2017) Cognitive mapping and planning for visual navigation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2616–2625. Cited by: §I, §II.
  • [8] A. Handa, V. Pătrăucean, S. Stent, and R. Cipolla (2016)

    Scenenet: an annotated model generator for indoor scene understanding

    In 2016 IEEE International Conference on Robotics and Automation (ICRA), pp. 5737–5743. Cited by: §II.
  • [9] K. He, G. Gkioxari, P. Dollár, and R. Girshick (2017) Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961–2969. Cited by: §I, §V-A.
  • [10] T. Hui, X. Tang, and C. C. Loy (2018) LiteFlowNet: a lightweight convolutional neural network for optical flow estimation. In IEEE Conference on Computer Vision and Pattern Recognition, Cited by: §I, §I, Fig. 4, §III-A, Fig. 7, §V-B.
  • [11] E. Kolve, R. Mottaghi, W. Han, E. VanderBilt, L. Weihs, A. Herrasti, D. Gordon, Y. Zhu, A. Gupta, and A. Farhadi (2017) AI2-thor: an interactive 3d environment for visual ai. arXiv. Cited by: §I, §I, TABLE I, §II, §II, §III-B.
  • [12] A. Lerer, S. Gross, and R. Fergus (2016) Learning physical intuition of block towers by example. arXiv preprint arXiv:1603.01312. Cited by: §II.
  • [13] T. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick (2014) Microsoft coco: common objects in context. In European conference on computer vision, pp. 740–755. Cited by: §V-A.
  • [14] Manolis Savva*, Abhishek Kadian*, Oleksandr Maksymets*, Y. Zhao, E. Wijmans, B. Jain, J. Straub, J. Liu, V. Koltun, J. Malik, D. Parikh, and D. Batra (2019) Habitat: A Platform for Embodied AI Research. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Cited by: §I, TABLE I, §II, §II.
  • [15] J. McCormac, A. Handa, S. Leutenegger, and A. J. Davison (2017-10)

    SceneNet rgb-d: can 5m synthetic images beat generic imagenet pre-training on indoor segmentation?

    In Proceedings of the IEEE International Conference on Computer Vision (ICCV), Cited by: §II.
  • [16] S. Song, F. Yu, A. Zeng, A. X. Chang, M. Savva, and T. Funkhouser (2017) Semantic scene completion from a single depth image. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1746–1754. Cited by: §II.
  • [17] X. Wang, W. Xiong, H. Wang, and W. Yang Wang (2018) Look before you leap: bridging model-free and model-based reinforcement learning for planned-ahead vision-and-language navigation. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 37–53. Cited by: §II.
  • [18] F. Xia, A. R. Zamir, Z. He, A. Sax, J. Malik, and S. Savarese (2018) Gibson env: real-world perception for embodied agents. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9068–9079. Cited by: §II.
  • [19] C. Yan, D. Misra, A. Bennnett, A. Walsman, Y. Bisk, and Y. Artzi (2018) Chalet: cornell house agent learning environment. arXiv preprint arXiv:1801.07357. Cited by: §II.
  • [20] Y. Zhu, R. Mottaghi, E. Kolve, J. J. Lim, A. Gupta, L. Fei-Fei, and A. Farhadi (2017) Target-driven visual navigation in indoor scenes using deep reinforcement learning. In 2017 IEEE international conference on robotics and automation (ICRA), pp. 3357–3364. Cited by: §I, §II.