Add TFLite object detection to reduce false positives
Motion detection now optionally runs MobileNet V2 SSD (COCO, quantized) on frames that trigger motion, identifying objects like people, cats, and cars. Events without detected objects are suppressed by default. Snapshots include bounding box annotations. New MCP tool vision_get_detections() enables label-based queries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -70,10 +70,16 @@ mkdir -p "${INSTALL_DIR}/ssl"
|
||||
# Copy files
|
||||
cp "${SCRIPT_DIR}/main.py" "${INSTALL_DIR}/"
|
||||
cp "${SCRIPT_DIR}/motion.py" "${INSTALL_DIR}/"
|
||||
cp "${SCRIPT_DIR}/detector.py" "${INSTALL_DIR}/"
|
||||
cp "${SCRIPT_DIR}/requirements.txt" "${INSTALL_DIR}/"
|
||||
cp "${SCRIPT_DIR}/generate_cert.sh" "${INSTALL_DIR}/"
|
||||
cp "${SCRIPT_DIR}/download_model.sh" "${INSTALL_DIR}/"
|
||||
cp "${SCRIPT_DIR}/.env" "${INSTALL_DIR}/"
|
||||
|
||||
# Copy model files
|
||||
mkdir -p "${INSTALL_DIR}/models"
|
||||
cp "${SCRIPT_DIR}/models/coco_labels.txt" "${INSTALL_DIR}/models/"
|
||||
|
||||
# Create virtual environment
|
||||
echo_info "Creating Python virtual environment..."
|
||||
cd "${INSTALL_DIR}"
|
||||
@@ -85,6 +91,19 @@ echo_info "Installing Python dependencies..."
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Install TFLite runtime for object detection
|
||||
echo_info "Installing TFLite runtime for object detection..."
|
||||
pip install tflite-runtime 2>/dev/null || echo_warn "tflite-runtime not available for this platform (object detection will be disabled)"
|
||||
|
||||
# Download object detection model (if not already present)
|
||||
if [ -f "${INSTALL_DIR}/models/ssd_mobilenet_v2_coco_quant_postprocess.tflite" ]; then
|
||||
echo_info "Object detection model already present"
|
||||
else
|
||||
echo_info "Downloading object detection model..."
|
||||
chmod +x "${INSTALL_DIR}/download_model.sh"
|
||||
cd "${INSTALL_DIR}" && ./download_model.sh
|
||||
fi
|
||||
|
||||
# Generate SSL certificates if not present
|
||||
if [ ! -f ssl/cert.pem ]; then
|
||||
echo_info "Generating SSL certificates..."
|
||||
|
||||
Reference in New Issue
Block a user