From 1c4e4170334ac7d706807e1c9e8b3bb8b5fc9abb Mon Sep 17 00:00:00 2001 From: Lorenzo Mammana Date: Tue, 20 Aug 2024 09:17:56 +0200 Subject: [PATCH] feat: Remove opencv python (#128) * build: Update dependencies to retain only opencv-python-headless * build: Upgrade version, update changelog * test: Skip draem test as it doesn't work with the current anomalib dependency * refactor: Update gradcam integration code to support the new version --- CHANGELOG.md | 6 + poetry.lock | 157 +++++--------------------- pyproject.toml | 6 +- quadra/__init__.py | 2 +- quadra/modules/classification/base.py | 6 +- quadra/tasks/classification.py | 1 - quadra/utils/models.py | 1 - tests/tasks/test_anomaly.py | 4 + 8 files changed, 44 insertions(+), 139 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a857a89b..f73c3d48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ # Changelog All notable changes to this project will be documented in this file. +### [2.2.3] + +#### Updated + +- Keep only opencv-python-headless as a dependency for quadra to avoid conflicts with the non-headless version + ### [2.2.2] #### Updated diff --git a/poetry.lock b/poetry.lock index b8f0edc8..f73ed47d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -187,26 +187,28 @@ test = ["flake8 (==3.7.9)", "mock (==2.0.0)", "pylint (==1.9.3)"] [[package]] name = "anomalib-orobix" -version = "0.7.0.dev140" +version = "0.7.0.dev141" description = "Orobix anomalib fork" optional = false -python-versions = ">=3.9,<3.11" +python-versions = "<3.11,>=3.9" files = [ - {file = "anomalib_orobix-0.7.0.dev140-py3-none-any.whl", hash = "sha256:4d78ab39fd38c88214b89edd6eccb3f66f91e5771f9f6382e4140bb348ac9ac9"}, - {file = "anomalib_orobix-0.7.0.dev140.tar.gz", hash = "sha256:e9c6d3a1c4547366d7622295080ab85710a381831f6b7d0a29dd03ae061a656d"}, + {file = "anomalib_orobix-0.7.0.dev141-py3-none-any.whl", hash = "sha256:b30b4a8ca5bc04b042f7fdea3a790a86c0767e5aba608ae572eab840081e209a"}, + {file = "anomalib_orobix-0.7.0.dev141.tar.gz", hash = "sha256:1e66d505792ef068e02ab066dd3ff7111e4142d1cc20c5f36b2daf6a4c3d08e8"}, ] [package.dependencies] einops = ">=0.6,<0.7" freia = ">=0.2,<0.3" gradio = "3.0.2" -imgaug = "0.4.0" jsonargparse = {version = ">=4.3.0,<4.4.0", extras = ["signatures"]} kornia = "0.6.5" line-profiler = "3.5.1" omegaconf = ">=2.3,<2.4" wandb = "0.12.17" +[package.extras] +augmentation = ["imgaug (==0.4.0)"] + [[package]] name = "antlr4-python3-runtime" version = "4.9.3" @@ -1465,25 +1467,26 @@ requests-oauthlib = ">=0.7.0" tool = ["click (>=6.0.0)"] [[package]] -name = "grad-cam" -version = "1.4.6" -description = "Many Class Activation Map methods implemented in Pytorch for classification, segmentation, object detection and more" +name = "grad-cam-orobix" +version = "1.5.3.dev1" +description = "Many Class Activation Map methods implemented in Pytorch. Including Grad-CAM, Grad-CAM++, Score-CAM, Ablation-CAM and XGrad-CAM" optional = false -python-versions = ">=3.6" +python-versions = "<3.11,>=3.9" files = [ - {file = "grad-cam-1.4.6.tar.gz", hash = "sha256:b0be3e5147c2eb425602024fbd77951941c0b24ba871e558c180eb62589b50e1"}, + {file = "grad_cam_orobix-1.5.3.dev1-py3-none-any.whl", hash = "sha256:7ee0c4114a95848445562b0a82f537193f0d3bbab14bdc96444115349b068694"}, + {file = "grad_cam_orobix-1.5.3.dev1.tar.gz", hash = "sha256:4f297995c07961f6403aeb5d3a88c86f2bf0bc9305ee8965c8e177330bef5754"}, ] [package.dependencies] -matplotlib = "*" -numpy = "*" -opencv-python = "*" -Pillow = "*" -scikit-learn = "*" +matplotlib = ">=3.6.0" +numpy = ">=1.20.0" +opencv-python-headless = ">=4.7.0.72" +Pillow = ">=9.0.0" +scikit-learn = ">=1.2.0" torch = ">=1.7.1" torchvision = ">=0.8.2" -tqdm = "*" -ttach = "*" +tqdm = ">=4.66.0" +ttach = ">=0.0.3" [[package]] name = "gradio" @@ -1974,28 +1977,6 @@ pyav = ["av"] test = ["fsspec[github]", "pytest", "pytest-cov"] tifffile = ["tifffile"] -[[package]] -name = "imgaug" -version = "0.4.0" -description = "Image augmentation library for deep neural networks" -optional = false -python-versions = "*" -files = [ - {file = "imgaug-0.4.0-py2.py3-none-any.whl", hash = "sha256:ce61e65b4eb7405fc62c1b0a79d2fa92fd47f763aaecb65152d29243592111f9"}, - {file = "imgaug-0.4.0.tar.gz", hash = "sha256:46bab63ed38f8980630ff721a09ca2281b7dbd4d8c11258818b6ebcc69ea46c7"}, -] - -[package.dependencies] -imageio = "*" -matplotlib = "*" -numpy = ">=1.15" -opencv-python = "*" -Pillow = "*" -scikit-image = ">=0.14.2" -scipy = "*" -Shapely = "*" -six = "*" - [[package]] name = "importlib-metadata" version = "6.11.0" @@ -2618,7 +2599,7 @@ files = [ cssselect = ["cssselect (>=0.7)"] html5 = ["html5lib"] htmlsoup = ["BeautifulSoup4"] -source = ["Cython (>=3.0.8)"] +source = ["Cython (>=3.0.7)"] [[package]] name = "mako" @@ -3609,30 +3590,6 @@ files = [ onnx = "*" rich = "*" -[[package]] -name = "opencv-python" -version = "4.9.0.80" -description = "Wrapper package for OpenCV python bindings." -optional = false -python-versions = ">=3.6" -files = [ - {file = "opencv-python-4.9.0.80.tar.gz", hash = "sha256:1a9f0e6267de3a1a1db0c54213d022c7c8b5b9ca4b580e80bdc58516c922c9e1"}, - {file = "opencv_python-4.9.0.80-cp37-abi3-macosx_10_16_x86_64.whl", hash = "sha256:7e5f7aa4486651a6ebfa8ed4b594b65bd2d2f41beeb4241a3e4b1b85acbbbadb"}, - {file = "opencv_python-4.9.0.80-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:71dfb9555ccccdd77305fc3dcca5897fbf0cf28b297c51ee55e079c065d812a3"}, - {file = "opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7b34a52e9da36dda8c151c6394aed602e4b17fa041df0b9f5b93ae10b0fcca2a"}, - {file = "opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4088cab82b66a3b37ffc452976b14a3c599269c247895ae9ceb4066d8188a57"}, - {file = "opencv_python-4.9.0.80-cp37-abi3-win32.whl", hash = "sha256:dcf000c36dd1651118a2462257e3a9e76db789a78432e1f303c7bac54f63ef6c"}, - {file = "opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl", hash = "sha256:3f16f08e02b2a2da44259c7cc712e779eff1dd8b55fdb0323e8cab09548086c0"}, -] - -[package.dependencies] -numpy = [ - {version = ">=1.21.0", markers = "python_version == \"3.9\" and platform_system == \"Darwin\" and platform_machine == \"arm64\""}, - {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\""}, - {version = ">=1.21.2", markers = "platform_system != \"Darwin\" and python_version >= \"3.10\""}, - {version = ">=1.19.3", markers = "platform_system == \"Linux\" and platform_machine == \"aarch64\" and python_version >= \"3.8\" and python_version < \"3.10\" or python_version > \"3.9\" and python_version < \"3.10\" or python_version >= \"3.9\" and platform_system != \"Darwin\" and python_version < \"3.10\" or python_version >= \"3.9\" and platform_machine != \"arm64\" and python_version < \"3.10\""}, -] - [[package]] name = "opencv-python-headless" version = "4.7.0.72" @@ -4648,7 +4605,7 @@ files = [ [[package]] name = "pyyaml-env-tag" version = "0.1" -description = "A custom YAML tag for referencing environment variables in YAML files." +description = "A custom YAML tag for referencing environment variables in YAML files. " optional = false python-versions = ">=3.6" files = [ @@ -5142,6 +5099,7 @@ description = "Scikit-multilearn is a BSD-licensed library for multi-label class optional = false python-versions = "*" files = [ + {file = "scikit-multilearn-0.2.0.linux-x86_64.tar.gz", hash = "sha256:3179fed29b1492f6a69600696c23045b9f494d2b89d1796a8bdc43ccbb33712b"}, {file = "scikit_multilearn-0.2.0-py2-none-any.whl", hash = "sha256:0a389600a6797db6567f2f6ca1d0dca30bebfaaa73f75de62d7ae40f8f03d4fb"}, {file = "scikit_multilearn-0.2.0-py3-none-any.whl", hash = "sha256:068c652f22704a084ca252d05d21a655e7c9b248d0a4543847b74de5fca2b3f0"}, ] @@ -5229,7 +5187,7 @@ name = "segmentation-models-pytorch-orobix" version = "0.3.3.dev1" description = "Deep Learning experiment orchestration library" optional = false -python-versions = ">=3.9,<3.11" +python-versions = "<3.11,>=3.9" files = [ {file = "segmentation_models_pytorch_orobix-0.3.3.dev1-py3-none-any.whl", hash = "sha256:e64ac97161fecb12af51f073c24b3a74c0f6ef37e39a756f7e846340ab3156a8"}, {file = "segmentation_models_pytorch_orobix-0.3.3.dev1.tar.gz", hash = "sha256:291d3d36c84cefd9af3b31be2c49b494bf36385b2da77353642344168b979025"}, @@ -5275,7 +5233,7 @@ huey = ["huey (>=2)"] loguru = ["loguru (>=0.5)"] opentelemetry = ["opentelemetry-distro (>=0.35b0)"] opentelemetry-experimental = ["opentelemetry-distro (>=0.40b0,<1.0)", "opentelemetry-instrumentation-aiohttp-client (>=0.40b0,<1.0)", "opentelemetry-instrumentation-django (>=0.40b0,<1.0)", "opentelemetry-instrumentation-fastapi (>=0.40b0,<1.0)", "opentelemetry-instrumentation-flask (>=0.40b0,<1.0)", "opentelemetry-instrumentation-requests (>=0.40b0,<1.0)", "opentelemetry-instrumentation-sqlite3 (>=0.40b0,<1.0)", "opentelemetry-instrumentation-urllib (>=0.40b0,<1.0)"] -pure-eval = ["asttokens", "executing", "pure-eval"] +pure-eval = ["asttokens", "executing", "pure_eval"] pymongo = ["pymongo (>=3.1)"] pyspark = ["pyspark (>=2.4.4)"] quart = ["blinker (>=1.1)", "quart (>=0.16.1)"] @@ -5402,63 +5360,6 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] -[[package]] -name = "shapely" -version = "2.0.2" -description = "Manipulation and analysis of geometric objects" -optional = false -python-versions = ">=3.7" -files = [ - {file = "shapely-2.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6ca8cffbe84ddde8f52b297b53f8e0687bd31141abb2c373fd8a9f032df415d6"}, - {file = "shapely-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:baa14fc27771e180c06b499a0a7ba697c7988c7b2b6cba9a929a19a4d2762de3"}, - {file = "shapely-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:36480e32c434d168cdf2f5e9862c84aaf4d714a43a8465ae3ce8ff327f0affb7"}, - {file = "shapely-2.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ef753200cbffd4f652efb2c528c5474e5a14341a473994d90ad0606522a46a2"}, - {file = "shapely-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a9a41ff4323fc9d6257759c26eb1cf3a61ebc7e611e024e6091f42977303fd3a"}, - {file = "shapely-2.0.2-cp310-cp310-win32.whl", hash = "sha256:72b5997272ae8c25f0fd5b3b967b3237e87fab7978b8d6cd5fa748770f0c5d68"}, - {file = "shapely-2.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:34eac2337cbd67650248761b140d2535855d21b969d76d76123317882d3a0c1a"}, - {file = "shapely-2.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5b0c052709c8a257c93b0d4943b0b7a3035f87e2d6a8ac9407b6a992d206422f"}, - {file = "shapely-2.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2d217e56ae067e87b4e1731d0dc62eebe887ced729ba5c2d4590e9e3e9fdbd88"}, - {file = "shapely-2.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:94ac128ae2ab4edd0bffcd4e566411ea7bdc738aeaf92c32a8a836abad725f9f"}, - {file = "shapely-2.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fa3ee28f5e63a130ec5af4dc3c4cb9c21c5788bb13c15e89190d163b14f9fb89"}, - {file = "shapely-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:737dba15011e5a9b54a8302f1748b62daa207c9bc06f820cd0ad32a041f1c6f2"}, - {file = "shapely-2.0.2-cp311-cp311-win32.whl", hash = "sha256:45ac6906cff0765455a7b49c1670af6e230c419507c13e2f75db638c8fc6f3bd"}, - {file = "shapely-2.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:dc9342fc82e374130db86a955c3c4525bfbf315a248af8277a913f30911bed9e"}, - {file = "shapely-2.0.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:06f193091a7c6112fc08dfd195a1e3846a64306f890b151fa8c63b3e3624202c"}, - {file = "shapely-2.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:eebe544df5c018134f3c23b6515877f7e4cd72851f88a8d0c18464f414d141a2"}, - {file = "shapely-2.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7e92e7c255f89f5cdf777690313311f422aa8ada9a3205b187113274e0135cd8"}, - {file = "shapely-2.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:be46d5509b9251dd9087768eaf35a71360de6afac82ce87c636990a0871aa18b"}, - {file = "shapely-2.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a5533a925d8e211d07636ffc2fdd9a7f9f13d54686d00577eeb11d16f00be9c4"}, - {file = "shapely-2.0.2-cp312-cp312-win32.whl", hash = "sha256:084b023dae8ad3d5b98acee9d3bf098fdf688eb0bb9b1401e8b075f6a627b611"}, - {file = "shapely-2.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:ea84d1cdbcf31e619d672b53c4532f06253894185ee7acb8ceb78f5f33cbe033"}, - {file = "shapely-2.0.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:ed1e99702125e7baccf401830a3b94d810d5c70b329b765fe93451fe14cf565b"}, - {file = "shapely-2.0.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e7d897e6bdc6bc64f7f65155dbbb30e49acaabbd0d9266b9b4041f87d6e52b3a"}, - {file = "shapely-2.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0521d76d1e8af01e712db71da9096b484f081e539d4f4a8c97342e7971d5e1b4"}, - {file = "shapely-2.0.2-cp37-cp37m-win32.whl", hash = "sha256:5324be299d4c533ecfcfd43424dfd12f9428fd6f12cda38a4316da001d6ef0ea"}, - {file = "shapely-2.0.2-cp37-cp37m-win_amd64.whl", hash = "sha256:78128357a0cee573257a0c2c388d4b7bf13cb7dbe5b3fe5d26d45ebbe2a39e25"}, - {file = "shapely-2.0.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:87dc2be34ac3a3a4a319b963c507ac06682978a5e6c93d71917618b14f13066e"}, - {file = "shapely-2.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:42997ac806e4583dad51c80a32d38570fd9a3d4778f5e2c98f9090aa7db0fe91"}, - {file = "shapely-2.0.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ccfd5fa10a37e67dbafc601c1ddbcbbfef70d34c3f6b0efc866ddbdb55893a6c"}, - {file = "shapely-2.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e7c95d3379ae3abb74058938a9fcbc478c6b2e28d20dace38f8b5c587dde90aa"}, - {file = "shapely-2.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6a21353d28209fb0d8cc083e08ca53c52666e0d8a1f9bbe23b6063967d89ed24"}, - {file = "shapely-2.0.2-cp38-cp38-win32.whl", hash = "sha256:03e63a99dfe6bd3beb8d5f41ec2086585bb969991d603f9aeac335ad396a06d4"}, - {file = "shapely-2.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:c6fd29fbd9cd76350bd5cc14c49de394a31770aed02d74203e23b928f3d2f1aa"}, - {file = "shapely-2.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1f217d28ecb48e593beae20a0082a95bd9898d82d14b8fcb497edf6bff9a44d7"}, - {file = "shapely-2.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:394e5085b49334fd5b94fa89c086edfb39c3ecab7f669e8b2a4298b9d523b3a5"}, - {file = "shapely-2.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:fd3ad17b64466a033848c26cb5b509625c87d07dcf39a1541461cacdb8f7e91c"}, - {file = "shapely-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d41a116fcad58048d7143ddb01285e1a8780df6dc1f56c3b1e1b7f12ed296651"}, - {file = "shapely-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dea9a0651333cf96ef5bb2035044e3ad6a54f87d90e50fe4c2636debf1b77abc"}, - {file = "shapely-2.0.2-cp39-cp39-win32.whl", hash = "sha256:b8eb0a92f7b8c74f9d8fdd1b40d395113f59bd8132ca1348ebcc1f5aece94b96"}, - {file = "shapely-2.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:794affd80ca0f2c536fc948a3afa90bd8fb61ebe37fe873483ae818e7f21def4"}, - {file = "shapely-2.0.2.tar.gz", hash = "sha256:1713cc04c171baffc5b259ba8531c58acc2a301707b7f021d88a15ed090649e7"}, -] - -[package.dependencies] -numpy = ">=1.14" - -[package.extras] -docs = ["matplotlib", "numpydoc (==1.1.*)", "sphinx", "sphinx-book-theme", "sphinx-remove-toctrees"] -test = ["pytest", "pytest-cov"] - [[package]] name = "shortuuid" version = "1.0.11" @@ -5568,7 +5469,7 @@ typing-extensions = ">=4.6.0" [package.extras] aiomysql = ["aiomysql (>=0.2.0)", "greenlet (!=0.4.17)"] aioodbc = ["aioodbc", "greenlet (!=0.4.17)"] -aiosqlite = ["aiosqlite", "greenlet (!=0.4.17)", "typing-extensions (!=3.10.0.1)"] +aiosqlite = ["aiosqlite", "greenlet (!=0.4.17)", "typing_extensions (!=3.10.0.1)"] asyncio = ["greenlet (!=0.4.17)"] asyncmy = ["asyncmy (>=0.2.3,!=0.2.4,!=0.2.6)", "greenlet (!=0.4.17)"] mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2,!=1.1.5)"] @@ -5578,7 +5479,7 @@ mssql-pyodbc = ["pyodbc"] mypy = ["mypy (>=0.910)"] mysql = ["mysqlclient (>=1.4.0)"] mysql-connector = ["mysql-connector-python"] -oracle = ["cx-oracle (>=8)"] +oracle = ["cx_oracle (>=8)"] oracle-oracledb = ["oracledb (>=1.0.1)"] postgresql = ["psycopg2 (>=2.7)"] postgresql-asyncpg = ["asyncpg", "greenlet (!=0.4.17)"] @@ -5588,7 +5489,7 @@ postgresql-psycopg2binary = ["psycopg2-binary"] postgresql-psycopg2cffi = ["psycopg2cffi"] postgresql-psycopgbinary = ["psycopg[binary] (>=3.0.7)"] pymysql = ["pymysql"] -sqlcipher = ["sqlcipher3-binary"] +sqlcipher = ["sqlcipher3_binary"] [[package]] name = "sqlparse" @@ -6683,4 +6584,4 @@ onnx = ["onnx", "onnxconverter-common", "onnxruntime_gpu", "onnxsim"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.11" -content-hash = "9e825cd3ec4777fcaf2aac90adb3d68fbdb7b114f3bcae89de32ff0f49dc8956" +content-hash = "29bc67ce4e603b9623edac9a6f09494fa604a272003f9faa8047bd95205d7e17" diff --git a/pyproject.toml b/pyproject.toml index fee15228..26b2243c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "quadra" -version = "2.2.2" +version = "2.2.3" description = "Deep Learning experiment orchestration library" authors = [ "Federico Belotti ", @@ -60,7 +60,7 @@ python_dotenv = "~0.21" rich = "~13.2" scikit_learn = "~1.2" pydantic = "1.10.10" -grad_cam = "1.4.6" +grad-cam-orobix = "1.5.3.dev001" matplotlib = "~3.6" seaborn = "~0.12" albumentations = "~1.3" @@ -72,7 +72,7 @@ h5py = "~3.8" timm = "0.9.12" segmentation_models_pytorch-orobix = "0.3.3.dev1" -anomalib-orobix = "0.7.0.dev140" +anomalib-orobix = "0.7.0.dev141" xxhash = "~3.2" torchinfo = "~1.8" typing_extensions = { version = "4.11.0", python = "<3.10" } diff --git a/quadra/__init__.py b/quadra/__init__.py index dca7522f..c3167475 100644 --- a/quadra/__init__.py +++ b/quadra/__init__.py @@ -1,4 +1,4 @@ -__version__ = "2.2.2" +__version__ = "2.2.3" def get_version(): diff --git a/quadra/modules/classification/base.py b/quadra/modules/classification/base.py index 4bb6bdfc..bfdf9a9f 100644 --- a/quadra/modules/classification/base.py +++ b/quadra/modules/classification/base.py @@ -138,13 +138,9 @@ def prepare_gradcam(self) -> None: if isinstance(self.model.features_extractor, timm.models.resnet.ResNet): target_layers = [cast(BaseNetworkBuilder, self.model).features_extractor.layer4[-1]] - # Get model current device - device = next(self.model.parameters()).device - self.cam = GradCAM( model=self.model, target_layers=target_layers, - use_cuda=device.type == "cuda", ) # Activating gradients for p in self.model.features_extractor.layer4[-1].parameters(): @@ -262,7 +258,7 @@ def __init__( self.gradcam = False else: target_layers = [model[0].features_extractor.layer4[-1]] - self.cam = GradCAM(model=model, target_layers=target_layers, use_cuda=torch.cuda.is_available()) + self.cam = GradCAM(model=model, target_layers=target_layers) def forward(self, x): return self.model(x) diff --git a/quadra/tasks/classification.py b/quadra/tasks/classification.py index b646d391..a87ced6c 100644 --- a/quadra/tasks/classification.py +++ b/quadra/tasks/classification.py @@ -1138,7 +1138,6 @@ def prepare_gradcam(self) -> None: self.cam = GradCAM( model=self.deployment_model.model, target_layers=target_layers, - use_cuda=(self.device != "cpu"), ) for p in self.deployment_model.model.features_extractor.layer4[-1].parameters(): p.requires_grad = True diff --git a/quadra/utils/models.py b/quadra/utils/models.py index e78cb10b..54590d52 100644 --- a/quadra/utils/models.py +++ b/quadra/utils/models.py @@ -131,7 +131,6 @@ def get_feature( cam = GradCAM( model=feature_extractor, target_layers=target_layers, - use_cuda=torch.cuda.is_available(), ) for p in feature_extractor.features_extractor.layer4[-1].parameters(): p.requires_grad = True diff --git a/tests/tasks/test_anomaly.py b/tests/tasks/test_anomaly.py index cc2c11db..823064d7 100644 --- a/tests/tasks/test_anomaly.py +++ b/tests/tasks/test_anomaly.py @@ -286,6 +286,10 @@ def test_fastflow(tmp_path: Path, base_anomaly_dataset: base_anomaly_dataset, ta shutil.rmtree(tmp_path) +@pytest.mark.skip( + reason="This test requires anomalib with imgaug installed which we don't want to include in the dependencies as it " + "requires the non headless version of opencv-python" +) @pytest.mark.slow @pytest.mark.usefixtures("mock_training") @pytest.mark.parametrize("task", ["classification", "segmentation"])