A Blender-based pipeline for generating synthetic counting datasets through physics simulation and multi-view rendering.
This pipeline processes 3D object datasets to create realistic counting scenarios by:
- Cleaning - Filtering objects to ensure they are watertight and single components
- Physics simulation - Dropping objects into containers to create natural arrangements
- Rendering - Generating multi-view images of the simulated scenes
- Assembly - Collecting all outputs into organized datasets
blender --background --python dataset_cleaning.py -- -p "path/to/dataset" -vArguments:
-p, --path: Dataset path (required)-v, --verbose: Enable verbose output
blender -b --python physics_sim.py -- -p "path/to/dataset" -s 0 -e 100Arguments:
-p, --path: Dataset path (required)-s, --start: Start index (optional)-e, --end: End index (optional)
blender Multi-view-rendering.blend -b --python render.py -- -p "path/to/dataset" -s 0 -e 100Arguments:
-p, --path: Dataset path (required)-s, --start: Start index (optional)-e, --end: End index (optional)--single_cam: Render only top view (optional)
python assemble_data.pyGathers all pipeline outputs into organized folders. See script for configuration options.
├── source/ # Core classes and utilities
│ ├── BatchPhysicsObject.py
│ ├── Containers.py
│ ├── PhysicsObject.py
│ ├── Scene.py
│ └── Utils.py
├── assets/ # Dataset folder and container models
│ └──dataset/
│ ├──000001/
│ │ └──000001.obj
│ └──000002/
│ └──000002.obj
├── *.blend # Blender scene files
└── *.py # Pipeline scripts
- Blender 4.3.2+
- coacd 1.0.5+
You'll need the coacd package in Blender:
-
Find Blender's modules path in Blender's Python console:
bpy.utils.user_resource("SCRIPTS", path="modules")
-
Install packages from terminal:
pip install coacd --target="path/from/previous/step" -
Restart Blender
NumPy Import Error: If installing coacd breaks numpy, install without dependencies:
pip install coacd --no-deps --target='/path/to/blender/modules'