Skip to main content

Professional Blender library for synthetic pallet dataset generation.

Project description

PalletDataGenerator

PyPI version Build Status Coverage Status Documentation Status PyPI - Downloads Python 3.11+ Blender 4.5+ License: MIT Code style: black

A professional Python library for generating high-quality synthetic pallet datasets using Blender for computer vision and machine learning applications.


๐ŸŽฏ Overview

PalletDataGenerator is a comprehensive, production-ready solution for creating photorealistic synthetic datasets of pallets and warehouse environments. Designed with professional computer vision workflows in mind, it bridges the gap between research needs and industry-grade dataset generation.

โœจ Key Features

  • ๐ŸŽฌ Dual Generation Modes: Single pallet focus and complex warehouse scenarios
  • ๐Ÿ“Š Multiple Export Formats: YOLO, COCO JSON, and PASCAL VOC XML annotations
  • โšก GPU-Accelerated Rendering: High-performance generation with Blender Cycles
  • ๐Ÿ”ง Flexible Configuration: YAML configs with CLI parameter overrides
  • ๐Ÿ“ฆ Professional Output Structure: Organized generated_XXXX batch folders
  • ๐Ÿ—๏ธ Modular Architecture: Clean, extensible, and thoroughly tested codebase
  • ๐ŸŒŸ Photorealistic Results: Advanced lighting, materials, and post-processing

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • Blender 4.5+ (automatically detected or manually specified)
  • NVIDIA GPU (recommended for optimal performance)

Installation

# Install from PyPI (recommended)
pip install palletdatagenerator

# Or install from source for latest features
git clone https://github.com/boubakriibrahim/PalletDataGenerator.git
cd PalletDataGenerator
pip install -e .

Basic Usage

Generate Warehouse Dataset

# Generate 50 warehouse scene images with multiple pallets and boxes
palletgen -m warehouse scenes/warehouse_objects.blend

# Custom configuration
palletgen -m warehouse scenes/warehouse_objects.blend \
    --frames 100 \
    --resolution 1920 1080 \
    --output custom_output_dir

Generate Single Pallet Dataset

# Generate focused single pallet images
palletgen -m single_pallet scenes/one_pallet.blend

# High-resolution batch
palletgen -m single_pallet scenes/one_pallet.blend \
    --frames 200 \
    --resolution 2048 1536

๐Ÿ“ธ Example Outputs

Warehouse Mode

Generate complex warehouse scenes with multiple pallets, stacked boxes, and realistic lighting:

Warehouse Example 1 Warehouse Example 2

Single Pallet Mode

Generate focused single pallet scenes with detailed box arrangements:

Single Pallet Example 1 Single Pallet Example 2

Multi-Modal Outputs

Each frame generates comprehensive data for training:

RGB Image Analysis Overlay Depth Map Normal Map

๐Ÿ—๏ธ Architecture & Features

Generation Modes

๐Ÿญ Warehouse Mode

  • Multi-pallet scenes with realistic warehouse layouts
  • Dynamic box stacking with collection-aware placement
  • Procedural lighting and environment variations
  • Complex occlusion scenarios for robust model training

๐Ÿ“ฆ Single Pallet Mode

  • Focused pallet detection with controlled backgrounds
  • Precise annotation quality for fine-grained training
  • Camera angle variations including side and corner views
  • Configurable cropping and occlusion levels

Export Formats

๐ŸŽฏ YOLO Format

# Example: 000000.txt
0 0.475345 0.595753 0.247050 0.102537

๐Ÿ“‹ COCO JSON

{
    "images": [{"id": 1, "file_name": "000000.png", "width": 1024, "height": 768}],
    "annotations": [{"id": 1, "image_id": 1, "category_id": 1, "bbox": [...]}],
    "categories": [{"id": 1, "name": "pallet", "supercategory": "object"}]
}

๐Ÿ“„ PASCAL VOC XML

