Nomeroff Net CI CPU Testing #1191
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Nomeroff Net CI CPU Testing | |
on: | |
pull_request: | |
branches: [ master, v3.0, v3.1 ] | |
paths: | |
- 'nomeroff_net/**' | |
- 'examples/ju/dataset_convertors/**' | |
- 'examples/ju/dataset_tools/**' | |
- 'examples/ju/inference/**' | |
- 'examples/ju/train/**' | |
- 'examples/py/inference/**' | |
- 'examples/py/rest_examples/**' | |
schedule: | |
- cron: '10 0 * * *' # Runs at 00:10 UTC every day | |
jobs: | |
cpu-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-18.04 ] | |
python-version: [ 3.7, 3.8, 3.9 ] | |
# Timeout: https://stackoverflow.com/a/59076067/4521646 | |
timeout-minutes: 120 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Note: This uses an internal pip API and may not always work | |
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow | |
- name: Get pip cache | |
id: pip-cache | |
run: | | |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | |
- name: Cache pip | |
uses: actions/[email protected] | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-pip- | |
- name: Install dependencies | |
run: | | |
sudo apt-get install libturbojpeg | |
python -m pip install --upgrade pip | |
pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
# extras | |
pip install setuptools wheel pytest jupyter | |
# fix AttributeError: module 'jinja2' has no attribute 'Markup' | |
pip install mkdocs==1.2.4 | |
pip install jinja2==3.1 | |
python --version | |
pip --version | |
pip list | |
shell: bash | |
- name: Tests workflow | |
run: | | |
# test train examples ocr | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/by.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/eu.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/ge.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/kg.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/kz.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/ua.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/ua-1995.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/su.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/ocr/ru.ipynb | |
# test train examples classification | |
#jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/classification/options-base-count_lines-train.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/classification/options-base-train.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/classification/options-custom-train.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/classification/options-train.ipynb | |
# test train examples object detection | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/train/object_detection/yolov5-train.ipynb | |
# test python inference examples | |
python examples/py/inference/get-started-demo.py | |
python examples/py/inference/get-started-tiny-demo.py | |
python examples/py/inference/number-plate-filling-demo.py | |
python examples/py/inference/number-plate-recognition-multiline-demo.py | |
# test jupyter inference examples | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/inference/custom-options-model-demo.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/inference/get-started-demo.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/inference/get-started-tiny-demo.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/inference/number-plate-bbox-filling.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/inference/number-plate-keypoints-filling.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/inference/number-plate-recognition-multiline-demo.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/inference/get-started-demo-ocr-custom.ipynb | |
# test python benchmarks examples | |
python examples/py/benchmark/accuracy-test.py | |
python examples/py/benchmark/runtime-test.py | |
# test jupyter benchmarks examples | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/benchmark/accuracy-test.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/benchmark/accuracy-test-custom.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/benchmark/accuracy-test-multiline.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/benchmark/runtime-test.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/benchmark/runtime-test-multiline.ipynb | |
# test jupyter dataset tools examples | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/dataset_tools/analyze_via_dataset.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/dataset_tools/auto_number_grab.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/dataset_tools/check_ocr_model.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/dataset_tools/option_checker.ipynb | |
jupyter nbconvert --ExecutePreprocessor.timeout=6000 --execute --to html examples/ju/dataset_tools/ocr_dataset_format_checker.ipynb | |
# test image loaders | |
python3 nomeroff_net/image_loaders/base.py | |
python3 -m nomeroff_net.image_loaders.dumpy_loader -f nomeroff_net/image_loaders/dumpy_loader.py | |
python3 -m nomeroff_net.image_loaders.opencv_loader -f nomeroff_net/image_loaders/opencv_loader.py | |
python3 -m nomeroff_net.image_loaders.pillow_loader -f nomeroff_net/image_loaders/pillow_loader.py | |
python3 -m nomeroff_net.image_loaders.turbo_loader -f nomeroff_net/image_loaders/turbo_loader.py | |
# test nnmodels | |
python3 -m nomeroff_net.nnmodels.numberplate_classification_model -f nomeroff_net/nnmodels/numberplate_classification_model.py | |
python3 -m nomeroff_net.nnmodels.numberplate_options_model -f nomeroff_net/nnmodels/numberplate_options_model.py | |
python3 -m nomeroff_net.nnmodels.fraud_numberpate_model -f nomeroff_net/nnmodels/fraud_numberpate_options.py | |
python3 -m nomeroff_net.nnmodels.numberplate_inverse_model -f nomeroff_net/nnmodels/numberplate_inverse_model.py | |
python3 -m nomeroff_net.nnmodels.numberplate_orientation_model -f nomeroff_net/nnmodels/numberplate_orientation_model.py | |
python3 -m nomeroff_net.nnmodels.ocr_model -f nomeroff_net/nnmodels/ocr_model.py | |
# test tools | |
python3 nomeroff_net/tools/test_tools.py | |
shell: bash |