timeout cmd can throw an input redirection error in background mode.
Replaced default timeout() with custom function delay()
python "%downloader_dir%\downloader.py" --name "%model_name%" --output_dir "%models_path%" --cache_dir "%models_cache%"
echo %model_name% model downloading completed
-timeout 7
+CALL :delay 7
if exist "%ir_dir%" (
echo.
echo Target folder %ir_dir% already exists. Skipping IR generation with Model Optimizer.
echo If you want to convert a model again, remove the entire %ir_dir% folder.
- timeout 7
+ CALL :delay 7
GOTO buildSample
)
echo.
echo ###############^|^| Install Model Optimizer prerequisites ^|^|###############
echo.
-timeout 3
+CALL :delay 3
cd "%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer\install_prerequisites"
call install_prerequisites_caffe.bat
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
echo.
echo ###############^|^| Run Model Optimizer ^|^|###############
echo.
-timeout 3
+CALL :delay 3
::set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
echo python "%downloader_dir%\converter.py" --mo "%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer\mo.py" --name "%model_name%" -d "%models_path%" -o "%irs_path%" --precisions "%TARGET_PRECISION%"
python "%downloader_dir%\converter.py" --mo "%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer\mo.py" --name "%model_name%" -d "%models_path%" -o "%irs_path%" --precisions "%TARGET_PRECISION%"
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
:buildSample
echo.
echo ###############^|^| Generate VS solution for Inference Engine samples using cmake ^|^|###############
echo.
-timeout 3
+CALL :delay 3
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set "PLATFORM=x64"
cd "%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\samples\cpp" && cmake -E make_directory "%SOLUTION_DIR64%" && cd "%SOLUTION_DIR64%" && cmake -G "Visual Studio !MSBUILD_VERSION!" -A %PLATFORM% "%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\samples\cpp"
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
echo.
echo ###############^|^| Build Inference Engine samples using MS Visual Studio (MSBuild.exe) ^|^|###############
echo.
-timeout 3
+CALL :delay 3
echo "!MSBUILD_BIN!" Samples.sln /p:Configuration=Release /t:cpp_samples\benchmark_app /clp:ErrorsOnly /m
"!MSBUILD_BIN!" Samples.sln /p:Configuration=Release /t:cpp_samples\benchmark_app /clp:ErrorsOnly /m
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
:runSample
echo.
echo ###############^|^| Run Inference Engine benchmark app ^|^|###############
echo.
-timeout 3
+CALL :delay 3
copy /Y "%ROOT_DIR%%model_name%.labels" "%ir_dir%"
cd "%SOLUTION_DIR64%\intel64\Release"
echo.
echo ###############^|^| Inference Engine benchmark app completed successfully ^|^|###############
-timeout 10
+CALL :delay 10
cd "%ROOT_DIR%"
goto :eof
:errorHandling
echo Error
cd "%ROOT_DIR%"
+
+:delay
+timeout %~1 2> nul
+EXIT /B 0
echo.
echo ###############^|^| Generate VS solution for Inference Engine demos using cmake ^|^|###############
echo.
-timeout 3
+CALL :delay 3
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set "PLATFORM=x64"
cd "%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\demos" && cmake -E make_directory "%SOLUTION_DIR64%" && cd "%SOLUTION_DIR64%" && cmake -G "Visual Studio !MSBUILD_VERSION!" -A %PLATFORM% "%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\demos"
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
echo.
echo ###############^|^| Build Inference Engine demos using MS Visual Studio (MSBuild.exe) ^|^|###############
echo.
-timeout 3
+CALL :delay 3
echo "!MSBUILD_BIN!" Demos.sln /p:Configuration=Release /t:security_barrier_camera_demo /clp:ErrorsOnly /m
"!MSBUILD_BIN!" Demos.sln /p:Configuration=Release /t:security_barrier_camera_demo /clp:ErrorsOnly /m
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
:runSample
echo.
echo ###############^|^| Run Inference Engine security barrier camera demo ^|^|###############
echo.
-timeout 3
+CALL :delay 3
cd "%SOLUTION_DIR64%\intel64\Release"
if not exist security_barrier_camera_demo.exe (
cd "%INTEL_OPENVINO_DIR%\inference_engine\demos\intel64\Release"
:errorHandling
echo Error
cd "%ROOT_DIR%"
+
+:delay
+timeout %~1 2> nul
+EXIT /B 0
python "%downloader_dir%\downloader.py" --name "%model_name%" --output_dir "%models_path%" --cache_dir "%models_cache%"
echo %model_name% model downloading completed
-timeout 7
+CALL :delay 7
if exist "%ir_dir%" (
echo.
echo Target folder %ir_dir% already exists. Skipping IR generation with Model Optimizer.
echo If you want to convert a model again, remove the entire %ir_dir% folder.
- timeout 7
+ CALL :delay 7
GOTO buildSample
)
echo.
echo ###############^|^| Install Model Optimizer prerequisites ^|^|###############
echo.
-timeout 3
+CALL :delay 3
cd "%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer\install_prerequisites"
call install_prerequisites_caffe.bat
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
echo.
echo ###############^|^| Run Model Optimizer ^|^|###############
echo.
-timeout 3
+CALL :delay 3
::set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
echo python "%downloader_dir%\converter.py" --mo "%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer\mo.py" --name "%model_name%" -d "%models_path%" -o "%irs_path%" --precisions "%TARGET_PRECISION%"
python "%downloader_dir%\converter.py" --mo "%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer\mo.py" --name "%model_name%" -d "%models_path%" -o "%irs_path%" --precisions "%TARGET_PRECISION%"
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
:buildSample
echo.
echo ###############^|^| Generate VS solution for Inference Engine samples using cmake ^|^|###############
echo.
-timeout 3
+CALL :delay 3
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set "PLATFORM=x64"
cd "%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\samples\cpp" && cmake -E make_directory "%SOLUTION_DIR64%" && cd "%SOLUTION_DIR64%" && cmake -G "Visual Studio !MSBUILD_VERSION!" -A %PLATFORM% "%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\samples\cpp"
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
echo.
echo ###############^|^| Build Inference Engine samples using MS Visual Studio (MSBuild.exe) ^|^|###############
echo.
-timeout 3
+CALL :delay 3
echo "!MSBUILD_BIN!" Samples.sln /p:Configuration=Release /t:cpp_samples\classification_sample_async /clp:ErrorsOnly /m
"!MSBUILD_BIN!" Samples.sln /p:Configuration=Release /t:cpp_samples\classification_sample_async /clp:ErrorsOnly /m
if ERRORLEVEL 1 GOTO errorHandling
-timeout 7
+CALL :delay 7
:runSample
echo.
echo ###############^|^| Run Inference Engine classification sample ^|^|###############
echo.
-timeout 3
+CALL :delay 3
copy /Y "%ROOT_DIR%%model_name%.labels" "%ir_dir%"
cd "%SOLUTION_DIR64%\intel64\Release"
if not exist classification_sample_async.exe (
echo.
echo ###############^|^| Classification demo completed successfully ^|^|###############
-timeout 10
+CALL :delay 10
cd "%ROOT_DIR%"
goto :eof
:errorHandling
echo Error
cd "%ROOT_DIR%"
+
+:delay
+timeout %~1 2> nul
+EXIT /B 0