Image generator tool for training 3D reconstruction and object segmentation networks. The tool renders supermarket products under randomized conditions along with metadata, segmentation masks and color-coded renderings of different ground truth parameters. It's built on top of Unity Perception Package (version 0.9.0 or later)
Initially, this tool was designed for generating training data for automatic store AI solutions, thus, it contains 3D models of supermarket products only. However this tool can be applied for any set of 3D objects to generate a more general training data for object detection/segmentation and 3D reconstruction tasks (just add to the project folder your 3D models with randomization tags)
Tested with Unity 2020.3/Perception Package 0.9.0 on Windows 10 and debugged with Visual Studio Community 2019
Relative to the baseline perception package it has the following additional features:
- wider randomization options for lighting, object rescaling and material settings
- a set of material shaders to color code various ground truth parameters, including instance segmentation masks and position of meshes in different 3D coordinate systems
- local/global cartesian coordinates, object normalized coordinates (NOC)
- much wider set of prefabs of supermarket products
- scripts for data postprocessing
- automatic test/ train dataset partitioning
- additional multi-view settings for multiple cameras
It generates two datasets: one containing 3D reconstruction data, and another one contains object detection / segmentation data. Based on the configurations, it can be either for monocular or multi-view settings.
Adds PNG renderings to an existing dataset folder or creates a new one (Dataset field of FgObjectRandomizer randomzier)
Currently supports only single foreground object mode
. # dataset root name
├── train # folder of samples selected for training data
│ ├── <1st_train_prefab> # renderings of the 1st prefab for training
│ │ ├── ... # j_th frame of i_th camera placed around given rotation axis (= x,y,z)
│ │ ├── frame_j_Original_<axis><camera_i>.png # here it's rendered with original prefab materials
│ │ ├── frame_j_<material>_<axis><camera_i>.png # here with a given replacement material (= NOC, SegmentationMask etc.)
│ │ ├── ... # other frames with other cameras
│ └── <last_train_prefab> # renderings of the last prefab for training
│ ├── ... # (same structure for all prefabs)
│
└── test # samples selected for test data
├── <1st_test_prefab> # renderings of the 1st prefab for testing
│ ├── ... # (same structure as in 'train' folder)
│
└── <last_test_prefab>
├── ... Supports both the single and multiple foreground object modes
In addition to 3D reconstruction data, each simulation generates a new dataset folder of the following structure:
. # dataset root named by the simulation ID (e.g., `888f73fd-b406-4612-9cfb-39d4303fe0fc`)
├── Dataset<ID> # metadata
│ ├── annotation_definitions.json # label segmentation colors and label names
│ ├── captures_000.json # metadata per frame: bounding boxes, camera position & parameters etc.
│ ├── egos.json # additional information
│ ├── metric_definitions.json # object counts per label
│ ├── metrics_000.json #
│ ├── sensors.json # additional camera parameters
├── RGB<ID> # Renderings
│ ├── rgb_1.png # 1st frame of the simulation ( = 1st rendering of 1st prefab)
│ ├── rgb_2.png # (2nd rendering of 1st prefab if more than one frame set per prefab)
│ ├── ...
└── SemanticSegmentation<ID> # segmentation masks
├── segmentation_1.png # 1st frame of the simulation ( = 1st segmentation of 1st prefab)
├── segmentation_2.png
├── ...JSON files apply to both 3D reconstruction and segmentation datasets generated from the same simulation.
To load project configurations and install required packages just open the product_generator.unity project file. Your configurations in Unity GUI should be as follows:
If you have any troubleshoots with automatic installation, then
- Follow this step-by-step setup to install Perception Package
- Set manually all the scene objects and component fields as described in the above table
A standard supermarket asset is included at Assets\Samples\Perception\0.9.0-preview.2\Tutorial Files\
- add
..\Tutorial Files\Foreground Objects\Phase 1\Prefabsfolder toFgSingleObjectRandomizerfor 3D reconstruction data - add
..\Tutorial Files\Background Objects\Prefabsto background randomizer, such asBackgroundObjectPlacementRandomizer[optional]
A sample of a large supermarket asset is included at Packs and Products subfolder of Assets\ModernSupermarketSample\Prefabs\Props (get the entire asset)
- E.g., add
..\Prefabs\Props\Productsfolder toFgSingleObjectRandomizerto get 3D reconstruction data- make sure not to include the same prefab twice!
To fully integrate additional 3D assets with the project ensure that each new prefab has Rotation Randomization Tag and Labeling components
To render standard products with 3D ground truth data:
- Setup
Fixed Length Scenarioas shown in the above table:- Enable
FgSingleObjectRandomizerand disable other randomizers (SimulationScenario column in the table above) - Add to
FgSingleObjectRandomizerprefabs viaAdd Folderbutton
- Enable
- Run simulations (
Playbutton) withReplacement Materialof the randomizer set toNone,NOC_material,SegmentationMaskMaterialetc. - For multi-view data and for covering occluded parts switch the camera via
Main Camera>Change Cameraand repeat Step 2
Here is a small dataset generated with the above steps.
| utility | info | usage |
|---|---|---|
| copy_data_sample.sh | Script to copy frames of selected materials and cameres between datasets generated by this tool. | ./copy_data_samples.sh source_path target_path "Original,NOC,SegmentationMask" "y00,y01" |
| Visualizer Tool | A standard visualizer designed for perception package. Compatible with data generated by this tool | Read Unity instructions |
| MyLightRandomizer.cs | Script for additional randomization of lighting per frame. | Enable it in the Simulation Scenario component |











