# zetane/viewer architecture

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

- Interactive diagram: https://gitdiagram.com/zetane/viewer
- Repository: https://github.com/zetane/viewer

## Overview

This repository is not a single application; it is a curated collection of model demos and assets for the Zetane Viewer desktop tool. The repo’s purpose is to let an engineer load prebuilt neural-network artifacts, inspect graph structure, and visualize tensors, feature maps, and weights.

The core architectural boundary is external: the Zetane Viewer reads the artifacts in this repo, but the repo itself does not contain the viewer runtime. Its files are inputs to that viewer, not a server or service stack.

The repository is organized as a model zoo under `models/`, with one self-contained subdirectory per example. Each subdirectory typically contains:
- a Python script that generates or prepares the model export,
- an ONNX model file for cross-framework import,
- a Zetane-native `.ztn` workspace for direct loading,
- model-specific helper files, label maps, specs, or sample inputs,
- a README explaining that particular example.

The main data flow is: framework-specific model code or an exported model is converted into ONNX and/or ZTN artifacts, then those artifacts are loaded into Zetane Viewer for interactive analysis. In some folders, the scripts appear to exist mainly to reproduce the exported artifacts or to create the workspace metadata used by Zetane.

The model families are clearly separated by task:
- image classification: AlexNet, EfficientNet, ResNet50v2,
- object detection: SSD, YOLOv3, RFB_320, VGG-based age/gender models,
- image segmentation: U-Net,
- image manipulation: super-resolution and style transfer,
- explainable AI examples: Keras and PyTorch XAI demos,
- classical ML: a scikit-learn Iris random forest exported to ONNX,
- emotion/face analysis: FERPlus and related models.

A notable architectural pattern is that several examples include “exposed nodes” ONNX variants. These are specialized exports intended to surface intermediate tensors or internal nodes so the viewer can inspect deeper parts of the computational graph, not just the final outputs.

The repo also includes model-specific support assets that shape the inference path:
- image files and sample inputs for running demonstrations,
- class-label text files for classification/XAI examples,
- detection spec files and box utilities for object-detection postprocessing,
- `.npy` / `.npz` inputs for deterministic model runs.

Technologically, the repo spans Python-based model preparation, ONNX as the interchange format, and Zetane’s `.ztn` format as the viewer-native workspace format. Some folders include notebooks or HTML exports, suggesting the examples were authored or validated in interactive Python workflows before being packaged.

There is little shared application code across models. The repository is intentionally modular: each folder is an isolated demo with its own assets and helper scripts, rather than a layered library with common services, APIs, or a runtime orchestration layer.

At the top level, the README and screenshots act as documentation for how the viewer consumes the artifacts. The architecture to diagram should emphasize “artifact generation → model export → Zetane Viewer import → interactive tensor/graph inspection,” with the repo serving as the artifact source and the desktop viewer serving as the execution/visualization boundary.

