Live Demo: https://jatacid.github.io/dogbarkingdetector Domain: https://dogbarkingdetector.com/
A browser-based, offline dog barking detection tool that uses machine learning to identify and log dog vocalizations in real-time. Built with TensorFlow.js and the YAMNet audio classification model.
This project is licensed under the MIT License - see the LICENSE file for details.
All application files are located in the /docs folder:
docs/
├── app.js # Main application logic
├── audio-processor.js # AudioWorklet for real-time audio capture
├── index.html # Main HTML interface
├── style.css # CSS styling
├── favicon.png # App icon
├── privacy-policy.html # Privacy policy page
├── robots.txt # SEO configuration
├── sitemap.xml # SEO sitemap
├── libs/ # Third-party libraries
│ └── yamnet.js # YAMNet wrapper
└── model/ # YAMNet machine learning model
├── model.json # Model configuration
├── group1-shard1of4.bin # Model weights (sharded)
├── group1-shard2of4.bin
├── group1-shard3of4.bin
├── group1-shard4of4.bin
├── assets/
│ └── yamnet_class_map.csv # Class labels
└── variables/
├── variables.data-00000-of-00001
└── variables.index
- Audio Capture: Uses Web Audio API to access microphone input
- File Upload: Allows uploading audio or video files for offline analysis
- Real-time Processing: AudioWorklet captures raw audio data in real-time
- Machine Learning: YAMNet model classifies 1-second audio chunks into 521 sound categories
- Dog Detection: Specifically monitors for dog vocalization classes such as Dog, Bark, YIp, etc
- Logging: Records detections with timestamps and audio playback capability
- Visualization: Real-time detection confidence scores
- Model: YAMNet (converted to TensorFlow.js format)
- Sample Rate: 16kHz (resampled from browser's native rate)
- Chunk Size: 1 second of audio per inference
- Classes: 521 total, focused on dog sounds (classes 70-75)
- Privacy: All processing happens client-side, no audio data (from microphone or uploaded files) leaves the browser
- Dependencies: TensorFlow.js (loaded from CDN), YAMNet wrapper library
This tool is intended for personal use only. Users are responsible for complying with all applicable local laws and regulations regarding audio recording and privacy.
The application requires modern browsers with Web Audio API support and sufficient hardware capabilities for real-time machine learning inference. Performance may vary on lower-end devices.
- Capture 1-second audio chunks
- Resample to 16kHz if necessary
- Run inference through YAMNet model
- Check scores for dog-related classes above sensitivity threshold
- Prioritize specific vocalizations (bark, yip, howl) over generic
- Log detection with timestamp and audio data
- Debounce detections to prevent spam (4-second minimum interval)
Requires modern browser with:
- Web Audio API support
- AudioWorklet support
- getUserMedia for microphone access
- TensorFlow.js compatible browser
Tested on Chrome, Firefox, Safari, and Edge.