# drivendataorg/zamba architecture

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

- Interactive diagram: https://gitdiagram.com/drivendataorg/zamba
- Repository: https://github.com/drivendataorg/zamba

## Overview

Zamba is a camera-trap computer-vision toolkit with CLI and Python workflows for classifying images and videos, training custom classifiers, and running depth and DensePose analysis. Users supply media and configuration; workflows validate and preprocess inputs, run registered or custom models, and produce predictions or training outputs. The graph includes shared model infrastructure and image/video processing. Some subsystem links are based on README statements or SOURCE INDEX references; unsampled implementation details and their internal calls are not inferred.

Main entry points: [`zamba/images/manager.py`](https://github.com/drivendataorg/zamba/blob/master/zamba/images/manager.py) (Image workflow manager), [`zamba/cli.py`](https://github.com/drivendataorg/zamba/blob/master/zamba/cli.py) (Video CLI), [`zamba/data/video.py`](https://github.com/drivendataorg/zamba/blob/master/zamba/data/video.py) (Video loading), [`zamba/models/config.py`](https://github.com/drivendataorg/zamba/blob/master/zamba/models/config.py) (Video configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["Video CLI<br/>[cli.py]"]
  node_image_cli["Image CLI<br/>[image_cli.py]"]
end

subgraph group_image["Image workflows"]
  node_image_config["Image configuration<br/>[config.py]"]
  node_image_manager["Image workflow manager<br/>[manager.py]"]
  node_image_data["Image data<br/>[data.py]"]
  node_image_classifier["Image classifier<br/>[classifier.py]"]
  node_image_results["Image results<br/>[result.py]"]
  node_bbox["Image boxes<br/>[bbox.py]"]
end

subgraph group_video["Video workflows"]
  node_video_config["Video configuration<br/>[config.py]"]
  node_video_files["Video metadata<br/>[metadata.py]"]
  node_video_loader["Video loading<br/>[video.py]"]
  node_frame_detector["Frame detector"]
end

subgraph group_models["Models and training"]
  node_model_manager["Video model workflow<br/>[model_manager.py]"]
  node_instantiation["Model instantiation<br/>[instantiation.py]"]
  node_registry["Model registry<br/>[registry.py]"]
  node_video_module["Video classifier module<br/>[video_modules.py]"]
  node_transforms["Tensor transforms<br/>[transforms.py]"]
  node_settings["Runtime settings<br/>[settings.py]"]
end

subgraph group_analysis["Additional analysis"]
  node_depth["Depth estimation<br/>[depth_manager.py]"]
  node_densepose["DensePose analysis"]
end

node_user(("CLI or Python user"))

node_user -->|"runs video commands"| node_cli
node_user -->|"runs image commands"| node_image_cli
node_cli -->|"dispatches training"| node_model_manager
node_cli -->|"configures prediction"| node_video_config
node_cli -->|"dispatches depth"| node_depth
node_cli -->|"dispatches DensePose"| node_densepose
node_image_cli -->|"builds configuration"| node_image_config
node_image_cli -->|"dispatches image work"| node_image_manager
node_image_manager -->|"loads image data"| node_image_data
node_image_manager -->|"runs classification"| node_image_classifier
node_image_manager -->|"creates model"| node_instantiation
node_image_manager -->|"uses transforms"| node_transforms
node_image_manager -->|"writes results"| node_image_results
node_image_config -->|"uses box helpers"| node_bbox
node_video_config -->|"uses metadata"| node_video_files
node_video_config -->|"validates video inputs"| node_video_loader
node_video_loader -->|"selects frames"| node_frame_detector
node_model_manager -->|"creates model"| node_instantiation
node_model_manager -->|"prepares video data"| node_video_loader
node_model_manager -->|"trains model"| node_video_module
node_instantiation -->|"resolves model"| node_registry
node_registry -->|"registers model classes"| node_video_module
node_video_module -->|"uses transforms"| node_transforms
node_depth -->|"loads video"| node_video_loader
node_depth -->|"uses detections"| node_frame_detector
node_densepose -->|"processes video"| node_video_loader
node_video_config -->|"uses defaults"| node_settings

click node_cli "https://github.com/drivendataorg/zamba/blob/master/zamba/cli.py"
click node_image_cli "https://github.com/drivendataorg/zamba/blob/master/zamba/image_cli.py"
click node_image_config "https://github.com/drivendataorg/zamba/blob/master/zamba/images/config.py"
click node_image_manager "https://github.com/drivendataorg/zamba/blob/master/zamba/images/manager.py"
click node_image_data "https://github.com/drivendataorg/zamba/blob/master/zamba/images/data.py"
click node_image_classifier "https://github.com/drivendataorg/zamba/blob/master/zamba/images/classifier.py"
click node_image_results "https://github.com/drivendataorg/zamba/blob/master/zamba/images/result.py"
click node_bbox "https://github.com/drivendataorg/zamba/blob/master/zamba/images/bbox.py"
click node_video_config "https://github.com/drivendataorg/zamba/blob/master/zamba/models/config.py"
click node_video_files "https://github.com/drivendataorg/zamba/blob/master/zamba/data/metadata.py"
click node_video_loader "https://github.com/drivendataorg/zamba/blob/master/zamba/data/video.py"
click node_frame_detector "https://github.com/drivendataorg/zamba/blob/master/zamba/object_detection/yolox/megadetector_lite_yolox.py"
click node_model_manager "https://github.com/drivendataorg/zamba/blob/master/zamba/models/model_manager.py"
click node_instantiation "https://github.com/drivendataorg/zamba/blob/master/zamba/models/instantiation.py"
click node_registry "https://github.com/drivendataorg/zamba/blob/master/zamba/models/registry.py"
click node_video_module "https://github.com/drivendataorg/zamba/blob/master/zamba/pytorch_lightning/video_modules.py"
click node_transforms "https://github.com/drivendataorg/zamba/blob/master/zamba/pytorch/transforms.py"
click node_depth "https://github.com/drivendataorg/zamba/blob/master/zamba/models/depth_estimation/depth_manager.py"
click node_densepose "https://github.com/drivendataorg/zamba/blob/master/zamba/models/densepose/densepose_manager.py"
click node_settings "https://github.com/drivendataorg/zamba/blob/master/zamba/settings.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_cli,node_image_cli,node_user toneBlue
class node_image_config,node_image_manager,node_image_data,node_image_classifier,node_image_results,node_bbox toneAmber
class node_video_config,node_video_files,node_video_loader,node_frame_detector toneMint
class node_model_manager,node_instantiation,node_registry,node_video_module,node_transforms,node_settings toneRose
class node_depth,node_densepose toneIndigo
```

## Components

### User entry points

- [Video CLI](https://github.com/drivendataorg/zamba/blob/master/zamba/cli.py): `zamba/cli.py`
- [Image CLI](https://github.com/drivendataorg/zamba/blob/master/zamba/image_cli.py): `zamba/image_cli.py`

### Image workflows

- [Image configuration](https://github.com/drivendataorg/zamba/blob/master/zamba/images/config.py): `zamba/images/config.py`
- [Image workflow manager](https://github.com/drivendataorg/zamba/blob/master/zamba/images/manager.py): `zamba/images/manager.py`
- [Image data](https://github.com/drivendataorg/zamba/blob/master/zamba/images/data.py): `zamba/images/data.py`
- [Image classifier](https://github.com/drivendataorg/zamba/blob/master/zamba/images/classifier.py): `zamba/images/classifier.py`
- [Image results](https://github.com/drivendataorg/zamba/blob/master/zamba/images/result.py): `zamba/images/result.py`
- [Image boxes](https://github.com/drivendataorg/zamba/blob/master/zamba/images/bbox.py): `zamba/images/bbox.py`

### Video workflows

- [Video configuration](https://github.com/drivendataorg/zamba/blob/master/zamba/models/config.py): `zamba/models/config.py`
- [Video metadata](https://github.com/drivendataorg/zamba/blob/master/zamba/data/metadata.py): `zamba/data/metadata.py`
- [Video loading](https://github.com/drivendataorg/zamba/blob/master/zamba/data/video.py): `zamba/data/video.py`
- [Frame detector](https://github.com/drivendataorg/zamba/blob/master/zamba/object_detection/yolox/megadetector_lite_yolox.py): `zamba/object_detection/yolox/megadetector_lite_yolox.py`

### Models and training

- [Video model workflow](https://github.com/drivendataorg/zamba/blob/master/zamba/models/model_manager.py): `zamba/models/model_manager.py`
- [Model instantiation](https://github.com/drivendataorg/zamba/blob/master/zamba/models/instantiation.py): `zamba/models/instantiation.py`
- [Model registry](https://github.com/drivendataorg/zamba/blob/master/zamba/models/registry.py): `zamba/models/registry.py`
- [Video classifier module](https://github.com/drivendataorg/zamba/blob/master/zamba/pytorch_lightning/video_modules.py): `zamba/pytorch_lightning/video_modules.py`
- [Tensor transforms](https://github.com/drivendataorg/zamba/blob/master/zamba/pytorch/transforms.py): `zamba/pytorch/transforms.py`
- [Runtime settings](https://github.com/drivendataorg/zamba/blob/master/zamba/settings.py): `zamba/settings.py`

### Additional analysis

- [Depth estimation](https://github.com/drivendataorg/zamba/blob/master/zamba/models/depth_estimation/depth_manager.py): `zamba/models/depth_estimation/depth_manager.py`
- [DensePose analysis](https://github.com/drivendataorg/zamba/blob/master/zamba/models/densepose/densepose_manager.py): `zamba/models/densepose/densepose_manager.py`

### Other components

- **CLI or Python user**

## Connections

- CLI or Python user → Video CLI: runs video commands
- CLI or Python user → Image CLI: runs image commands
- Video CLI → Video model workflow: dispatches training (evidence: `zamba/cli.py`)
- Video CLI → Video configuration: configures prediction (evidence: `zamba/cli.py`)
- Video CLI → Depth estimation: dispatches depth (evidence: `zamba/cli.py`)
- Video CLI → DensePose analysis: dispatches DensePose (evidence: `zamba/cli.py`)
- Image CLI → Image configuration: builds configuration (evidence: `zamba/image_cli.py`)
- Image CLI → Image workflow manager: dispatches image work (evidence: `zamba/image_cli.py`)
- Image workflow manager → Image data: loads image data (evidence: `zamba/images/manager.py`)
- Image workflow manager → Image classifier: runs classification (evidence: `zamba/images/manager.py`)
- Image workflow manager → Model instantiation: creates model (evidence: `zamba/images/manager.py`)
- Image workflow manager → Tensor transforms: uses transforms (evidence: `zamba/images/manager.py`)
- Image workflow manager → Image results: writes results (evidence: `zamba/images/manager.py`)
- Image configuration → Image boxes: uses box helpers (evidence: `zamba/images/config.py`)
- Video configuration → Video metadata: uses metadata (evidence: `zamba/models/config.py`)
- Video configuration → Video loading: validates video inputs (evidence: `zamba/models/config.py`)
- Video loading → Frame detector: selects frames (evidence: `zamba/data/video.py`)
- Video model workflow → Model instantiation: creates model (evidence: `zamba/models/model_manager.py`)
- Video model workflow → Video loading: prepares video data (evidence: `zamba/models/model_manager.py`)
- Video model workflow → Video classifier module: trains model (evidence: `zamba/models/model_manager.py`)
- Model instantiation → Model registry: resolves model (evidence: `zamba/models/instantiation.py`)
- Model registry → Video classifier module: registers model classes (evidence: `zamba/models/registry.py`)
- Video classifier module → Tensor transforms: uses transforms (evidence: `zamba/pytorch_lightning/video_modules.py`)
- Depth estimation → Video loading: loads video (evidence: `zamba/models/depth_estimation/depth_manager.py`)
- Depth estimation → Frame detector: uses detections (evidence: `zamba/models/depth_estimation/depth_manager.py`)
- DensePose analysis → Video loading: processes video (evidence: `zamba/models/densepose/densepose_manager.py`)
- Video configuration → Runtime settings: uses defaults (evidence: `zamba/models/config.py`)
