This project demonstrates real-time object detection using a webcam. It uses the SSD MobileNet V2 model pretrained on the COCO dataset to detect objects in the camera stream. When the model detects a specific object (in this case, "people"), it plays a sound.
- Modern web browser supporting
navigator.mediaDevices.getUserMedia()
. - Audio file to play when the object is detected.
- Clone this repository to your local machine.
- Ensure you have an audio file (e.g.,
test.mp3
) in the project directory. - Open
index.html
in your web browser. - Allow access to your webcam when prompted.
- The camera stream will start, and the model will begin detecting objects in real-time.
- If a specified object (e.g., "people") is detected, a sound will be played.
- The project uses the
cocoSsd
object detection model, which is loaded asynchronously usingcocoSsd.load()
. - The webcam stream is obtained using
navigator.mediaDevices.getUserMedia()
. - The video feed from the webcam is drawn onto a canvas element.
- The canvas image data is fed into the object detection model to detect objects in the video frame.
- If a specified object is detected (e.g., "people"), a sound is played.
- Object detections are displayed in real-time on the webpage.
- You can customize the object to be detected by modifying the condition in the
processVideoFrame()
function. - Adjust the volume of the sound played by modifying the
audio.volume
property in theplayDogBarkSound()
function. - Ensure that your audio file is in the correct format (e.g., MP3) and located in the project directory.
- This project utilizes the COCO-SSD model for object detection.
- Audio file sourced from [your_source_here].
[License information here, if applicable.]