Skip to content

Getting StartedΒΆ

This guide will help you set up SpaRRTa for evaluating Visual Foundation Models on spatial reasoning tasks.

PrerequisitesΒΆ

Before installing SpaRRTa, ensure you have the following:

  • Python 3.9 or higher
  • PyTorch 2.0 or higher with CUDA support
  • Git for cloning the repository
  • NVIDIA GPU with at least 11GB VRAM (for evaluation)

Optional: Unreal Engine 5

If you want to generate new synthetic data, you'll also need:

  • Unreal Engine 5.5 (for scene generation)
  • Windows operating system (UE5 requirement)
  • Additional 24GB+ VRAM recommended for rendering

InstallationΒΆ

Step 1: Clone the RepositoryΒΆ

git clone https://github.com/gmum/SpaRRTa.git
cd SpaRRTa

Step 2: Create Virtual EnvironmentΒΆ

conda create -n sparrta python=3.10
conda activate sparrta
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
.\venv\Scripts\activate  # Windows

Step 3: Install DependenciesΒΆ

# Install PyTorch (adjust for your CUDA version)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121

# Install SpaRRTa
pip install -e .

Step 4: Download Pre-generated DatasetΒΆ

# Download the benchmark dataset
python scripts/download_dataset.py --output data/

# Verify installation
python -c "from sparrta import SpaRRTaDataset; print('Installation successful!')"

Quick StartΒΆ

Evaluate a Single ModelΒΆ

from sparrta import SpaRRTaEvaluator, load_vfm

# Load a Visual Foundation Model
model = load_vfm("dinov2_vitb14")

# Initialize evaluator
evaluator = SpaRRTaEvaluator(
    data_path="data/sparrta",
    probe_type="efficient",  # or "linear", "abmilp"
)

# Run evaluation
results = evaluator.evaluate(
    model=model,
    environments=["forest", "desert"],  # or "all"
    tasks=["ego", "allo"],
)

# Print results
print(results.summary())

Run Full BenchmarkΒΆ

# Evaluate all models with default settings
python scripts/run_benchmark.py --config configs/default.yaml

# Evaluate specific model
python scripts/run_benchmark.py --model dinov2_vitb14 --probe efficient

# Evaluate on specific environment
python scripts/run_benchmark.py --model vggt --env city --task allo

Unreal Engine 5 SetupΒΆ

If you want to generate custom synthetic data, follow these additional steps.

System RequirementsΒΆ

Component Minimum Recommended
OS Windows 10/11 Windows 11
CPU 6-core 8+ cores
RAM 32GB 64GB
GPU RTX 2080 (11GB) RTX 4090 (24GB)
Storage 100GB SSD 500GB NVMe SSD

Step 1: Install Unreal Engine 5.5ΒΆ

  1. Download and install Epic Games Launcher
  2. Install Unreal Engine 5.5 from the launcher
  3. Enable Python Editor Script Plugin:
  4. Edit β†’ Plugins β†’ Search "Python"
  5. Enable "Python Editor Script Plugin"
  6. Restart the editor

Step 2: Install UnrealCV PluginΒΆ

# Clone UnrealCV
git clone https://github.com/unrealcv/unrealcv.git

# Copy to UE5 plugins folder
cp -r unrealcv/Plugins/UnrealCV /path/to/UE5/Engine/Plugins/

Step 3: Configure SpaRRTa EnvironmentsΒΆ

# Download SpaRRTa UE5 project
python scripts/download_ue5_project.py --output ue5_project/

# Open in Unreal Engine
# File β†’ Open Project β†’ Select ue5_project/SpaRRTa.uproject

Step 4: Generate Custom DataΒΆ

from sparrta.generation import SceneGenerator

# Initialize generator
generator = SceneGenerator(
    ue5_project_path="ue5_project/",
    output_path="data/custom/",
)

# Generate scenes
generator.generate(
    environment="forest",
    num_images=1000,
    task="ego",  # or "allo"
    objects=["bear", "tree", "human"],
)

ConfigurationΒΆ

Default Configuration FileΒΆ

Create configs/my_config.yaml:

# Data settings
data:
  path: "data/sparrta"
  environments: ["forest", "desert", "winter_town", "bridge", "city"]
  tasks: ["ego", "allo"]

# Model settings
model:
  name: "dinov2_vitb14"
  checkpoint: null  # Use default pretrained weights

# Probe settings
probe:
  type: "efficient"  # linear, abmilp, efficient
  num_queries: 4  # For efficient probing
  dropout: 0.4

# Training settings
training:
  batch_size: 256
  learning_rate: 0.001
  epochs: 500
  warmup_steps: 100
  weight_decay: 0.001

# Evaluation settings
evaluation:
  seeds: [42, 123]
  triples_per_env: 3

Environment VariablesΒΆ

# Set data path
export SPARRTA_DATA_PATH=/path/to/data

# Set cache directory for model weights
export SPARRTA_CACHE_DIR=/path/to/cache

# Enable CUDA (default: auto-detect)
export SPARRTA_DEVICE=cuda:0

Project StructureΒΆ

SpaRRTa/
β”œβ”€β”€ sparrta/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ dataset.py          # Dataset classes
β”‚   β”œβ”€β”€ evaluator.py        # Main evaluation logic
β”‚   β”œβ”€β”€ models/             # VFM loaders
β”‚   β”‚   β”œβ”€β”€ dino.py
β”‚   β”‚   β”œβ”€β”€ clip.py
β”‚   β”‚   β”œβ”€β”€ mae.py
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ probes/             # Probing heads
β”‚   β”‚   β”œβ”€β”€ linear.py
β”‚   β”‚   β”œβ”€β”€ abmilp.py
β”‚   β”‚   └── efficient.py
β”‚   └── generation/         # UE5 data generation
β”‚       β”œβ”€β”€ scene_generator.py
β”‚       └── utils.py
β”œβ”€β”€ configs/
β”‚   └── default.yaml
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ download_dataset.py
β”‚   β”œβ”€β”€ run_benchmark.py
β”‚   └── download_ue5_project.py
β”œβ”€β”€ data/                   # Dataset storage
β”œβ”€β”€ docs/                   # Documentation
β”œβ”€β”€ tests/                  # Unit tests
└── README.md

TroubleshootingΒΆ

CUDA out of memory error

Try reducing batch size:

python scripts/run_benchmark.py --batch-size 128

Or use gradient checkpointing:

evaluator = SpaRRTaEvaluator(gradient_checkpointing=True)

Model not found error

Ensure the model is available:

from sparrta.models import list_available_models
print(list_available_models())

Or download manually:

python scripts/download_models.py --model dinov2_vitb14

UnrealCV connection failed
  1. Ensure UE5 project is running
  2. Check firewall settings
  3. Verify UnrealCV plugin is enabled
  4. Try restarting the UE5 editor

Next StepsΒΆ