<annotation>
    <object>
        <name>pallet</name>
        <bndbox>
            <xmin>123</xmin><ymin>456</ymin>
            <xmax>789</xmax><ymax>654</ymax>
        </bndbox>
    </object>
</annotation>

Output Structure

output/
โ”œโ”€โ”€ warehouse/
โ”‚   โ”œโ”€โ”€ generated_000001/
โ”‚   โ”‚   โ”œโ”€โ”€ images/          # RGB images (PNG)
โ”‚   โ”‚   โ”œโ”€โ”€ analysis/        # Overlay analysis images
โ”‚   โ”‚   โ”œโ”€โ”€ depth/           # Depth maps (PNG)
โ”‚   โ”‚   โ”œโ”€โ”€ normals/         # Normal maps (PNG)
โ”‚   โ”‚   โ”œโ”€โ”€ index/           # Index/segmentation maps
โ”‚   โ”‚   โ”œโ”€โ”€ yolo_labels/     # YOLO format annotations
โ”‚   โ”‚   โ”œโ”€โ”€ voc_xml/         # PASCAL VOC annotations
โ”‚   โ”‚   โ””โ”€โ”€ coco/            # COCO JSON annotations
โ”‚   โ””โ”€โ”€ generated_000002/    # Next batch...
โ””โ”€โ”€ single_pallet/
    โ””โ”€โ”€ generated_000001/    # Same structure

โš™๏ธ Configuration

CLI Parameters

palletgen --help

usage: palletgen [-h] [-m {single_pallet,warehouse}] [-f FRAMES]
                 [-r WIDTH HEIGHT] [-o OUTPUT] scene_path

Generate synthetic pallet datasets using Blender

positional arguments:
  scene_path            Path to Blender scene file (.blend)

optional arguments:
  -h, --help            show this help message and exit
  -m, --mode           Generation mode: single_pallet or warehouse (default: single_pallet)
  -f, --frames         Number of frames to generate (default: 50)
  -r, --resolution     Image resolution as WIDTH HEIGHT (default: 1024 768)
  -o, --output         Output directory (default: output/{mode}/generated_XXXXXX)

Advanced Configuration

The system supports extensive customization through internal configuration:

# Single Pallet Configuration
SINGLE_PALLET_CONFIG = {
    "num_images": 50,
    "resolution_x": 1024,
    "resolution_y": 768,
    "render_engine": "CYCLES",
    "camera_focal_mm": 35.0,
    "side_face_probability": 0.9,
    "allow_cropping": True,
    "min_visible_area_ratio": 0.3,
    "add_floor": True,
    "depth_scale": 1000.0,
    # ... many more options
}

# Warehouse Configuration
WAREHOUSE_CONFIG = {
    "num_images": 50,
    "resolution_x": 1024,
    "resolution_y": 768,
    "max_boxes_per_pallet": 8,
    "stacking_probability": 0.7,
    "lighting_variations": True,
    "camera_movement_range": 5.0,
    # ... extensive warehouse-specific options
}

๐Ÿ› ๏ธ Development Setup

Development Installation

# Clone and setup development environment
git clone https://github.com/boubakriibrahim/PalletDataGenerator.git
cd PalletDataGenerator

# Install in development mode with all dependencies
pip install -e ".[dev,docs,test]"

# Install pre-commit hooks for code quality
pre-commit install

Code Quality Tools

# Run code formatting
black src/ tests/

# Run linting
ruff check src/ tests/

# Run type checking
mypy src/

# Run all tests with coverage
pytest --cov=palletdatagenerator --cov-report=html

Project Structure

