Datasets:
dataset_info:
features:
- name: voxels_occupancy
dtype:
array4_d:
shape:
- 1
- 32
- 32
- 32
dtype: float32
- name: voxels_colors
dtype:
array4_d:
shape:
- 3
- 32
- 32
- 32
dtype: float32
- name: model_id
dtype: string
- name: name
dtype: string
- name: categories
sequence: string
- name: tags
sequence: string
- name: metadata
struct:
- name: is_augmented
dtype: bool
- name: original_file
dtype: string
- name: num_occupied
dtype: int32
- name: split
dtype: string
splits:
- name: train
num_bytes: 207426028571
num_examples: 515177
- name: test
num_bytes: 10942650293
num_examples: 27115
download_size: 4338398625
dataset_size: 218368678864
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: test
path: data/test-*
BlockGen-3D Dataset
Overview
BlockGen-3D is a large-scale dataset of voxelized 3D models with accompanying text descriptions, specifically designed for text-to-3D generation tasks. By processing and voxelizing models from the Objaverse dataset, we have created a standardized representation that is particularly suitable for training 3D diffusion models.
Our dataset provides two types of representations: shape-only models represented as binary occupancy grids, and colored models with full RGBA information. Each model is represented in a 32×32×32 voxel grid. The dataset contains 542,292 total samples, with:
- 515,177 training samples
- 27,115 test samples
Data Format and Structure
Every sample in our dataset consists of a voxel grid with accompanying metadata. The voxel grid uses a consistent 32³ resolution, with values structured as follows:
For shape-only data:
voxels_occupancy
: A binary grid of shape [1, 32, 32, 32] where each voxel is either empty (0) or occupied (1)
For colored data:
voxels_colors
: RGB color information with shape [3, 32, 32, 32], normalized to [0, 1]voxels_occupancy
: The occupancy mask as described above
Each sample also includes rich metadata:
- Text descriptions derived from the original Objaverse dataset
- Categorization and tagging information
- Augmentation status and original file information
- Number of occupied voxels for quick filtering or analysis
Using the Dataset
Basic Loading and Inspection
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("PeterAM4/blockgen-3d")
# Access splits
train_dataset = dataset["train"]
test_dataset = dataset["test"]
# Examine a sample
sample = train_dataset[0]
print(f"Sample description: {sample['name']}")
print(f"Number of occupied voxels: {sample['metadata']['num_occupied']}")
Working with Voxel Data
When working with the voxel data, you'll often want to handle both shape-only and colored samples uniformly. Here's a utility function that helps standardize the processing:
import torch
def process_voxel_data(sample, default_color=[0.5, 0.5, 0.5]):
"""Process voxel data with default colors for shape-only data.
Args:
sample: Dataset sample
default_color: Default RGB values for shape-only models (default: gray)
Returns:
torch.Tensor: RGBA data with shape [4, 32, 32, 32]
"""
occupancy = torch.from_numpy(sample['voxels_occupancy'])
if sample['voxels_colors'] is not None:
# Use provided colors for RGBA samples
colors = torch.from_numpy(sample['voxels_colors'])
else:
# Apply default color to shape-only samples
default_color = torch.tensor(default_color)[:, None, None, None]
colors = default_color.repeat(1, 32, 32, 32) * occupancy
# Combine into RGBA format
rgba = torch.cat([colors, occupancy], dim=0)
return rgba
Batch Processing with DataLoader
For training deep learning models, you'll likely want to use PyTorch's DataLoader. Here's how to set it up with a simple prompt strategy:
For basic text-to-3D generation, you can use the model names as prompts:
def collate_fn(batch):
"""Simple collate function using basic prompts."""
return {
'voxels': torch.stack([process_voxel_data(x) for x in batch]),
'prompt': [x['name'] for x in batch] # Using name field as prompt, could also use more complex prompts from categories and tags dict keys
}
# Create DataLoader
dataloader = DataLoader(
train_dataset,
batch_size=32,
shuffle=True,
collate_fn=collate_fn
)
Visualization Examples
Dataset Usage Example - Showing voxelization process
Dataset Creation Process
Our dataset was created through the following steps:
- Starting with the Objaverse dataset
- Voxelizing 3D models at 32³ resolution
- Preserving color information where available
- Generating data augmentations through rotations
- Creating train/test splits (95%/5% split ratio)
Training tips
For shape-only models, use only the occupancy channel
For colored models:
- Apply colors only to occupied voxels
- Use default colors for shape-only samples
Citation
If you use this dataset in your research, please cite:
@misc{blockgen2024,
title={BlockGen-3D: A Large-Scale Dataset for Text-to-3D Voxel Generation},
author={Peter A. Massih},
year={2024},
publisher={Hugging Face}
}
Please also cite the original Objaverse dataset:
@article{objaverse2023,
title={Objaverse: A Universe of Annotated 3D Objects},
author={Matt Deitke and Dustin Schwenk and Jordi Salvador and Luca Weihs and Oscar Michel and Eli VanderBilt and Ludwig Schmidt and Kiana Ehsani and Aniruddha Kembhavi and Ali Farhadi},
journal={arXiv preprint arXiv:2304.02643},
year={2023}
}
Limitations
- Fixed 32³ resolution limits fine detail representation
- Not all models have color information
- Augmentations are limited to rotations
- Voxelization may lose some geometric details