File size: 1,869 Bytes
d8dbbf1 8b6f265 d8dbbf1 8b6f265 fc5affc 8b6f265 d8dbbf1 fc5affc d8dbbf1 8b6f265 d8dbbf1 8b6f265 d8dbbf1 8b6f265 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# Copyright (C) Intel Corporation
#
# Download the YOLOv8 license plate detector and PaddleOCR PP-OCRv4
# recognizer (both as OpenVINO IR) for use with Intel DLStreamer.
# Usage: ./export_and_quantize.sh [MODELS_DIR]
# Example: ./export_and_quantize.sh ./models
set -euo pipefail
MODELS_DIR="${1:-./models}"
LP_DETECTOR_NAME="yolov8_license_plate_detector"
LP_DETECTOR_URL="https://github.com/open-edge-platform/edge-ai-resources/raw/main/models/license-plate-reader.zip"
mkdir -p "${MODELS_DIR}"
echo "--- Downloading sample test video ---"
SAMPLE_VIDEO_URL="https://github.com/open-edge-platform/edge-ai-resources/raw/main/videos/ParkingVideo.mp4"
if [[ ! -f ParkingVideo.mp4 ]]; then
wget -q -O ParkingVideo.mp4 "${SAMPLE_VIDEO_URL}"
echo "Downloaded: ParkingVideo.mp4"
else
echo "Already present: ParkingVideo.mp4"
fi
echo "--- Downloading ${LP_DETECTOR_NAME} (OpenVINO IR) ---"
LP_DIR="${MODELS_DIR}/${LP_DETECTOR_NAME}"
mkdir -p "${LP_DIR}"
TMP_ZIP="$(mktemp --suffix=.zip)"
trap 'rm -f "${TMP_ZIP}"' EXIT
wget -q -O "${TMP_ZIP}" "${LP_DETECTOR_URL}"
unzip -oq "${TMP_ZIP}" -d "${LP_DIR}"
LP_XML="$(find "${LP_DIR}" -name "*retrained*.xml" -o -name "*license*plate*.xml" | head -n1)"
if [[ -z "${LP_XML}" ]]; then
LP_XML="$(find "${LP_DIR}" -path "*/yolov8n/*.xml" | head -n1)"
fi
if [[ -z "${LP_XML}" ]]; then
echo "Error: license plate detector .xml not found under ${LP_DIR}" >&2
exit 1
fi
echo "Found detector model: ${LP_XML}"
OCR_XML="$(find "${LP_DIR}" -path "*ch_PP-OCRv4_rec_infer*.xml" | head -n1)"
if [[ -z "${OCR_XML}" ]]; then
echo "Error: PaddleOCR PP-OCRv4 .xml not found under ${LP_DIR}" >&2
exit 1
fi
echo "Found OCR model: ${OCR_XML}"
echo "--- Done ---"
echo "Detector : ${LP_XML}"
echo "OCR : ${OCR_XML}"
echo "Sample : $(pwd)/ParkingVideo.mp4"
|