0% found this document useful (0 votes)
2 views2 pages

Object Detection Project Interview

This document describes a Python program for real-time object detection using a Raspberry Pi Camera and a MobileNet SSD model, which alerts users via email if a person is detected for over 10 seconds. It covers the program's structure, including library imports, camera setup, email configuration, and the detection process. Additionally, it includes a series of interview questions and answers related to the implementation and functionality of the code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Object Detection Project Interview

This document describes a Python program for real-time object detection using a Raspberry Pi Camera and a MobileNet SSD model, which alerts users via email if a person is detected for over 10 seconds. It covers the program's structure, including library imports, camera setup, email configuration, and the detection process. Additionally, it includes a series of interview questions and answers related to the implementation and functionality of the code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Working of the Code This Python program is designed to perform real-time object detection using a

Raspberry Pi Camera (Picamera2) and a pre-trained MobileNet SSD deep learning model. It
specifically monitors for the presence of a person and sends an email alert if a person is
continuously detected for more than 10 seconds. 1. Imports and Model Loading: - Libraries such
as OpenCV, NumPy, smtplib, and Picamera2 are imported. - The MobileNet SSD deep learning
model (Caffe format) is loaded. 2. Class Labels: - A predefined list of object categories (COCO
dataset classes) is used. 3. Camera Initialization: - The PiCamera2 is initialized with resolution
640x480 and RGB format. 4. Email Configuration: - Email sender, receiver, and app password
are configured for Gmail SMTP. 5. Main Loop: - Captures frames from the camera. - Preprocesses
the frame into a blob suitable for MobileNet SSD. - Runs object detection and extracts detected
classes with confidence > 0.5. - Draws bounding boxes and labels on the frame. 6. Persistent
Detection: - If a "person" is detected: - Starts a timer. - If the person remains detected for at least
10 seconds, it captures a snapshot and sends an email with the image attached. - If no person is
detected, the timer resets. 7. Display and Exit: - The detection results are displayed in a window. -
Pressing "q" exits the program safely, closing camera and windows. This code is useful for building
smart surveillance systems using Raspberry Pi.

Interview Questions with Answers


Q1. What is MobileNet SSD and why is it used here?
MobileNet SSD (Single Shot MultiBox Detector) is a deep learning model optimized for real-time
object detection on resource-constrained devices like Raspberry Pi. It balances accuracy and
speed, making it suitable for surveillance applications.

Q2. Why is blobFromImage() used in OpenCV?


The function [Link]() converts an image into a 4D blob (batch of images) that is
preprocessed (resized, normalized, mean-subtracted) before feeding into the deep learning model.

Q3. What is the role of 'confidence' in object detection?


Confidence indicates how sure the model is about a detection. A threshold (0.5 in this case)
ensures only reliable detections are considered.

Q4. How is persistent detection implemented in this project?


By starting a timer when a person is detected and checking if the detection lasts for at least 10
seconds before triggering an alert.

Q5. Why is smtplib used in this project?


smtplib is used to send emails via Gmail SMTP. It enables the system to send an alert with an
attached snapshot when suspicious activity is detected.

Q6. What is the purpose of [Link]() and [Link]()?


[Link]() draws a bounding box around detected objects, while [Link]() displays the
object label and confidence score on the video frame.

Q7. Why is Picamera2 used instead of USB camera?


Picamera2 is optimized for Raspberry Pi hardware, providing better integration, low latency, and
direct access to Pi’s camera module.

Q8. What happens if multiple objects are detected in a frame?


The loop checks each detection. In this code, it breaks after detecting the first object with
confidence > 0.5, prioritizing the first detection (like 'person').

Q9. How does the system reset when no person is detected?


If no person is found in the frame, the timer and alert flags are reset, ensuring false alarms are
avoided.

Q10. How can this system be improved?


Possible improvements include: integrating motion detection to reduce false positives, storing
detection logs in a database, using more advanced models (YOLO, EfficientDet), and adding
multi-object tracking.

You might also like