Synthetic Data Generation

Synthetic Data Generation using Nvidia-Omniverse Replicator

NVIDIA Omniverse™ Replicator is an extensible set of APIs that enables developers to generate physically-accurate synthetic data, to accelerate the training of computer vision. In this blog, we will show the steps to install and use the replicator.

Install Code Application

Open Omniverse launcher. This screen will pop up.

Install the Omniverse code app from the Exchange tab by pressing the green button in the top right corner.

After installing the code app next step is to launch the app by pressing the “LAUNCH” button:

Now hit the “script editor” tab to write a Python script:

The next step is to write the script in Python:

Now hit “Replicator” on the top left corner to start synthetic data generation. Or press Ctrl+enter

Synthetic Data Generation Python Code

Code: The first step is to import the library with the following Python code:

Initiating asset path. Here we want to generate gun dat. “Gun” is a gun asset, “ENVS” is the background environment, and “SURFACE” is a plane on which we can randomize the target object.

Write the function to attach the class with the target object. “Position” is the position of an object here we have used uniform distribution and given the coordinates points where our object will range. Similarly rotating is used to rotate the object in different directions to add diversity to our data. For all practical purposes position and rotation are used to make data more diverse and general which will affect the accuracy of our perception model positively.

Calling randomizer function from the replicator. This line of code will randomize the object.

On the given coordinates.

Creating a camera and attaching it to the rendered product. This code is making our camera render along with the target object so that all frames that are captured must have the target object. If the camera is not attached to the rendering object then there will be frames missing the target object that is useless to train the DL model.

Attaching writer to write annotations in .npy file. Omniverse replicator comes with different annotation patterns we used bounding_box_2d_tight.

Generating frames with different sizes of objects from different angles. Generating large data is easy in Omniverse num_frames is a parameter you can give in integers like 10,1000 & 10000. It will capture that number of frames. 

Output directory: