This repo is part of my submission of google women techmakers hackhaton.
- The simplified version can be check on this branch.
- I still develop the geospatial maps, currently trying to add some Sentinel image for remote sensing.
- I use Gemini-1.5-flash + Langchain
- Here is how gemmini will analyze the detected violation:
Training yolov8's notebook for violence detection can be found in my kaggle repo.
drone-surveillance-system/
├── frontend/ # react frontend application
│ ├── public/
│ │ └── assets/
│ │ └── drone-icon.svg
│ ├── src/
│ │ ├── main.jsx # application entry point
│ │ ├── App.jsx # root component
│ │ ├── components/
│ │ │ ├── ui/ # shadcn/ui components
│ │ │ │ ├── alert.jsx
│ │ │ │ ├── badge.jsx
│ │ │ │ └── card.jsx
│ │ │ ├── theme-provider.jsx
│ │ │ ├── MapDashboard.jsx
│ │ │ ├── EventsList.jsx
│ │ │ └── EventDetails.jsx
│ │ ├── services/
│ │ │ ├── api.js
│ │ │ └── eventService.js
│ │ ├── hooks/
│ │ │ └── useEvents.js
│ │ ├── utils/
│ │ │ ├── constants.js
│ │ │ └── geoUtils.js
│ │ └── styles/
│ │ └── index.css
│ ├── index.html
│ ├── package.json
│ ├── tailwind.config.js
│ └── vite.config.js
│
├── server/ # fastAPI backend server
│ ├── main.py # server entry point
│ ├── database.py
│ ├── models.py
│ └── api/
│ └── routes/
│ ├── events.py
│ └── analytics.py
│
├── drone/ # drone control system
│ ├── main.py # drone controller
│ ├── video_processor.py # YOLO processing
│ ├── geospatial.py # location processing
│ ├── llm_processor.py # Gemma + Langchain
│ └── data_transmitter.py # data transmission
│
├── models/ # AI Models
│ ├── yolo/
│ │ └── best.pt # YOLO weights
│ └── gemma/ # Gemma model files
│
├── data/ # data storage
│ ├── terrain.tif # terrain data
│ └── land_use.gpkg # land use data
│
├── requirements.txt
└── README.md
clone this repo
# create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
# install Python dependencies
pip install -r requirements.txt
# navigate to frontend directory
cd frontend
# install dependencies
npm install
# install additional required packages
npm install @radix-ui/react-alert @radix-ui/react-badge lucide-react class-variance-authority clsx tailwind-merge tailwindcss-animate
Create a .env
file in the root directory:
# Backend settings
BACKEND_HOST=localhost
BACKEND_PORT=8000
# Drone settings
YOLO_MODEL_PATH=./models/yolo/best.pt
GEMMA_MODEL_PATH=./models/gemma
VIDEO_SOURCE=0 # 0 for webcam, or video file path
# Database settings
DATABASE_URL=postgresql://username:password@host:port/database_name
- Start the Backend Server:
cd server
uvicorn main:app --reload --port 8000
- Start the Frontend Development Server:
cd frontend
npm run dev
- Start the Drone Simulation:
cd drone
python main.py
- The frontend runs on
http://localhost:5173
- Components are in
frontend/src/components
- Use shadcn/ui components from
components/ui
- Styles are managed with Tailwind CSS
- The API runs on
http://localhost:8000
- API documentation at
http://localhost:8000/docs
- Add new routes in
server/api/routes
- Use FastAPI dependency injection for services
- YOLO model processing in
drone/video_processor.py
- Geospatial processing in
drone/geospatial.py
- LLM analysis in
drone/llm_processor.py
- Event transmission in
drone/data_transmitter.py
npm run dev
npm run build
npm run preview
npm run lint
uvicorn main:app --reload
uvicorn main:app --host 0.0.0.0
python -m pytest tests/
python main.py
python main.py --simulate
python main.py --debug
-
Frontend Components:
- Create component in
frontend/src/components
- Add styles using Tailwind classes
- Update API services if needed
- Create component in
-
Backend Endpoints:
- Add route in
server/api/routes
- Update models in
server/models.py
- Add tests in
tests/
- Add route in
-
Drone Features:
- Add processing modules in
drone/
- Update main controller as needed
- Add new data transmission handlers
- Add processing modules in
-
CORS Issues:
- Check frontend API endpoint configuration
- Verify CORS settings in FastAPI
-
Model Loading:
- Ensure model paths are correct
- Check CUDA availability for GPU usage
-
Video Processing:
- Verify camera/video source availability
- Check OpenCV installation
-
Database:
- Ensure proper permissions for SQLite file
- Check database migrations