# nvlabs/fastervit architecture

> Architecture diagram of the GitHub repository nvlabs/fastervit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nvlabs/fastervit
- Repository: https://github.com/nvlabs/fastervit

## Overview

This repository centers on FasterViT image classification: users instantiate a registered pretrained model, run inference, or train and validate it on ImageNet. It also includes substantial downstream DINO detection and MOTRv2 tracking applications, plus model-export utilities. The graph preserves these separate product branches. Some downstream wiring is documented or indexed but not excerpted, so those relationships are dashed rather than presented as verified calls.

Main entry points: [`fastervit/models/faster_vit.py`](https://github.com/nvlabs/fastervit/blob/main/fastervit/models/faster_vit.py) (FasterViT Models), [`downstream/object_detection/dino/main.py`](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/main.py) (Detection Entrypoint), [`fastervit/train.py`](https://github.com/nvlabs/fastervit/blob/main/fastervit/train.py) (Classifier Training), [`downstream/object_tracking/motrv2/main.py`](https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/main.py) (Tracking Entrypoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_classification["FasterViT Classification"]
  node_registry["Model Registry<br/>[registry.py]"]
  node_standard["FasterViT Models<br/>[faster_vit.py]"]
  node_anyres["Any-Resolution Models"]
end

subgraph group_training["Training and Evaluation"]
  node_datasets["ImageNet Data<br/>[datasets.py]"]
  node_trainer["Classifier Training<br/>[train.py]"]
  node_scheduler["Learning-Rate Schedulers"]
  node_validator["Classifier Validation<br/>[validate.py]"]
end

subgraph group_detection["Object Detection"]
  node_dino_config["DINO Configurations"]
  node_dino_main["Detection Entrypoint<br/>[main.py]"]
  node_coco["COCO Data<br/>[coco.py]"]
  node_transforms["Detection Transforms<br/>[transforms.py]"]
  node_dino_model["DINO Detector<br/>[dino.py]"]
  node_dino_engine["Detection Engine<br/>[engine.py]"]
  node_coco_eval["COCO Evaluation<br/>[coco_eval.py]"]
end

subgraph group_tracking["Object Tracking"]
  node_mot_main["Tracking Entrypoint<br/>[main.py]"]
  node_mot_data["Tracking Data<br/>[transforms.py]"]
  node_mot_model["MOTRv2 Model<br/>[motr.py]"]
  node_mot_backbone["FasterViT Backbone<br/>[fastervit.py]"]
  node_mot_engine["Tracking Engine<br/>[engine.py]"]
  node_trackeval["Tracking Evaluation<br/>[eval.py]"]
end

subgraph group_export["Model Export"]
  node_onnx["ONNX Export<br/>[onnx_convert.py]"]
  node_coreml["Core ML Conversion<br/>[coreml_convert.py]"]
end

node_user(("User"))

node_user -->|"creates model"| node_registry
node_registry -->|"registers"| node_standard
node_registry -->|"registers"| node_anyres
node_user -->|"runs inference"| node_standard
node_user -->|"runs inference"| node_anyres
node_trainer -->|"loads data"| node_datasets
node_trainer -->|"trains"| node_standard
node_trainer -->|"trains"| node_anyres
node_trainer -->|"configures schedule"| node_scheduler
node_validator -->|"validates"| node_standard
node_dino_main -->|"loads config"| node_dino_config
node_dino_main -->|"builds detector"| node_dino_model
node_dino_main -.->|"runs engine"| node_dino_engine
node_dino_main -.->|"loads dataset"| node_coco
node_coco -->|"applies transforms"| node_transforms
node_dino_engine -->|"evaluates detections"| node_coco_eval
node_user -.->|"trains detector"| node_dino_main
node_mot_main -.->|"runs engine"| node_mot_engine
node_mot_main -.->|"builds tracker"| node_mot_model
node_mot_main -.->|"loads data"| node_mot_data
node_mot_model -.->|"uses backbone"| node_mot_backbone
node_mot_engine -.->|"evaluates tracks"| node_trackeval
node_user -.->|"trains tracker"| node_mot_main
node_onnx -->|"exports model"| node_standard
node_onnx -->|"exports model"| node_anyres
node_coreml -.->|"converts model"| node_standard

click node_registry "https://github.com/nvlabs/fastervit/blob/main/fastervit/models/registry.py"
click node_standard "https://github.com/nvlabs/fastervit/blob/main/fastervit/models/faster_vit.py"
click node_anyres "https://github.com/nvlabs/fastervit/blob/main/fastervit/models/faster_vit_any_res.py"
click node_datasets "https://github.com/nvlabs/fastervit/blob/main/fastervit/utils/datasets.py"
click node_trainer "https://github.com/nvlabs/fastervit/blob/main/fastervit/train.py"
click node_scheduler "https://github.com/nvlabs/fastervit/blob/main/fastervit/scheduler/scheduler_factory.py"
click node_validator "https://github.com/nvlabs/fastervit/blob/main/fastervit/validate.py"
click node_dino_config "https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/config/DINO/DINO_5scale_faster_vit_4_21k_224.py"
click node_dino_main "https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/main.py"
click node_coco "https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/datasets/coco.py"
click node_transforms "https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/datasets/transforms.py"
click node_dino_model "https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/models/dino/dino.py"
click node_dino_engine "https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/engine.py"
click node_coco_eval "https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/datasets/coco_eval.py"
click node_mot_main "https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/main.py"
click node_mot_data "https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/datasets/transforms.py"
click node_mot_model "https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/models/motr.py"
click node_mot_backbone "https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/models/fastervit.py"
click node_mot_engine "https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/engine.py"
click node_trackeval "https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/TrackEval/trackeval/eval.py"
click node_onnx "https://github.com/nvlabs/fastervit/blob/main/onnx_convert.py"
click node_coreml "https://github.com/nvlabs/fastervit/blob/main/coreml_convert.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_registry,node_standard,node_anyres,node_user toneBlue
class node_datasets,node_trainer,node_scheduler,node_validator toneAmber
class node_dino_config,node_dino_main,node_coco,node_transforms,node_dino_model,node_dino_engine,node_coco_eval toneMint
class node_mot_main,node_mot_data,node_mot_model,node_mot_backbone,node_mot_engine,node_trackeval toneRose
class node_onnx,node_coreml toneIndigo
```

## Components

### FasterViT Classification

- [Model Registry](https://github.com/nvlabs/fastervit/blob/main/fastervit/models/registry.py): `fastervit/models/registry.py`
- [FasterViT Models](https://github.com/nvlabs/fastervit/blob/main/fastervit/models/faster_vit.py): `fastervit/models/faster_vit.py`
- [Any-Resolution Models](https://github.com/nvlabs/fastervit/blob/main/fastervit/models/faster_vit_any_res.py): `fastervit/models/faster_vit_any_res.py`

### Training and Evaluation

- [ImageNet Data](https://github.com/nvlabs/fastervit/blob/main/fastervit/utils/datasets.py): `fastervit/utils/datasets.py`
- [Classifier Training](https://github.com/nvlabs/fastervit/blob/main/fastervit/train.py): `fastervit/train.py`
- [Learning-Rate Schedulers](https://github.com/nvlabs/fastervit/blob/main/fastervit/scheduler/scheduler_factory.py): `fastervit/scheduler/scheduler_factory.py`
- [Classifier Validation](https://github.com/nvlabs/fastervit/blob/main/fastervit/validate.py): `fastervit/validate.py`

### Object Detection

- [DINO Configurations](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/config/DINO/DINO_5scale_faster_vit_4_21k_224.py): `downstream/object_detection/dino/config/DINO/DINO_5scale_faster_vit_4_21k_224.py`
- [Detection Entrypoint](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/main.py): `downstream/object_detection/dino/main.py`
- [COCO Data](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/datasets/coco.py): `downstream/object_detection/dino/datasets/coco.py`
- [Detection Transforms](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/datasets/transforms.py): `downstream/object_detection/dino/datasets/transforms.py`
- [DINO Detector](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/models/dino/dino.py): `downstream/object_detection/dino/models/dino/dino.py`
- [Detection Engine](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/engine.py): `downstream/object_detection/dino/engine.py`
- [COCO Evaluation](https://github.com/nvlabs/fastervit/blob/main/downstream/object_detection/dino/datasets/coco_eval.py): `downstream/object_detection/dino/datasets/coco_eval.py`

### Object Tracking

- [Tracking Entrypoint](https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/main.py): `downstream/object_tracking/motrv2/main.py`
- [Tracking Data](https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/datasets/transforms.py): `downstream/object_tracking/motrv2/datasets/transforms.py`
- [MOTRv2 Model](https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/models/motr.py): `downstream/object_tracking/motrv2/models/motr.py`
- [FasterViT Backbone](https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/models/fastervit.py): `downstream/object_tracking/motrv2/models/fastervit.py`
- [Tracking Engine](https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/engine.py): `downstream/object_tracking/motrv2/engine.py`
- [Tracking Evaluation](https://github.com/nvlabs/fastervit/blob/main/downstream/object_tracking/motrv2/TrackEval/trackeval/eval.py): `downstream/object_tracking/motrv2/TrackEval/trackeval/eval.py`

### Model Export

- [ONNX Export](https://github.com/nvlabs/fastervit/blob/main/onnx_convert.py): `onnx_convert.py`
- [Core ML Conversion](https://github.com/nvlabs/fastervit/blob/main/coreml_convert.py): `coreml_convert.py`

### Other components

- **User**

## Connections

- User → Model Registry: creates model (evidence: `README.md`)
- Model Registry → FasterViT Models: registers (evidence: `fastervit/models/__init__.py`)
- Model Registry → Any-Resolution Models: registers (evidence: `fastervit/models/__init__.py`)
- User → FasterViT Models: runs inference (evidence: `README.md`)
- User → Any-Resolution Models: runs inference (evidence: `README.md`)
- Classifier Training → ImageNet Data: loads data (evidence: `fastervit/train.py`)
- Classifier Training → FasterViT Models: trains (evidence: `fastervit/train.py`)
- Classifier Training → Any-Resolution Models: trains (evidence: `fastervit/train.py`)
- Classifier Training → Learning-Rate Schedulers: configures schedule (evidence: `fastervit/train.py`)
- Classifier Validation → FasterViT Models: validates (evidence: `fastervit/validate.py`)
- Detection Entrypoint → DINO Configurations: loads config (evidence: `downstream/object_detection/dino/main.py`)
- Detection Entrypoint → DINO Detector: builds detector (evidence: `downstream/object_detection/dino/main.py`)
- Detection Entrypoint → Detection Engine: runs engine (evidence: `downstream/object_detection/dino/main.py`)
- Detection Entrypoint → COCO Data: loads dataset
- COCO Data → Detection Transforms: applies transforms (evidence: `downstream/object_detection/dino/datasets/coco.py`)
- Detection Engine → COCO Evaluation: evaluates detections (evidence: `downstream/object_detection/dino/engine.py`)
- User → Detection Entrypoint: trains detector (evidence: `README.md`)
- Tracking Entrypoint → Tracking Engine: runs engine
- Tracking Entrypoint → MOTRv2 Model: builds tracker
- Tracking Entrypoint → Tracking Data: loads data
- MOTRv2 Model → FasterViT Backbone: uses backbone
- Tracking Engine → Tracking Evaluation: evaluates tracks
- User → Tracking Entrypoint: trains tracker (evidence: `README.md`)
- ONNX Export → FasterViT Models: exports model (evidence: `onnx_convert.py`)
- ONNX Export → Any-Resolution Models: exports model (evidence: `onnx_convert.py`)
- Core ML Conversion → FasterViT Models: converts model
