# ahmedesammohmaed/pretrained_model architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedesammohmaed/pretrained_model
- Repository: https://github.com/ahmedesammohmaed/pretrained_model

## Overview

This is a Streamlit architectural floor-plan analyzer that turns an uploaded PDF or image into a segmented overlay and a structural JSON hierarchy with estimated wall thickness, material, and RF loss. The main path is upload and image conversion, model inference and geometry analysis, then display/download. The RF classification helper is a useful internal layer. `pretrain_model.py` also contains a Colab-style upload and analysis workflow. The excerpts show these behaviors, but not a separate trained-model implementation; model loading references a Hugging Face model.

Main entry points: [`app.py`](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py) (Mask2Former inference), [`pretrain_model.py`](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/pretrain_model.py) (Colab analysis workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_streamlit["Upload and controls<br/>[app.py]"]
  node_image_input["Image conversion<br/>[app.py]"]
end

subgraph group_analysis["Floor-plan analysis"]
  node_segmentation["Mask2Former inference<br/>[app.py]"]
  node_geometry["Geometry extraction<br/>[app.py]"]
  node_rf_rules["RF classification<br/>[app.py]"]
  node_colab["Colab analysis workflow<br/>[pretrain_model.py]"]
end

subgraph group_results["Analysis results"]
  node_results["Overlay and hierarchy<br/>[app.py]"]
end

node_user(("Floor-plan user"))
node_model_repo["Hugging Face model"]

node_user -->|"uploads plan"| node_streamlit
node_streamlit -->|"passes file"| node_image_input
node_image_input -->|"passes image"| node_segmentation
node_segmentation -->|"loads weights"| node_model_repo
node_segmentation -->|"provides segments"| node_geometry
node_geometry -->|"classifies walls"| node_rf_rules
node_geometry -->|"builds hierarchy"| node_results
node_rf_rules -->|"adds RF properties"| node_results
node_results -->|"returns for display"| node_streamlit
node_user -->|"uploads plan"| node_colab

click node_streamlit "https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py"
click node_image_input "https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py"
click node_segmentation "https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py"
click node_geometry "https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py"
click node_rf_rules "https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py"
click node_results "https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py"
click node_colab "https://github.com/ahmedesammohmaed/pretrained_model/blob/main/pretrain_model.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_input,node_user toneBlue
class node_segmentation,node_geometry,node_rf_rules,node_colab toneAmber
class node_results toneMint
class node_model_repo toneIndigo
```

## Components

### User interface

- [Upload and controls](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py): `app.py`
- [Image conversion](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py): `app.py`

### Floor-plan analysis

- [Mask2Former inference](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py): `app.py`
- [Geometry extraction](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py): `app.py`
- [RF classification](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py): `app.py`
- [Colab analysis workflow](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/pretrain_model.py): `pretrain_model.py`

### Analysis results

- [Overlay and hierarchy](https://github.com/ahmedesammohmaed/pretrained_model/blob/main/app.py): `app.py`

### Other components

- **Floor-plan user**
- **Hugging Face model**

## Connections

- Floor-plan user → Upload and controls: uploads plan (evidence: `app.py`)
- Upload and controls → Image conversion: passes file (evidence: `app.py`)
- Image conversion → Mask2Former inference: passes image (evidence: `app.py`)
- Mask2Former inference → Hugging Face model: loads weights (evidence: `app.py`)
- Mask2Former inference → Geometry extraction: provides segments (evidence: `app.py`)
- Geometry extraction → RF classification: classifies walls (evidence: `app.py`)
- Geometry extraction → Overlay and hierarchy: builds hierarchy (evidence: `app.py`)
- RF classification → Overlay and hierarchy: adds RF properties (evidence: `app.py`)
- Overlay and hierarchy → Upload and controls: returns for display (evidence: `app.py`)
- Floor-plan user → Colab analysis workflow: uploads plan (evidence: `pretrain_model.py`)
