File size: 6,909 Bytes
61c0452 5dc2e68 61c0452 5ca24f4 e3cc8c2 5ca24f4 e3cc8c2 5ca24f4 5dc2e68 c9f9c37 fbd477f 32d8ff6 7dcb017 a1e7c91 bb91ef9 1068ca0 93e5078 b1ec89f 262c191 c9f9c37 f5adac0 5dc2e68 b34f9a5 5dc2e68 61c0452 b34f9a5 61c0452 b34f9a5 e3cc8c2 61c0452 5dc2e68 61c0452 b34f9a5 fbd477f 61c0452 184877d 5ca24f4 61c0452 5dc2e68 61c0452 b34f9a5 e3cc8c2 61c0452 c9f9c37 b34f9a5 c9f9c37 b34f9a5 c9f9c37 61c0452 5ca24f4 61c0452 7ba2314 61c0452 0a86595 184877d 0a86595 184877d b34f9a5 0a86595 b34f9a5 0a86595 61c0452 006b049 61c0452 b34f9a5 61c0452 0a86595 61c0452 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
---
tags:
- vision
- image-classification
- fractal-positional-encoding
- geometric-deep-learning
- devil-staircase
- simplex-geometry
license: mit
---
# ViT-Beatrix: Fractal PE + Geometric Simplex Vision Transformer
This repository contains Vision Transformers integrating Devil's Staircase positional encoding
with geometric simplex features for vision tasks.
## Key Features
- **Fractal Positional Encoding**: Devil's Staircase multi-scale position embeddings
- **Geometric Simplex Features**: k-simplex vertex computations from Cantor measure
- **SimplexFactory Initialization**: Pre-initialized simplices with geometrically meaningful shapes (regular/random/uniform)
- **Adaptive Augmentation**: Progressive augmentation escalation to prevent overfitting
- **Beatrix Formula Suite**: Flow alignment, hierarchical coherence, and multi-scale consistency losses
### Simplex Initialization
Instead of random initialization, the model uses **SimplexFactory** to create geometrically sound starting configurations:
- **Regular** (default): All edges equal length, perfectly balanced symmetric structure
- **Random**: QR decomposition ensuring affine independence
- **Uniform**: Hypercube sampling with perturbations
Regular simplices provide the most stable and mathematically meaningful initialization, giving the model a better starting point for learning geometric features.
### Adaptive Augmentation System
The trainer includes an intelligent augmentation system that monitors train/validation accuracy gap and progressively enables more augmentation:
1. **Baseline**: RandomCrop + RandomHorizontalFlip
2. **Stage 1**: + ColorJitter
3. **Stage 2**: + RandomRotation
4. **Stage 3**: + RandomAffine
5. **Stage 4**: + RandomErasing
6. **Stage 5**: + AutoAugment (CIFAR policy)
7. **Stage 6**: Enable Mixup (α=0.2)
8. **Stage 7**: Enable CutMix (α=1.0) - Final stage
When train accuracy exceeds validation accuracy by 2% or more, the system automatically escalates to the next augmentation stage.
## Available Models (Best Checkpoints Only)
| Model Name | Training Session | Accuracy | Epoch | Weights Path | Logs Path |
|------------|------------------|----------|-------|--------------|----------|
| beatrix-cifar100 | 20251007_182851 | 0.5819 | 42 | `weights/beatrix-cifar100/20251007_182851` | `N/A` |
| beatrix-simplex4-patch4-512d-flow | 20251008_115206 | 0.5674 | 87 | `weights/beatrix-simplex4-patch4-512d-flow/20251008_115206` | `logs/beatrix-simplex4-patch4-512d-flow/20251008_115206` |
| beatrix-simplex7-patch4-256d-ce | 20251008_034231 | 0.5372 | 77 | `weights/beatrix-simplex7-patch4-256d-ce/20251008_034231` | `logs/beatrix-simplex7-patch4-256d-ce/20251008_034231` |
| beatrix-simplex7-patch4-256d | 20251008_020048 | 0.5291 | 89 | `weights/beatrix-simplex7-patch4-256d/20251008_020048` | `logs/beatrix-simplex7-patch4-256d/20251008_020048` |
| beatrix-cifar100 | 20251007_215344 | 0.5161 | 41 | `weights/beatrix-cifar100/20251007_215344` | `logs/beatrix-cifar100/20251007_215344` |
| beatrix-cifar100 | 20251007_195812 | 0.4701 | 42 | `weights/beatrix-cifar100/20251007_195812` | `logs/beatrix-cifar100/20251007_195812` |
| beatrix-cifar100 | 20251008_002950 | 0.4363 | 49 | `weights/beatrix-cifar100/20251008_002950` | `logs/beatrix-cifar100/20251008_002950` |
| beatrix-cifar100 | 20251007_203741 | 0.4324 | 40 | `weights/beatrix-cifar100/20251007_203741` | `logs/beatrix-cifar100/20251007_203741` |
| beatrix-simplex7-patch4-45d | 20251008_010524 | 0.2917 | 95 | `weights/beatrix-simplex7-patch4-45d/20251008_010524` | `logs/beatrix-simplex7-patch4-45d/20251008_010524` |
| beatrix-4simplex-45d | 20251007_231008 | 0.2916 | 85 | `weights/beatrix-4simplex-45d/20251007_231008` | `logs/beatrix-4simplex-45d/20251007_231008` |
| beatrix-cifar100 | 20251007_193112 | 0.2802 | 10 | `weights/beatrix-cifar100/20251007_193112` | `N/A` |
| beatrix-4simplex-45d | 20251008_001147 | 0.1382 | 10 | `weights/beatrix-4simplex-45d/20251008_001147` | `logs/beatrix-4simplex-45d/20251008_001147` |
## Latest Updated Model: beatrix-simplex4-patch4-512d-flow (Session: 20251008_115206)
### Model Details
- **Architecture**: Vision Transformer with fractal positional encoding
- **Dataset**: CIFAR-100 (100 classes)
- **Embedding Dimension**: 512
- **Depth**: 8 layers
- **Patch Size**: 4x4
- **PE Levels**: 12
- **Simplex Dimension**: 4-simplex
- **Simplex Initialization**: regular (scale=1.0)
### Training Details
- **Training Session**: 20251008_115206
- **Best Accuracy**: 0.5674
- **Epochs Trained**: 87
- **Batch Size**: 512
- **Learning Rate**: 0.0001
- **Adaptive Augmentation**: Enabled
### Loss Configuration
- Task Loss Weight: 0.5
- Flow Alignment Weight: 1.0
- Coherence Weight: 0.3
- Multi-Scale Weight: 0.2
### TensorBoard Logs
Training logs are available in the repository at:
```
logs/beatrix-simplex4-patch4-512d-flow/20251008_115206
```
To view them locally:
```bash
# Clone the repo
git clone https://huggingface.co/AbstractPhil/vit-beatrix
# View logs in TensorBoard
tensorboard --logdir vit-beatrix/logs/beatrix-simplex4-patch4-512d-flow/20251008_115206
```
## Usage
### Installation
For Google Colab:
```python
# Install for Colab
try:
!pip uninstall -qy geometricvocab
except:
pass
!pip install -q git+https://github.com/AbstractEyes/lattice_vocabulary.git
```
For local environments:
```bash
# install the repo into your environment
pip install -q git+https://github.com/AbstractEyes/lattice_vocabulary.git
```
### Loading Models
```python
from geovocab2.train.model.core.vit_beatrix import SimplifiedGeometricClassifier
from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
import json
# Download and view manifest to see all available models
manifest_path = hf_hub_download(
repo_id="AbstractPhil/vit-beatrix",
filename="manifest.json"
)
with open(manifest_path, 'r') as f:
manifest = json.load(f)
# List all available models sorted by accuracy
for key, info in sorted(manifest.items(), key=lambda x: x[1]['accuracy'], reverse=True):
print(f"{info['model_name']} ({info['timestamp']}): {info['accuracy']:.4f}")
# Download weights for the latest training session of beatrix-simplex4-patch4-512d-flow
weights_path = hf_hub_download(
repo_id="AbstractPhil/vit-beatrix",
filename="weights/beatrix-simplex4-patch4-512d-flow/20251008_115206/model.safetensors"
)
# Load model
model = SimplifiedGeometricClassifier(
num_classes=100,
img_size=32,
embed_dim=512,
depth=8
)
# Load weights
state_dict = load_file(weights_path)
model.load_state_dict(state_dict)
model.eval()
# Inference
output = model(images)
```
## Citation
```bibtex
@misc{vit-beatrix,
author = {AbstractPhil},
title = {ViT-Beatrix: Fractal Positional Encoding with Geometric Simplices},
year = {2025},
url = {https://github.com/AbstractEyes/lattice_vocabulary}
}
```
## License
MIT License
|