# michellelychan/posenet-pytorch architecture

> Architecture diagram of the GitHub repository michellelychan/posenet-pytorch, 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/michellelychan/posenet-pytorch
- Repository: https://github.com/michellelychan/posenet-pytorch

## Overview

PoseNet Pytorch is a multi-person pose-estimation implementation with end-to-end dataset preparation, training, inference demos, and heatmap visualization. The principal inference workflow accepts an image or video, loads a MobileNet PoseNet model, decodes pose outputs, and presents keypoints or skeletons. Training and annotation conversion are separate product branches. Edges rely on README statements or SOURCE INDEX references; unsampled modules are represented only at their documented or indexed boundaries.

Main entry points: [`posenet/models/model_factory.py`](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/models/model_factory.py) (Model loader), [`streamlit_demo.py`](https://github.com/michellelychan/posenet-pytorch/blob/master/streamlit_demo.py) (Streamlit demo), [`posenet/decode_multi.py`](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/decode_multi.py) (Multi-pose decoder), [`train.py`](https://github.com/michellelychan/posenet-pytorch/blob/master/train.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Inference interfaces"]
  node_streamlit["Streamlit demo<br/>[streamlit_demo.py]"]
  node_image_demo["Image demo<br/>[image_demo.py]"]
  node_webcam["Webcam demo<br/>[webcam_demo.py]"]
  node_benchmark["Inference benchmark<br/>[benchmark.py]"]
end

subgraph group_runtime["Pose inference runtime"]
  node_preprocess["Image preprocessing<br/>[utils.py]"]
  node_factory["Model loader<br/>[model_factory.py]"]
  node_mobilenet["MobileNet PoseNet<br/>[mobilenet_v1.py]"]
  node_decode_multi["Multi-pose decoder<br/>[decode_multi.py]"]
  node_decode["Pose decoding<br/>[decode.py]"]
  node_constants["Pose topology<br/>[constants.py]"]
  node_visualizers["Pose and heatmap rendering<br/>[visualizers.py]"]
end

subgraph group_training["Training and annotations"]
  node_dataloop["Dataloop annotations"]
  node_roboflow["Roboflow annotations"]
  node_training_loop["Model training<br/>[train.py]"]
  node_training_viz["Training visualizations<br/>[visualizers.py]"]
end

subgraph group_weights["Model weights"]
  node_converter["TFJS weight conversion<br/>[tfjs2pytorch.py]"]
  node_downloader["Weight downloader<br/>[wget.py]"]
end

node_user(("User / image source"))
node_google_weights[("TensorFlow.js weights")]

node_user -->|"uploads media"| node_streamlit
node_user -->|"provides images"| node_image_demo
node_user -->|"provides camera feed"| node_webcam
node_streamlit -->|"processes media"| node_preprocess
node_streamlit -->|"loads model"| node_factory
node_streamlit -->|"decodes poses"| node_decode_multi
node_streamlit -->|"renders results"| node_visualizers
node_image_demo -->|"loads model"| node_factory
node_image_demo -->|"decodes poses"| node_decode_multi
node_webcam -->|"loads model"| node_factory
node_benchmark -->|"loads model"| node_factory
node_factory -->|"instantiates"| node_mobilenet
node_factory -->|"converts missing weights"| node_converter
node_converter -->|"loads parameters"| node_mobilenet
node_converter -->|"requests weights"| node_downloader
node_downloader -->|"downloads"| node_google_weights
node_decode_multi -->|"decodes keypoints"| node_decode
node_decode_multi -->|"uses pose topology"| node_constants
node_decode -->|"uses pose topology"| node_constants
node_training_loop -->|"loads annotations"| node_dataloop
node_training_loop -->|"evaluates poses"| node_decode_multi
node_training_loop -->|"visualizes training"| node_training_viz
node_training_loop -.->|"trains model"| node_mobilenet
node_dataloop -->|"accepts annotations"| node_user
node_roboflow -->|"accepts annotations"| node_user

click node_streamlit "https://github.com/michellelychan/posenet-pytorch/blob/master/streamlit_demo.py"
click node_image_demo "https://github.com/michellelychan/posenet-pytorch/blob/master/image_demo.py"
click node_webcam "https://github.com/michellelychan/posenet-pytorch/blob/master/webcam_demo.py"
click node_benchmark "https://github.com/michellelychan/posenet-pytorch/blob/master/benchmark.py"
click node_preprocess "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/utils.py"
click node_factory "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/models/model_factory.py"
click node_mobilenet "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/models/mobilenet_v1.py"
click node_decode_multi "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/decode_multi.py"
click node_decode "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/decode.py"
click node_constants "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/constants.py"
click node_visualizers "https://github.com/michellelychan/posenet-pytorch/blob/master/visualizers.py"
click node_dataloop "https://github.com/michellelychan/posenet-pytorch/blob/master/ground_truth_dataloop.py"
click node_roboflow "https://github.com/michellelychan/posenet-pytorch/blob/master/ground_truth_roboflow.py"
click node_training_loop "https://github.com/michellelychan/posenet-pytorch/blob/master/train.py"
click node_training_viz "https://github.com/michellelychan/posenet-pytorch/blob/master/visualizers.py"
click node_converter "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/converter/tfjs2pytorch.py"
click node_downloader "https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/converter/wget.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_streamlit,node_image_demo,node_webcam,node_benchmark,node_user toneBlue
class node_preprocess,node_factory,node_mobilenet,node_decode_multi,node_decode,node_constants,node_visualizers,node_google_weights toneAmber
class node_dataloop,node_roboflow,node_training_loop,node_training_viz toneMint
class node_converter,node_downloader toneRose
```

## Components

### Inference interfaces

- [Streamlit demo](https://github.com/michellelychan/posenet-pytorch/blob/master/streamlit_demo.py): `streamlit_demo.py`
- [Image demo](https://github.com/michellelychan/posenet-pytorch/blob/master/image_demo.py): `image_demo.py`
- [Webcam demo](https://github.com/michellelychan/posenet-pytorch/blob/master/webcam_demo.py): `webcam_demo.py`
- [Inference benchmark](https://github.com/michellelychan/posenet-pytorch/blob/master/benchmark.py): `benchmark.py`

### Pose inference runtime

- [Image preprocessing](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/utils.py): `posenet/utils.py`
- [Model loader](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/models/model_factory.py): `posenet/models/model_factory.py`
- [MobileNet PoseNet](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/models/mobilenet_v1.py): `posenet/models/mobilenet_v1.py`
- [Multi-pose decoder](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/decode_multi.py): `posenet/decode_multi.py`
- [Pose decoding](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/decode.py): `posenet/decode.py`
- [Pose topology](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/constants.py): `posenet/constants.py`
- [Pose and heatmap rendering](https://github.com/michellelychan/posenet-pytorch/blob/master/visualizers.py): `visualizers.py`

### Training and annotations

- [Dataloop annotations](https://github.com/michellelychan/posenet-pytorch/blob/master/ground_truth_dataloop.py): `ground_truth_dataloop.py`
- [Roboflow annotations](https://github.com/michellelychan/posenet-pytorch/blob/master/ground_truth_roboflow.py): `ground_truth_roboflow.py`
- [Model training](https://github.com/michellelychan/posenet-pytorch/blob/master/train.py): `train.py`
- [Training visualizations](https://github.com/michellelychan/posenet-pytorch/blob/master/visualizers.py): `visualizers.py`

### Model weights

- [TFJS weight conversion](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/converter/tfjs2pytorch.py): `posenet/converter/tfjs2pytorch.py`
- [Weight downloader](https://github.com/michellelychan/posenet-pytorch/blob/master/posenet/converter/wget.py): `posenet/converter/wget.py`

### Other components

- **User / image source**
- **TensorFlow.js weights**

## Connections

- User / image source → Streamlit demo: uploads media (evidence: `README.md`)
- User / image source → Image demo: provides images (evidence: `README.md`)
- User / image source → Webcam demo: provides camera feed (evidence: `README.md`)
- Streamlit demo → Image preprocessing: processes media (evidence: `streamlit_demo.py`)
- Streamlit demo → Model loader: loads model (evidence: `streamlit_demo.py`)
- Streamlit demo → Multi-pose decoder: decodes poses (evidence: `streamlit_demo.py`)
- Streamlit demo → Pose and heatmap rendering: renders results (evidence: `streamlit_demo.py`)
- Image demo → Model loader: loads model (evidence: `image_demo.py`)
- Image demo → Multi-pose decoder: decodes poses (evidence: `image_demo.py`)
- Webcam demo → Model loader: loads model (evidence: `webcam_demo.py`)
- Inference benchmark → Model loader: loads model (evidence: `README.md`)
- Model loader → MobileNet PoseNet: instantiates (evidence: `posenet/models/model_factory.py`)
- Model loader → TFJS weight conversion: converts missing weights (evidence: `posenet/models/model_factory.py`)
- TFJS weight conversion → MobileNet PoseNet: loads parameters (evidence: `posenet/converter/tfjs2pytorch.py`)
- TFJS weight conversion → Weight downloader: requests weights (evidence: `posenet/converter/tfjs2pytorch.py`)
- Weight downloader → TensorFlow.js weights: downloads (evidence: `posenet/converter/wget.py`)
- Multi-pose decoder → Pose decoding: decodes keypoints (evidence: `posenet/decode_multi.py`)
- Multi-pose decoder → Pose topology: uses pose topology (evidence: `posenet/decode_multi.py`)
- Pose decoding → Pose topology: uses pose topology (evidence: `posenet/decode.py`)
- Model training → Dataloop annotations: loads annotations (evidence: `train.py`)
- Model training → Multi-pose decoder: evaluates poses (evidence: `train.py`)
- Model training → Training visualizations: visualizes training (evidence: `train.py`)
- Model training → MobileNet PoseNet: trains model
- Dataloop annotations → User / image source: accepts annotations (evidence: `README.md`)
- Roboflow annotations → User / image source: accepts annotations (evidence: `README.md`)
