PrimitiveAnything/README.md
2025-05-07 16:51:22 +08:00

3.5 KiB
Raw Blame History

PrimitiveAnything: Human-Crafted 3D Primitive Assembly Generation with Auto-Regressive Transformer

🔥 Updates

[2025/05/07] test dataset, code, pretrained checkpoints and Gradio demo are released!

🔍 Table of Contents

⚙️ Deployment

Set up a Python environment and install the required packages:

conda create -n primitiveanything python=3.9 -y
conda activate primitiveanything

# Install torch, torchvision based on your machine configuration
pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118

# Install other dependencies
pip install -r requirements.txt

Then download data and pretrained weights:

  1. Our Model Weights: Download from our 🤗 Hugging Face repository (download here) and place them in ./ckpt/.

  2. Michelangelos Point Cloud Encoder: Download weights from Michelangelos Hugging Face repo and save them to ./ckpt/.

  3. Demo and test data:

    Download from this Google Drive link, then decompress the files into ./data/.

After downloading and organizing the files, your project directory should look like this:

- data/
    ├── basic_shapes_norm/
    ├── basic_shapes_norm_pc10000/
    ├── demo_glb/                   # Demo files in GLB format
    └── test_pc/                    # Test point cloud data
- ckpt/
    ├── mesh-transformer.ckpt.60.pt # Our model checkpoint
    └── shapevae-256.ckpt           # Michelangelo ShapeVAE checkpoint

🖥️ Run PrimitiveAnything

Demo

python demo.py --input ./data/demo_glb --log_path ./results/demo

Notes:

  • --input accepts either:
    • Any standard 3D file (GLB, OBJ, etc.)
    • A directory containing multiple 3D files
  • For optimal results with fine structures, we automatically apply marching cubes and dilation operations (which differs from testing and evaluation). This prevents quality degradation in thin areas.

Testing and Evaluation

# Autoregressive generation
python infer.py

# Sample point clouds from predictions  
python sample.py

# Calculate evaluation metrics
python eval.py

📝 Citation

If you find our work useful, please kindly cite:

@article{ye2025primitiveanything,
  title={PrimitiveAnything: Human-Crafted 3D Primitive Assembly Generation with Auto-Regressive Transformer},
  author={Ye, Jingwen and He, Yuze and Zhou, Yanning and Zhu, Yiqin and Xiao, Kaiwen and Liu, Yong-Jin and Yang, Wei and Han, Xiao},
  journal={arXiv preprint arXiv:250x.xxxxx},
  year={2025}
}