Skip to content
ModelListedExternal
Download

SymbolicCapsuleNetwork

> What if a detector could tell you not just what it found, but why it is confident?

KindOtherVersionRevision 14ae73d

Model source

Kind
Other
File size
59.0 MB
Version
vRevision 14ae73d
Updated
Sep 19, 2026
Downloads
1
Source
Hugging Face

Source description

Symbolic Capsule Network (SCN)

What if a detector could tell you not just what it found, but why it is confident?

SCN is a real-time object detection and instance segmentation model that replaces the conventional convolutional head with a capsule-based neck and head. By encoding visual entities as pose-aware vectors rather than scalar activations, SCN explicitly captures part-whole relationships — the structural agreements between object parts and the wholes they compose. Every detection is backed by a symbolic routing path: a traceable chain of capsule agreements that exposes which parts voted for which object, turning each prediction into an auditable reasoning trace.

Live Demo

Try the interactive demo ↗

Example Results

buspeople
scenescene2

Key Ideas

Standard convolutional detectors reduce every visual entity to a scalar confidence score, discarding the compositional structure that makes objects recognisable. SCN addresses this with three tightly integrated contributions:

1. Part-Whole Relation Modelling CapsRoute layers propagate evidence upward from low-level part capsules — encoding local features such as wheels, windows, and body panels — to high-level object capsules through dynamic routing-by-agreement. Agreement is only reached when the geometric votes from multiple parts are mutually consistent, giving the model an inductive bias toward spatially coherent detections.

2. Symbolic Routing Paths The routing coefficients produced at each capsule layer form an explicit, directed evidence graph. Unlike Grad-CAM or SHAP, which reconstruct explanations after the fact, SCN's routing weights are native model outputs — first-class signals that describe the model's reasoning as it happens, without any additional computation.

3. Concept-Based Detection Auditing Routing paths enable structured inspection that scalar networks cannot support:

  • Verify that a predicted "car" is grounded in consistent wheel, body, and windshield part activations.
  • Diagnose which part capsule collapsed when the model misses an object under occlusion or viewpoint change.
  • Detect bias by aggregating routing statistics across a dataset to reveal which visual parts the model over-relies on.

Architecture

Architecture Overview

The pipeline flows through four capsule-specific modules:

ModuleRole
CapsProjProjects multi-scale CNN feature maps into capsule space
CapsAlignAligns capsule resolutions across FPN levels
CapsRoute / CapsRouteV2-4Dynamic routing-by-agreement across part-to-whole levels
CapsDecodeDecodes final capsule activations into boxes and masks

Performance

Detection — COCO 2017 val

SCN sets a new state of the art among nano-scale detectors, surpassing every YOLO variant at comparable FLOPs.

ModelmAP50mAP50:95mAP50 (E2E)mAP50:95 (E2E)Speed (ms)Params (M)FLOPs (B)
YOLOv6n53.1%37.5%52.1%36.9%20.84.711.4
YOLOv7-tiny56.7%38.7%55.7%38.1%20.96.213.8
YOLOv8n52.5%37.3%51.5%36.6%18.33.28.7
YOLOv9t53.1%38.3%52.1%37.6%20.12.07.7
YOLOv10n53.8%38.5%52.8%37.8%16.72.36.7
YOLOv11n55.1%39.5%54.1%38.8%19.32.66.5
YOLOv12n56.7%40.4%55.7%39.7%19.42.56.0
YOLO26n56.8%40.8%55.7%40.0%14.42.66.1
SCN-n (Ours)57.1%41.6%56.1%40.4%29.63.36.5

SCN-n achieves +0.3% mAP50 and +0.8% mAP50:95 over the previous best (YOLO26n) at the same 6.5B FLOPs budget — accuracy gains that come entirely from structural reasoning, not extra capacity.

Accuracy–Efficiency Frontier

COCO mAP50:95 vs FLOPs

SCN occupies the top of the accuracy–efficiency frontier across all model scales (n / s / m / l / x). At every FLOPs level, SCN variants outperform their YOLO counterparts, demonstrating that part-whole routing is a principled and scalable improvement.

