A professional web-based application for viewing, editing, and managing metadata of camera trap images. Designed for wildlife researchers, conservationists, and field biologists who need to efficiently organize and annotate large collections of camera trap photos with AI-powered species identification.
The Camera Trap Metadata Editor streamlines the camera trap image analysis workflow by providing:
- π€ AI-Powered Species Identification: Advanced computer vision using OpenAI's GPT-4 Vision API to automatically identify wildlife species from image selections
- π Intelligent Footer Data Extraction: Automatically extracts temperature, camera ID, and timestamp data from camera trap image footers
- ποΈ Comprehensive Metadata Management: Edit, add, and organize custom metadata fields specific to wildlife research
- πΎ Dual Storage System: Saves metadata to both human-readable sidecar files and embedded EXIF data
- π Geographic Customization: Fully customizable AI prompts tailored to specific geographic regions and local wildlife
- π± Modern Web Interface: Responsive design that works seamlessly across desktop, tablet, and mobile devices
- Wildlife researchers and field biologists
- Conservation organizations
- Camera trap survey projects
- Biodiversity monitoring programs
- Ecological research institutions
- Wildlife photography projects
- Click-and-drag selection: Select specific areas of images for targeted species identification
- Geographic awareness: AI prompts customized for your specific location and local wildlife
- Confidence scoring: Receive confidence levels for species identifications
- Scientific naming: Get both common and scientific names for identified species
- Behavioral analysis: AI describes animal behavior and posture
- Pre-configured fields: Species, Count, Behavior, Weather, Location, Camera_ID, Researcher, Notes
- Custom field creation: Add unlimited project-specific metadata fields
- EXIF integration: View and edit existing camera EXIF data
- Batch processing: Efficient navigation through large image collections
- Data validation: Ensures metadata integrity and consistency
- High-quality display: Optimized image rendering with zoom and pan capabilities
- Keyboard navigation: Arrow keys, Home, End for rapid image browsing
- Image information: File size, dimensions, and technical details
- Responsive design: Works perfectly on any screen size
- Sidecar files: Human-readable
[filename]_metadata.txtfiles alongside images - EXIF embedding: Metadata written directly to JPEG/TIFF image files
- Backup protection: Automatic backup creation before modifying images
- Cross-platform compatibility: Works on Windows, macOS, and Linux
- Python 3.8+ (recommended: Python 3.9 or higher)
- OpenAI API Key (for AI species identification)
- Modern web browser (Chrome, Firefox, Safari, Edge)
git clone https://github.com/anderdad/camtrap-metadata.git
cd camtrap-metadata.# Create virtual environment
python -m venv camera_trap_env
# Activate virtual environment
# On macOS/Linux:
source camera_trap_env/bin/activate
# On Windows:
camera_trap_env\Scripts\activatepip install -r requirements.txt- Copy the example environment file:
cp .env.example .env- Edit the
.envfile with your configuration:
# Required: OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Optional: Camera Trap Location Configuration
CAMERA_TRAP_LOCATION=Namibia, Africa
CAMERA_TRAP_REGION=Southern Africa| Variable | Required | Description | Example |
|---|---|---|---|
OPENAI_API_KEY |
Yes | Your OpenAI API key for species identification | sk-proj-abc123... |
CAMERA_TRAP_LOCATION |
No | Specific location of your camera traps | Yellowstone National Park, USA |
CAMERA_TRAP_REGION |
No | Broader geographic region | North America |
- Visit OpenAI Platform
- Sign up or log in to your account
- Navigate to "API Keys" section
- Click "Create new secret key"
- Copy the key and paste it into your
.envfile
Important: Keep your API key secure and never commit it to version control.
The AI species identification system is fully customizable for different geographic regions. This ensures accurate species identification based on local wildlife.
Edit ai_prompt_config.py and customize the AI_PROMPT_TEMPLATE for your location:
AI_PROMPT_TEMPLATE = """Analyze this camera trap image crop from {location_upper} and identify any animals present.
IMPORTANT CONTEXT: This image is from a camera trap in {location}, so focus specifically on wildlife species native to or commonly found in {region} ecosystems including:
LARGE MAMMALS: White-tailed deer, mule deer, elk, moose, black bear, brown bear, mountain lion, bobcat, coyote, gray wolf, pronghorn
SMALLER MAMMALS: Raccoon, opossum, skunk, porcupine, beaver, river otter, red fox, gray fox, various squirrel species, chipmunks
BIRDS: Wild turkey, various ground-dwelling species that might trigger camera traps
Please provide:
1. Species name (common and scientific name)
2. Confidence level (High/Medium/Low) - be more confident if it matches known {region} species
3. Count of individuals visible
4. Brief description including behavior/posture
5. Habitat context if visible (forest, grassland, wetland, etc.)
Format your response as JSON with keys: species, scientific_name, confidence, count, description, habitat"""AI_PROMPT_TEMPLATE = """Analyze this camera trap image crop from {location_upper} and identify any animals present.
IMPORTANT CONTEXT: This image is from a camera trap in {location}, so focus specifically on wildlife species native to or commonly found in {region} ecosystems including:
LARGE MAMMALS: Red deer, roe deer, wild boar, brown bear, Eurasian lynx, gray wolf, European pine marten
SMALLER MAMMALS: European badger, red fox, European hare, various mustelid species, hedgehog, squirrel species
BIRDS: Various ground-dwelling species including game birds
Please provide species identification with confidence level and count for {region} wildlife."""- Species Lists: Replace with animals specific to your study area
- Habitat Types: Adjust habitat descriptions (desert, rainforest, tundra, etc.)
- Confidence Criteria: Modify how the AI assesses identification confidence
- Behavioral Categories: Add region-specific behaviors to look for
- Seasonal Considerations: Include seasonal migration or hibernation patterns
The prompt system uses these variables from your .env file:
{location}: Your specific camera trap location{location_upper}: Location in uppercase for emphasis{region}: Broader geographic region
Example .env configuration:
CAMERA_TRAP_LOCATION=Kruger National Park, South Africa
CAMERA_TRAP_REGION=Southern African SavannaResults in prompt text:
"This image is from a camera trap in Kruger National Park, South Africa, so focus specifically on wildlife species native to or commonly found in Southern African Savanna ecosystems..."
python app.pyOpen your browser and navigate to: http://localhost:5001
- Click "Browse Folders" to open the folder navigator
- Navigate to your camera trap images directory
- Select the folder containing your images
- Click "Load Images" to begin
- Mouse: Use First, Previous, Next, Last buttons
- Keyboard: Arrow keys (β/β), Home, End
- Image counter: Shows current position (e.g., "Image 15 of 247")
- Click the "Identify Species" button (purple button)
- Click and drag on the image to select the animal area
- Wait for AI analysis (usually 3-5 seconds)
- Review the populated metadata fields:
- Species (common name)
- Scientific_Name
- AI_Confidence
- Count
- Behavior description
For camera traps with embedded text footers:
- The system automatically extracts footer data when loading images
- Look for populated fields:
Temperature_C,Temperature_F,Camera_ID,DateTime - Data is extracted from the bottom portion of images using AI vision
- Edit existing fields: Click in any metadata field to modify
- Add custom fields: Click "Add Custom Field" button
- Delete fields: Use the red Γ button next to custom fields
- Save changes: Click "Save Changes" to persist metadata
Metadata is automatically saved in two formats:
- Sidecar files:
[imagename]_metadata.txt(human-readable) - EXIF data: Embedded in JPEG/TIFF files (machine-readable)
camera-trap-metadata-editor/
βββ app.py # Main Flask application
βββ ai_prompt_config.py # AI prompt customization
βββ create_favicon.py # Favicon generation script
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ .env # Your environment configuration (create this)
βββ static/ # Static web assets
β βββ css/style.css # Application styling
β βββ js/app.js # Frontend JavaScript
β βββ favicon.ico # Website favicon
β βββ [various favicon files]
βββ templates/
β βββ index.html # Main web interface
βββ README.md # This file
| Key | Action |
|---|---|
β |
Previous image |
β |
Next image |
Home |
First image |
End |
Last image |
Escape |
Cancel species identification mode |
Enter |
Load folder (when in folder input) |
- Backend: Flask (Python web framework)
- Frontend: Vanilla JavaScript with responsive CSS
- AI Integration: OpenAI GPT-4 Vision API
- Image Processing: Pillow (PIL), OpenCV, NumPy
- Metadata Handling: piexif for EXIF data manipulation
- JPEG/JPG: Full EXIF support + sidecar files
- TIFF/TIF: Full EXIF support + sidecar files
- PNG: Sidecar files only (PNG doesn't support EXIF)
- Sidecar Files: Plain text format for maximum compatibility
- EXIF Metadata: Industry-standard embedded metadata
- Backup System: Automatic
.backupfile creation before modifications - Cross-Platform: Works on Windows, macOS, Linux
- Local Processing: All image processing happens locally
- API Efficiency: Only sends cropped image sections to OpenAI
- Memory Management: Optimized for large image collections
- Responsive Design: Efficient loading and navigation
AI Species Identification Not Working
- Verify OpenAI API key is correctly set in
.env - Check internet connection
- Ensure you have API credits available
- Try selecting a clearer area of the animal
Footer Extraction Failing
- Ensure image has a dark footer with white text
- Check that text is clearly visible and high contrast
- Try images with standard camera trap footer formats
Images Not Loading
- Verify folder path is correct and accessible
- Check that folder contains supported image formats
- Ensure proper file permissions
Metadata Not Saving
- Check write permissions in the image directory
- Verify disk space availability
- For EXIF writing, ensure images are JPEG or TIFF format
- Check the console output when running
python app.py - Verify environment variables are correctly set
- Test with sample images to isolate issues
- Check file permissions in your image directories
We welcome contributions! Please feel free to:
- Report bugs and issues
- Suggest new features
- Submit pull requests
- Improve documentation
- Share your AI prompt configurations for different regions
- OpenAI for providing the GPT-4 Vision API
- Camera trap research community for feedback and testing
- Open source contributors who made this project possible
Built for wildlife research and conservation π¦ππ¦
Making camera trap data management efficient, accurate, and accessible for researchers worldwide.
Copyright (c) 2025 Anderdad
Licensed under the MIT License. See LICENSE file for details.