From cd28481e53afeafcceffbe2e40b6006189e79f85 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Mon, 31 Jul 2023 20:09:45 +0200 Subject: [PATCH] [qa] Changes to docformatter; Update minimum Python version to 3.9 --- src/ptbench/configs/models/alexnet.py | 1 - .../configs/models/alexnet_pretrained.py | 1 - src/ptbench/configs/models/densenet.py | 1 - .../configs/models/densenet_pretrained.py | 1 - .../configs/models/logistic_regression.py | 1 - src/ptbench/configs/models/pasa.py | 1 - src/ptbench/configs/models/signs_to_tb.py | 1 - .../configs/models_datasets/densenet_rs.py | 1 - src/ptbench/data/hivtb/__init__.py | 1 - src/ptbench/data/hivtb/fold_0.py | 1 - src/ptbench/data/hivtb/fold_1.py | 1 - src/ptbench/data/hivtb/fold_2.py | 1 - src/ptbench/data/hivtb/fold_3.py | 1 - src/ptbench/data/hivtb/fold_4.py | 1 - src/ptbench/data/hivtb/fold_5.py | 1 - src/ptbench/data/hivtb/fold_6.py | 1 - src/ptbench/data/hivtb/fold_7.py | 1 - src/ptbench/data/hivtb/fold_8.py | 1 - src/ptbench/data/hivtb/fold_9.py | 1 - src/ptbench/data/image_utils.py | 8 +- src/ptbench/data/mc_ch_in_pc/default.py | 1 - src/ptbench/data/padchest/__init__.py | 1 - .../data/padchest/cardiomegaly_idiap.py | 1 - src/ptbench/data/padchest/idiap.py | 1 - src/ptbench/data/padchest/no_tb_idiap.py | 1 - src/ptbench/data/padchest/tb_idiap.py | 1 - src/ptbench/data/tbpoc/__init__.py | 1 - src/ptbench/data/tbpoc/fold_0.py | 1 - src/ptbench/data/tbpoc/fold_1.py | 1 - src/ptbench/data/tbpoc/fold_2.py | 1 - src/ptbench/data/tbpoc/fold_3.py | 1 - src/ptbench/data/tbpoc/fold_4.py | 1 - src/ptbench/data/tbpoc/fold_5.py | 1 - src/ptbench/data/tbpoc/fold_6.py | 1 - src/ptbench/data/tbpoc/fold_7.py | 1 - src/ptbench/data/tbpoc/fold_8.py | 1 - src/ptbench/data/tbpoc/fold_9.py | 1 - src/ptbench/engine/evaluator.py | 6 +- src/ptbench/models/normalizer.py | 1 - src/ptbench/models/transforms.py | 1 - src/ptbench/scripts/relevance_analysis.py | 1 - src/ptbench/utils/resources.py | 1 - tests/data/iris.json | 312 +++++++++--------- tests/test_11k.py | 1 - tests/test_11k_RS.py | 1 - tests/test_11k_v2.py | 1 - tests/test_11k_v2_RS.py | 1 - tests/test_ch_RS.py | 1 - tests/test_cli.py | 1 - tests/test_database_split.py | 17 +- tests/test_hivtb.py | 1 - tests/test_hivtb_RS.py | 1 - tests/test_image_utils.py | 1 - tests/test_in_RS.py | 1 - tests/test_indian.py | 1 - tests/test_mc_RS.py | 1 - tests/test_mc_ch.py | 1 - tests/test_mc_ch_RS.py | 1 - tests/test_mc_ch_in.py | 1 - tests/test_mc_ch_in_11k.py | 1 - tests/test_mc_ch_in_11k_RS.py | 1 - tests/test_mc_ch_in_11kv2.py | 1 - tests/test_mc_ch_in_11kv2_RS.py | 1 - tests/test_mc_ch_in_RS.py | 1 - tests/test_mc_ch_in_pc.py | 1 - tests/test_mc_ch_in_pc_RS.py | 1 - tests/test_measures.py | 1 - tests/test_nih_cxr14.py | 1 - tests/test_nih_cxr14_pc.py | 1 - tests/test_pc.py | 1 - tests/test_pc_RS.py | 1 - tests/test_shenzhen.py | 1 - tests/test_tbpoc.py | 1 - tests/test_tbpoc_RS.py | 1 - tests/test_tranforms.py | 1 - 75 files changed, 169 insertions(+), 245 deletions(-) diff --git a/src/ptbench/configs/models/alexnet.py b/src/ptbench/configs/models/alexnet.py index 0028e810..8de265c5 100644 --- a/src/ptbench/configs/models/alexnet.py +++ b/src/ptbench/configs/models/alexnet.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """AlexNet.""" from torch.nn import BCEWithLogitsLoss diff --git a/src/ptbench/configs/models/alexnet_pretrained.py b/src/ptbench/configs/models/alexnet_pretrained.py index 9c772f42..b6db6c59 100644 --- a/src/ptbench/configs/models/alexnet_pretrained.py +++ b/src/ptbench/configs/models/alexnet_pretrained.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """AlexNet.""" from torch.nn import BCEWithLogitsLoss diff --git a/src/ptbench/configs/models/densenet.py b/src/ptbench/configs/models/densenet.py index 5d453a6d..cce44a25 100644 --- a/src/ptbench/configs/models/densenet.py +++ b/src/ptbench/configs/models/densenet.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """DenseNet.""" from torch.nn import BCEWithLogitsLoss diff --git a/src/ptbench/configs/models/densenet_pretrained.py b/src/ptbench/configs/models/densenet_pretrained.py index 49b0162f..9e32807e 100644 --- a/src/ptbench/configs/models/densenet_pretrained.py +++ b/src/ptbench/configs/models/densenet_pretrained.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """DenseNet.""" from torch.nn import BCEWithLogitsLoss diff --git a/src/ptbench/configs/models/logistic_regression.py b/src/ptbench/configs/models/logistic_regression.py index 145dddd7..dab855aa 100644 --- a/src/ptbench/configs/models/logistic_regression.py +++ b/src/ptbench/configs/models/logistic_regression.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Feedforward network for Tuberculosis Detection. Simple feedforward network taking radiological signs in output and diff --git a/src/ptbench/configs/models/pasa.py b/src/ptbench/configs/models/pasa.py index b1a201e5..22e664a2 100644 --- a/src/ptbench/configs/models/pasa.py +++ b/src/ptbench/configs/models/pasa.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """CNN for Tuberculosis Detection. Implementation of the model architecture proposed by F. Pasa in the article diff --git a/src/ptbench/configs/models/signs_to_tb.py b/src/ptbench/configs/models/signs_to_tb.py index 1ce89b12..acec64f3 100644 --- a/src/ptbench/configs/models/signs_to_tb.py +++ b/src/ptbench/configs/models/signs_to_tb.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Feedforward network for Tuberculosis Detection. Simple feedforward network taking radiological signs in output and diff --git a/src/ptbench/configs/models_datasets/densenet_rs.py b/src/ptbench/configs/models_datasets/densenet_rs.py index 714404bf..b1ba206b 100644 --- a/src/ptbench/configs/models_datasets/densenet_rs.py +++ b/src/ptbench/configs/models_datasets/densenet_rs.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """CNN for radiological findings detection. A Densenet121 model for radiological extraction diff --git a/src/ptbench/data/hivtb/__init__.py b/src/ptbench/data/hivtb/__init__.py index e004c1dc..0fca31ae 100644 --- a/src/ptbench/data/hivtb/__init__.py +++ b/src/ptbench/data/hivtb/__init__.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for computer-aided diagnosis (only BMP files) * Reference: [HIV-TB-2019]_ diff --git a/src/ptbench/data/hivtb/fold_0.py b/src/ptbench/data/hivtb/fold_0.py index af3be161..dae7f3dc 100644 --- a/src/ptbench/data/hivtb/fold_0.py +++ b/src/ptbench/data/hivtb/fold_0.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 0) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_1.py b/src/ptbench/data/hivtb/fold_1.py index ec86cab3..e2f31bb9 100644 --- a/src/ptbench/data/hivtb/fold_1.py +++ b/src/ptbench/data/hivtb/fold_1.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 1) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_2.py b/src/ptbench/data/hivtb/fold_2.py index 56ae69fe..2bb387e7 100644 --- a/src/ptbench/data/hivtb/fold_2.py +++ b/src/ptbench/data/hivtb/fold_2.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 2) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_3.py b/src/ptbench/data/hivtb/fold_3.py index 5dbddeda..ff3ca7e6 100644 --- a/src/ptbench/data/hivtb/fold_3.py +++ b/src/ptbench/data/hivtb/fold_3.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 3) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_4.py b/src/ptbench/data/hivtb/fold_4.py index 9ab5a79f..11111025 100644 --- a/src/ptbench/data/hivtb/fold_4.py +++ b/src/ptbench/data/hivtb/fold_4.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 4) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_5.py b/src/ptbench/data/hivtb/fold_5.py index 445ce458..b27e34df 100644 --- a/src/ptbench/data/hivtb/fold_5.py +++ b/src/ptbench/data/hivtb/fold_5.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 5) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_6.py b/src/ptbench/data/hivtb/fold_6.py index fbbea2ad..f6cd1cf5 100644 --- a/src/ptbench/data/hivtb/fold_6.py +++ b/src/ptbench/data/hivtb/fold_6.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 6) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_7.py b/src/ptbench/data/hivtb/fold_7.py index dcce836d..7fabae5c 100644 --- a/src/ptbench/data/hivtb/fold_7.py +++ b/src/ptbench/data/hivtb/fold_7.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 7) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_8.py b/src/ptbench/data/hivtb/fold_8.py index 7ba95a1e..53a0e1a7 100644 --- a/src/ptbench/data/hivtb/fold_8.py +++ b/src/ptbench/data/hivtb/fold_8.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 8) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/hivtb/fold_9.py b/src/ptbench/data/hivtb/fold_9.py index 4a244adf..dcac4d53 100644 --- a/src/ptbench/data/hivtb/fold_9.py +++ b/src/ptbench/data/hivtb/fold_9.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """HIV-TB dataset for TB detection (cross validation fold 9) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/image_utils.py b/src/ptbench/data/image_utils.py index 9103126f..b9f8c810 100644 --- a/src/ptbench/data/image_utils.py +++ b/src/ptbench/data/image_utils.py @@ -1,8 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - - """Data loading code.""" import pathlib @@ -16,9 +14,9 @@ class SingleAutoLevel16to8: This transform assumes that the input image is gray-scaled. - To auto-level, we calculate the maximum and the minimum of the image, and - consider such a range should be mapped to the [0,255] range of the - destination image. + To auto-level, we calculate the maximum and the minimum of the + image, and consider such a range should be mapped to the [0,255] + range of the destination image. """ def __call__(self, img): diff --git a/src/ptbench/data/mc_ch_in_pc/default.py b/src/ptbench/data/mc_ch_in_pc/default.py index 0b8be8f4..4715b13d 100644 --- a/src/ptbench/data/mc_ch_in_pc/default.py +++ b/src/ptbench/data/mc_ch_in_pc/default.py @@ -1,7 +1,6 @@ # Copyright © 2022 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Aggregated dataset composed of Montgomery, Shenzhen, Indian and Padchest datasets.""" diff --git a/src/ptbench/data/padchest/__init__.py b/src/ptbench/data/padchest/__init__.py index f6f39a9e..1151b55f 100644 --- a/src/ptbench/data/padchest/__init__.py +++ b/src/ptbench/data/padchest/__init__.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Padchest dataset for computer-aided diagnosis. A large chest x-ray image dataset with multi-label annotated reports. diff --git a/src/ptbench/data/padchest/cardiomegaly_idiap.py b/src/ptbench/data/padchest/cardiomegaly_idiap.py index 25eaa6e8..d2538738 100644 --- a/src/ptbench/data/padchest/cardiomegaly_idiap.py +++ b/src/ptbench/data/padchest/cardiomegaly_idiap.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Padchest cardiomegaly (idiap protocol) dataset for computer-aided diagnosis. The first 40 images with cardiomegaly. diff --git a/src/ptbench/data/padchest/idiap.py b/src/ptbench/data/padchest/idiap.py index d91b552f..284a944d 100644 --- a/src/ptbench/data/padchest/idiap.py +++ b/src/ptbench/data/padchest/idiap.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Padchest (idiap protocol) dataset for computer-aided diagnosis. * See :py:mod:`ptbench.data.padchest` for dataset details diff --git a/src/ptbench/data/padchest/no_tb_idiap.py b/src/ptbench/data/padchest/no_tb_idiap.py index 78155abf..a424e0fe 100644 --- a/src/ptbench/data/padchest/no_tb_idiap.py +++ b/src/ptbench/data/padchest/no_tb_idiap.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Padchest tuberculosis (no TB idiap protocol) dataset for computer-aided diagnosis. diff --git a/src/ptbench/data/padchest/tb_idiap.py b/src/ptbench/data/padchest/tb_idiap.py index 51428935..1a251620 100644 --- a/src/ptbench/data/padchest/tb_idiap.py +++ b/src/ptbench/data/padchest/tb_idiap.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Padchest tuberculosis (idiap protocol) dataset for computer-aided diagnosis. The 125 healthy images are the first 125 padchest images with the following diff --git a/src/ptbench/data/tbpoc/__init__.py b/src/ptbench/data/tbpoc/__init__.py index 4d9f4550..00f5f42c 100644 --- a/src/ptbench/data/tbpoc/__init__.py +++ b/src/ptbench/data/tbpoc/__init__.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for computer-aided diagnosis. * Reference: [TB-POC-2018]_ diff --git a/src/ptbench/data/tbpoc/fold_0.py b/src/ptbench/data/tbpoc/fold_0.py index a440117f..332347a9 100644 --- a/src/ptbench/data/tbpoc/fold_0.py +++ b/src/ptbench/data/tbpoc/fold_0.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 0) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_1.py b/src/ptbench/data/tbpoc/fold_1.py index 95a54ee3..c8b055f3 100644 --- a/src/ptbench/data/tbpoc/fold_1.py +++ b/src/ptbench/data/tbpoc/fold_1.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 1) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_2.py b/src/ptbench/data/tbpoc/fold_2.py index 508c54a8..33a2329a 100644 --- a/src/ptbench/data/tbpoc/fold_2.py +++ b/src/ptbench/data/tbpoc/fold_2.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 2) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_3.py b/src/ptbench/data/tbpoc/fold_3.py index 28d34553..ac418f20 100644 --- a/src/ptbench/data/tbpoc/fold_3.py +++ b/src/ptbench/data/tbpoc/fold_3.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 3) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_4.py b/src/ptbench/data/tbpoc/fold_4.py index 90bff0b2..da21a882 100644 --- a/src/ptbench/data/tbpoc/fold_4.py +++ b/src/ptbench/data/tbpoc/fold_4.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 4) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_5.py b/src/ptbench/data/tbpoc/fold_5.py index cbe4ff6e..323996c7 100644 --- a/src/ptbench/data/tbpoc/fold_5.py +++ b/src/ptbench/data/tbpoc/fold_5.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 5) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_6.py b/src/ptbench/data/tbpoc/fold_6.py index 3edeb727..7be3befa 100644 --- a/src/ptbench/data/tbpoc/fold_6.py +++ b/src/ptbench/data/tbpoc/fold_6.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 6) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_7.py b/src/ptbench/data/tbpoc/fold_7.py index 3ef4fe0b..9c84b929 100644 --- a/src/ptbench/data/tbpoc/fold_7.py +++ b/src/ptbench/data/tbpoc/fold_7.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 7) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_8.py b/src/ptbench/data/tbpoc/fold_8.py index 6b68c0c3..c647f6f6 100644 --- a/src/ptbench/data/tbpoc/fold_8.py +++ b/src/ptbench/data/tbpoc/fold_8.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 8) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/data/tbpoc/fold_9.py b/src/ptbench/data/tbpoc/fold_9.py index 0f2565a4..aad4c14e 100644 --- a/src/ptbench/data/tbpoc/fold_9.py +++ b/src/ptbench/data/tbpoc/fold_9.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """TB-POC dataset for TB detection (cross validation fold 9) * Split reference: none (stratified kfolding) diff --git a/src/ptbench/engine/evaluator.py b/src/ptbench/engine/evaluator.py index a551dba6..9d14f790 100644 --- a/src/ptbench/engine/evaluator.py +++ b/src/ptbench/engine/evaluator.py @@ -1,14 +1,14 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Defines functionality for the evaluation of predictions.""" import logging import os import re -from typing import Iterable, Optional +from collections.abc import Iterable +from typing import Optional import matplotlib.pyplot as plt import numpy @@ -292,7 +292,6 @@ def run( ), ) data_df = data_df.set_index("index") - """# Save evaluation csv if output_folder is not None: fullpath = os.path.join(output_folder, f"{name}.csv") @@ -353,7 +352,6 @@ def run( axes.spines["right"].set_visible(False) axes.spines["top"].set_visible(False) axes.spines["left"].set_position(("data", -0.015)) - """if f1_thresh is not None and eer_thresh is not None: # get the closest possible threshold we have index = int(round(steps * f1_thresh)) diff --git a/src/ptbench/models/normalizer.py b/src/ptbench/models/normalizer.py index ce68f4b5..147efc7e 100644 --- a/src/ptbench/models/normalizer.py +++ b/src/ptbench/models/normalizer.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """A network model that prefixes a subtract/divide step to any other module.""" import torch diff --git a/src/ptbench/models/transforms.py b/src/ptbench/models/transforms.py index 585b5846..8ff0af72 100644 --- a/src/ptbench/models/transforms.py +++ b/src/ptbench/models/transforms.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """A transform that turns grayscale images to RGB.""" import torch diff --git a/src/ptbench/scripts/relevance_analysis.py b/src/ptbench/scripts/relevance_analysis.py index 1771c107..6be7abd5 100644 --- a/src/ptbench/scripts/relevance_analysis.py +++ b/src/ptbench/scripts/relevance_analysis.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Import copy import os import shutil. import numpy as np diff --git a/src/ptbench/utils/resources.py b/src/ptbench/utils/resources.py index d6ed0219..ca0f5efa 100644 --- a/src/ptbench/utils/resources.py +++ b/src/ptbench/utils/resources.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tools for interacting with the running computer or GPU.""" import logging diff --git a/tests/data/iris.json b/tests/data/iris.json index 1777efc3..4bbc1d84 100644 --- a/tests/data/iris.json +++ b/tests/data/iris.json @@ -1,156 +1,156 @@ -{ - "train": [ - [5.1,3.5,1.4,0.2,"Iris-setosa"], - [4.9,3,1.4,0.2,"Iris-setosa"], - [4.7,3.2,1.3,0.2,"Iris-setosa"], - [4.6,3.1,1.5,0.2,"Iris-setosa"], - [5,3.6,1.4,0.2,"Iris-setosa"], - [5.4,3.9,1.7,0.4,"Iris-setosa"], - [4.6,3.4,1.4,0.3,"Iris-setosa"], - [5,3.4,1.5,0.2,"Iris-setosa"], - [4.4,2.9,1.4,0.2,"Iris-setosa"], - [4.9,3.1,1.5,0.1,"Iris-setosa"], - [5.4,3.7,1.5,0.2,"Iris-setosa"], - [4.8,3.4,1.6,0.2,"Iris-setosa"], - [4.8,3,1.4,0.1,"Iris-setosa"], - [4.3,3,1.1,0.1,"Iris-setosa"], - [5.8,4,1.2,0.2,"Iris-setosa"], - [5.7,4.4,1.5,0.4,"Iris-setosa"], - [5.4,3.9,1.3,0.4,"Iris-setosa"], - [5.1,3.5,1.4,0.3,"Iris-setosa"], - [5.7,3.8,1.7,0.3,"Iris-setosa"], - [5.1,3.8,1.5,0.3,"Iris-setosa"], - [5.4,3.4,1.7,0.2,"Iris-setosa"], - [5.1,3.7,1.5,0.4,"Iris-setosa"], - [4.6,3.6,1,0.2,"Iris-setosa"], - [5.1,3.3,1.7,0.5,"Iris-setosa"], - [4.8,3.4,1.9,0.2,"Iris-setosa"], - [7,3.2,4.7,1.4,"Iris-versicolor"], - [6.4,3.2,4.5,1.5,"Iris-versicolor"], - [6.9,3.1,4.9,1.5,"Iris-versicolor"], - [5.5,2.3,4,1.3,"Iris-versicolor"], - [6.5,2.8,4.6,1.5,"Iris-versicolor"], - [5.7,2.8,4.5,1.3,"Iris-versicolor"], - [6.3,3.3,4.7,1.6,"Iris-versicolor"], - [4.9,2.4,3.3,1,"Iris-versicolor"], - [6.6,2.9,4.6,1.3,"Iris-versicolor"], - [5.2,2.7,3.9,1.4,"Iris-versicolor"], - [5,2,3.5,1,"Iris-versicolor"], - [5.9,3,4.2,1.5,"Iris-versicolor"], - [6,2.2,4,1,"Iris-versicolor"], - [6.1,2.9,4.7,1.4,"Iris-versicolor"], - [5.6,2.9,3.6,1.3,"Iris-versicolor"], - [6.7,3.1,4.4,1.4,"Iris-versicolor"], - [5.6,3,4.5,1.5,"Iris-versicolor"], - [5.8,2.7,4.1,1,"Iris-versicolor"], - [6.2,2.2,4.5,1.5,"Iris-versicolor"], - [5.6,2.5,3.9,1.1,"Iris-versicolor"], - [5.9,3.2,4.8,1.8,"Iris-versicolor"], - [6.1,2.8,4,1.3,"Iris-versicolor"], - [6.3,2.5,4.9,1.5,"Iris-versicolor"], - [6.1,2.8,4.7,1.2,"Iris-versicolor"], - [6.4,2.9,4.3,1.3,"Iris-versicolor"], - [6.3,3.3,6,2.5,"Iris-virginica"], - [5.8,2.7,5.1,1.9,"Iris-virginica"], - [7.1,3,5.9,2.1,"Iris-virginica"], - [6.3,2.9,5.6,1.8,"Iris-virginica"], - [6.5,3,5.8,2.2,"Iris-virginica"], - [7.6,3,6.6,2.1,"Iris-virginica"], - [4.9,2.5,4.5,1.7,"Iris-virginica"], - [7.3,2.9,6.3,1.8,"Iris-virginica"], - [6.7,2.5,5.8,1.8,"Iris-virginica"], - [7.2,3.6,6.1,2.5,"Iris-virginica"], - [6.5,3.2,5.1,2,"Iris-virginica"], - [6.4,2.7,5.3,1.9,"Iris-virginica"], - [6.8,3,5.5,2.1,"Iris-virginica"], - [5.7,2.5,5,2,"Iris-virginica"], - [5.8,2.8,5.1,2.4,"Iris-virginica"], - [6.4,3.2,5.3,2.3,"Iris-virginica"], - [6.5,3,5.5,1.8,"Iris-virginica"], - [7.7,3.8,6.7,2.2,"Iris-virginica"], - [7.7,2.6,6.9,2.3,"Iris-virginica"], - [6,2.2,5,1.5,"Iris-virginica"], - [6.9,3.2,5.7,2.3,"Iris-virginica"], - [5.6,2.8,4.9,2,"Iris-virginica"], - [7.7,2.8,6.7,2,"Iris-virginica"], - [6.3,2.7,4.9,1.8,"Iris-virginica"], - [6.7,3.3,5.7,2.1,"Iris-virginica"] - ], - "test": [ - [5,3,1.6,0.2,"Iris-setosa"], - [5,3.4,1.6,0.4,"Iris-setosa"], - [5.2,3.5,1.5,0.2,"Iris-setosa"], - [5.2,3.4,1.4,0.2,"Iris-setosa"], - [4.7,3.2,1.6,0.2,"Iris-setosa"], - [4.8,3.1,1.6,0.2,"Iris-setosa"], - [5.4,3.4,1.5,0.4,"Iris-setosa"], - [5.2,4.1,1.5,0.1,"Iris-setosa"], - [5.5,4.2,1.4,0.2,"Iris-setosa"], - [4.9,3.1,1.5,0.1,"Iris-setosa"], - [5,3.2,1.2,0.2,"Iris-setosa"], - [5.5,3.5,1.3,0.2,"Iris-setosa"], - [4.9,3.1,1.5,0.1,"Iris-setosa"], - [4.4,3,1.3,0.2,"Iris-setosa"], - [5.1,3.4,1.5,0.2,"Iris-setosa"], - [5,3.5,1.3,0.3,"Iris-setosa"], - [4.5,2.3,1.3,0.3,"Iris-setosa"], - [4.4,3.2,1.3,0.2,"Iris-setosa"], - [5,3.5,1.6,0.6,"Iris-setosa"], - [5.1,3.8,1.9,0.4,"Iris-setosa"], - [4.8,3,1.4,0.3,"Iris-setosa"], - [5.1,3.8,1.6,0.2,"Iris-setosa"], - [4.6,3.2,1.4,0.2,"Iris-setosa"], - [5.3,3.7,1.5,0.2,"Iris-setosa"], - [5,3.3,1.4,0.2,"Iris-setosa"], - [6.6,3,4.4,1.4,"Iris-versicolor"], - [6.8,2.8,4.8,1.4,"Iris-versicolor"], - [6.7,3,5,1.7,"Iris-versicolor"], - [6,2.9,4.5,1.5,"Iris-versicolor"], - [5.7,2.6,3.5,1,"Iris-versicolor"], - [5.5,2.4,3.8,1.1,"Iris-versicolor"], - [5.5,2.4,3.7,1,"Iris-versicolor"], - [5.8,2.7,3.9,1.2,"Iris-versicolor"], - [6,2.7,5.1,1.6,"Iris-versicolor"], - [5.4,3,4.5,1.5,"Iris-versicolor"], - [6,3.4,4.5,1.6,"Iris-versicolor"], - [6.7,3.1,4.7,1.5,"Iris-versicolor"], - [6.3,2.3,4.4,1.3,"Iris-versicolor"], - [5.6,3,4.1,1.3,"Iris-versicolor"], - [5.5,2.5,4,1.3,"Iris-versicolor"], - [5.5,2.6,4.4,1.2,"Iris-versicolor"], - [6.1,3,4.6,1.4,"Iris-versicolor"], - [5.8,2.6,4,1.2,"Iris-versicolor"], - [5,2.3,3.3,1,"Iris-versicolor"], - [5.6,2.7,4.2,1.3,"Iris-versicolor"], - [5.7,3,4.2,1.2,"Iris-versicolor"], - [5.7,2.9,4.2,1.3,"Iris-versicolor"], - [6.2,2.9,4.3,1.3,"Iris-versicolor"], - [5.1,2.5,3,1.1,"Iris-versicolor"], - [5.7,2.8,4.1,1.3,"Iris-versicolor"], - [7.2,3.2,6,1.8,"Iris-virginica"], - [6.2,2.8,4.8,1.8,"Iris-virginica"], - [6.1,3,4.9,1.8,"Iris-virginica"], - [6.4,2.8,5.6,2.1,"Iris-virginica"], - [7.2,3,5.8,1.6,"Iris-virginica"], - [7.4,2.8,6.1,1.9,"Iris-virginica"], - [7.9,3.8,6.4,2,"Iris-virginica"], - [6.4,2.8,5.6,2.2,"Iris-virginica"], - [6.3,2.8,5.1,1.5,"Iris-virginica"], - [6.1,2.6,5.6,1.4,"Iris-virginica"], - [7.7,3,6.1,2.3,"Iris-virginica"], - [6.3,3.4,5.6,2.4,"Iris-virginica"], - [6.4,3.1,5.5,1.8,"Iris-virginica"], - [6,3,4.8,1.8,"Iris-virginica"], - [6.9,3.1,5.4,2.1,"Iris-virginica"], - [6.7,3.1,5.6,2.4,"Iris-virginica"], - [6.9,3.1,5.1,2.3,"Iris-virginica"], - [5.8,2.7,5.1,1.9,"Iris-virginica"], - [6.8,3.2,5.9,2.3,"Iris-virginica"], - [6.7,3.3,5.7,2.5,"Iris-virginica"], - [6.7,3,5.2,2.3,"Iris-virginica"], - [6.3,2.5,5,1.9,"Iris-virginica"], - [6.5,3,5.2,2,"Iris-virginica"], - [6.2,3.4,5.4,2.3,"Iris-virginica"], - [5.9,3,5.1,1.8,"Iris-virginica"] - ] -} +{ + "train": [ + [5.1, 3.5, 1.4, 0.2, "Iris-setosa"], + [4.9, 3, 1.4, 0.2, "Iris-setosa"], + [4.7, 3.2, 1.3, 0.2, "Iris-setosa"], + [4.6, 3.1, 1.5, 0.2, "Iris-setosa"], + [5, 3.6, 1.4, 0.2, "Iris-setosa"], + [5.4, 3.9, 1.7, 0.4, "Iris-setosa"], + [4.6, 3.4, 1.4, 0.3, "Iris-setosa"], + [5, 3.4, 1.5, 0.2, "Iris-setosa"], + [4.4, 2.9, 1.4, 0.2, "Iris-setosa"], + [4.9, 3.1, 1.5, 0.1, "Iris-setosa"], + [5.4, 3.7, 1.5, 0.2, "Iris-setosa"], + [4.8, 3.4, 1.6, 0.2, "Iris-setosa"], + [4.8, 3, 1.4, 0.1, "Iris-setosa"], + [4.3, 3, 1.1, 0.1, "Iris-setosa"], + [5.8, 4, 1.2, 0.2, "Iris-setosa"], + [5.7, 4.4, 1.5, 0.4, "Iris-setosa"], + [5.4, 3.9, 1.3, 0.4, "Iris-setosa"], + [5.1, 3.5, 1.4, 0.3, "Iris-setosa"], + [5.7, 3.8, 1.7, 0.3, "Iris-setosa"], + [5.1, 3.8, 1.5, 0.3, "Iris-setosa"], + [5.4, 3.4, 1.7, 0.2, "Iris-setosa"], + [5.1, 3.7, 1.5, 0.4, "Iris-setosa"], + [4.6, 3.6, 1, 0.2, "Iris-setosa"], + [5.1, 3.3, 1.7, 0.5, "Iris-setosa"], + [4.8, 3.4, 1.9, 0.2, "Iris-setosa"], + [7, 3.2, 4.7, 1.4, "Iris-versicolor"], + [6.4, 3.2, 4.5, 1.5, "Iris-versicolor"], + [6.9, 3.1, 4.9, 1.5, "Iris-versicolor"], + [5.5, 2.3, 4, 1.3, "Iris-versicolor"], + [6.5, 2.8, 4.6, 1.5, "Iris-versicolor"], + [5.7, 2.8, 4.5, 1.3, "Iris-versicolor"], + [6.3, 3.3, 4.7, 1.6, "Iris-versicolor"], + [4.9, 2.4, 3.3, 1, "Iris-versicolor"], + [6.6, 2.9, 4.6, 1.3, "Iris-versicolor"], + [5.2, 2.7, 3.9, 1.4, "Iris-versicolor"], + [5, 2, 3.5, 1, "Iris-versicolor"], + [5.9, 3, 4.2, 1.5, "Iris-versicolor"], + [6, 2.2, 4, 1, "Iris-versicolor"], + [6.1, 2.9, 4.7, 1.4, "Iris-versicolor"], + [5.6, 2.9, 3.6, 1.3, "Iris-versicolor"], + [6.7, 3.1, 4.4, 1.4, "Iris-versicolor"], + [5.6, 3, 4.5, 1.5, "Iris-versicolor"], + [5.8, 2.7, 4.1, 1, "Iris-versicolor"], + [6.2, 2.2, 4.5, 1.5, "Iris-versicolor"], + [5.6, 2.5, 3.9, 1.1, "Iris-versicolor"], + [5.9, 3.2, 4.8, 1.8, "Iris-versicolor"], + [6.1, 2.8, 4, 1.3, "Iris-versicolor"], + [6.3, 2.5, 4.9, 1.5, "Iris-versicolor"], + [6.1, 2.8, 4.7, 1.2, "Iris-versicolor"], + [6.4, 2.9, 4.3, 1.3, "Iris-versicolor"], + [6.3, 3.3, 6, 2.5, "Iris-virginica"], + [5.8, 2.7, 5.1, 1.9, "Iris-virginica"], + [7.1, 3, 5.9, 2.1, "Iris-virginica"], + [6.3, 2.9, 5.6, 1.8, "Iris-virginica"], + [6.5, 3, 5.8, 2.2, "Iris-virginica"], + [7.6, 3, 6.6, 2.1, "Iris-virginica"], + [4.9, 2.5, 4.5, 1.7, "Iris-virginica"], + [7.3, 2.9, 6.3, 1.8, "Iris-virginica"], + [6.7, 2.5, 5.8, 1.8, "Iris-virginica"], + [7.2, 3.6, 6.1, 2.5, "Iris-virginica"], + [6.5, 3.2, 5.1, 2, "Iris-virginica"], + [6.4, 2.7, 5.3, 1.9, "Iris-virginica"], + [6.8, 3, 5.5, 2.1, "Iris-virginica"], + [5.7, 2.5, 5, 2, "Iris-virginica"], + [5.8, 2.8, 5.1, 2.4, "Iris-virginica"], + [6.4, 3.2, 5.3, 2.3, "Iris-virginica"], + [6.5, 3, 5.5, 1.8, "Iris-virginica"], + [7.7, 3.8, 6.7, 2.2, "Iris-virginica"], + [7.7, 2.6, 6.9, 2.3, "Iris-virginica"], + [6, 2.2, 5, 1.5, "Iris-virginica"], + [6.9, 3.2, 5.7, 2.3, "Iris-virginica"], + [5.6, 2.8, 4.9, 2, "Iris-virginica"], + [7.7, 2.8, 6.7, 2, "Iris-virginica"], + [6.3, 2.7, 4.9, 1.8, "Iris-virginica"], + [6.7, 3.3, 5.7, 2.1, "Iris-virginica"] + ], + "test": [ + [5, 3, 1.6, 0.2, "Iris-setosa"], + [5, 3.4, 1.6, 0.4, "Iris-setosa"], + [5.2, 3.5, 1.5, 0.2, "Iris-setosa"], + [5.2, 3.4, 1.4, 0.2, "Iris-setosa"], + [4.7, 3.2, 1.6, 0.2, "Iris-setosa"], + [4.8, 3.1, 1.6, 0.2, "Iris-setosa"], + [5.4, 3.4, 1.5, 0.4, "Iris-setosa"], + [5.2, 4.1, 1.5, 0.1, "Iris-setosa"], + [5.5, 4.2, 1.4, 0.2, "Iris-setosa"], + [4.9, 3.1, 1.5, 0.1, "Iris-setosa"], + [5, 3.2, 1.2, 0.2, "Iris-setosa"], + [5.5, 3.5, 1.3, 0.2, "Iris-setosa"], + [4.9, 3.1, 1.5, 0.1, "Iris-setosa"], + [4.4, 3, 1.3, 0.2, "Iris-setosa"], + [5.1, 3.4, 1.5, 0.2, "Iris-setosa"], + [5, 3.5, 1.3, 0.3, "Iris-setosa"], + [4.5, 2.3, 1.3, 0.3, "Iris-setosa"], + [4.4, 3.2, 1.3, 0.2, "Iris-setosa"], + [5, 3.5, 1.6, 0.6, "Iris-setosa"], + [5.1, 3.8, 1.9, 0.4, "Iris-setosa"], + [4.8, 3, 1.4, 0.3, "Iris-setosa"], + [5.1, 3.8, 1.6, 0.2, "Iris-setosa"], + [4.6, 3.2, 1.4, 0.2, "Iris-setosa"], + [5.3, 3.7, 1.5, 0.2, "Iris-setosa"], + [5, 3.3, 1.4, 0.2, "Iris-setosa"], + [6.6, 3, 4.4, 1.4, "Iris-versicolor"], + [6.8, 2.8, 4.8, 1.4, "Iris-versicolor"], + [6.7, 3, 5, 1.7, "Iris-versicolor"], + [6, 2.9, 4.5, 1.5, "Iris-versicolor"], + [5.7, 2.6, 3.5, 1, "Iris-versicolor"], + [5.5, 2.4, 3.8, 1.1, "Iris-versicolor"], + [5.5, 2.4, 3.7, 1, "Iris-versicolor"], + [5.8, 2.7, 3.9, 1.2, "Iris-versicolor"], + [6, 2.7, 5.1, 1.6, "Iris-versicolor"], + [5.4, 3, 4.5, 1.5, "Iris-versicolor"], + [6, 3.4, 4.5, 1.6, "Iris-versicolor"], + [6.7, 3.1, 4.7, 1.5, "Iris-versicolor"], + [6.3, 2.3, 4.4, 1.3, "Iris-versicolor"], + [5.6, 3, 4.1, 1.3, "Iris-versicolor"], + [5.5, 2.5, 4, 1.3, "Iris-versicolor"], + [5.5, 2.6, 4.4, 1.2, "Iris-versicolor"], + [6.1, 3, 4.6, 1.4, "Iris-versicolor"], + [5.8, 2.6, 4, 1.2, "Iris-versicolor"], + [5, 2.3, 3.3, 1, "Iris-versicolor"], + [5.6, 2.7, 4.2, 1.3, "Iris-versicolor"], + [5.7, 3, 4.2, 1.2, "Iris-versicolor"], + [5.7, 2.9, 4.2, 1.3, "Iris-versicolor"], + [6.2, 2.9, 4.3, 1.3, "Iris-versicolor"], + [5.1, 2.5, 3, 1.1, "Iris-versicolor"], + [5.7, 2.8, 4.1, 1.3, "Iris-versicolor"], + [7.2, 3.2, 6, 1.8, "Iris-virginica"], + [6.2, 2.8, 4.8, 1.8, "Iris-virginica"], + [6.1, 3, 4.9, 1.8, "Iris-virginica"], + [6.4, 2.8, 5.6, 2.1, "Iris-virginica"], + [7.2, 3, 5.8, 1.6, "Iris-virginica"], + [7.4, 2.8, 6.1, 1.9, "Iris-virginica"], + [7.9, 3.8, 6.4, 2, "Iris-virginica"], + [6.4, 2.8, 5.6, 2.2, "Iris-virginica"], + [6.3, 2.8, 5.1, 1.5, "Iris-virginica"], + [6.1, 2.6, 5.6, 1.4, "Iris-virginica"], + [7.7, 3, 6.1, 2.3, "Iris-virginica"], + [6.3, 3.4, 5.6, 2.4, "Iris-virginica"], + [6.4, 3.1, 5.5, 1.8, "Iris-virginica"], + [6, 3, 4.8, 1.8, "Iris-virginica"], + [6.9, 3.1, 5.4, 2.1, "Iris-virginica"], + [6.7, 3.1, 5.6, 2.4, "Iris-virginica"], + [6.9, 3.1, 5.1, 2.3, "Iris-virginica"], + [5.8, 2.7, 5.1, 1.9, "Iris-virginica"], + [6.8, 3.2, 5.9, 2.3, "Iris-virginica"], + [6.7, 3.3, 5.7, 2.5, "Iris-virginica"], + [6.7, 3, 5.2, 2.3, "Iris-virginica"], + [6.3, 2.5, 5, 1.9, "Iris-virginica"], + [6.5, 3, 5.2, 2, "Iris-virginica"], + [6.2, 3.4, 5.4, 2.3, "Iris-virginica"], + [5.9, 3, 5.1, 1.8, "Iris-virginica"] + ] +} diff --git a/tests/test_11k.py b/tests/test_11k.py index 2a82b459..b08a249c 100644 --- a/tests/test_11k.py +++ b/tests/test_11k.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for TBX11K simplified dataset split 1.""" import pytest diff --git a/tests/test_11k_RS.py b/tests/test_11k_RS.py index 9cbcee20..1f9d975d 100644 --- a/tests/test_11k_RS.py +++ b/tests/test_11k_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Extended TBX11K simplified dataset split 1.""" import pytest diff --git a/tests/test_11k_v2.py b/tests/test_11k_v2.py index 8751a9b8..9feab3ce 100644 --- a/tests/test_11k_v2.py +++ b/tests/test_11k_v2.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for TBX11K simplified dataset split 2.""" import pytest diff --git a/tests/test_11k_v2_RS.py b/tests/test_11k_v2_RS.py index 4b1c7a4c..590d2872 100644 --- a/tests/test_11k_v2_RS.py +++ b/tests/test_11k_v2_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Extended TBX11K simplified dataset split 2.""" import pytest diff --git a/tests/test_ch_RS.py b/tests/test_ch_RS.py index fbe1c3b6..0f1fa602 100644 --- a/tests/test_ch_RS.py +++ b/tests/test_ch_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Extended Shenzhen dataset.""" import pytest diff --git a/tests/test_cli.py b/tests/test_cli.py index dd6e3445..67b39bd7 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for our CLI applications.""" import contextlib diff --git a/tests/test_database_split.py b/tests/test_database_split.py index 851a1097..aa360e2c 100644 --- a/tests/test_database_split.py +++ b/tests/test_database_split.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Test code for datasets.""" from ptbench.data.split import CSVDatabaseSplit, JSONDatabaseSplit @@ -14,14 +13,14 @@ def test_csv_loading(datadir): assert len(database_split["iris-train"]) == 75 for k in database_split["iris-train"]: for f in range(4): - assert type(k[f]) == str # csv only loads stringd - assert type(k[4]) == str + assert isinstance(k[f], str) # csv only loads stringd + assert isinstance(k[4], str) assert len(database_split["iris-test"]) == 75 for k in database_split["iris-test"]: for f in range(4): - assert type(k[f]) == str # csv only loads stringd - assert type(k[4]) == str + assert isinstance(k[f], str) # csv only loads stringd + assert isinstance(k[4], str) assert k[4] in ("Iris-setosa", "Iris-versicolor", "Iris-virginica") @@ -33,11 +32,11 @@ def test_json_loading(datadir): assert len(database_split["train"]) == 75 for k in database_split["train"]: for f in range(4): - assert type(k[f]) in [int, float] - assert type(k[4]) == str + assert isinstance(k[f], (int, float)) + assert isinstance(k[4], str) assert len(database_split["test"]) == 75 for k in database_split["test"]: for f in range(4): - assert type(k[f]) in [int, float] - assert type(k[4]) == str + assert isinstance(k[f], (int, float)) + assert isinstance(k[4], str) diff --git a/tests/test_hivtb.py b/tests/test_hivtb.py index 0398085a..37876051 100644 --- a/tests/test_hivtb.py +++ b/tests/test_hivtb.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for HIV-TB dataset.""" import pytest diff --git a/tests/test_hivtb_RS.py b/tests/test_hivtb_RS.py index fb9732b4..9a440598 100644 --- a/tests/test_hivtb_RS.py +++ b/tests/test_hivtb_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for HIV-TB_RS dataset.""" import pytest diff --git a/tests/test_image_utils.py b/tests/test_image_utils.py index 3b56fad9..e6da9cee 100644 --- a/tests/test_image_utils.py +++ b/tests/test_image_utils.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for image utilities.""" import numpy diff --git a/tests/test_in_RS.py b/tests/test_in_RS.py index b4215593..551265ad 100644 --- a/tests/test_in_RS.py +++ b/tests/test_in_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Extended Indian dataset.""" import pytest diff --git a/tests/test_indian.py b/tests/test_indian.py index f7d16ff8..87660c1a 100644 --- a/tests/test_indian.py +++ b/tests/test_indian.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Indian dataset.""" import pytest diff --git a/tests/test_mc_RS.py b/tests/test_mc_RS.py index 4f7b4e6e..a0175c23 100644 --- a/tests/test_mc_RS.py +++ b/tests/test_mc_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Extended Montgomery dataset.""" import pytest diff --git a/tests/test_mc_ch.py b/tests/test_mc_ch.py index 88557633..17c1fb4c 100644 --- a/tests/test_mc_ch.py +++ b/tests/test_mc_ch.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen dataset.""" import pytest diff --git a/tests/test_mc_ch_RS.py b/tests/test_mc_ch_RS.py index 327998b1..7e916229 100644 --- a/tests/test_mc_ch_RS.py +++ b/tests/test_mc_ch_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen dataset.""" import pytest diff --git a/tests/test_mc_ch_in.py b/tests/test_mc_ch_in.py index a3ae8931..7305b66b 100644 --- a/tests/test_mc_ch_in.py +++ b/tests/test_mc_ch_in.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian dataset.""" import pytest diff --git a/tests/test_mc_ch_in_11k.py b/tests/test_mc_ch_in_11k.py index f7be318e..964faf06 100644 --- a/tests/test_mc_ch_in_11k.py +++ b/tests/test_mc_ch_in_11k.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian dataset.""" import pytest diff --git a/tests/test_mc_ch_in_11k_RS.py b/tests/test_mc_ch_in_11k_RS.py index bc3fcfb5..f8843bef 100644 --- a/tests/test_mc_ch_in_11k_RS.py +++ b/tests/test_mc_ch_in_11k_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian-tbx11k_simplified dataset.""" diff --git a/tests/test_mc_ch_in_11kv2.py b/tests/test_mc_ch_in_11kv2.py index 1c514fd6..a4d801d6 100644 --- a/tests/test_mc_ch_in_11kv2.py +++ b/tests/test_mc_ch_in_11kv2.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian dataset.""" import pytest diff --git a/tests/test_mc_ch_in_11kv2_RS.py b/tests/test_mc_ch_in_11kv2_RS.py index d8143a4b..3c128968 100644 --- a/tests/test_mc_ch_in_11kv2_RS.py +++ b/tests/test_mc_ch_in_11kv2_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian-tbx11k_simplified_v2 dataset.""" diff --git a/tests/test_mc_ch_in_RS.py b/tests/test_mc_ch_in_RS.py index 14283d89..1600f60b 100644 --- a/tests/test_mc_ch_in_RS.py +++ b/tests/test_mc_ch_in_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian dataset.""" import pytest diff --git a/tests/test_mc_ch_in_pc.py b/tests/test_mc_ch_in_pc.py index 1680fded..8aa38bef 100644 --- a/tests/test_mc_ch_in_pc.py +++ b/tests/test_mc_ch_in_pc.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian-Padchest dataset.""" import pytest diff --git a/tests/test_mc_ch_in_pc_RS.py b/tests/test_mc_ch_in_pc_RS.py index 21c56856..1014fb1d 100644 --- a/tests/test_mc_ch_in_pc_RS.py +++ b/tests/test_mc_ch_in_pc_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated Montgomery-Shenzhen-Indian-Padchest(TB) dataset.""" import pytest diff --git a/tests/test_measures.py b/tests/test_measures.py index 181ea8a5..69bcdc3c 100644 --- a/tests/test_measures.py +++ b/tests/test_measures.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for measure functions.""" import random diff --git a/tests/test_nih_cxr14.py b/tests/test_nih_cxr14.py index 78f0ce09..d7cc149a 100644 --- a/tests/test_nih_cxr14.py +++ b/tests/test_nih_cxr14.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for NIH CXR14 dataset.""" import pytest diff --git a/tests/test_nih_cxr14_pc.py b/tests/test_nih_cxr14_pc.py index 3b951f2f..05ae5a13 100644 --- a/tests/test_nih_cxr14_pc.py +++ b/tests/test_nih_cxr14_pc.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for the aggregated NIH CXR14-PadChest dataset.""" import pytest diff --git a/tests/test_pc.py b/tests/test_pc.py index 6f013cde..1ac31cbd 100644 --- a/tests/test_pc.py +++ b/tests/test_pc.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Padchest dataset.""" import pytest diff --git a/tests/test_pc_RS.py b/tests/test_pc_RS.py index e895dbea..c62ef780 100644 --- a/tests/test_pc_RS.py +++ b/tests/test_pc_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Extended Padchest dataset.""" import pytest diff --git a/tests/test_shenzhen.py b/tests/test_shenzhen.py index 1452a232..6e577081 100644 --- a/tests/test_shenzhen.py +++ b/tests/test_shenzhen.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for Shenzhen dataset.""" import importlib diff --git a/tests/test_tbpoc.py b/tests/test_tbpoc.py index b7be97d9..9609ea66 100644 --- a/tests/test_tbpoc.py +++ b/tests/test_tbpoc.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for TB-POC dataset.""" import pytest diff --git a/tests/test_tbpoc_RS.py b/tests/test_tbpoc_RS.py index 175bb5fb..72f3e596 100644 --- a/tests/test_tbpoc_RS.py +++ b/tests/test_tbpoc_RS.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for TB-POC_RS dataset.""" import pytest diff --git a/tests/test_tranforms.py b/tests/test_tranforms.py index c02c80d0..2c324aa1 100644 --- a/tests/test_tranforms.py +++ b/tests/test_tranforms.py @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> # # SPDX-License-Identifier: GPL-3.0-or-later - """Tests for transforms.""" import numpy -- GitLab