How dolaposalim/web-based-macroalgae-active-learner works
Project type and purpose
• This is a monolithic “full-stack” Python web tool built with Streamlit.
• Purpose: let users upload underwater macroalgae images, auto-label them via a YOLO→SAM pipeline, compute per-class coverage percentages, display overlays interactively, and download annotations/masks.
File structure
• project/images/ ← raw input images
• project/scr/app.py ← single Streamlit app (frontend + backend)
• project/output/ ← generated artifacts
• masks/ ← per-object segmentation masks
• overlays/ ← overlay visuals for display
• annotations.json ← structured label + coverage data
• requirements.txt ← Python dependencies (streamlit, opencv-python, ultralytics, etc.)
Main components
a. User Interface (Streamlit front end)
b. Application Server (app.py)
c. Image Processing Pipeline
• Pre-processing (OpenCV, NumPy)
• YOLO detection module (yolo_model.pt)
• SAM segmentation module (sam_b.pt)
• Coverage calculator (pixel-area per class)
d. Data stores
• Local file system: project/images, project/output
• Model artifacts: YOLO weights, SAM weights
e. Optional: External storage (e.g., Firebase/GCP bucket)
Relationships and data flow
1) User uploads image(s) via Streamlit UI →
2) app.py saves to project/images →
3) app.py invokes pipeline:
– Pre-process → YOLO inference → SAM segmentation → coverage calc →
4) Pipeline writes masks, overlays, annotations.json to project/output →
5) Streamlit UI reads outputs, renders overlays + stats →
6) User can trigger “Download JSON/masks ZIP”
Architectural patterns and principles
• Monolith with clear separation of concerns: “UI” vs “processing pipeline” vs “storage.”
• Modular pipeline functions (detect, segment, measure).
• File-based data interchange (images in → outputs out).
• Easy extension point: swap in cloud storage or additional models.
Technologies and frameworks to annotate
• Streamlit for UI + web server
• Python libraries: OpenCV, NumPy, Pillow
• ultralytics YOLO model
• Segment Anything Model (SAM)
• JSON for annotations
• (Optional) Firebase/GCP for storage