|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +green="\033[0;32m" |
| 4 | +red="\033[0;31m" |
| 5 | +end="\033[0m" |
| 6 | + |
| 7 | +green () { |
| 8 | + echo -e "${green}${1}${end}" |
| 9 | +} |
| 10 | + |
| 11 | +red () { |
| 12 | + echo -e "${red}${1}${end}" |
| 13 | +} |
| 14 | + |
| 15 | +# check if (no ARG and no some appropriate files are compiled) or |
| 16 | +# (some args provided but arg1 is not existing file) |
| 17 | +# of course, you could shoot your leg here in different ways |
| 18 | +if ([ ! $# -ge 1 ] && ! $(ls ../create_wheel/dist/opencv_python_inference_engine*.whl &> /dev/null)) || |
| 19 | + ([ $# -ge 1 ] && [ ! -f $1 ]); then |
| 20 | + red "How do you suppose to run wheel tests without wheel?" |
| 21 | + red "Compile it or provide as an ARG1 to script" |
| 22 | + exit 1 |
| 23 | +fi |
| 24 | + |
| 25 | + |
| 26 | +green "CREATE SEPARATE TEST VENV" |
| 27 | +if [ ! -d ./venv_t ]; then |
| 28 | + virtualenv --clear --always-copy -p /usr/bin/python3 ./venv_t |
| 29 | +fi |
| 30 | + |
| 31 | + |
| 32 | +green "INSTALLING DEPENDENCIES" |
| 33 | +if [ $1 ]; then |
| 34 | + # install ARGV1 |
| 35 | + green "Installing from provided path" |
| 36 | + ./venv_t/bin/pip3 install --force-reinstall "$1" |
| 37 | +else |
| 38 | + # install compiled wheel |
| 39 | + green "Installing from default path" |
| 40 | + ./venv_t/bin/pip3 install --force-reinstall ../create_wheel/dist/opencv_python_inference_engine*.whl |
| 41 | +fi |
| 42 | + |
| 43 | +./venv_t/bin/pip3 install -r requirements.txt |
| 44 | + |
| 45 | + |
| 46 | +green "GET MODELS" |
| 47 | + |
| 48 | +if [ ! -d "rateme" ]; then |
| 49 | + ./venv_t/bin/pip3 install --python-version 3 rateme -U --no-deps -t ./ |
| 50 | +fi |
| 51 | + |
| 52 | +# urls, filenames and checksums are from: |
| 53 | +# + <https://github.com/opencv/open_model_zoo/blob/2020.1/models/intel/text-detection-0004/model.yml> |
| 54 | +# + <https://github.com/opencv/open_model_zoo/blob/2020.1/models/intel/text-recognition-0012/model.yml> |
| 55 | +declare -a models=("text-detection-0004.xml" |
| 56 | + "text-detection-0004.bin" |
| 57 | + "text-recognition-0012.xml" |
| 58 | + "text-recognition-0012.bin") |
| 59 | + |
| 60 | +url_start="https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1" |
| 61 | + |
| 62 | +for i in "${models[@]}"; do |
| 63 | + if [ ! -f $i ]; then |
| 64 | + wget "${url_start}/${i%.*}/FP32/${i}" |
| 65 | + else |
| 66 | + sha256sum -c "${i}.sha256sum" |
| 67 | + fi |
| 68 | +done |
| 69 | + |
| 70 | + |
| 71 | +green "RUN TESTS with ./venv_t/bin/python ./tests.py" |
| 72 | +./venv_t/bin/python ./tests.py |
0 commit comments