# devgxg/iminsight architecture

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

- Interactive diagram: https://gitdiagram.com/devgxg/iminsight
- Repository: https://github.com/devgxg/iminsight

## Overview

IMInsight is a naval-image analysis web app. A user selects an image in the React interface, submits it to Flask, and receives classification, a caption, object detections, anomaly findings, and a naval assessment. GeoTIFF preview is a separate frontend capability using Leaflet tiles. The sampled Flask route establishes the analysis calls and response assembly; classification implementation is unsampled, and the README’s planned geovisualization is represented only by the implemented preview.

Main entry points: [`backend/app.py`](https://github.com/devgxg/iminsight/blob/main/backend/app.py) (Upload Analysis Route), [`frontend/src/upload.jsx`](https://github.com/devgxg/iminsight/blob/main/frontend/src/upload.jsx) (Upload & Report), [`frontend/src/App.jsx`](https://github.com/devgxg/iminsight/blob/main/frontend/src/App.jsx) (App Shell), [`frontend/src/GeoTIFFpreview.jsx`](https://github.com/devgxg/iminsight/blob/main/frontend/src/GeoTIFFpreview.jsx) (GeoTIFF Preview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Interface"]
  node_entry["React Entry<br/>[main.jsx]"]
  node_app["App Shell<br/>[App.jsx]"]
  node_upload["Upload &amp; Report<br/>[upload.jsx]"]
end

subgraph group_api["Analysis API"]
  node_flask["Upload Analysis Route<br/>[app.py]"]
  node_uploads[("Uploaded Images")]
end

subgraph group_models["Image Analysis"]
  node_classification["Image Classification<br/>[clip_utils.py]"]
  node_caption["Caption Generation<br/>[blip_caption.py]"]
  node_detection["Object Detection"]
  node_anomaly["Anomaly Rules"]
end

subgraph group_mapping["Geo Preview"]
  node_geo["GeoTIFF Preview<br/>[GeoTIFFpreview.jsx]"]
end

node_user(("Image Analyst"))
node_tiles["OpenStreetMap Tiles"]

node_user -->|"selects image"| node_upload
node_entry -->|"renders"| node_app
node_app -->|"renders"| node_upload
node_upload -->|"renders preview"| node_geo
node_geo -->|"requests tiles"| node_tiles
node_upload -->|"posts image"| node_flask
node_flask -->|"saves image"| node_uploads
node_flask -->|"classifies image"| node_classification
node_flask -->|"generates caption"| node_caption
node_flask -->|"detects objects"| node_detection
node_flask -->|"checks detections"| node_anomaly
node_flask -->|"returns report"| node_upload

click node_entry "https://github.com/devgxg/iminsight/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/devgxg/iminsight/blob/main/frontend/src/App.jsx"
click node_upload "https://github.com/devgxg/iminsight/blob/main/frontend/src/upload.jsx"
click node_geo "https://github.com/devgxg/iminsight/blob/main/frontend/src/GeoTIFFpreview.jsx"
click node_flask "https://github.com/devgxg/iminsight/blob/main/backend/app.py"
click node_uploads "https://github.com/devgxg/iminsight/tree/main/backend/static/uploads"
click node_classification "https://github.com/devgxg/iminsight/blob/main/backend/model/clip_utils.py"
click node_caption "https://github.com/devgxg/iminsight/blob/main/backend/model/blip_caption.py"
click node_detection "https://github.com/devgxg/iminsight/blob/main/backend/model/object_detection.py"
click node_anomaly "https://github.com/devgxg/iminsight/blob/main/backend/model/anomaly_detector.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_entry,node_app,node_upload toneBlue
class node_flask,node_uploads toneAmber
class node_classification,node_caption,node_detection,node_anomaly toneMint
class node_geo toneRose
class node_user,node_tiles toneIndigo
```

## Components

### Web Interface

- [React Entry](https://github.com/devgxg/iminsight/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [App Shell](https://github.com/devgxg/iminsight/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Upload & Report](https://github.com/devgxg/iminsight/blob/main/frontend/src/upload.jsx): `frontend/src/upload.jsx`

### Analysis API

- [Upload Analysis Route](https://github.com/devgxg/iminsight/blob/main/backend/app.py): `backend/app.py`
- [Uploaded Images](https://github.com/devgxg/iminsight/tree/main/backend/static/uploads): `backend/static/uploads`

### Image Analysis

- [Image Classification](https://github.com/devgxg/iminsight/blob/main/backend/model/clip_utils.py): `backend/model/clip_utils.py`
- [Caption Generation](https://github.com/devgxg/iminsight/blob/main/backend/model/blip_caption.py): `backend/model/blip_caption.py`
- [Object Detection](https://github.com/devgxg/iminsight/blob/main/backend/model/object_detection.py): `backend/model/object_detection.py`
- [Anomaly Rules](https://github.com/devgxg/iminsight/blob/main/backend/model/anomaly_detector.py): `backend/model/anomaly_detector.py`

### Geo Preview

- [GeoTIFF Preview](https://github.com/devgxg/iminsight/blob/main/frontend/src/GeoTIFFpreview.jsx): `frontend/src/GeoTIFFpreview.jsx`

### Other components

- **Image Analyst**
- **OpenStreetMap Tiles**

## Connections

- Image Analyst → Upload & Report: selects image
- React Entry → App Shell: renders
- App Shell → Upload & Report: renders
- Upload & Report → GeoTIFF Preview: renders preview
- GeoTIFF Preview → OpenStreetMap Tiles: requests tiles
- Upload & Report → Upload Analysis Route: posts image
- Upload Analysis Route → Uploaded Images: saves image
- Upload Analysis Route → Image Classification: classifies image
- Upload Analysis Route → Caption Generation: generates caption
- Upload Analysis Route → Object Detection: detects objects
- Upload Analysis Route → Anomaly Rules: checks detections
- Upload Analysis Route → Upload & Report: returns report
