How bajpaidhruv2018/desert_hackathon works
This repo is an applied ML semantic-segmentation system with two distinct “modes”:
Offline ML pipeline (training + evaluation + experiment iterations V0–V5)
• Multiple training scripts (run_training.py, local_train*.py, train_total_war*.py, etc.)
• Multiple evaluation/verification scripts (check_iou.py, final_test.py, accurate_check.py, etc.)
• Produces a model artifact: best_model.pth
Online inference/demo UI(s)
• Streamlit app: app.py (explicitly documented in README)
• A separate web-ui/ folder that looks like a Vite + React frontend plus a small Python backend (web-ui/api_server.py) likely used as an HTTP inference API for the React UI.
So the “system” is not a single service—it’s a pipeline + artifact + one (or two) demo surfaces.
Data / Inputs
• Offroad_Segmentation_Training_Dataset/ (gitignored, external)
• train/Color_Images/, train/Segmentation/
• val/Color_Images/, val/Segmentation/
• Key domain constraint: masks use raw pixel IDs (100…10000) that must be read with cv2.imread(..., -1) and remapped via an ID_MAPPING to class indices 0–9.
ML Training & Experimentation (offline)
• Training scripts representing iterations:
• Baseline → fixed mask mapping → augmentation/loss/scheduler → 512 fine-tune
• Core ML stack:
• PyTorch
• segmentation-models-pytorch (U-Net, ResNet34 encoder, ImageNet pretrained)
• Output:
• best_model.pth (weights)
Evaluation & Reporting (offline)
• Scripts that compute:
• IoU, pixel accuracy, confusion matrix, qualitative overlays
• Outputs stored in:
• final_submission_results/
• test_results/
• readme_assets/ (metrics charts, etc.)
Inference Runtime(s) (online demo)
• Streamlit (app.py)
• Loads best_model.pth
• React Web UI (web-ui/src/*) + API server (web-ui/api_server.py)
• Likely: browser uploads image → API server runs inference → returns mask/overlay/metrics → UI renders
Streamlit path
User → Streamlit UI (app.py) → Preprocess → Model load + inference → Postprocess overlay + confidence → UI
React path
User Browser (React/Vite) → HTTP upload → Python API server (api_server.py) → Model inference → Response (mask/overlay/metrics) → React render
Training vs Inference are different runtimes
• Training: GPU-heavy, batch-based, uses augmentation, backprop
• Inference: single-image forward pass, deterministic transforms
Model artifact as the contract
• best_model.pth is the handoff between offline and online worlds
• It as a first-class node: “Model Registry/Artifact Store (local file)”
Dataset is external + versioned implicitly
• Since dataset is gitignored, treat it as an external dependency
Preprocessing/postprocessing are system components
• Especially mask ID mapping + overlay coloring + resizing to 512×512
Project-specific “don’t miss these details” checklist
• Two UI surfaces if both are real: Streamlit (app.py) and web-ui/ (React + api_server.py)
• Model architecture detail at the right level: “U-Net (ResNet34 encoder, SMP)”
• Training evolution as either:
• a side panel listing V0–V5 scripts, or
• Outputs: confusion matrix + per-class IoU plots + qualitative overlays (final_submission_results/, readme_assets/)
• Explicit boundary around “Repo code” vs “External dataset”