# shrirangkanade/ml-for-mars-exploration architecture

> Architecture diagram of the GitHub repository shrirangkanade/ml-for-mars-exploration, 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/shrirangkanade/ml-for-mars-exploration
- Repository: https://github.com/shrirangkanade/ml-for-mars-exploration

## Overview

The product is a Streamlit application for segmenting Mars terrain images into safe and dangerous regions. Its main workflow selects or uploads an image, resizes and normalizes it, runs either the Keras or TensorFlow Lite model, converts class scores to a mask, and displays the mask overlaid on the input. The README also describes the U-Net model and segmentation objective. The notebook is present in the tree, but its contents were not sampled, so training internals are not mapped.

Main entry points: [`new_app.py`](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py) (Image selection), [`app.py`](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py) (Image upload), [`quantized_model.tflite`](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/quantized_model.tflite) (Quantized model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Streamlit interface"]
  node_web_app["Image selection<br/>[new_app.py]"]
  node_upload_app["Image upload<br/>[app.py]"]
  node_result_view["Segmented result<br/>[new_app.py]"]
  node_upload_result_view["Segmented result<br/>[app.py]"]
end

subgraph group_inference["Image inference"]
  node_preprocess["Resize and normalize<br/>[new_app.py]"]
  node_upload_preprocess["Resize and normalize<br/>[app.py]"]
  node_mask_decode["Class mask<br/>[new_app.py]"]
  node_upload_mask_decode["Class mask<br/>[app.py]"]
end

subgraph group_models["Segmentation models"]
  node_lite_inference["TFLite inference<br/>[new_app.py]"]
  node_keras_inference["Keras inference<br/>[app.py]"]
  node_lite_model["Quantized model"]
  node_h5_model["Full model"]
end

subgraph group_presentation["Result presentation"]
  node_render["Overlay rendering<br/>[new_app.py]"]
  node_upload_render["Overlay rendering<br/>[app.py]"]
end

node_user(("Explorer"))
node_streamlit(("Streamlit runtime"))

node_user -->|"selects image"| node_web_app
node_user -->|"uploads image"| node_upload_app
node_web_app -->|"passes image"| node_preprocess
node_upload_app -->|"passes image"| node_upload_preprocess
node_preprocess -->|"passes tensor"| node_lite_inference
node_lite_inference -->|"invokes"| node_lite_model
node_lite_inference -->|"returns scores"| node_mask_decode
node_upload_preprocess -->|"passes tensor"| node_keras_inference
node_keras_inference -.->|"loads and predicts"| node_h5_model
node_keras_inference -->|"returns scores"| node_upload_mask_decode
node_web_app -->|"requests display"| node_render
node_render -->|"returns image URL"| node_result_view
node_upload_app -->|"requests display"| node_upload_render
node_upload_render -->|"returns image URL"| node_upload_result_view
node_streamlit -->|"runs"| node_web_app
node_streamlit -->|"runs"| node_upload_app

click node_web_app "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py"
click node_upload_app "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py"
click node_preprocess "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py"
click node_upload_preprocess "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py"
click node_lite_inference "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py"
click node_keras_inference "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py"
click node_lite_model "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/quantized_model.tflite"
click node_mask_decode "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py"
click node_upload_mask_decode "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py"
click node_render "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py"
click node_upload_render "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py"
click node_result_view "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py"
click node_upload_result_view "https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.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_web_app,node_upload_app,node_result_view,node_upload_result_view toneBlue
class node_preprocess,node_upload_preprocess,node_mask_decode,node_upload_mask_decode toneAmber
class node_lite_inference,node_keras_inference,node_lite_model,node_h5_model toneMint
class node_render,node_upload_render toneRose
class node_user,node_streamlit toneIndigo
```

## Components

### Streamlit interface

- [Image selection](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py): `new_app.py`
- [Image upload](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py): `app.py`
- [Segmented result](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py): `new_app.py`
- [Segmented result](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py): `app.py`

### Image inference

- [Resize and normalize](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py): `new_app.py`
- [Resize and normalize](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py): `app.py`
- [Class mask](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py): `new_app.py`
- [Class mask](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py): `app.py`

### Segmentation models

- [TFLite inference](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py): `new_app.py`
- [Keras inference](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py): `app.py`
- [Quantized model](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/quantized_model.tflite): `quantized_model.tflite`
- **Full model**

### Result presentation

- [Overlay rendering](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/new_app.py): `new_app.py`
- [Overlay rendering](https://github.com/shrirangkanade/ml-for-mars-exploration/blob/master/app.py): `app.py`

### Other components

- **Explorer**
- **Streamlit runtime**

## Connections

- Explorer → Image selection: selects image
- Explorer → Image upload: uploads image
- Image selection → Resize and normalize: passes image
- Image upload → Resize and normalize: passes image
- Resize and normalize → TFLite inference: passes tensor
- TFLite inference → Quantized model: invokes
- TFLite inference → Class mask: returns scores
- Resize and normalize → Keras inference: passes tensor
- Keras inference → Full model: loads and predicts
- Keras inference → Class mask: returns scores
- Image selection → Overlay rendering: requests display
- Overlay rendering → Segmented result: returns image URL
- Image upload → Overlay rendering: requests display
- Overlay rendering → Segmented result: returns image URL
- Streamlit runtime → Image selection: runs
- Streamlit runtime → Image upload: runs
