How ahsan47-hq/weed-detection-app works
Precision Weed Detection is a React interface backed by a FastAPI image-analysis API. The user selects or drops a field image, submits it for ONNX YOLOv8-Seg inference, and receives an annotated segmentation image and prediction metrics; the UI presents the result, legend, and species guidance. The excerpts show the API orchestration, model preprocessing/postprocessing, and rendering. README documents the broader capabilities; links for unexcerpted result components are limited to documented or directly visible relationships.
Main entry points: App.jsx Analysis page · routes.py API routes · SpeciesInfo.jsx Species guidance · UploadCard.jsx Image upload
Components 15
Web interface
- React entry
frontend/src/main.jsx - Analysis page
frontend/src/App.jsx - Image upload
frontend/src/components/UploadCard.jsx - Prediction summary
frontend/src/components/ResultCard.jsx - Mask legend
frontend/src/components/Legend.jsx - Species guidance
frontend/src/components/SpeciesInfo.jsx - Weed reference data
frontend/src/data/weedInfo.js
Prediction API
- FastAPI app
backend/app/main.py - API routes
backend/app/routes.py - Response schema
backend/app/schemas.py
Segmentation inference
- ONNX predictor
backend/app/predictor.py - ONNX model
backend/models/best.onnx - Mask renderer
backend/app/visualizer.py
Other components
- Field user
- Inference API
Connections 17
- Field user → Image upload: selects image
frontend/src/components/UploadCard.jsx - React entry → Analysis page: renders
frontend/src/main.jsx - Analysis page → Image upload: renders
frontend/src/App.jsx - Analysis page → Prediction summary: renders results
frontend/src/App.jsx - Analysis page → Mask legend: renders legend
frontend/src/App.jsx - Analysis page → Species guidance: renders guidance
frontend/src/App.jsx - Species guidance → Weed reference data: looks up species
frontend/src/components/SpeciesInfo.jsx - Image upload → Inference API: posts image
frontend/src/components/UploadCard.jsx - Inference API → FastAPI app: serves API
README.md - FastAPI app → API routes: registers routes
backend/app/main.py - API routes → ONNX predictor: runs prediction
backend/app/routes.py - API routes → Mask renderer: renders masks
backend/app/routes.py - API routes → Response schema: validates response
backend/app/routes.py - ONNX predictor → ONNX model: loads model
- Prediction summary → Field user: shows metrics
- Mask legend → Field user: explains colors
- Species guidance → Field user: shows guidance