PalletDataGenerator/
โ”œโ”€โ”€ src/palletdatagenerator/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py                    # Command-line interface
โ”‚   โ”œโ”€โ”€ generator.py              # Main generator class
โ”‚   โ”œโ”€โ”€ config.py                 # Configuration management
โ”‚   โ”œโ”€โ”€ blender_runner.py         # Blender execution handler
โ”‚   โ”œโ”€โ”€ utils.py                  # Shared utilities
โ”‚   โ””โ”€โ”€ modes/
โ”‚       โ”œโ”€โ”€ base_generator.py     # Abstract base class
โ”‚       โ”œโ”€โ”€ single_pallet.py      # Single pallet mode
โ”‚       โ””โ”€โ”€ warehouse.py          # Warehouse mode
โ”œโ”€โ”€ tests/                        # Comprehensive test suite
โ”œโ”€โ”€ docs/                         # Sphinx documentation
โ”œโ”€โ”€ scenes/                       # Example Blender scenes
โ”œโ”€โ”€ original_files/               # Legacy reference implementations
โ”œโ”€โ”€ scripts/                      # Development scripts
โ””โ”€โ”€ readme_images/               # README assets

๐Ÿ“š API Reference

Core Classes

PalletDataGenerator

Main generator class that orchestrates the entire generation process.

from palletdatagenerator import PalletDataGenerator

generator = PalletDataGenerator(
    scene_path="scenes/warehouse_objects.blend",
    mode="warehouse",
    output_dir="custom_output"
)

# Generate dataset
generator.generate_dataset(num_frames=100)

Mode-Specific Generators

from palletdatagenerator.modes import WarehouseMode, SinglePalletMode

# Warehouse mode with custom configuration
warehouse = WarehouseMode(config=custom_warehouse_config)
warehouse.generate_scene(frame_number=0)

# Single pallet mode
single = SinglePalletMode(config=custom_single_config)
single.generate_scene(frame_number=0)

Utility Functions

from palletdatagenerator.utils import (
    find_blender_executable,
    setup_logging,
    validate_scene_file
)

# Auto-detect Blender installation
blender_path = find_blender_executable()

# Validate scene compatibility
is_valid = validate_scene_file("path/to/scene.blend")

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository and create a feature branch
  2. Make your changes with proper testing
  3. Run quality checks: black, ruff, mypy, pytest
  4. Update documentation if needed
  5. Submit a Pull Request with clear description

๐Ÿ“„ License & Citation

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use PalletDataGenerator in your research, please cite:

@software{palletdatagenerator2025,
  title={PalletDataGenerator: Professional Synthetic Pallet Dataset Generation},
  author={Ibrahim Boubakri},
  year={2025},
  url={https://github.com/boubakriibrahim/PalletDataGenerator},
  version={0.1.2}
}

๐Ÿ”— Links & Resources

๐Ÿ™ Acknowledgments

  • Blender Foundation for the incredible open-source 3D suite
  • Computer Vision Community for inspiration and feedback
  • Contributors who help improve this project
  • Warehouse Industry Partners for real-world validation

Made with โค๏ธ for the Computer Vision Community

โญ Star this repo if you find it useful! โญ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

palletdatagenerator-0.1.2.tar.gz (10.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

palletdatagenerator-0.1.2-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

Details for the file palletdatagenerator-0.1.2.tar.gz.

File metadata

  • Download URL: palletdatagenerator-0.1.2.tar.gz
  • Upload date:
  • Size: 10.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for palletdatagenerator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 95f1c891874ad6f9d8331474c804f0ff1de29f335acaa5023e919ea935ba7e21
MD5 bc85663281070290e55e1c428d950146
BLAKE2b-256 d4906c45d081b2ad3a9e7ff1624474efcae147c28a7c4e74e4295da93d28d7b7

See more details on using hashes here.

File details

Details for the file palletdatagenerator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for palletdatagenerator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c83977e2075697f67b21c49fd85a553602a2b0234f8ffbadc9959c9da9551c26
MD5 021d745c208d5dfed78e528b25e743b3
BLAKE2b-256 acf8b3714027606145af3e1cab6fada002c5912a097467cd85c7459c112d66eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page