This project is a Streamlit-based hackathon demo for off-road semantic segmentation. It combines a polished dashboard with a PyTorch segmentation backend so users can upload an image, run inference, view the predicted mask, and compute IoU when a ground-truth mask is available.
- Upload an image and run segmentation
- Show the prediction mask in clean class colors
- Show an overlay view for easy visual comparison
- Compute IoU when a ground-truth mask is provided
- Display model performance, risk analysis, and summary pages
- Fall back safely if the trained model is missing
project/app.py- Streamlit dashboardproject/iou_docs.py- IoU explanation block shown in the dashboardmodel_loader.py- Model loading, preprocessing, prediction, mask coloring, and IoU helpersXPLENDIA_GitHub/segmentation_head.pth- Model checkpoint used if a local one is not found
Core packages:
streamlitnumpypillowtorchopencv-python
Optional packages:
pandasmatplotlib
The app works even if the optional packages are missing, but some charts will fall back to simpler display modes.
- Open a terminal in the project root.
- Activate your virtual environment if you are using one.
- Install dependencies:
pip install -r requirements.txt- Start the app:
streamlit run project/app.pyIoU stands for Intersection over Union.
Formula:
IoU = Intersection / Union
The dashboard shows a dedicated IoU explanation section and uses the same calculation in the backend when a ground-truth mask is available.
For the sample viewer and risk analysis pages:
- input image files such as
sample1_input.png - ground-truth mask files such as
sample1_mask.png - prediction files such as
sample1_pred.png
For live upload:
- upload an image
- optionally upload a matching ground-truth mask
- The dashboard keeps its dark theme and layout.
- The backend tries to load the real model first.
- If the model is missing or invalid, a safe fallback model keeps the app usable.
- IoU is only shown when a ground-truth mask is available.
- If the app opens but IoU says
Not Available, upload a ground-truth mask too. - If the model is missing, check
XPLENDIA_GitHub/segmentation_head.pth. - If a package import fails, reinstall the dependencies in a clean virtual environment.
- Dashboard starts successfully
- Upload and prediction flow works
- Segmentation mask is shown
- Overlay view is shown
- IoU section is visible and documented
- Model fallback works if the checkpoint is missing