# marshal-gg/advanced-image-captioning-system architecture

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

- Interactive diagram: https://gitdiagram.com/marshal-gg/advanced-image-captioning-system
- Repository: https://github.com/marshal-gg/advanced-image-captioning-system

## Overview

This repository is an image-captioning application: a user uploads an image, the app extracts visual features, and a trained sequence model generates a text caption. The README also documents a Flickr8k-based notebook workflow for preprocessing, training, and evaluation. The notebook is present but was not sampled, so its internal stages and artifact-writing relationships are not verified; those links are shown as unverified where appropriate.

Main entry points: [`main.ipynb`](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/main.ipynb) (Preprocessing, training, evaluation), [`app.py`](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py) (Caption generation), [`data/processed/trained_model.keras`](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/processed/trained_model.keras) (Trained decoder), [`data/wordtoix.pkl`](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/wordtoix.pkl) (Word mappings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Captioning app"]
  node_interface["Gradio interface<br/>[app.py]"]
  node_caption["Caption generation<br/>[app.py]"]
  node_extract["Feature extraction<br/>[app.py]"]
  node_encoder["InceptionV3 encoder<br/>[app.py]"]
end

subgraph group_model["Caption model"]
  node_decoder["Trained decoder"]
  node_vocab["Word mappings<br/>[wordtoix.pkl]"]
  node_reverse_vocab["Reverse word mapping<br/>[vocab.pkl]"]
  node_train_features["Train features"]
  node_test_features["Test features"]
end

subgraph group_training["Training workflow"]
  node_training_data[("Flickr8k dataset")]
  node_notebook["Preprocessing, training, evaluation<br/>[main.ipynb]"]
end

node_user(("Image uploader"))
node_weights["ImageNet weights"]

node_user -->|"uploads image"| node_interface
node_interface -->|"calls"| node_caption
node_caption -->|"extracts features"| node_extract
node_extract -->|"predicts features"| node_encoder
node_encoder -->|"loads weights"| node_weights
node_caption -->|"predicts words"| node_decoder
node_caption -->|"maps input words"| node_vocab
node_caption -->|"looks up predicted word"| node_reverse_vocab
node_notebook -.->|"uses dataset"| node_training_data
node_notebook -.->|"prepares features"| node_train_features
node_notebook -.->|"prepares features"| node_test_features
node_notebook -.->|"trains model"| node_decoder
node_notebook -.->|"creates mapping"| node_vocab
node_notebook -.->|"creates mapping"| node_reverse_vocab

click node_interface "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py"
click node_caption "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py"
click node_extract "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py"
click node_encoder "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py"
click node_decoder "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/processed/trained_model.keras"
click node_vocab "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/wordtoix.pkl"
click node_reverse_vocab "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/vocab.pkl"
click node_notebook "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/main.ipynb"
click node_train_features "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/processed/train_encoded_features.npy"
click node_test_features "https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/processed/test_encoded_features.npy"

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_interface,node_caption,node_extract,node_encoder toneBlue
class node_decoder,node_vocab,node_reverse_vocab,node_train_features,node_test_features toneAmber
class node_training_data,node_notebook toneMint
class node_user,node_weights toneIndigo
```

## Components

### Captioning app

- [Gradio interface](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py): `app.py`
- [Caption generation](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py): `app.py`
- [Feature extraction](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py): `app.py`
- [InceptionV3 encoder](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/app.py): `app.py`

### Caption model

- [Trained decoder](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/processed/trained_model.keras): `data/processed/trained_model.keras`
- [Word mappings](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/wordtoix.pkl): `data/wordtoix.pkl`
- [Reverse word mapping](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/vocab.pkl): `data/vocab.pkl`
- [Train features](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/processed/train_encoded_features.npy): `data/processed/train_encoded_features.npy`
- [Test features](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/data/processed/test_encoded_features.npy): `data/processed/test_encoded_features.npy`

### Training workflow

- **Flickr8k dataset**
- [Preprocessing, training, evaluation](https://github.com/marshal-gg/advanced-image-captioning-system/blob/main/main.ipynb): `main.ipynb`

### Other components

- **Image uploader**
- **ImageNet weights**

## Connections

- Image uploader → Gradio interface: uploads image (evidence: `app.py`)
- Gradio interface → Caption generation: calls (evidence: `app.py`)
- Caption generation → Feature extraction: extracts features (evidence: `app.py`)
- Feature extraction → InceptionV3 encoder: predicts features (evidence: `app.py`)
- InceptionV3 encoder → ImageNet weights: loads weights (evidence: `app.py`)
- Caption generation → Trained decoder: predicts words (evidence: `app.py`)
- Caption generation → Word mappings: maps input words (evidence: `app.py`)
- Caption generation → Reverse word mapping: looks up predicted word (evidence: `app.py`)
- Preprocessing, training, evaluation → Flickr8k dataset: uses dataset (evidence: `README.md`)
- Preprocessing, training, evaluation → Train features: prepares features
- Preprocessing, training, evaluation → Test features: prepares features
- Preprocessing, training, evaluation → Trained decoder: trains model (evidence: `README.md`)
- Preprocessing, training, evaluation → Word mappings: creates mapping
- Preprocessing, training, evaluation → Reverse word mapping: creates mapping
