| --- |
| language: en |
| license: mit |
| tags: |
| - image-classification |
| - imagenet |
| - multi-scale |
| - crystal-geometry |
| - david |
| datasets: |
| - imagenet-1k |
| metrics: |
| - accuracy |
| model-index: |
| - name: David-fully_shared-weighted_sum |
| results: |
| - task: |
| type: image-classification |
| dataset: |
| name: ImageNet-1K |
| type: imagenet-1k |
| metrics: |
| - type: accuracy |
| value: 72.38 |
| --- |
| |
| # David: Multi-Scale Crystal Classifier |
|
|
| **David** is a multi-scale deep learning classifier that uses crystal geometry (pentachora/4-simplexes) |
| as class prototypes with role-weighted similarity computation (Rose Loss). |
|
|
| ## Model Details |
|
|
| ### Architecture |
| - **Preset**: small_fast |
| - **Sharing Mode**: fully_shared |
| - **Fusion Mode**: weighted_sum |
| - **Scales**: [256, 512] |
| - **Feature Dim**: 512 |
| - **Parameters**: ~8.8M |
| |
| ### Training Configuration |
| - **Dataset**: AbstractPhil/imagenet-clip-features-orderly |
| - **Model Variant**: clip_vit_b16 |
| - **Epochs**: 10 |
| - **Batch Size**: 1024 |
| - **Learning Rate**: 0.01 |
| - **Rose Loss Weight**: 0.1 β 0.5 |
| - **Cayley Loss**: False |
| |
| ## Performance |
| |
| ### Best Results |
| - **Validation Accuracy**: 72.38% |
| - **Best Epoch**: 0 |
| - **Final Train Accuracy**: 66.85% |
| |
| ### Per-Scale Performance |
| - **Scale 256**: 71.83% |
| - **Scale 512**: 72.23% |
| |
| |
| ## Usage |
| |
| ### Repository Structure |
| |
| ``` |
| AbstractPhil/gated-david/ |
| βββ weights/ |
| β βββ best_model.pth # Best model weights (PyTorch) |
| β βββ best_model.safetensors # Best model weights (SafeTensors) |
| β βββ best_model_metadata.json # Training metadata |
| β βββ final_model.pth # Final epoch weights |
| β βββ final_model.safetensors |
| β βββ david_config.json # Model architecture config |
| β βββ train_config.json # Training configuration |
| βββ runs/ |
| β βββ events.out.tfevents.* # TensorBoard logs |
| βββ README.md # This file |
| βββ best_model.json # Performance summary |
| ``` |
| |
| ### Loading the Model |
| |
| ```python |
| from geovocab2.train.model.core.david import David, DavidArchitectureConfig |
| from huggingface_hub import hf_hub_download |
| |
| # Download config |
| config_path = hf_hub_download(repo_id="AbstractPhil/gated-david", |
| filename="weights/david_config.json") |
| config = DavidArchitectureConfig.from_json(config_path) |
|
|
| # Download weights |
| weights_path = hf_hub_download(repo_id="AbstractPhil/gated-david", |
| filename="weights/best_model.pth") |
| |
| # Initialize model |
| david = David.from_config(config) |
| checkpoint = torch.load(weights_path) |
| david.load_state_dict(checkpoint['model_state_dict']) |
| david.eval() |
| ``` |
| |
| ### Inference |
| |
| ```python |
| import torch |
| import torch.nn.functional as F |
|
|
| # Assuming you have CLIP features (512-dim for ViT-B/16) |
| features = get_clip_features(image) # [1, 512] |
|
|
| # Load anchors |
| anchors_dict = torch.load("anchors.pth") |
| |
| # Forward pass |
| with torch.no_grad(): |
| logits, _ = david(features, anchors_dict) |
| predictions = logits.argmax(dim=-1) |
| ``` |
| |
| ## Architecture Overview |
|
|
| ### Multi-Scale Processing |
| David processes inputs at multiple scales (256, 512), |
| allowing it to capture both coarse and fine-grained features. |
|
|
| ### Crystal Geometry |
| Each class is represented by a pentachoron (4-simplex) in embedding space with 5 vertices: |
| - **Anchor**: Primary class representative |
| - **Need**: Complementary direction |
| - **Relation**: Contextual alignment |
| - **Purpose**: Functional direction |
| - **Observer**: Meta-perspective |
|
|
| ### Rose Loss |
| Similarity computation uses role-weighted cosine similarities: |
| ``` |
| score = w_anchor * sim(z, anchor) + w_need * sim(z, need) + ... |
| ``` |
|
|
| ### Fusion Strategy |
| **weighted_sum**: Intelligently combines predictions from multiple scales. |
| |
| ## Training Details |
| |
| ### Loss Components |
| - **Cross-Entropy**: Standard classification loss |
| - **Rose Loss**: Pentachora role-weighted margin loss (weight: 0.1β0.5) |
| - **Cayley Loss**: Geometric regularization (disabled) |
| |
| ### Optimization |
| - **Optimizer**: AdamW |
| - **Weight Decay**: 1e-05 |
| - **Scheduler**: cosine_restarts |
| - **Gradient Clip**: 5.0 |
| - **Mixed Precision**: False |
| |
| ## Citation |
| |
| ```bibtex |
| @software{david_classifier_2025, |
| title = {David: Multi-Scale Crystal Classifier}, |
| author = {AbstractPhil}, |
| year = {2025}, |
| url = {https://huggingface.co/AbstractPhil/gated-david}, |
| note = {Run ID: 20251012_060013} |
| } |
| ``` |
| |
| ## License |
| |
| MIT License |
| |
| ## Acknowledgments |
| |
| Built with crystal lattice geometry and multi-scale deep learning. |
| Special thanks to Claude (Anthropic) for debugging assistance. |
| |
| --- |
| |
| *Generated on 2025-10-12 06:02:00* |
| |