66# LICENSE file in the root directory of this source tree.
77
88set -ex
9+
910# shellcheck source=/dev/null
1011source " $( dirname " ${BASH_SOURCE[0]} " ) /utils.sh"
1112
@@ -50,21 +51,21 @@ PT2E_QUANTIZE="${PT2E_QUANTIZE:-}"
5051# Default CMake Build Type to release mode
5152CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:- Release}
5253
53- if [[ $# -lt 5 ]]; then # Assuming 4 mandatory args
54- echo " Expecting atleast 5 positional arguments"
55- echo " Usage: [...]"
56- fi
5754if [[ -z " ${MODEL_NAME:- } " ]]; then
5855 echo " Missing model name, exiting..."
5956 exit 1
6057fi
6158
62-
6359if [[ -z " ${MODE:- } " ]]; then
6460 echo " Missing mode, choose openvino or xnnpack, exiting..."
6561 exit 1
6662fi
6763
64+ if [[ -z " ${VIDEO_PATH:- } " ]]; then
65+ echo " Missing video path, exiting..."
66+ exit 1
67+ fi
68+
6869if [[ -z " ${PYTHON_EXECUTABLE:- } " ]]; then
6970 PYTHON_EXECUTABLE=python3
7071fi
@@ -75,21 +76,13 @@ if [[ "${MODE}" =~ .*openvino.* ]]; then
7576 OPENVINO=ON
7677 TARGET_LIBS=" $TARGET_LIBS openvino_backend "
7778
78- git clone https://github.com/openvinotoolkit/openvino.git
79- cd openvino && git b16b776ac119dafda51f69a80f1e6b7376d02c3b
80- git submodule update --init --recursive
81- sudo ./install_build_dependencies.sh
82- mkdir build && cd build
83- cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
84- make -j$( nproc)
85-
86- cd ..
87- cmake --install build --prefix dist
88-
89- source dist/setupvars.sh
90- cd ../backends/openvino
91- pip install -r requirements.txt
92- cd ../../
79+ # Install specific OpenVINO runtime from pip.
80+ $PYTHON_EXECUTABLE -m pip install --pre openvino==2026.1.0.dev20260131 --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
81+ $PYTHON_EXECUTABLE -m pip install -r backends/openvino/requirements.txt
82+
83+ # Set OPENVINO_LIB_PATH so the C++ demo runner can also find libopenvino_c.so.
84+ OPENVINO_LIB_PATH=$( $PYTHON_EXECUTABLE -c " import openvino, os, glob; print(sorted(glob.glob(os.path.join(os.path.dirname(openvino.__file__), 'libs', 'libopenvino_c.so*')))[-1])" )
85+ export OPENVINO_LIB_PATH
9386else
9487 OPENVINO=OFF
9588fi
10396
10497which " ${PYTHON_EXECUTABLE} "
10598
99+ TORCH_URL=https://download.pytorch.org/whl/cpu
106100
107- DIR=" examples/models/yolo12 "
108- $PYTHON_EXECUTABLE -m pip install -r ${DIR} /requirements.txt
101+ DIR=" examples/models/yolo26 "
102+ $PYTHON_EXECUTABLE -m pip install --upgrade-strategy only-if-needed --extra-index-url " $TORCH_URL " - r ${DIR} /requirements.txt
109103
110104cmake_install_executorch_libraries () {
111105 rm -rf cmake-out
@@ -142,11 +136,11 @@ cmake_install_executorch_libraries() {
142136
143137 echo $TARGET_LIBS
144138 export CMAKE_BUILD_ARGS=" --target $TARGET_LIBS "
145- pip install . --no-build-isolation
139+ $PYTHON_EXECUTABLE -m pip install . --no-build-isolation
146140}
147141
148142cmake_build_demo () {
149- echo " Building yolo12 runner"
143+ echo " Building yolo26 runner"
150144 retry cmake \
151145 -DCMAKE_BUILD_TYPE=" $CMAKE_BUILD_TYPE " \
152146 -DUSE_OPENVINO_BACKEND=" $OPENVINO " \
@@ -174,24 +168,29 @@ prepare_artifacts_upload() {
174168
175169
176170# Export model.
177- EXPORTED_MODEL_NAME=" ${MODEL_NAME} _fp32_${MODE} .pte"
178- echo " Exporting ${EXPORTED_MODEL_NAME} "
179171EXPORT_ARGS=" --model_name=${MODEL_NAME} --backend=${MODE} "
172+ if [[ -n " ${PT2E_QUANTIZE} " ]]; then
173+ EXPORTED_MODEL_NAME=" ${MODEL_NAME} _int8_${MODE} .pte"
174+ EXPORT_ARGS=" ${EXPORT_ARGS} --quantize --video_path=${VIDEO_PATH} "
175+ else
176+ EXPORTED_MODEL_NAME=" ${MODEL_NAME} _fp32_${MODE} .pte"
177+ fi
178+ echo " Exporting ${EXPORTED_MODEL_NAME} "
180179
181180# Add dynamically linked library location
182181cmake_install_executorch_libraries
183182
184- $PYTHON_EXECUTABLE -m examples.models.yolo12 .export_and_validate ${EXPORT_ARGS}
183+ $PYTHON_EXECUTABLE -m examples.models.yolo26 .export_and_validate ${EXPORT_ARGS}
185184
186185
187186RUNTIME_ARGS=" --model_path=${EXPORTED_MODEL_NAME} --input_path=${VIDEO_PATH} "
188187# Check build tool.
189188cmake_build_demo
190- # Run yolo12 runner
189+ # Run yolo26 runner
191190NOW=$( date +" %H:%M:%S" )
192- echo " Starting to run yolo12 runner at ${NOW} "
191+ echo " Starting to run yolo26 runner at ${NOW} "
193192# shellcheck source=/dev/null
194- cmake-out/examples/models/yolo12/Yolo12DetectionDemo ${RUNTIME_ARGS} > result.txt
193+ cmake-out/examples/models/yolo26/Yolo26DetectionDemo ${RUNTIME_ARGS} > result.txt
195194NOW=$( date +" %H:%M:%S" )
196195echo " Finished at ${NOW} "
197196
0 commit comments