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|
- split: test
|
| 55 |
path: data/test-*
|
| 56 |
---
|
| 57 |
+
|
| 58 |
+
# BlockGen-3D Dataset
|
| 59 |
+
|
| 60 |
+
## Overview
|
| 61 |
+
|
| 62 |
+
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](https://huggingface.co/datasets/allenai/objaverse), we have created a standardized representation that is particularly suitable for training 3D generative models.
|
| 63 |
+
|
| 64 |
+
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, striking a balance between detail preservation and computational efficiency. This uniform representation makes the dataset especially suitable for training diffusion models and other deep learning architectures for 3D generation.
|
| 65 |
+
|
| 66 |
+
The dataset contains 542,292 total samples, with:
|
| 67 |
+
- 515,177 training samples
|
| 68 |
+
- 27,115 test samples
|
| 69 |
+
|
| 70 |
+
## Data Format and Structure
|
| 71 |
+
|
| 72 |
+
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:
|
| 73 |
+
|
| 74 |
+
For shape-only data:
|
| 75 |
+
- `voxels_occupancy`: A binary grid of shape [1, 32, 32, 32] where each voxel is either empty (0) or occupied (1)
|
| 76 |
+
|
| 77 |
+
For colored data:
|
| 78 |
+
- `voxels_colors`: RGB color information with shape [3, 32, 32, 32], normalized to [0, 1]
|
| 79 |
+
- `voxels_occupancy`: The occupancy mask as described above
|
| 80 |
+
|
| 81 |
+
Each sample also includes rich metadata:
|
| 82 |
+
- Text descriptions derived from the original Objaverse dataset
|
| 83 |
+
- Categorization and tagging information
|
| 84 |
+
- Augmentation status and original file information
|
| 85 |
+
- Number of occupied voxels for quick filtering or analysis
|
| 86 |
+
|
| 87 |
+
## Using the Dataset
|
| 88 |
+
|
| 89 |
+
### Basic Loading and Inspection
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from datasets import load_dataset
|
| 93 |
+
|
| 94 |
+
# Load the dataset
|
| 95 |
+
dataset = load_dataset("PeterAM4/blockgen-3d")
|
| 96 |
+
|
| 97 |
+
# Access splits
|
| 98 |
+
train_dataset = dataset["train"]
|
| 99 |
+
test_dataset = dataset["test"]
|
| 100 |
+
|
| 101 |
+
# Examine a sample
|
| 102 |
+
sample = train_dataset[0]
|
| 103 |
+
print(f"Sample description: {sample['name']}")
|
| 104 |
+
print(f"Number of occupied voxels: {sample['metadata']['num_occupied']}")
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
### Working with Voxel Data
|
| 108 |
+
|
| 109 |
+
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:
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
import torch
|
| 113 |
+
|
| 114 |
+
def process_voxel_data(sample, default_color=[0.5, 0.5, 0.5]):
|
| 115 |
+
"""Process voxel data with default colors for shape-only data.
|
| 116 |
+
|
| 117 |
+
Args:
|
| 118 |
+
sample: Dataset sample
|
| 119 |
+
default_color: Default RGB values for shape-only models (default: gray)
|
| 120 |
+
|
| 121 |
+
Returns:
|
| 122 |
+
torch.Tensor: RGBA data with shape [4, 32, 32, 32]
|
| 123 |
+
"""
|
| 124 |
+
occupancy = torch.from_numpy(sample['voxels_occupancy'])
|
| 125 |
+
|
| 126 |
+
if sample['voxels_colors'] is not None:
|
| 127 |
+
# Use provided colors for RGBA samples
|
| 128 |
+
colors = torch.from_numpy(sample['voxels_colors'])
|
| 129 |
+
else:
|
| 130 |
+
# Apply default color to shape-only samples
|
| 131 |
+
default_color = torch.tensor(default_color)[:, None, None, None]
|
| 132 |
+
colors = default_color.repeat(1, 32, 32, 32) * occupancy
|
| 133 |
+
|
| 134 |
+
# Combine into RGBA format
|
| 135 |
+
rgba = torch.cat([colors, occupancy], dim=0)
|
| 136 |
+
return rgba
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
### Batch Processing with DataLoader
|
| 140 |
+
|
| 141 |
+
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:
|
| 142 |
+
|
| 143 |
+
For basic text-to-3D generation, you can use the model names as prompts:
|
| 144 |
+
```python
|
| 145 |
+
def collate_fn(batch):
|
| 146 |
+
"""Simple collate function using basic prompts."""
|
| 147 |
+
return {
|
| 148 |
+
'voxels': torch.stack([process_voxel_data(x) for x in batch]),
|
| 149 |
+
'prompt': [x['name'] for x in batch] # Using name field as prompt, could also use more complex prompts from categories and tags dict keys
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
# Create DataLoader
|
| 153 |
+
dataloader = DataLoader(
|
| 154 |
+
train_dataset,
|
| 155 |
+
batch_size=32,
|
| 156 |
+
shuffle=True,
|
| 157 |
+
collate_fn=collate_fn
|
| 158 |
+
)
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
## Visualization Examples
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
## Dataset Creation Process
|
| 166 |
+
|
| 167 |
+
Our dataset was created through the following steps:
|
| 168 |
+
|
| 169 |
+
1. Starting with the Objaverse dataset
|
| 170 |
+
2. Voxelizing 3D models at 32³ resolution
|
| 171 |
+
3. Preserving color information where available
|
| 172 |
+
4. Generating data augmentations through rotations
|
| 173 |
+
5. Creating train/test splits (95%/5% split ratio)
|
| 174 |
+
|
| 175 |
+
## Training tips
|
| 176 |
+
|
| 177 |
+
- For shape-only models, use only the occupancy channel
|
| 178 |
+
- For colored models:
|
| 179 |
+
|
| 180 |
+
- Apply colors only to occupied voxels
|
| 181 |
+
- Use default colors for shape-only samples
|
| 182 |
+
|
| 183 |
+
## Citation
|
| 184 |
+
|
| 185 |
+
If you use this dataset in your research, please cite:
|
| 186 |
+
|
| 187 |
+
@misc{blockgen2024,
|
| 188 |
+
title={BlockGen-3D: A Large-Scale Dataset for Text-to-3D Voxel Generation},
|
| 189 |
+
author={Peter A. Massih},
|
| 190 |
+
year={2024},
|
| 191 |
+
publisher={Hugging Face}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
Please also cite the original Objaverse dataset:
|
| 195 |
+
|
| 196 |
+
@article{objaverse2023,
|
| 197 |
+
title={Objaverse: A Universe of Annotated 3D Objects},
|
| 198 |
+
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},
|
| 199 |
+
journal={arXiv preprint arXiv:2304.02643},
|
| 200 |
+
year={2023}
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
## Limitations
|
| 204 |
+
|
| 205 |
+
- Fixed 32³ resolution limits fine detail representation
|
| 206 |
+
- Not all models have color information
|
| 207 |
+
- Augmentations are limited to rotations
|
| 208 |
+
- Voxelization may lose some geometric details
|
| 209 |
+
|
| 210 |
+
|