From d383ad3d74779b13b5627f64c0ec29baed5e7297 Mon Sep 17 00:00:00 2001 From: Hans Gaiser Date: Fri, 11 Oct 2019 13:39:14 +0200 Subject: [PATCH 1/7] Rename 'resize' back to 'resize_images'. --- .circleci/config.yml | 69 +++++++++++++++++++++++++++++++++++ .travis.yml | 7 +++- tests/models/test_densenet.py | 2 +- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..95e51f082 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,69 @@ +version: 2.0 + +references: + + install_python: &install_python + run: + name: Install Python + command: | + sudo add-apt-repository ppa:jonathonf/python-$PYTHON_VER + sudo apt-get update -qq --fix-missing + sudo apt-get install -y wget python$PYTHON_VER python$PYTHON_VER-dev + # sudo update-alternatives --install /usr/bin/python python /usr/bin/python$PYTHON_VER 1 + wget https://bootstrap.pypa.io/get-pip.py + sudo python$PYTHON_VER get-pip.py + pwd ; ls -l + python$PYTHON_VER --version ; pip$PYTHON_VER --version + + install_pips: &install_pips + run: + name: Install PyPI dependences + command: | + sudo pip$PYTHON_VER install numpy==1.14 + pip$PYTHON_VER install -r requirements.txt --user + sudo pip$PYTHON_VER install -r tests/requirements.txt + pip$PYTHON_VER list + + test_coverage: &test_coverage + run: + name: Testing and Formating + command: | + python$PYTHON_VER setup.py check -m -s + python$PYTHON_VER setup.py build_ext --inplace + python$PYTHON_VER setup.py install --dry-run --user + coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --flake8 + no_output_timeout: 30m + +jobs: + + Py3: + machine: + image: ubuntu-1604:201903-01 + environment: + - PYTHON_VER: "3.6" + steps: &steps + - checkout + # INSTALLATION + - *install_python + - *install_pips + # TESTING + - *test_coverage + + # PASSING + - run: + name: Finalise + command: | + coverage xml && codecov + coverage report && coverage xml -o test-reports/coverage.xml + # RESULTS + - store_test_results: + path: test-reports + - store_artifacts: + path: test-reports + + +workflows: + version: 2 + build: + jobs: + - Py3 diff --git a/.travis.yml b/.travis.yml index 47b078c99..8222bbb4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,14 @@ +dist: bionic # Ubuntu 18.04 + language: python sudo: required python: - '2.7' + - '3.5' - '3.6' + - '3.7' install: - pip install -r requirements.txt @@ -15,7 +19,8 @@ cache: pip script: - python setup.py check -m -s - python setup.py build_ext --inplace - - travis_wait coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 + - python setup.py install --dry-run + - coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 --ignore=tests/models/test_densenet.py --ignore=tests/models/test_mobilenet.py after_success: - coverage xml diff --git a/tests/models/test_densenet.py b/tests/models/test_densenet.py index 595fb5672..f571d2f37 100644 --- a/tests/models/test_densenet.py +++ b/tests/models/test_densenet.py @@ -48,4 +48,4 @@ def test_backbone(backbone): }, optimizer=keras.optimizers.adam(lr=1e-5, clipnorm=0.001)) - model.fit(inputs, targets, batch_size=1) + model.fit(inputs, targets, batch_size=1, epochs=1) From bd6cca45c275baed69d52ade6bfcad1e53587147 Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Mon, 14 Oct 2019 18:36:09 +0200 Subject: [PATCH 2/7] freeze TF to 1.x --- .circleci/config.yml | 69 -------------------------------------------- .travis.yml | 7 +++-- 2 files changed, 4 insertions(+), 72 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 95e51f082..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,69 +0,0 @@ -version: 2.0 - -references: - - install_python: &install_python - run: - name: Install Python - command: | - sudo add-apt-repository ppa:jonathonf/python-$PYTHON_VER - sudo apt-get update -qq --fix-missing - sudo apt-get install -y wget python$PYTHON_VER python$PYTHON_VER-dev - # sudo update-alternatives --install /usr/bin/python python /usr/bin/python$PYTHON_VER 1 - wget https://bootstrap.pypa.io/get-pip.py - sudo python$PYTHON_VER get-pip.py - pwd ; ls -l - python$PYTHON_VER --version ; pip$PYTHON_VER --version - - install_pips: &install_pips - run: - name: Install PyPI dependences - command: | - sudo pip$PYTHON_VER install numpy==1.14 - pip$PYTHON_VER install -r requirements.txt --user - sudo pip$PYTHON_VER install -r tests/requirements.txt - pip$PYTHON_VER list - - test_coverage: &test_coverage - run: - name: Testing and Formating - command: | - python$PYTHON_VER setup.py check -m -s - python$PYTHON_VER setup.py build_ext --inplace - python$PYTHON_VER setup.py install --dry-run --user - coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --flake8 - no_output_timeout: 30m - -jobs: - - Py3: - machine: - image: ubuntu-1604:201903-01 - environment: - - PYTHON_VER: "3.6" - steps: &steps - - checkout - # INSTALLATION - - *install_python - - *install_pips - # TESTING - - *test_coverage - - # PASSING - - run: - name: Finalise - command: | - coverage xml && codecov - coverage report && coverage xml -o test-reports/coverage.xml - # RESULTS - - store_test_results: - path: test-reports - - store_artifacts: - path: test-reports - - -workflows: - version: 2 - build: - jobs: - - Py3 diff --git a/.travis.yml b/.travis.yml index 8222bbb4d..83d7953d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,17 +10,18 @@ python: - '3.6' - '3.7' +cache: pip + install: + - pip install "tensorflow<2.0" # https://github.com/fizyr/keras-retinanet/issues/1123#issuecomment-541566486 - pip install -r requirements.txt - pip install -r tests/requirements.txt -cache: pip - script: - python setup.py check -m -s - python setup.py build_ext --inplace - python setup.py install --dry-run - - coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 --ignore=tests/models/test_densenet.py --ignore=tests/models/test_mobilenet.py + - coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 after_success: - coverage xml From a1346e2025dbea7525c9eeb3a12144f2e7e869b3 Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Tue, 29 Oct 2019 12:21:38 +0100 Subject: [PATCH 3/7] TF disable_v2_behavior --- .travis.yml | 3 ++- keras_retinanet/__init__.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 83d7953d8..e8937e4e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,8 @@ python: cache: pip install: - - pip install "tensorflow<2.0" # https://github.com/fizyr/keras-retinanet/issues/1123#issuecomment-541566486 + # see: https://github.com/fizyr/keras-retinanet/issues/1123#issuecomment-541566486 + # - pip install "tensorflow<2.0" - pip install -r requirements.txt - pip install -r tests/requirements.txt diff --git a/keras_retinanet/__init__.py b/keras_retinanet/__init__.py index e69de29bb..533f3d71a 100644 --- a/keras_retinanet/__init__.py +++ b/keras_retinanet/__init__.py @@ -0,0 +1,3 @@ +import tensorflow + +tensorflow.compat.v1.disable_v2_behavior() \ No newline at end of file From 0c90e1fdf12e9b24b49e55c47ee8676278fba963 Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Tue, 29 Oct 2019 13:31:25 +0100 Subject: [PATCH 4/7] multi TF build --- .travis.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e8937e4e2..7545cc6d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,17 +4,32 @@ language: python sudo: required -python: - - '2.7' - - '3.5' - - '3.6' - - '3.7' +matrix: + include: + #- python: 2.7 + # dist: xenial # Ubuntu 16.04 + # env: TOXENV=py27 + - python: 3.5 + dist: xenial # Ubuntu 16.04 + env: TF_VERSION="tensorflow<2.0" + - python: 3.6 + dist: bionic # Ubuntu 18.04 + env: TF_VERSION="tensorflow<2.0" + - python: 3.7 + dist: bionic # Ubuntu 18.04 + env: TF_VERSION="tensorflow<2.0" + - python: 3.6 + dist: bionic # Ubuntu 18.04 + env: TF_VERSION="tensorflow>=2.0" + - python: 3.7 + dist: bionic # Ubuntu 18.04 + env: TF_VERSION="tensorflow>=2.0" cache: pip install: # see: https://github.com/fizyr/keras-retinanet/issues/1123#issuecomment-541566486 - # - pip install "tensorflow<2.0" + - pip install $TF_VERSION - pip install -r requirements.txt - pip install -r tests/requirements.txt From 1d64c0402dcf7a15176807df97114529b4146565 Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Tue, 29 Oct 2019 13:27:20 +0100 Subject: [PATCH 5/7] fix TF eager --- .travis.yml | 1 + keras_retinanet/__init__.py | 3 --- keras_retinanet/backend/__init__.py | 13 +++++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7545cc6d9..94cbdf067 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ install: - pip install $TF_VERSION - pip install -r requirements.txt - pip install -r tests/requirements.txt + - pip list script: - python setup.py check -m -s diff --git a/keras_retinanet/__init__.py b/keras_retinanet/__init__.py index 533f3d71a..e69de29bb 100644 --- a/keras_retinanet/__init__.py +++ b/keras_retinanet/__init__.py @@ -1,3 +0,0 @@ -import tensorflow - -tensorflow.compat.v1.disable_v2_behavior() \ No newline at end of file diff --git a/keras_retinanet/backend/__init__.py b/keras_retinanet/backend/__init__.py index 4bace6940..faaa440e9 100644 --- a/keras_retinanet/backend/__init__.py +++ b/keras_retinanet/backend/__init__.py @@ -1,2 +1,15 @@ +import tensorflow + +# parse the tensorflow version +tf_version = [int(i) for i in tensorflow.__version__.split('.')] +if tf_version[0] >= 2: + # Disable Tensorflow 2.x behavior as we experience issues with it. + # see: https://www.tensorflow.org/api_docs/python/tf/compat/v1/disable_v2_behavior + tensorflow.compat.v1.disable_v2_behavior() + # for cases of using `x.numpy()` + # Aiming: NotImplementedError: numpy() is only available when eager execution is enabled. + # see: https://www.tensorflow.org/api_docs/python/tf/compat/v1/enable_eager_execution + tensorflow.compat.v1.enable_eager_execution() + from .dynamic import * # noqa: F401,F403 from .common import * # noqa: F401,F403 From f0437acfc90562947eab4bea1b0747828cb375dc Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Tue, 29 Oct 2019 14:34:03 +0100 Subject: [PATCH 6/7] try wait --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94cbdf067..d981b62bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -dist: bionic # Ubuntu 18.04 - language: python sudo: required @@ -38,7 +36,7 @@ script: - python setup.py check -m -s - python setup.py build_ext --inplace - python setup.py install --dry-run - - coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 + - travis_wait coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 after_success: - coverage xml From 937e46ada84efafbf5243cedea06192eda6fa29a Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Tue, 29 Oct 2019 15:24:59 +0100 Subject: [PATCH 7/7] drop wait --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d981b62bb..875489f0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ script: - python setup.py check -m -s - python setup.py build_ext --inplace - python setup.py install --dry-run - - travis_wait coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 + - coverage run --source keras_retinanet -m py.test keras_retinanet tests --doctest-modules --forked --flake8 after_success: - coverage xml