AI-Powered Wildlife Camera Trap Analysis for Conservation Research
Automatically detect, classify, and organize thousands of camera trap images. Save time, protect wildlife, and combat poaching with intelligent image analysis.
Wildlife researchers and conservationists face the monumental challenge of processing thousands of camera trap images manually. Traditional methods are:
- Time-intensive: Manual review of thousands of images takes weeks
- Error-prone: Human fatigue leads to missed detections and misclassifications
- Resource-heavy: Requires large teams of trained personnel
- Inefficient: No systematic way to organize and analyze wildlife data
TrapSense AI revolutionizes this process by providing an intelligent, automated solution that processes camera trap images in real-time, delivering accurate wildlife detection and classification results instantly.
TrapSense AI is a comprehensive platform that combines cutting-edge computer vision with modern web technologies to deliver:
- Smart Detection: AI automatically identifies animals, humans, and vehicles in camera trap images
- Instant Classification: Segregate valid wildlife photos from empty frames and false triggers
- Real-time Processing: Process thousands of images in minutes, not days
- Interactive Dashboard: Visualize wildlife distribution patterns with heatmaps and statistics
- Batch Processing: Upload entire folders while preserving organizational structure
- Export Capabilities: Download filtered results and metadata for further analysis
- Two-Stage ML Pipeline: Classification (blank/non-blank) followed by object detection
- Geographic Visualization: Interactive heatmaps showing wildlife distribution patterns
- User Authentication: Secure access with Clerk authentication
- Cloud Storage: Scalable S3 integration for image storage
- Real-time Updates: Live processing status and prediction results
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend │ │ ML Pipeline │
│ (React) │◄──►│ (FastAPI) │◄──►│ (PyTorch) │
│ │ │ │ │ │
│ • Dashboard │ │ • REST API │ │ • YOLOv8 │
│ • Upload UI │ │ • Auth (Clerk) │ │ • Classification│
│ • Heatmaps │ │ • Database │ │ • Detection │
│ • Statistics │ │ • S3 Storage │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Cloud Storage │ │ Database │ │ Background │
│ (AWS S3) │ │ (SQLite) │ │ Processing │
│ │ │ │ │ │
│ • Image Storage │ │ • User Data │ │ • Async Tasks │
│ • Presigned URLs│ │ • Media Records │ │ • ML Inference │
│ • File Metadata │ │ • Predictions │ │ • DB Updates │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- Upload: Users upload images via React frontend
- Storage: Images stored in AWS S3 with presigned URLs
- Database: Media records created in SQLite database
- Processing: Background tasks trigger ML pipeline
- Classification: YOLOv8 model classifies images as blank/non-blank
- Detection: Non-blank images processed through object detection
- Results: Predictions stored in database and displayed in dashboard
- Visualization: Heatmaps and statistics generated from processed data
- React 19.1+ - Modern UI framework with hooks and context
- Vite - Fast build tool and development server
- Tailwind CSS - Utility-first CSS framework for responsive design
- Framer Motion - Smooth animations and transitions
- React Router - Client-side routing
- Leaflet - Interactive maps for heatmap visualization
- Clerk - Authentication and user management
- Axios - HTTP client for API communication
- FastAPI - High-performance Python web framework
- SQLAlchemy - Python SQL toolkit and ORM
- SQLite - Lightweight database for development
- Pydantic - Data validation using Python type annotations
- Uvicorn - ASGI server for FastAPI
- Clerk Backend API - Server-side authentication
- Boto3 - AWS SDK for S3 integration
- PyTorch - Deep learning framework
- Ultralytics YOLOv8 - State-of-the-art object detection
- PIL (Pillow) - Python Imaging Library
- NumPy - Numerical computing
- Torchvision - Computer vision utilities
- AWS S3 - Cloud storage for images
- Docker - Containerization (optional)
- Git - Version control
IIIT_M/
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── common/ # Shared components
│ │ │ └── layout/ # Layout components
│ │ ├── pages/ # Page components
│ │ ├── auth/ # Authentication components
│ │ ├── css/ # Stylesheets
│ │ └── utils/ # Utility functions
│ ├── public/ # Static assets
│ └── package.json # Dependencies
├── backend/ # FastAPI backend
│ ├── src/
│ │ ├── api/ # API routes
│ │ ├── database/ # Database models and operations
│ │ ├── services/ # Business logic
│ │ │ ├── ml.py # ML pipeline
│ │ │ ├── s3.py # S3 operations
│ │ │ └── worker.py # Background processing
│ │ ├── routes/ # API endpoints
│ │ └── utils/ # Utility functions
│ └── pyproject.toml # Python dependencies
├── ml/ # Machine learning models
│ ├── classifier/ # Classification model
│ └── detection/ # Object detection model
└── README.md # This file
- Python 3.10+
- Node.js 18+
- AWS S3 bucket (for production)
- Clerk account (for authentication)
-
Clone the repository
git clone <repository-url> cd IIIT_M
-
Backend Setup
cd backend pip install -r requirements.txt # Or using uv (recommended) uv sync
-
Frontend Setup
cd frontend npm install -
Environment Configuration
# Backend .env CLERK_SECRET_KEY=your_clerk_secret_key JWT_SECRET_KEY=your_jwt_secret AWS_ACCESS_KEY_ID=your_aws_access_key AWS_SECRET_ACCESS_KEY=your_aws_secret_key AWS_BUCKET_NAME=your_s3_bucket AWS_REGION=your_aws_region # Frontend .env VITE_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key VITE_API_BASE_URL=http://localhost:8000/api
-
Start the Backend
cd backend uvicorn src.app:app --reload --host 0.0.0.0 --port 8000 -
Start the Frontend
cd frontend npm run dev -
Access the Application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
POST /api/users- Create new userGET /api/users/me- Get current user
POST /api/media- Upload single imagePOST /api/media/batch- Upload multiple imagesGET /api/media- Get user's mediaGET /api/media/{id}- Get specific mediaGET /api/media/heatmap- Get coordinates for heatmap
GET /api/predictions/{id}- Get ML predictionsPOST /api/predictions/process/{id}- Trigger processing
GET /api/media/export/csv- Export as CSVGET /api/media/export/zip- Export as ZIPGET /api/media/export/summary- Get export statistics
-
Classification Stage
- Input: Raw camera trap image
- Model: Custom YOLOv8 classification model
- Output: "blank" or "non-blank" with confidence score
- Purpose: Filter out empty frames and false triggers
-
Detection Stage (for non-blank images)
- Input: Classified non-blank image
- Model: YOLOv8 object detection model
- Output: Bounding boxes, species identification, confidence scores
- Purpose: Identify and classify wildlife species
- Framework: PyTorch with Ultralytics YOLOv8
- Input Size: 224x224 pixels (classification), variable (detection)
- Preprocessing: Image normalization, resizing, tensor conversion
- Output: JSON format with bounding boxes, classes, and confidence scores
- Interactive map showing wildlife distribution patterns
- Geographic visualization of camera trap locations
- Heat intensity based on detection frequency
- Focused on Serengeti ecosystem for demonstration
- Animal Count: Total detections by species
- Non-blank Statistics: Processing metrics and success rates
- Export Capabilities: Download filtered results and metadata
- Real-time Updates: Live processing status and results
- Single File Upload: Individual image processing
- Batch Upload: Multiple images with progress tracking
- Folder Upload: Preserve organizational structure
- Preview System: Full-screen image preview with predictions
- Clerk Integration: Secure user authentication and management
- JWT Tokens: Stateless authentication for API access
- User Isolation: Data segregation by authenticated users
- Presigned URLs: Secure S3 upload without exposing credentials
- CORS Protection: Cross-origin request security
- Database: Migrate from SQLite to PostgreSQL for production
- Storage: AWS S3 for scalable image storage
- Authentication: Clerk for production-ready auth
- Monitoring: Add logging and error tracking
- Scaling: Consider containerization with Docker
# Production environment variables
DATABASE_URL=postgresql://user:pass@host:port/db
AWS_BUCKET_NAME=production-bucket
CLERK_SECRET_KEY=production_secret_keyWe welcome contributions to improve TrapSense AI! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Ultralytics for the YOLOv8 framework
- Clerk for authentication services
- AWS for cloud storage infrastructure
- React and FastAPI communities for excellent documentation
- Wildlife Conservation organizations for inspiration and use cases
Built with ❤️ for Wildlife Conservation
Empowering researchers to protect our planet's biodiversity through intelligent technology