|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Part 1: Synthetic Data Generation and Training Workflow with Warehouse Sim Ready Assets\n", |
| 8 | + "\n", |
| 9 | + "This notebook is the first part of the SDG and Training Workflow. We will be focusing on generating Synthetic Data for our use case\n", |
| 10 | + "\n", |
| 11 | + "A high level overview of the steps:\n", |
| 12 | + "* Pulling Isaac Sim Docker Container \n", |
| 13 | + "* Using Replicator API for Data Generation with Domain Randomization\n" |
| 14 | + ] |
| 15 | + }, |
| 16 | + { |
| 17 | + "cell_type": "markdown", |
| 18 | + "metadata": {}, |
| 19 | + "source": [ |
| 20 | + "### Table of Contents\n", |
| 21 | + "\n", |
| 22 | + "This notebook shows provides an overview of generating synthetic data using Warehouse Sim Ready assets with Isaac Sim and Omniverse Replicator. We will generate data for the `palletjack` class of objects. \n", |
| 23 | + "\n", |
| 24 | + "1. [Set up Isaac Sim via Docker Container](#head-1)\n", |
| 25 | + "2. [Generate Data for Detecting Palletjacks](#head-2)\n", |
| 26 | + "3. [Deeper dive into SDG script](#head-3)\n" |
| 27 | + ] |
| 28 | + }, |
| 29 | + { |
| 30 | + "cell_type": "markdown", |
| 31 | + "metadata": {}, |
| 32 | + "source": [ |
| 33 | + "## 1. Set up Isaac Sim: Docker Container Installation <a class=\"anchor\" id=\"head-1\"></a>\n", |
| 34 | + "\n", |
| 35 | + "### This step can be skipped if the Isaac Sim Docker container has already been set up on your Cloud/Remote Instance\n", |
| 36 | + "\n", |
| 37 | + "* Follow the [instructions](https://docs.omniverse.nvidia.com/isaacsim/2022.2.1/install_container.html) for Isaac Sim Container Installation\n", |
| 38 | + "* Ensure that `docker run` command on Step 7 works as expected and you are able to enter the container. \n", |
| 39 | + "\n", |
| 40 | + "We will use `./python.sh` in the container to run our SDG script. Please make sure you exit the container before running the next cells " |
| 41 | + ] |
| 42 | + }, |
| 43 | + { |
| 44 | + "cell_type": "markdown", |
| 45 | + "metadata": { |
| 46 | + "tags": [] |
| 47 | + }, |
| 48 | + "source": [ |
| 49 | + "## 2. Generate Data for Detecting Palletjacks <a class=\"anchor\" id=\"head-2\"></a>\n", |
| 50 | + "\n", |
| 51 | + "* We can find the Palletjack USDs in the Warehouse Sim Ready asset collection (`http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/DigitalTwin/Assets/Warehouse/Equipment/Pallet_Trucks`)\n", |
| 52 | + "* First, we will mount our current local directory while running the docker container. This will ensure that we can run our scripts inside the Isaac Sim container. Data generated in the container will also be saved in this mounted directory." |
| 53 | + ] |
| 54 | + }, |
| 55 | + { |
| 56 | + "cell_type": "code", |
| 57 | + "execution_count": 1, |
| 58 | + "metadata": { |
| 59 | + "tags": [] |
| 60 | + }, |
| 61 | + "outputs": [ |
| 62 | + { |
| 63 | + "name": "stdout", |
| 64 | + "output_type": "stream", |
| 65 | + "text": [ |
| 66 | + "/home/karma/Downloads/getting_started_v4.0.1/notebooks/tao_launcher_starter_kit/detectnet_v2/sdg_and_training/sdg-and-training/palletjack_sdg\n" |
| 67 | + ] |
| 68 | + } |
| 69 | + ], |
| 70 | + "source": [ |
| 71 | + "import os\n", |
| 72 | + "\n", |
| 73 | + "# This is the directory which will be mounted into the Isaac Sim container. Make sure <path_to_repo_cloned> is updated correctly\n", |
| 74 | + "# os.environ[\"MOUNT_DIR\"]=os.path.join(<path_where_repo_cloned>, \"palletjack_sdg\")\n", |
| 75 | + "os.environ[\"LOCAL_PROJECT_DIR\"]=os.path.dirname(os.getcwd())\n", |
| 76 | + "os.environ[\"MOUNT_DIR\"] = os.path.join(os.getenv(\"LOCAL_PROJECT_DIR\"), \"palletjack_sdg\")\n", |
| 77 | + "print(os.getenv(\"MOUNT_DIR\"))" |
| 78 | + ] |
| 79 | + }, |
| 80 | + { |
| 81 | + "cell_type": "code", |
| 82 | + "execution_count": null, |
| 83 | + "metadata": { |
| 84 | + "scrolled": true, |
| 85 | + "tags": [] |
| 86 | + }, |
| 87 | + "outputs": [], |
| 88 | + "source": [ |
| 89 | + "# Make sure the MOUNT_DIR location is correct, it shold have the scripts needed for SDG there\n", |
| 90 | + "\n", |
| 91 | + "!docker run --name isaac-sim --entrypoint bash -it --gpus all -e \"ACCEPT_EULA=Y\" --rm --network=host \\\n", |
| 92 | + " -v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache/Kit:rw \\\n", |
| 93 | + " -v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \\\n", |
| 94 | + " -v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw \\\n", |
| 95 | + " -v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \\\n", |
| 96 | + " -v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \\\n", |
| 97 | + " -v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \\\n", |
| 98 | + " -v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \\\n", |
| 99 | + " -v ~/docker/isaac-sim/documents:/root/Documents:rw \\\n", |
| 100 | + " -v $MOUNT_DIR:/isaac-sim/palletjack_sdg \\\n", |
| 101 | + " nvcr.io/nvidia/isaac-sim:2022.2.1 \\\n", |
| 102 | + " ./palletjack_sdg/palletjack_datagen.sh\n", |
| 103 | + " \n", |
| 104 | + "# Make sure $MOUNT_DIR is set correctly from the cell above" |
| 105 | + ] |
| 106 | + }, |
| 107 | + { |
| 108 | + "cell_type": "markdown", |
| 109 | + "metadata": {}, |
| 110 | + "source": [ |
| 111 | + "\n", |
| 112 | + "The data generation will begin in `headless` mode. We will be generating 5k images and using a 90:10 split for training and validation. " |
| 113 | + ] |
| 114 | + }, |
| 115 | + { |
| 116 | + "cell_type": "code", |
| 117 | + "execution_count": null, |
| 118 | + "metadata": { |
| 119 | + "tags": [] |
| 120 | + }, |
| 121 | + "outputs": [], |
| 122 | + "source": [ |
| 123 | + "# Once the data generation is complete, list the folders in the data directory\n", |
| 124 | + "\n", |
| 125 | + "!ls -rlt $MOUNT_DIR/palletjack_data\n", |
| 126 | + "\n", |
| 127 | + "# There hould be 3 folders -> 1. distractors_warehouse 2. distractors_additional 3. no_distractors " |
| 128 | + ] |
| 129 | + }, |
| 130 | + { |
| 131 | + "cell_type": "markdown", |
| 132 | + "metadata": {}, |
| 133 | + "source": [ |
| 134 | + "## 3. Deeper Dive into SDG Script <a class=\"anchor\" id=\"head-3\"></a>\n", |
| 135 | + "\n", |
| 136 | + "* The `standalone_palletjack_sdg.py` is the Python script which runs and generates data in headless mode inside the container.\n", |
| 137 | + "* The overall flow of the script is similar to the `standalone_examples/replicator/offline_generation.py` file provided as a starting point with Isaac Sim\n", |
| 138 | + "\n", |
| 139 | + "\n", |
| 140 | + "* We will be carrying out specific randomizations targeted to our use case. Some of them are:\n", |
| 141 | + " * Camera Pose Randomization -> Should be similar to a robot perspective in the scene\n", |
| 142 | + " * Palletjack Color Randomization -> To ensure model is robust to variations in Palletjack colors\n", |
| 143 | + " * Distractors Pose Randomization -> To enable the model to *focus* on the right object (Our object of interest: Palletjack)\n", |
| 144 | + " * Lighting Randomization-> Model robust to lights and reflections/shadows in the scene\n", |
| 145 | + " * Floor and Wall Texture Randomization -> Model more robust to changes in background textures and features <br> <br>\n", |
| 146 | + " \n", |
| 147 | + " \n", |
| 148 | + "* We are only interested in the `palletjack` object class, all other semantics are removed from the stage with the `update_semantics()` function\n", |
| 149 | + "\n", |
| 150 | + "* You can use a model of your own choice to train with this data (Pytorch/Tensorflow or other frameworks)\n", |
| 151 | + "\n", |
| 152 | + "* The data is written in the KITTI Format, this allows seamless integration with TAO to train a model. Refer to `training/cloud_train.ipynb` notebook (Part 2) for training with TAO\n" |
| 153 | + ] |
| 154 | + } |
| 155 | + ], |
| 156 | + "metadata": { |
| 157 | + "kernelspec": { |
| 158 | + "display_name": "Python 3 (ipykernel)", |
| 159 | + "language": "python", |
| 160 | + "name": "python3" |
| 161 | + }, |
| 162 | + "language_info": { |
| 163 | + "codemirror_mode": { |
| 164 | + "name": "ipython", |
| 165 | + "version": 3 |
| 166 | + }, |
| 167 | + "file_extension": ".py", |
| 168 | + "mimetype": "text/x-python", |
| 169 | + "name": "python", |
| 170 | + "nbconvert_exporter": "python", |
| 171 | + "pygments_lexer": "ipython3", |
| 172 | + "version": "3.8.10" |
| 173 | + }, |
| 174 | + "vscode": { |
| 175 | + "interpreter": { |
| 176 | + "hash": "f23a2831654361cfd8b219e05b5055fdda3e37fe5c0b020e6226f740844c300a" |
| 177 | + } |
| 178 | + } |
| 179 | + }, |
| 180 | + "nbformat": 4, |
| 181 | + "nbformat_minor": 4 |
| 182 | +} |
0 commit comments