COD-VAE 8x32
Browse files
README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: cod-vae
|
| 4 |
+
pipeline_tag: feature-extraction
|
| 5 |
+
tags:
|
| 6 |
+
- 3d
|
| 7 |
+
- shape-reconstruction
|
| 8 |
+
- autoencoder
|
| 9 |
+
- vae
|
| 10 |
+
- occupancy
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# COD-VAE 8 x 32
|
| 14 |
+
|
| 15 |
+
A [COD-VAE](https://arxiv.org/abs/2503.08737) that compresses a 3D shape into
|
| 16 |
+
**8 latent vectors of 32 dimensions = 256 numbers**, and decodes them back
|
| 17 |
+
into an occupancy field.
|
| 18 |
+
|
| 19 |
+
Trained with [`cod-vae`](https://github.com/TimSchneider42/cod-vae), a PyTorch/JAX reimplementation of COD-VAE
|
| 20 |
+
(Cho et al., ICCV 2025). The weights are a self-contained npz and load with either
|
| 21 |
+
backend.
|
| 22 |
+
|
| 23 |
+
Stage 1 ran the full 100 epochs and stage 2 another 100, following the
|
| 24 |
+
reference schedule throughout.
|
| 25 |
+
|
| 26 |
+
## Usage
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
import trimesh
|
| 30 |
+
from cod_vae import CODVAE
|
| 31 |
+
|
| 32 |
+
vae = CODVAE.from_pretrained("TimSchneider42/cod-vae-8x32")
|
| 33 |
+
|
| 34 |
+
mesh = trimesh.load("bunny.obj", force="mesh")
|
| 35 |
+
latent, transform = vae.encode_mesh(mesh, return_transform=True) # (8, 32)
|
| 36 |
+
reconstruction = vae.decode_mesh(latent, transform=transform) # trimesh.Trimesh
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
Latents can also be computed from raw surface point clouds and decoded at arbitrary
|
| 40 |
+
query points:
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
latents = vae.encode(points) # (N, 3) in [-1, 1]^3
|
| 44 |
+
logits = vae.decode(latents, queries) # occupancy logits, positive inside
|
| 45 |
+
volume = vae.decode_volume(latents, resolution=128) # dense logit grid
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
Install with `pip install cod-vae[torch,hub]` (or `cod-vae[jax,hub]`).
|
| 49 |
+
|
| 50 |
+
## Training data
|
| 51 |
+
|
| 52 |
+
A merged dataset of 110,077 shapes, built with the `cod-vae-dataset` tool:
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
cod-vae-dataset data/merged --vecset path/to/shapenet_vecset_root
|
| 56 |
+
|
| 57 |
+
cod-vae-dataset data/merged \
|
| 58 |
+
--hf abc=TimSchneider42/tactile-mnist-abc-dataset-small:0.24435897 --hf-split train \
|
| 59 |
+
--num-vol 500000 --num-surface 250000
|
| 60 |
+
|
| 61 |
+
cod-vae-dataset data/merged \
|
| 62 |
+
--hf mnist3d=TimSchneider42/tactile-mnist-mnist3d --hf-split train \
|
| 63 |
+
--num-vol 50000 --num-surface 25000
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
| source | shapes | query pools per shape |
|
| 67 |
+
|---|---|---|
|
| 68 |
+
| ShapeNet (3DShape2VecSet, 55 synsets) | 48,597 | 500k volume + 500k near-surface |
|
| 69 |
+
| [tactile-mnist-abc-dataset-small](https://huggingface.co/datasets/TimSchneider42/tactile-mnist-abc-dataset-small) | 50,000 | 500k + 500k |
|
| 70 |
+
| [tactile-mnist-mnist3d](https://huggingface.co/datasets/TimSchneider42/tactile-mnist-mnist3d) | 11,480 | 50k + 50k |
|
| 71 |
+
|
| 72 |
+
Only the training splits are used; the ABC and MNIST3D pool sizes are scaled to the
|
| 73 |
+
geometric complexity of each source. Meshes are preprocessed with the original authors'
|
| 74 |
+
[sdf_gen](https://github.com/1zb/sdf_gen) recipe.
|
| 75 |
+
|
| 76 |
+
## Training recipe
|
| 77 |
+
|
| 78 |
+
Both stages follow the reference implementation; see
|
| 79 |
+
[TRAINING.md](https://github.com/TimSchneider42/cod-vae/blob/main/TRAINING.md) for the full guide and the exact commands.
|
| 80 |
+
|
| 81 |
+
| | stage 1 (autoencoder) | stage 2 (latent VAE) |
|
| 82 |
+
|---|---|---|
|
| 83 |
+
| epochs | 100 | 100 |
|
| 84 |
+
| batch | 32 per GPU x 2 accumulation x 4 GPUs = 256 | 128 per GPU x 4 GPUs = 512 |
|
| 85 |
+
| learning rate | 1e-4, scaled by effective batch / 256 | same, halved at epochs 60/70/80/90 |
|
| 86 |
+
| dataset repeat | 8 per epoch | 8 per epoch |
|
| 87 |
+
| precision | float32 with TF32 matmuls | same |
|
| 88 |
+
|
| 89 |
+
## Held-out reconstruction quality
|
| 90 |
+
|
| 91 |
+
| source | held-out shapes | volume IoU | near-surface accuracy |
|
| 92 |
+
|---|---|---|---|
|
| 93 |
+
| ABC (CAD parts) | 128 | 0.8868 | 0.8513 |
|
| 94 |
+
| MNIST3D (embossed digits) | 128 | 0.9304 | 0.8930 |
|
| 95 |
+
|
| 96 |
+
Measured on the test splits of ABC and MNIST3D, which are disjoint from training.
|
| 97 |
+
Volume IoU compares `decode(latents, queries) > 0` against ground-truth occupancy on
|
| 98 |
+
uniformly sampled query points; near-surface accuracy uses points sampled around the
|
| 99 |
+
surface.
|
| 100 |
+
|
| 101 |
+
## Citation
|
| 102 |
+
|
| 103 |
+
The model architecture and training recipe are from:
|
| 104 |
+
|
| 105 |
+
```bibtex
|
| 106 |
+
@inproceedings{cho2025cod,
|
| 107 |
+
author={Cho, In and Yoo, Youngbeom and Jeon, Subin and Kim, Seon Joo},
|
| 108 |
+
title={Representing 3D Shapes with 64 Latent Vectors for 3D Diffusion Models},
|
| 109 |
+
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
|
| 110 |
+
year={2025}
|
| 111 |
+
}
|
| 112 |
+
```
|