forked from mindspore-Ecosystem/mindspore
supplement windows CI models
This commit is contained in:
parent
d3401c1810
commit
b4907a3b8c
|
@ -45,8 +45,8 @@ IF NOT EXIST "%BUILD_PATH%/mindspore" (
|
|||
|
||||
cd %BUILD_PATH%/mindspore
|
||||
IF "%1%" == "lite" (
|
||||
cmake -DPLATFORM_ARM64=off -DPLATFORM_ARM32=off -DSUPPORT_TRAIN=off ^
|
||||
-DENABLE_TOOLS=off -DENABLE_CONVERTER=on -DBUILD_TESTCASES=off -DUSE_GLOG=ON ^
|
||||
cmake -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=off ^
|
||||
-DENABLE_TOOLS=on -DENABLE_CONVERTER=on -DBUILD_TESTCASES=off ^
|
||||
-DCMAKE_BUILD_TYPE=Release -DSUPPORT_GPU=off -DBUILD_MINDDATA=off -DOFFLINE_COMPILE=off ^
|
||||
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
|
||||
-G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
|
||||
|
|
|
@ -14,82 +14,115 @@
|
|||
@rem ============================================================================
|
||||
@echo off
|
||||
@title run_benchmark_nets
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
SET BASEPATH=%CD%
|
||||
SET OUTPUT_PATH=%BASEPATH%/output
|
||||
SET TOOL_PATH=%1
|
||||
SET TOOL_PATH=%TOOL_PATH:"=%/windows_x64
|
||||
SET MODEL_PATH=%2
|
||||
SET MODEL_PATH=%MODEL_PATH:"=%/models/hiai
|
||||
SET BENCHMARK_BASE=%BASEPATH:"=%/output/benchmark
|
||||
SET MODEL_CONFIG=%BASEPATH%/win_models.cfg
|
||||
|
||||
cd /d %BASEPATH%
|
||||
|
||||
IF EXIST "%BASEPATH%/output" (
|
||||
rd /s /q output
|
||||
)
|
||||
md output
|
||||
|
||||
SET OUTPUT_PATH=%BASEPATH%/output
|
||||
|
||||
cd /d %OUTPUT_PATH%
|
||||
|
||||
IF EXIST benchmark (
|
||||
rd /s /q benchmark
|
||||
)
|
||||
md benchmark
|
||||
SET ret_code=0
|
||||
7z x -r "%TOOL_PATH%/mindspore-lite-*-converter-win-cpu.zip" -o"%BENCHMARK_BASE%"
|
||||
|
||||
SET RET_CODE=0
|
||||
|
||||
cd benchmark
|
||||
unzip "%TOOL_PATH%/mindspore-lite-*-converter-win-cpu.zip"
|
||||
IF NOT %errorlevel% == 0 (
|
||||
echo "Decompression of converter tool fail!"
|
||||
SET ret_code=1
|
||||
SET RET_CODE=1
|
||||
goto run_eof
|
||||
)
|
||||
IF %ret_code% == 0 (
|
||||
7z x -r "%TOOL_PATH%/mindspore-lite-*-win-runtime-x86-cpu.zip" -o"%BENCHMARK_BASE%"
|
||||
IF NOT %errorlevel% == 0 (
|
||||
echo "Decompression of runtime tool fail!"
|
||||
SET ret_code=1
|
||||
)
|
||||
unzip "%TOOL_PATH%/mindspore-lite-*-win-runtime-x86-cpu.zip"
|
||||
IF NOT %errorlevel% == 0 (
|
||||
echo "Decompression of runtime tool fail!"
|
||||
SET RET_CODE=1
|
||||
goto run_eof
|
||||
)
|
||||
cd benchmark
|
||||
|
||||
md ms
|
||||
|
||||
SET TYPE_ID=''
|
||||
SET MODEL_NAME=''
|
||||
SET SUFFIX=''
|
||||
|
||||
echo "Convert models"
|
||||
cd mindspore-lite-*-converter-win-cpu/converter
|
||||
IF %ret_code% == 0 (
|
||||
converter_lite --outputFile="%BENCHMARK_BASE%/ms/scan_hms_angle1" --modelFile="%MODEL_PATH%/scan_hms_angle1.tflite" --fmk=TFLITE
|
||||
IF NOT %errorlevel% == 0 (
|
||||
echo "Model conversion of scan_hms_angle1.tflite fail!"
|
||||
SET ret_code=1
|
||||
)
|
||||
)
|
||||
|
||||
IF %ret_code% == 0 (
|
||||
converter_lite --outputFile="%BENCHMARK_BASE%/ms/scan_hms_detect" --modelFile="%MODEL_PATH%/scan_hms_detect.tflite" --fmk=TFLITE
|
||||
IF NOT %errorlevel% == 0 (
|
||||
echo "Model conversion of scan_hms_detect.tflite fail!"
|
||||
SET ret_code=1
|
||||
|
||||
for /f "tokens=1-2 delims= " %%i in (%MODEL_CONFIG%) do (
|
||||
for /f "tokens=1-2 delims=." %%k in ("%%j") do (
|
||||
SET TYPE_ID=%%i
|
||||
SET MODEL_NAME=%%k
|
||||
SET SUFFIX=%%l
|
||||
)
|
||||
|
||||
if !TYPE_ID!==1 (converter_lite --fmk=MINDIR --modelFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!")
|
||||
if !TYPE_ID!==2 (converter_lite --fmk=MINDIR --modelFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!_train" --trainModel=true)
|
||||
if !TYPE_ID!==3 (converter_lite --fmk=CAFFE --modelFile="%MODEL_PATH%/!MODEL_NAME!.prototxt" --weightFile="%MODEL_PATH%/!MODEL_NAME!.caffemodel" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!")
|
||||
if !TYPE_ID!==4 (converter_lite --fmk=ONNX --modelFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!")
|
||||
if !TYPE_ID!==5 (converter_lite --fmk=TFLITE --modelFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!")
|
||||
if !TYPE_ID!==6 (converter_lite --fmk=TFLITE --modelFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!" --quantType=AwareTraining)
|
||||
if !TYPE_ID!==7 (converter_lite --fmk=TFLITE --modelFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!_posttraining" --quantType=PostTraining --configFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!_posttraining.config")
|
||||
if !TYPE_ID!==8 (converter_lite --fmk=TFLITE --modelFile="%MODEL_PATH%/!MODEL_NAME!.!SUFFIX!" --outputFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!_weightquant" --quantType=WeightQuant --bitNum=8 --quantWeightSize=500 --quantWeightChannel=16)
|
||||
|
||||
IF !errorlevel! == 0 (
|
||||
echo "Run converter for model (TYPE_ID=!TYPE_ID!) !MODEL_NAME!.!SUFFIX! : pass!"
|
||||
) ELSE (
|
||||
echo "Run converter for model (TYPE_ID=!TYPE_ID!) !MODEL_NAME!.!SUFFIX! : fail!"
|
||||
SET RET_CODE=1
|
||||
goto run_eof
|
||||
)
|
||||
)
|
||||
|
||||
echo "Run converted models"
|
||||
cd /d %BENCHMARK_BASE%/mindspore-lite-*-win-runtime-x86-cpu/benchmark
|
||||
SET INPUT_BASE=%MODEL_PATH%/input_output/input
|
||||
SET OUTPUT_BASE=%MODEL_PATH%/input_output/output
|
||||
IF %ret_code% == 0 (
|
||||
benchmark --modelFile="%BENCHMARK_BASE%/ms/scan_hms_angle1.ms" --inDataFile="%INPUT_BASE%/scan_hms_angle1.tflite.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/scan_hms_angle1.tflite.ms.out"
|
||||
IF NOT %errorlevel% == 0 (
|
||||
echo "benchmark scan_hms_angle1 fail!"
|
||||
SET ret_code=1
|
||||
|
||||
for /f "tokens=1-2 delims= " %%i in (%MODEL_CONFIG%) do (
|
||||
for /f "tokens=1-2 delims=." %%k in ("%%j") do (
|
||||
SET TYPE_ID=%%i
|
||||
SET MODEL_NAME=%%k
|
||||
SET SUFFIX=%%l
|
||||
)
|
||||
|
||||
if !TYPE_ID!==1 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!.ms" --inDataFile="%INPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.out" --accuracyThreshold=1.5)
|
||||
if !TYPE_ID!==2 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!_train.ms" --inDataFile="%INPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.out" --accuracyThreshold=1.5)
|
||||
if !TYPE_ID!==3 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.ms" --inDataFile="%INPUT_BASE%/!MODEL_NAME!.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.ms.out")
|
||||
if !TYPE_ID!==4 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!.ms" --inDataFile="%INPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.out")
|
||||
if !TYPE_ID!==5 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!.ms" --inDataFile="%INPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.out")
|
||||
if !TYPE_ID!==6 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!.ms" --inDataFile="%INPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.out")
|
||||
if !TYPE_ID!==7 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!_posttraining.ms" --inDataFile="%MODEL_PATH%/../../quantTraining/mnist_calibration_data/00099.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.!SUFFIX!_posttraining.ms.out")
|
||||
if !TYPE_ID!==8 (benchmark --modelFile="%BENCHMARK_BASE%/ms/!MODEL_NAME!.!SUFFIX!_weightquant.ms" --inDataFile="%INPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/!MODEL_NAME!.!SUFFIX!.ms.out")
|
||||
|
||||
IF !errorlevel! == 0 (
|
||||
echo "Run benchmark for model (TYPE_ID=!TYPE_ID!) !MODEL_NAME!.!SUFFIX! : pass!"
|
||||
) ELSE (
|
||||
echo "Run benchmark for model (TYPE_ID=!TYPE_ID!) !MODEL_NAME!.!SUFFIX! : fail!"
|
||||
SET RET_CODE=1
|
||||
goto run_eof
|
||||
)
|
||||
)
|
||||
|
||||
IF %ret_code% == 0 (
|
||||
benchmark --modelFile="%BENCHMARK_BASE%/ms/scan_hms_detect.ms" --inDataFile="%INPUT_BASE%/scan_hms_detect.tflite.ms.bin" --benchmarkDataFile="%OUTPUT_BASE%/scan_hms_detect.tflite.ms.out"
|
||||
IF NOT %errorlevel% == 0 (
|
||||
echo "benchmark scan_hms_detect fail!"
|
||||
SET ret_code=1
|
||||
:run_eof
|
||||
IF %RET_CODE% == 0 (
|
||||
SET errorlevel=0
|
||||
echo "Run models in Windows success!"
|
||||
) ELSE (
|
||||
SET errorlevel=1
|
||||
echo "Run models in Windows fail!"
|
||||
)
|
||||
)
|
||||
cd /d %BASEPATH%
|
||||
|
||||
cd /d %BASEPATH%
|
||||
|
||||
IF %ret_code% == 1 (
|
||||
SET errorlevel=1
|
||||
)
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
@rem Copyright 2020 Huawei Technologies Co., Ltd
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem ============================================================================
|
||||
@echo off
|
||||
@title run_converter
|
||||
|
||||
SET BASEPATH=%CD%
|
||||
SET TOOL_PATH=%1
|
||||
SET TOOL_PATH=%TOOL_PATH:"=%/windows_x64
|
||||
SET MODEL_PATH=%2
|
||||
SET MODEL_PATH=%MODEL_PATH:"=%/models/hiai
|
||||
SET WinRarDir=%3
|
||||
SET WinRarDir=%WinRarDir:"=%
|
||||
|
||||
cd /d %BASEPATH%
|
||||
|
||||
IF EXIST "%BASEPATH%/output" (
|
||||
rd /s /q output
|
||||
)
|
||||
md output
|
||||
|
||||
SET OUTPUT_PATH=%BASEPATH%/output
|
||||
|
||||
cd /d %TOOL_PATH%
|
||||
|
||||
IF EXIST tool (
|
||||
rd /s /q tool
|
||||
)
|
||||
md tool
|
||||
"%WinRarDir%/WinRAR" x -l "%TOOL_PATH%/mindspore-lite-*-converter-win-cpu.zip" "%TOOL_PATH%/tool"
|
||||
IF errorlevel 1 (
|
||||
echo "Decompression of converter tool is failed."
|
||||
call :run_fail
|
||||
)
|
||||
|
||||
cd tool/mindspore-lite-*-converter-win-cpu/converter
|
||||
|
||||
converter_lite --outputFile="%OUTPUT_PATH%/detect" --modelFile="%MODEL_PATH%/detect.tflite" --fmk=TFLITE
|
||||
IF errorlevel 1 (
|
||||
echo "Model conversion of detect.tflite is failed."
|
||||
call :run_fail
|
||||
)
|
||||
|
||||
converter_lite --outputFile="%OUTPUT_PATH%/mobilenet_v1_0.5_128" --modelFile="%MODEL_PATH%/mobilenet_v1_0.5_128.tflite" --fmk=TFLITE
|
||||
IF errorlevel 1 (
|
||||
echo "Model conversion of mobilenet_v1_0.5_128.tflite is failed."
|
||||
call :run_fail
|
||||
)
|
||||
|
||||
converter_lite --outputFile="%OUTPUT_PATH%/mobilenet_v1_0.5_128_quant" --modelFile="%MODEL_PATH%/mobilenet_v1_0.5_128_quant.tflite" --fmk=TFLITE --quantType=AwareTraining
|
||||
IF errorlevel 1 (
|
||||
echo "Model conversion of mobilenet_v1_0.5_128_quant.tflite is failed."
|
||||
call :run_fail
|
||||
)
|
||||
|
||||
converter_lite --outputFile="%OUTPUT_PATH%/mtk_AADB_HADB_MBV2_model_f16" --modelFile="%MODEL_PATH%/mtk_AADB_HADB_MBV2_model_f16.tflite" --fmk=TFLITE
|
||||
IF errorlevel 1 (
|
||||
echo "Model conversion of mtk_AADB_HADB_MBV2_model_f16.tflite is failed."
|
||||
call :run_fail
|
||||
)
|
||||
|
||||
converter_lite --outputFile="%OUTPUT_PATH%/detect_mbv1_640_480_nopostprocess_simplified" --modelFile="%MODEL_PATH%/detect_mbv1_640_480_nopostprocess_simplified.onnx" --fmk=ONNX
|
||||
IF errorlevel 1 (
|
||||
echo "Model conversion of detect_mbv1_640_480_nopostprocess_simplified.onnx is failed."
|
||||
call :run_fail
|
||||
)
|
||||
|
||||
converter_lite --outputFile="%OUTPUT_PATH%/emotion" --modelFile="%MODEL_PATH%/emotion.prototxt" --weightFile="%MODEL_PATH%/emotion.caffemodel" --fmk=CAFFE
|
||||
IF errorlevel 1 (
|
||||
echo "Model conversion of emotion.prototxt is failed."
|
||||
goto run_fail
|
||||
)
|
||||
|
||||
SET /a count=0
|
||||
FOR /f "tokens=* delims= " %%i in ('dir/s/b/a-d "%OUTPUT_PATH%\*.*"') DO (SET /a count=count+1)
|
||||
IF NOT %count% == 6 (
|
||||
echo "Conversion of some models are failed."
|
||||
call :run_fail
|
||||
)
|
||||
|
||||
:run_fail
|
||||
set errorlevel=1
|
||||
|
||||
:run_eof
|
||||
cd /d %BASEPATH%
|
|
@ -0,0 +1,24 @@
|
|||
1 mobilenetv2_438.mindir
|
||||
1 shufflenetv2.mindir
|
||||
1 retinaface.mindir
|
||||
1 mobilefacenet.mindir
|
||||
1 ocr_mobilenetV2.mindir
|
||||
2 efficientnet.mindir
|
||||
3 gender_res_large_deploy
|
||||
3 ml_ocr_detect_20200305
|
||||
3 hiai_cv_focusShootOCRModel_07
|
||||
3 detect_mbv1_640_480_nopostprocess_simplified
|
||||
4 mtk_detect-mbv2-shortcut-400-400-simplified.onnx
|
||||
4 mtk_face_features_v3.onnx
|
||||
4 gts_version-RFB-320_simplified.onnx
|
||||
4 mnist-8.onnx
|
||||
5 hiai_chinese_english_recognize_model_float32.tflite
|
||||
5 hiai_latin_ocr.tflite
|
||||
5 mtk_AADB_HADB_MBV2_model_f16.tflite
|
||||
5 ml_object_detect_1.tflite
|
||||
5 lite-model_arbitrary-image-stylization-inceptionv3_fp16_predict_1.tflite
|
||||
6 lite-model_aiy_vision_classifier_birds_V1_3.tflite
|
||||
6 ssd_mobilenet_v1_1_default_1.tflite
|
||||
6 object_detection_mobile_object_localizer_v1_1_default_1.tflite
|
||||
7 mobilenet.tflite
|
||||
8 ml_face_openclose.tflite
|
Loading…
Reference in New Issue