motion-detection / export_and_quantize.sh
vagheshpatel's picture
Sync motion-detection from metro-analytics-catalog
fb1ba43 verified
Raw
History Blame Contribute Delete
1.71 kB
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# Copyright (C) Intel Corporation
#
# Download the sample video for the motion-detection use case.
# This use case uses classical computer vision (OpenCV background
# subtraction) and the GStreamer decode stack in DLStreamer; no model
# export or quantization is required.
# Usage: ./export_and_quantize.sh
set -euo pipefail
SAMPLE_VIDEO_URL="https://github.com/intel-iot-devkit/sample-videos/raw/master/people-detection.mp4"
# Ask for approval before downloading models and sample files
echo ""
echo "This script will download:"
echo " - Model weights and/or sample files"
echo ""
read -p "Continue with downloads? (yes/no): " APPROVAL
if [[ "${APPROVAL}" != "yes" ]]; then
echo "Download cancelled by user."
exit 0
fi
# Ping the HuggingFace repo to register a tracked download of config.json.
# This is best-effort: a failure (offline, or before the repo is published)
# must not stop the export.
echo "--- Registering HuggingFace download (tracking ping) ---"
HF_REPO_ID="Intel/motion-detection"
HF_CONFIG_URL="https://huggingface.co/${HF_REPO_ID}/resolve/main/config.json"
if curl -fsSL -o /dev/null "${HF_CONFIG_URL}"; then
echo "Registered HuggingFace download for ${HF_REPO_ID}"
else
echo "WARNING: HuggingFace tracking ping failed (offline?); continuing." >&2
fi
echo ""
echo "--- Downloading sample test video ---"
if [[ ! -f test_video.mp4 ]]; then
wget -q -O test_video.mp4 "${SAMPLE_VIDEO_URL}"
echo "Downloaded: test_video.mp4"
else
echo "Already present: test_video.mp4"
fi
echo "--- Done ---"
echo "Sample : $(pwd)/test_video.mp4"
echo "Note : This use case requires no model; run the README samples directly."