Main entry points: [`models/README.md`](https://github.com/zetane/viewer/blob/initial/models/README.md) (Models guide), [`models/alexnet/alexnet.py`](https://github.com/zetane/viewer/blob/initial/models/alexnet/alexnet.py) (AlexNet), [`models/ssd/SSD.py`](https://github.com/zetane/viewer/blob/initial/models/ssd/SSD.py) (SSD), [`models/unet/unet.py`](https://github.com/zetane/viewer/blob/initial/models/unet/unet.py) (U-Net)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["Docs"]
  node_repo_readme["README<br/>docs<br/>[README.md]"]
  node_models_readme["Models guide<br/>docs<br/>[README.md]"]
end

subgraph group_classification["Image classification"]
  node_alexnet["AlexNet<br/>classification demo<br/>[alexnet.py]"]
  node_efficientnet["EfficientNet<br/>classification demo<br/>[efficientnet.py]"]
  node_resnet50v2["ResNet50v2<br/>classification demo<br/>[resnet50v2.py]"]
end

subgraph group_detection["Object detection"]
  node_ssd["SSD<br/>detection demo<br/>[SSD.py]"]
  node_yolov3["YOLOv3<br/>detection demo<br/>[yolo_V3.py]"]
  node_rfb320["RFB_320<br/>detection demo<br/>[RFB_320.py]"]
  node_age_gender["Age model<br/>detection demo"]
  node_gender_model["Gender model<br/>detection demo"]
end

subgraph group_segmentation["Segmentation and manipulation"]
  node_unet["U-Net<br/>segmentation demo<br/>[unet.py]"]
  node_superres["Super-resolution<br/>image transform demo"]
  node_style_transfer["Style transfer<br/>image transform demo<br/>[style_transfer.py]"]
end

subgraph group_xai["XAI demos"]
  node_xai_keras["XAI Keras<br/>explainability demo<br/>[xai_keras.py]"]
  node_xai_torch["XAI Torch<br/>explainability demo<br/>[xai_torch.py]"]
end

subgraph group_classical["Classical ML"]
  node_iris_rf["Iris RF<br/>classical ML export<br/>[sklearn_iris.py]"]
end

subgraph group_emotion["Emotion analysis"]
  node_ferplus8["FERPlus8<br/>emotion demo"]
end

node_viewer["Zetane Viewer<br/>external viewer"]

node_repo_readme -->|"points to"| node_models_readme
node_models_readme -->|"indexes"| node_alexnet
node_models_readme -->|"indexes"| node_ssd
node_models_readme -->|"indexes"| node_unet
node_models_readme -->|"indexes"| node_xai_keras
node_models_readme -->|"indexes"| node_iris_rf
node_models_readme -->|"indexes"| node_ferplus8
node_alexnet -->|"loaded by"| node_viewer
node_efficientnet -->|"loaded by"| node_viewer
node_resnet50v2 -->|"loaded by"| node_viewer
node_ssd -->|"loaded by"| node_viewer
node_yolov3 -->|"loaded by"| node_viewer
node_rfb320 -->|"loaded by"| node_viewer
node_age_gender -->|"loaded by"| node_viewer
node_gender_model -->|"loaded by"| node_viewer
node_unet -->|"loaded by"| node_viewer
node_superres -->|"loaded by"| node_viewer
node_style_transfer -->|"loaded by"| node_viewer
node_xai_keras -->|"loaded by"| node_viewer
node_xai_torch -->|"loaded by"| node_viewer
node_iris_rf -->|"loaded by"| node_viewer
node_ferplus8 -->|"loaded by"| node_viewer

click node_repo_readme "https://github.com/zetane/viewer/blob/initial/README.md"
click node_models_readme "https://github.com/zetane/viewer/blob/initial/models/README.md"
click node_alexnet "https://github.com/zetane/viewer/blob/initial/models/alexnet/alexnet.py"
click node_efficientnet "https://github.com/zetane/viewer/blob/initial/models/efficientnet/efficientnet.py"
click node_resnet50v2 "https://github.com/zetane/viewer/blob/initial/models/resnet50v2/resnet50v2.py"
click node_ssd "https://github.com/zetane/viewer/blob/initial/models/ssd/SSD.py"
click node_yolov3 "https://github.com/zetane/viewer/blob/initial/models/yolo_V3/yolo_V3.py"
click node_rfb320 "https://github.com/zetane/viewer/blob/initial/models/RFB_320/RFB_320.py"
click node_age_gender "https://github.com/zetane/viewer/blob/initial/models/vgg_ilsvrc_16_age/vgg_ilsvrc_16_age.py"
click node_gender_model "https://github.com/zetane/viewer/blob/initial/models/vgg_ilsvrc_16_gen/vgg_ilsvrc_16_gen.py"
click node_unet "https://github.com/zetane/viewer/blob/initial/models/unet/unet.py"
click node_superres "https://github.com/zetane/viewer/blob/initial/models/super-resolution/super-resolution.py"
click node_style_transfer "https://github.com/zetane/viewer/blob/initial/models/style_transfer/style_transfer.py"
click node_xai_keras "https://github.com/zetane/viewer/blob/initial/models/xai_keras/xai_keras.py"
click node_xai_torch "https://github.com/zetane/viewer/blob/initial/models/xai_torch/xai_torch.py"
click node_iris_rf "https://github.com/zetane/viewer/blob/initial/models/sklearn_iris/sklearn_iris.py"
click node_ferplus8 "https://github.com/zetane/viewer/blob/initial/models/emotion_ferplus8/emotion_ferplus8.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_repo_readme,node_models_readme,node_ferplus8 toneBlue
class node_alexnet,node_efficientnet,node_resnet50v2 toneAmber
class node_ssd,node_yolov3,node_rfb320,node_age_gender,node_gender_model toneMint
class node_unet,node_superres,node_style_transfer toneRose
class node_xai_keras,node_xai_torch toneIndigo
class node_iris_rf toneTeal
class node_viewer toneNeutral
```

## Components

### Docs

Repository and model-zoo guidance

- [README](https://github.com/zetane/viewer/blob/initial/README.md): docs · Top-level entry points and viewer-oriented overview · `README.md`
- [Models guide](https://github.com/zetane/viewer/blob/initial/models/README.md): docs · Index for the curated model zoo under models/ · `models/README.md`

### Image classification

Classification demo bundles and exports

- [AlexNet](https://github.com/zetane/viewer/blob/initial/models/alexnet/alexnet.py): classification demo · Python prep script with ONNX and ZTN workspace for inspection · `models/alexnet/alexnet.py`
- [EfficientNet](https://github.com/zetane/viewer/blob/initial/models/efficientnet/efficientnet.py): classification demo · Lite4 export packaged for Viewer loading · `models/efficientnet/efficientnet.py`
- [ResNet50v2](https://github.com/zetane/viewer/blob/initial/models/resnet50v2/resnet50v2.py): classification demo · Image-classification export with a Viewer workspace · `models/resnet50v2/resnet50v2.py`

### Object detection

Detection demo bundles and exports

- [SSD](https://github.com/zetane/viewer/blob/initial/models/ssd/SSD.py): detection demo · Object-detection example with specs and postprocessing helpers · `models/ssd/SSD.py`
- [YOLOv3](https://github.com/zetane/viewer/blob/initial/models/yolo_V3/yolo_V3.py): detection demo · Detection export with sample inputs and specs · `models/yolo_V3/yolo_V3.py`
- [RFB_320](https://github.com/zetane/viewer/blob/initial/models/RFB_320/RFB_320.py): detection demo · Detection bundle including exposed-node ONNX variant · `models/RFB_320/RFB_320.py`
- [Age model](https://github.com/zetane/viewer/blob/initial/models/vgg_ilsvrc_16_age/vgg_ilsvrc_16_age.py): detection demo · VGG-based age analysis export with exposed-node variant · `models/vgg_ilsvrc_16_age/vgg_ilsvrc_16_age.py`
- [Gender model](https://github.com/zetane/viewer/blob/initial/models/vgg_ilsvrc_16_gen/vgg_ilsvrc_16_gen.py): detection demo · VGG-based gender analysis export with exposed-node variant · `models/vgg_ilsvrc_16_gen/vgg_ilsvrc_16_gen.py`

### Segmentation and manipulation

Dense prediction and image transform demos

- [U-Net](https://github.com/zetane/viewer/blob/initial/models/unet/unet.py): segmentation demo · Segmentation model packaged as ONNX and ZTN · `models/unet/unet.py`
- [Super-resolution](https://github.com/zetane/viewer/blob/initial/models/super-resolution/super-resolution.py): image transform demo · Upsampling example with notebook-derived artifacts · `models/super-resolution/super-resolution.py`
- [Style transfer](https://github.com/zetane/viewer/blob/initial/models/style_transfer/style_transfer.py): image transform demo · Multiple style-transfer exports plus exposed-node variants · `models/style_transfer/style_transfer.py`

### XAI demos

Explainability-focused model examples

- [XAI Keras](https://github.com/zetane/viewer/blob/initial/models/xai_keras/xai_keras.py): explainability demo · Keras-based explainability example with label assets · `models/xai_keras/xai_keras.py`
- [XAI Torch](https://github.com/zetane/viewer/blob/initial/models/xai_torch/xai_torch.py): explainability demo · PyTorch-based explainability example with label assets · `models/xai_torch/xai_torch.py`

### Classical ML

Non-deep-learning export example

- [Iris RF](https://github.com/zetane/viewer/blob/initial/models/sklearn_iris/sklearn_iris.py): classical ML export · Scikit-learn random forest exported to ONNX and ZTN · `models/sklearn_iris/sklearn_iris.py`

### Emotion analysis

FERPlus-style facial emotion demo

- [FERPlus8](https://github.com/zetane/viewer/blob/initial/models/emotion_ferplus8/emotion_ferplus8.py): emotion demo · Facial emotion example with ONNX and workspace bundle · `models/emotion_ferplus8/emotion_ferplus8.py`

### Other components

- **Zetane Viewer**: external viewer · Desktop tool that loads ONNX and ZTN artifacts for inspection

## Connections

- README → Models guide: points to · Top-level docs direct readers to the model zoo
- Models guide → AlexNet: indexes · Representative classification example
- Models guide → SSD: indexes · Representative detection example
- Models guide → U-Net: indexes · Representative segmentation example
- Models guide → XAI Keras: indexes · Representative explainability example
- Models guide → Iris RF: indexes · Representative classical ML example
- Models guide → FERPlus8: indexes · Representative emotion example
- AlexNet → Zetane Viewer: loaded by · ONNX and ZTN artifacts are consumed in the desktop viewer
- EfficientNet → Zetane Viewer: loaded by · ONNX and ZTN artifacts are consumed in the desktop viewer
- ResNet50v2 → Zetane Viewer: loaded by · ONNX and ZTN artifacts are consumed in the desktop viewer
- SSD → Zetane Viewer: loaded by · Detection artifacts and workspace load into the viewer
- YOLOv3 → Zetane Viewer: loaded by · Detection artifacts and workspace load into the viewer
- RFB_320 → Zetane Viewer: loaded by · Exposed-node and standard ONNX exports load into the viewer
- Age model → Zetane Viewer: loaded by · Exposed-node and standard ONNX exports load into the viewer
- Gender model → Zetane Viewer: loaded by · Exposed-node and standard ONNX exports load into the viewer
- U-Net → Zetane Viewer: loaded by · Segmentation artifacts and workspace load into the viewer
- Super-resolution → Zetane Viewer: loaded by · Image transform artifacts and workspace load into the viewer
- Style transfer → Zetane Viewer: loaded by · Style-transfer artifacts and workspace load into the viewer
- XAI Keras → Zetane Viewer: loaded by · Explainability artifacts and label maps load into the viewer
- XAI Torch → Zetane Viewer: loaded by · Explainability artifacts and label maps load into the viewer
- Iris RF → Zetane Viewer: loaded by · Classical ML ONNX and workspace load into the viewer
- FERPlus8 → Zetane Viewer: loaded by · Emotion-analysis artifacts and workspace load into the viewer
