A full-stack wildlife and intrusion detection system built for pond/farm safety. Combines real-time visual detection (YOLO on Raspberry Pi camera), audio classification (YAMNet), Firebase backend, and a Flutter mobile app for remote alerts and control.
┌─────────────────────────────────┐ ┌──────────────────────┐
│ Raspberry Pi 5 (Edge) │ │ Flutter Mobile App │
│ │ │ │
│ ┌─────────────┐ ┌──────────┐ │ │ - Live alerts │
│ │ YOLO Camera │ │ YAMNet │ │◄──────►│ - Detection history │
│ │ Detection │ │ Audio │ │Firebase│ - Arm/disarm │
│ └─────────────┘ └──────────┘ │ │ - Auth (email/ │
│ │ │ │ │ Google) │
│ └──────┬──────┘ │ └──────────────────────┘
│ ▼ │
│ Firebase Firestore │
│ (detections + │
│ commands) │
└─────────────────────────────────┘
Runs on Raspberry Pi 5. Listens for trigger commands from Firebase, then performs:
- Camera detection — YOLO (NCNN format) via Picamera2, detects animals/persons
- Audio classification — YAMNet embeddings → custom Keras classifier, detects animal sounds
Training pipeline for the animal sound classification model:
- Extracts YAMNet embeddings from ESC-50 dataset audio
- Trains a lightweight Dense classifier on top
- Exports
.kerasmodel + label encoder for deployment on RPi
Cross-platform mobile/web app (Android, iOS, Web):
- Firebase Auth (email/password + Google Sign-In)
- Real-time detection alerts via Firebase Cloud Messaging
- Detection history from Firestore
- Remote trigger control (camera / voice mode)
cd rpi-backend
pip install -r requirements.txtSet up Firebase credentials:
# Download your service account key from:
# Firebase Console → Project Settings → Service Accounts → Generate new private key
# Save as firebase_credentials.json (never commit this file)
export FIREBASE_CREDENTIALS=firebase_credentials.json
export YOLO_MODEL_PATH=models/best_ncnn_model
export CLASSIFIER_PATH=models/final_animal_classifier.keras
export ENCODER_PATH=models/label_encoder_classes.npy
python main.pycd audio-classifier
pip install -r requirements.txt
# 1. Download ESC-50 dataset: https://github.com/karolpiczak/ESC-50
# 2. Place audio files in audio/ and esc50.csv in this directory
# 3. Extract and organize audio files
python extracting_audio_files.py
# 4. Train the YAMNet-based classifier
python YAMnet_embeddings.py
# 5. Test real-time classification
python test_voice_classification.pycd flutter-app
flutter pub getConfigure Firebase:
- Create a Firebase project at https://console.firebase.google.com
- Add Android/iOS/Web apps to your project
- Download
google-services.json(Android) andGoogleService-Info.plist(iOS) - Update the web config in
lib/main.dartwith your project credentials - Run:
flutter run- Raspberry Pi 5 (8GB recommended)
- Raspberry Pi Camera Module 3
- USB microphone or I2S microphone
- Stable internet connection for Firebase
| Model | Purpose | Format |
|---|---|---|
| YOLOv8 (custom trained) | Visual animal/person detection | NCNN (RPi optimized) |
| YAMNet + Dense classifier | Animal sound classification | Keras .keras |
Model weights are not included in this repo (too large). Train your own using the scripts in audio-classifier/ or contact for pre-trained weights.
MIT — free to use, modify, and distribute.