How amgharhind/gravsense works
GravSense is a server-side construction-debris analysis API with a browser interface. A user uploads a site photo and selects a detection method; the API validates it, obtains a debris mask, optionally runs depth estimation and reference-width calibration in parallel, then computes area and volume and returns metrics plus visualization images. The graph preserves the SegFormer benchmark path and the separate calibration and depth stages. Relationships are based on the sampled API implementation and README; unsampled UI internals are not inferred.
Main entry points: main.py FastAPI analysis · index.html Upload and results UI · schemas.py Analysis response schema · grounded_sam.py Grounded SAM detector
Components 9
User Interface
- Upload and results UI
gravsense/api/static/index.html
Analysis API
- FastAPI analysis
gravsense/api/main.py - Analysis response schema
gravsense/api/schemas.py
Detection and Depth
- Grounded SAM detector
gravsense/core/grounded_sam.py - SegFormer baseline
gravsense/core/segformer_detector.py - Pile depth estimator
gravsense/core/depth_estimator.py
Calibration and Measurement
- Reference-width calibration
gravsense/core/auto_calibrate.py - Area and volume calculation
gravsense/core/volume.py
Other components
- User browser
Connections 9
- User browser → Upload and results UI: opens
README.md - Upload and results UI → FastAPI analysis: submits analysis
README.md - FastAPI analysis → Upload and results UI: serves UI
gravsense/api/main.py - FastAPI analysis → Grounded SAM detector: dispatches detection
gravsense/api/main.py - FastAPI analysis → SegFormer baseline: dispatches detection
gravsense/api/main.py - FastAPI analysis → Pile depth estimator: estimates depth
gravsense/api/main.py - FastAPI analysis → Reference-width calibration: calibrates width
gravsense/api/main.py - FastAPI analysis → Area and volume calculation: calculates area and volume
gravsense/api/main.py - FastAPI analysis → Analysis response schema: returns schema
gravsense/api/main.py