Skip to content

Commit c907e10

Browse files
authored
Frigate: check OpenVino model files exist before configuring detector and use curl_with_retry instead of default wget (#13019)
* fix(frigate): check OpenVino model files exist before configuring detector When the OpenVino model build fails (e.g. TensorFlow import error), the model files are not created but the config still references them if the CPU supports avx/sse4_2, causing Frigate to crash on start with FileNotFoundError. Now also checks that ssdlite_mobilenet_v2.xml and coco_91cl_bkgr.txt actually exist before configuring the OpenVino detector, falling back to CPU model otherwise. Fixes #12808 * fix(frigate): use curl_with_retry for all downloads Replace all wget and bare curl calls with curl_with_retry from tools.func for robust downloads with retry logic, exponential backoff, and DNS pre-checks. This prevents install failures from transient network issues during model and dependency downloads.
1 parent 804c462 commit c907e10

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

install/frigate-install.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ ldconfig
146146
msg_ok "Built libUSB"
147147

148148
msg_info "Bootstrapping pip"
149-
wget -q https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py
149+
curl_with_retry "https://bootstrap.pypa.io/get-pip.py" "/tmp/get-pip.py"
150150
sed -i 's/args.append("setuptools")/args.append("setuptools==77.0.3")/' /tmp/get-pip.py
151151
$STD python3 /tmp/get-pip.py "pip"
152152
rm -f /tmp/get-pip.py
@@ -169,13 +169,13 @@ NODE_VERSION="20" setup_nodejs
169169

170170
msg_info "Downloading Inference Models"
171171
mkdir -p /models /openvino-model
172-
wget -q -O /edgetpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite
173-
wget -q -O /models/cpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite
172+
curl_with_retry "https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite" "/edgetpu_model.tflite"
173+
curl_with_retry "https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite" "/models/cpu_model.tflite"
174174
cp /opt/frigate/labelmap.txt /labelmap.txt
175175
msg_ok "Downloaded Inference Models"
176176

177177
msg_info "Downloading Audio Model"
178-
wget -q -O /tmp/yamnet.tar.gz https://www.kaggle.com/api/v1/models/google/yamnet/tfLite/classification-tflite/1/download
178+
curl_with_retry "https://www.kaggle.com/api/v1/models/google/yamnet/tfLite/classification-tflite/1/download" "/tmp/yamnet.tar.gz"
179179
$STD tar xzf /tmp/yamnet.tar.gz -C /
180180
mv /1.tflite /cpu_audio_model.tflite
181181
cp /opt/frigate/audio-labelmap.txt /audio-labelmap.txt
@@ -205,7 +205,7 @@ msg_ok "Installed OpenVino"
205205

206206
msg_info "Building OpenVino Model"
207207
cd /models
208-
wget -q http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz
208+
curl_with_retry "http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz" "ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz"
209209
$STD tar -zxf ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz --no-same-owner
210210
if python3 /opt/frigate/docker/main/build_ov_model.py &>/dev/null; then
211211
mkdir -p /openvino-model
@@ -219,7 +219,7 @@ if python3 /opt/frigate/docker/main/build_ov_model.py &>/dev/null; then
219219
if [[ -n "$OV_LABELS" ]]; then
220220
ln -sf "$OV_LABELS" /openvino-model/coco_91cl_bkgr.txt
221221
else
222-
wget -q "https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/data/dataset_classes/coco_91cl_bkgr.txt" -O /openvino-model/coco_91cl_bkgr.txt
222+
curl_with_retry "https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/data/dataset_classes/coco_91cl_bkgr.txt" "/openvino-model/coco_91cl_bkgr.txt"
223223
fi
224224
fi
225225
sed -i 's/truck/car/g' /openvino-model/coco_91cl_bkgr.txt
@@ -246,7 +246,7 @@ msg_info "Configuring Frigate"
246246
mkdir -p /config /media/frigate
247247
cp -r /opt/frigate/config/. /config
248248

249-
curl -fsSL "https://github.com/intel-iot-devkit/sample-videos/raw/master/person-bicycle-car-detection.mp4" -o "/media/frigate/person-bicycle-car-detection.mp4"
249+
curl_with_retry "https://github.com/intel-iot-devkit/sample-videos/raw/master/person-bicycle-car-detection.mp4" "/media/frigate/person-bicycle-car-detection.mp4"
250250

251251
echo "tmpfs /tmp/cache tmpfs defaults 0 0" >>/etc/fstab
252252

@@ -289,7 +289,7 @@ detect:
289289
enabled: false
290290
EOF
291291

292-
if grep -q -o -m1 -E 'avx[^ ]*|sse4_2' /proc/cpuinfo; then
292+
if grep -q -o -m1 -E 'avx[^ ]*|sse4_2' /proc/cpuinfo && [[ -f /openvino-model/ssdlite_mobilenet_v2.xml ]] && [[ -f /openvino-model/coco_91cl_bkgr.txt ]]; then
293293
cat <<EOF >>/config/config.yml
294294
ffmpeg:
295295
hwaccel_args: auto

0 commit comments

Comments
 (0)