Instance Segmentation — COCO 2017 val

ModelInputMask mAP50Mask mAP50:95
SCN Segmentation64053.3%34.1%

Quick Start

pip install ultralytics huggingface_hub
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
from models import register_ultralytics_modules

weights = hf_hub_download(
    repo_id="zpyuan/SymbolicCapsuleNetwork",
    filename="weights/symbolic_capsule_network_segmentation.pt",
)
register_ultralytics_modules()
model = YOLO(weights)
results = model.predict("image.jpg", imgsz=640, conf=0.25)
results[0].show()

Command-line:

python predict.py path/to/image.jpg
python predict.py path/to/image.jpg --conf 0.3 --imgsz 1280

Repository Structure

PathDescription
weights/symbolic_capsule_network_segmentation.ptPretrained segmentation checkpoint
modules/Capsule modules: CapsProj, CapsAlign, CapsRoute, CapsRouteV2-4, CapsDecode
models/custom_yolo.pyUltralytics hook that registers capsule layers before model load
configs/seg_model/YAML defining the capsule neck and head architecture
predict.pyMinimal inference entry point

Sources

1 source
Hugging FacePrimaryVersion 14ae73d8aa614938098b2547850de55a15adab42
huggingface.co/zpyuan/SymbolicCapsuleNetwork/tree/14ae73d8aa614938098b2547850de55a15adab42

Verified Sep 8

Model artifacts

1 artifact

weights/symbolic_capsule_network_segmentation.pt

pt · 59.0 MB · SHA-256 f22c511a429d…6776 · Hugging Face

Download

Source excerpts

2 excerpts

--- license: gpl-3.0 language: - en tags: - object-detection - instance-segmentation - yolov8 - coco - real-time - pytorch - capsule-network - interpretable-ai - symbolic-ai library_name: ultralytics pipeline_tag: image-segmentation datasets: - coco model-index: - name: SCN results: - task: type: object-detection name: Object Detection dataset: name: COCO 2017 type: coco split: val2017 metrics: - type: mAP50 value: 0.57100 name: mAP50 - type: mAP50-95 value: 0.41600 name: mAP50:95 - task: type: instance-segmentation name: Instance Segmentation dataset: name: COCO 2017 type: coco split: val2017 metrics: - type: mAP50 value: 0.53316 name: Mask mAP50 - type: mAP50-95 value: 0.34080 name: Mask mAP50:95 --- # Symbolic Capsule Network (SCN) > *What if a detector could tell you not just **what** it found, but **why** it is confident?* **SCN** is a real-time object detection and instance segmentation model that replaces the conventional convolutional head with a **capsule-based neck and head**. By encoding visual entities as pose-aware vectors rather than scalar activations, SCN explicitly captures *part-whole relationships* — the structural agreements between object parts and the wholes they compose. Every detection is backed by a **symbolic routing path**: a traceable chain of capsule agreements that exposes *which parts* voted for *which object*, turning each prediction into an auditable reasoning trace. ## Live Demo [Try the interactive demo ↗](https://huggingface.co/spaces/zpyuan/SymbolicCapsuleNetwork-demo) ## Example Results | | | |---|---| | ![bus](figures/demo/bus.jpg) | ![people](figures/demo/people.jpg) | | ![scene](figures/demo/coco_000000104101.jpg) | ![scene2](figures/demo/coco_000000023912.jpg) | --- ## Key Ideas Standard convolutional detectors reduce every visual entity to a scalar confidence score, discarding the compositional structure that makes objects recognisable. SCN addresses this with three tightly integrated contributions: **1. Part-Whole Relation Modelling** `CapsRoute` layers propagate evidence upward from low-level part capsules — encoding local features such as wheels, windows, and body panels — to high-level object capsules through dynamic routing-by-agreement. Agreement is only reached when the geometric votes from multiple parts are mutually consistent, giving the model an inductive bias to...

Source context: 1 downloads · 1 likes · Pipeline image-segmentation · Library ultralytics · Repo zpyuan/SymbolicCapsuleNetwork