This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprepare_and_run_tests.sh
executable file
·77 lines (61 loc) · 2.18 KB
/
prepare_and_run_tests.sh
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
green="\033[0;32m"
red="\033[0;31m"
end="\033[0m"
green () {
echo -e "${green}${1}${end}"
}
red () {
echo -e "${red}${1}${end}"
}
# check if (no ARG and no some appropriate files are compiled) or
# (some args provided but arg1 is not existing file)
# of course, you could shoot your leg here in different ways
if ([ ! $# -ge 1 ] && ! $(ls ../create_wheel/dist/opencv_python_inference_engine*.whl &> /dev/null)) ||
([ $# -ge 1 ] && [ ! -f $1 ]); then
red "How do you suppose to run wheel tests without wheel?"
red "Compile it or provide as an ARG1 to script"
exit 1
fi
echo "======================================================================"
green "CREATE SEPARATE TEST VENV"
if [ ! -d ./venv_t ]; then
virtualenv --clear --always-copy -p /usr/bin/python3 ./venv_t
fi
green "INSTALLING DEPENDENCIES"
if [ $1 ]; then
# install ARGV1
green "Installing from provided path"
WHEEL="$1"
else
# install compiled wheel
green "Installing from default path"
WHEEL=$(realpath ../create_wheel/dist/opencv_python_inference_engine*.whl)
fi
./venv_t/bin/pip3 install --force-reinstall "$WHEEL"
./venv_t/bin/pip3 install -r requirements.txt
green "GET MODELS"
if [ ! -d "rateme" ]; then
./venv_t/bin/pip3 install "https://github.com/banderlog/rateme/releases/download/v0.1.1/rateme-0.1.1.tar.gz"
fi
# urls, filenames and checksums are from:
# + <https://github.com/opencv/open_model_zoo/blob/2020.1/models/intel/text-detection-0004/model.yml>
# + <https://github.com/opencv/open_model_zoo/blob/2020.1/models/intel/text-recognition-0012/model.yml>
declare -a models=("text-detection-0004.xml"
"text-detection-0004.bin"
"text-recognition-0012.xml"
"text-recognition-0012.bin")
url_start="https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1"
for i in "${models[@]}"; do
# if no such file
if [ ! -f $i ]; then
# download
wget "${url_start}/${i%.*}/FP32/${i}"
else
# checksum
sha256sum -c "${i}.sha256sum" || red "PROBLEMS ^^^"
fi
done
green "For \"$WHEEL\""
green "RUN TESTS with ./venv_t/bin/python ./tests.py"
./venv_t/bin/python ./tests.py