Real-time hazard interpretation and APF-based steering support for agricultural vehicles, built around an upload-to-dashboard workflow.
Agricultural autonomy fails hardest when perception is uncertain and reaction is late. This project focuses on that gap.
AgroCIT ingests a short frame sequence, runs tracking and deterministic safety inference, and returns frame-by-frame reasoning plus control suggestions. The system is intentionally hybrid: detector + tracker + deterministic graph/physics logic, with visual outputs that operators and judges can inspect directly.
This is not an end-to-end learned autonomy stack. It is a transparent safety pipeline designed for explainability and fast iteration in field-like scenarios.
- Upload frames from the UI (current tracker pipeline processes up to 20 frames).
- Backend stores the run and starts background processing.
- YOLO + ResNet ReID tracker writes annotated frames and tracking CSV.
- CSV is mapped to kinematics and fed into deterministic SGG + APF logic.
- Backend writes run-scoped
final_output.json. - Frontend dashboard loads run visual data (SGG + APF), supports frame stepping, research/chat, and report views.
- Chat/report can use Claude when configured, with deterministic fallback behavior.
- Frame upload pipeline with run IDs and status polling.
- YOLO detection + ResNet-embedding ReID tracking over uploaded frames.
- Deterministic SGG inference for certainty, TTC, and danger quality.
- APF control output for steering (
delta_theta) and target velocity (v_target). - APF visualization payload: potential surface, steering cue, suggested path trajectory, corridor, and entities.
- Run-grounded chat endpoint (
/runs/{run_id}/chat) and report endpoint (/report).
High-level flow:
- Frontend uploads image frames to FastAPI.
- FastAPI creates
run_id, persists files/metadata, and starts tracker task. - Tracker (
backend/yolo_tracker.py) emits:- annotated frame images
- tracking CSV (
multiclass_tracking_20frames.csv)
- Backend maps CSV into kinematics entities.
- Deterministic SGG inference + processing generates graph semantics and danger classes.
- APF service computes lateral steering, longitudinal velocity, potential field (
z_surface), corridor, and rollout trajectory. - Backend writes
final_output.jsonper run underbackend/data/uploads/<run_id>/. - Frontend fetches run-specific visual data and renders dashboard pages.
Given detector confidence and track age:
Relative velocity is projected toward ego. If the object is moving away, TTC is infinite.
Class severity weight with exponential TTC decay:
Implemented components include:
- Crop-edge attractive term from occupancy-grid gradient and PD edge tracking.
- Repulsive obstacle term using certainty, danger quality, distance, and forward exponential decay.
- Exponential forward decay term
$e^{-\alpha y}$ to prioritize near-forward threats. - Vortex (tangential) component to reduce symmetric deadlocks.
- Adaptive repulsion weight based on nearest hazard distance.
- Steering clamp and rate limiting for control smoothness.
- Builds a forward safety corridor polygon.
- Computes in-corridor threat score from predicted entities.
- Reduces target speed from base velocity based on max in-corridor threat.
z_surface is log-scaled potential:
This improves readability versus raw potential magnitudes.
- React + TypeScript + Vite
- Plotly via
react-plotly.js - Tailwind CSS
- FastAPI + Uvicorn
- Pydantic
- NumPy, SciPy, Shapely
- OpenCV
- PyTorch + TorchVision
- Ultralytics YOLO
- Anthropic Claude via
ANTHROPIC_API_KEYfor report/chat generation - Deterministic fallback when key is absent or remote call fails
.
├── backend/
│ ├── main.py
│ ├── yolo_tracker.py
│ ├── reporting.py
│ ├── requirements.txt
│ ├── src/agri_nav/
│ │ ├── dto/
│ │ ├── logic/
│ │ ├── mapper/
│ │ ├── service/
│ │ └── viz/
│ └── data/uploads/
├── frontend/
│ ├── src/
│ └── package.json
└── README.md
Supporting docs:
- Backend details: backend/README.md
- Frontend details: frontend/README.md
cd backend
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
PYTHONPATH=src python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000Backend docs:
- Swagger: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
cd frontend
npm install
npm run dev -- --hostDefault local UI URL: http://localhost:5173
ANTHROPIC_API_KEY(optional, enables Claude-backed report/chat)ANTHROPIC_MODEL(optional override)CORS_ORIGINS(optional comma-separated list)
Uploads frame files, creates run_id, starts background tracker processing.
Returns run status, tracker status, and uploaded frame list.
Returns run-scoped final visual payload when ready (final_output.json).
Run-grounded chat endpoint using Claude when configured, fallback otherwise.
Returns run summary report (Claude-backed if available, fallback if not).
Returns live/fixture demo visual data when upload-run output is not used.
- Current tracker processing window is short (first 20 frames), suitable for demo runs, not long missions.
- Runtime dependencies are heavy (Torch/YOLO/OpenCV), so startup and environment setup are non-trivial.
- SGG/APF are deterministic and explainable, but still require broader field validation and calibration.
- Upload pipeline currently assumes image frame inputs, not full sensor fusion.
Planned improvements:
- Longer sequence processing and streaming ingestion.
- Better model/runtime packaging for reproducible deployment.
- Expanded evaluation on diverse weather/lighting/terrain conditions.
- Richer operator UX for uncertainty and intervention planning.
Built for HackHPI 2026 as a practical safety-intelligence layer for agricultural autonomy: combining interpretable perception outputs, deterministic decision logic, and operator-facing visualization/reporting.