quadra 0.0.1__py3-none-any.whl → 2.2.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hydra_plugins/quadra_searchpath_plugin.py +30 -0
- quadra/__init__.py +6 -0
- quadra/callbacks/__init__.py +0 -0
- quadra/callbacks/anomalib.py +289 -0
- quadra/callbacks/lightning.py +501 -0
- quadra/callbacks/mlflow.py +291 -0
- quadra/callbacks/scheduler.py +69 -0
- quadra/configs/__init__.py +0 -0
- quadra/configs/backbone/caformer_m36.yaml +8 -0
- quadra/configs/backbone/caformer_s36.yaml +8 -0
- quadra/configs/backbone/convnextv2_base.yaml +8 -0
- quadra/configs/backbone/convnextv2_femto.yaml +8 -0
- quadra/configs/backbone/convnextv2_tiny.yaml +8 -0
- quadra/configs/backbone/dino_vitb8.yaml +12 -0
- quadra/configs/backbone/dino_vits8.yaml +12 -0
- quadra/configs/backbone/dinov2_vitb14.yaml +12 -0
- quadra/configs/backbone/dinov2_vits14.yaml +12 -0
- quadra/configs/backbone/efficientnet_b0.yaml +8 -0
- quadra/configs/backbone/efficientnet_b1.yaml +8 -0
- quadra/configs/backbone/efficientnet_b2.yaml +8 -0
- quadra/configs/backbone/efficientnet_b3.yaml +8 -0
- quadra/configs/backbone/efficientnetv2_s.yaml +8 -0
- quadra/configs/backbone/levit_128s.yaml +8 -0
- quadra/configs/backbone/mnasnet0_5.yaml +9 -0
- quadra/configs/backbone/resnet101.yaml +8 -0
- quadra/configs/backbone/resnet18.yaml +8 -0
- quadra/configs/backbone/resnet18_ssl.yaml +8 -0
- quadra/configs/backbone/resnet50.yaml +8 -0
- quadra/configs/backbone/smp.yaml +9 -0
- quadra/configs/backbone/tiny_vit_21m_224.yaml +9 -0
- quadra/configs/backbone/unetr.yaml +15 -0
- quadra/configs/backbone/vit16_base.yaml +9 -0
- quadra/configs/backbone/vit16_small.yaml +9 -0
- quadra/configs/backbone/vit16_tiny.yaml +9 -0
- quadra/configs/backbone/xcit_tiny_24_p8_224.yaml +9 -0
- quadra/configs/callbacks/all.yaml +45 -0
- quadra/configs/callbacks/default.yaml +34 -0
- quadra/configs/callbacks/default_anomalib.yaml +64 -0
- quadra/configs/config.yaml +33 -0
- quadra/configs/core/default.yaml +11 -0
- quadra/configs/datamodule/base/anomaly.yaml +16 -0
- quadra/configs/datamodule/base/classification.yaml +21 -0
- quadra/configs/datamodule/base/multilabel_classification.yaml +23 -0
- quadra/configs/datamodule/base/segmentation.yaml +18 -0
- quadra/configs/datamodule/base/segmentation_multiclass.yaml +20 -0
- quadra/configs/datamodule/base/sklearn_classification.yaml +23 -0
- quadra/configs/datamodule/base/sklearn_classification_patch.yaml +17 -0
- quadra/configs/datamodule/base/ssl.yaml +21 -0
- quadra/configs/datamodule/generic/imagenette/classification/base.yaml +9 -0
- quadra/configs/datamodule/generic/imagenette/ssl/base.yaml +10 -0
- quadra/configs/datamodule/generic/mnist/anomaly/base.yaml +14 -0
- quadra/configs/datamodule/generic/mvtec/anomaly/base.yaml +14 -0
- quadra/configs/datamodule/generic/oxford_pet/segmentation/base.yaml +9 -0
- quadra/configs/experiment/base/anomaly/cfa.yaml +47 -0
- quadra/configs/experiment/base/anomaly/cflow.yaml +47 -0
- quadra/configs/experiment/base/anomaly/csflow.yaml +48 -0
- quadra/configs/experiment/base/anomaly/draem.yaml +51 -0
- quadra/configs/experiment/base/anomaly/efficient_ad.yaml +43 -0
- quadra/configs/experiment/base/anomaly/fastflow.yaml +46 -0
- quadra/configs/experiment/base/anomaly/inference.yaml +21 -0
- quadra/configs/experiment/base/anomaly/padim.yaml +37 -0
- quadra/configs/experiment/base/anomaly/patchcore.yaml +37 -0
- quadra/configs/experiment/base/classification/classification.yaml +73 -0
- quadra/configs/experiment/base/classification/classification_evaluation.yaml +25 -0
- quadra/configs/experiment/base/classification/multilabel_classification.yaml +41 -0
- quadra/configs/experiment/base/classification/sklearn_classification.yaml +27 -0
- quadra/configs/experiment/base/classification/sklearn_classification_patch.yaml +25 -0
- quadra/configs/experiment/base/classification/sklearn_classification_patch_test.yaml +18 -0
- quadra/configs/experiment/base/classification/sklearn_classification_test.yaml +25 -0
- quadra/configs/experiment/base/segmentation/smp.yaml +30 -0
- quadra/configs/experiment/base/segmentation/smp_evaluation.yaml +17 -0
- quadra/configs/experiment/base/segmentation/smp_multiclass.yaml +26 -0
- quadra/configs/experiment/base/segmentation/smp_multiclass_evaluation.yaml +18 -0
- quadra/configs/experiment/base/ssl/barlow.yaml +48 -0
- quadra/configs/experiment/base/ssl/byol.yaml +43 -0
- quadra/configs/experiment/base/ssl/dino.yaml +46 -0
- quadra/configs/experiment/base/ssl/linear_eval.yaml +52 -0
- quadra/configs/experiment/base/ssl/simclr.yaml +48 -0
- quadra/configs/experiment/base/ssl/simsiam.yaml +53 -0
- quadra/configs/experiment/custom/cls.yaml +12 -0
- quadra/configs/experiment/default.yaml +15 -0
- quadra/configs/experiment/generic/imagenette/classification/default.yaml +20 -0
- quadra/configs/experiment/generic/imagenette/ssl/barlow.yaml +14 -0
- quadra/configs/experiment/generic/imagenette/ssl/byol.yaml +14 -0
- quadra/configs/experiment/generic/imagenette/ssl/dino.yaml +14 -0
- quadra/configs/experiment/generic/imagenette/ssl/simclr.yaml +14 -0
- quadra/configs/experiment/generic/imagenette/ssl/simsiam.yaml +14 -0
- quadra/configs/experiment/generic/mnist/anomaly/cfa.yaml +34 -0
- quadra/configs/experiment/generic/mnist/anomaly/cflow.yaml +33 -0
- quadra/configs/experiment/generic/mnist/anomaly/csflow.yaml +33 -0
- quadra/configs/experiment/generic/mnist/anomaly/draem.yaml +33 -0
- quadra/configs/experiment/generic/mnist/anomaly/fastflow.yaml +29 -0
- quadra/configs/experiment/generic/mnist/anomaly/inference.yaml +27 -0
- quadra/configs/experiment/generic/mnist/anomaly/padim.yaml +37 -0
- quadra/configs/experiment/generic/mnist/anomaly/patchcore.yaml +37 -0
- quadra/configs/experiment/generic/mvtec/anomaly/cfa.yaml +34 -0
- quadra/configs/experiment/generic/mvtec/anomaly/cflow.yaml +33 -0
- quadra/configs/experiment/generic/mvtec/anomaly/csflow.yaml +33 -0
- quadra/configs/experiment/generic/mvtec/anomaly/draem.yaml +33 -0
- quadra/configs/experiment/generic/mvtec/anomaly/efficient_ad.yaml +38 -0
- quadra/configs/experiment/generic/mvtec/anomaly/fastflow.yaml +29 -0
- quadra/configs/experiment/generic/mvtec/anomaly/inference.yaml +27 -0
- quadra/configs/experiment/generic/mvtec/anomaly/padim.yaml +37 -0
- quadra/configs/experiment/generic/mvtec/anomaly/patchcore.yaml +37 -0
- quadra/configs/experiment/generic/oxford_pet/segmentation/smp.yaml +27 -0
- quadra/configs/export/default.yaml +13 -0
- quadra/configs/hydra/anomaly_custom.yaml +15 -0
- quadra/configs/hydra/default.yaml +14 -0
- quadra/configs/inference/default.yaml +26 -0
- quadra/configs/logger/comet.yaml +10 -0
- quadra/configs/logger/csv.yaml +5 -0
- quadra/configs/logger/mlflow.yaml +12 -0
- quadra/configs/logger/tensorboard.yaml +8 -0
- quadra/configs/loss/asl.yaml +7 -0
- quadra/configs/loss/barlow.yaml +2 -0
- quadra/configs/loss/bce.yaml +1 -0
- quadra/configs/loss/byol.yaml +1 -0
- quadra/configs/loss/cross_entropy.yaml +1 -0
- quadra/configs/loss/dino.yaml +8 -0
- quadra/configs/loss/simclr.yaml +2 -0
- quadra/configs/loss/simsiam.yaml +1 -0
- quadra/configs/loss/smp_ce.yaml +3 -0
- quadra/configs/loss/smp_dice.yaml +2 -0
- quadra/configs/loss/smp_dice_multiclass.yaml +2 -0
- quadra/configs/loss/smp_mcc.yaml +2 -0
- quadra/configs/loss/vicreg.yaml +5 -0
- quadra/configs/model/anomalib/cfa.yaml +35 -0
- quadra/configs/model/anomalib/cflow.yaml +30 -0
- quadra/configs/model/anomalib/csflow.yaml +34 -0
- quadra/configs/model/anomalib/dfm.yaml +19 -0
- quadra/configs/model/anomalib/draem.yaml +29 -0
- quadra/configs/model/anomalib/efficient_ad.yaml +31 -0
- quadra/configs/model/anomalib/fastflow.yaml +32 -0
- quadra/configs/model/anomalib/padim.yaml +32 -0
- quadra/configs/model/anomalib/patchcore.yaml +36 -0
- quadra/configs/model/barlow.yaml +16 -0
- quadra/configs/model/byol.yaml +25 -0
- quadra/configs/model/classification.yaml +10 -0
- quadra/configs/model/dino.yaml +26 -0
- quadra/configs/model/logistic_regression.yaml +4 -0
- quadra/configs/model/multilabel_classification.yaml +9 -0
- quadra/configs/model/simclr.yaml +18 -0
- quadra/configs/model/simsiam.yaml +24 -0
- quadra/configs/model/smp.yaml +4 -0
- quadra/configs/model/smp_multiclass.yaml +4 -0
- quadra/configs/model/vicreg.yaml +16 -0
- quadra/configs/optimizer/adam.yaml +5 -0
- quadra/configs/optimizer/adamw.yaml +3 -0
- quadra/configs/optimizer/default.yaml +4 -0
- quadra/configs/optimizer/lars.yaml +8 -0
- quadra/configs/optimizer/sgd.yaml +4 -0
- quadra/configs/scheduler/default.yaml +5 -0
- quadra/configs/scheduler/rop.yaml +5 -0
- quadra/configs/scheduler/step.yaml +3 -0
- quadra/configs/scheduler/warmrestart.yaml +2 -0
- quadra/configs/scheduler/warmup.yaml +6 -0
- quadra/configs/task/anomalib/cfa.yaml +5 -0
- quadra/configs/task/anomalib/cflow.yaml +5 -0
- quadra/configs/task/anomalib/csflow.yaml +5 -0
- quadra/configs/task/anomalib/draem.yaml +5 -0
- quadra/configs/task/anomalib/efficient_ad.yaml +5 -0
- quadra/configs/task/anomalib/fastflow.yaml +5 -0
- quadra/configs/task/anomalib/inference.yaml +3 -0
- quadra/configs/task/anomalib/padim.yaml +5 -0
- quadra/configs/task/anomalib/patchcore.yaml +5 -0
- quadra/configs/task/classification.yaml +6 -0
- quadra/configs/task/classification_evaluation.yaml +6 -0
- quadra/configs/task/default.yaml +1 -0
- quadra/configs/task/segmentation.yaml +9 -0
- quadra/configs/task/segmentation_evaluation.yaml +3 -0
- quadra/configs/task/sklearn_classification.yaml +13 -0
- quadra/configs/task/sklearn_classification_patch.yaml +11 -0
- quadra/configs/task/sklearn_classification_patch_test.yaml +8 -0
- quadra/configs/task/sklearn_classification_test.yaml +8 -0
- quadra/configs/task/ssl.yaml +2 -0
- quadra/configs/trainer/lightning_cpu.yaml +36 -0
- quadra/configs/trainer/lightning_gpu.yaml +35 -0
- quadra/configs/trainer/lightning_gpu_bf16.yaml +36 -0
- quadra/configs/trainer/lightning_gpu_fp16.yaml +36 -0
- quadra/configs/trainer/lightning_multigpu.yaml +37 -0
- quadra/configs/trainer/sklearn_classification.yaml +7 -0
- quadra/configs/transforms/byol.yaml +47 -0
- quadra/configs/transforms/byol_no_random_resize.yaml +61 -0
- quadra/configs/transforms/default.yaml +37 -0
- quadra/configs/transforms/default_numpy.yaml +24 -0
- quadra/configs/transforms/default_resize.yaml +22 -0
- quadra/configs/transforms/dino.yaml +63 -0
- quadra/configs/transforms/linear_eval.yaml +18 -0
- quadra/datamodules/__init__.py +20 -0
- quadra/datamodules/anomaly.py +180 -0
- quadra/datamodules/base.py +375 -0
- quadra/datamodules/classification.py +1003 -0
- quadra/datamodules/generic/__init__.py +0 -0
- quadra/datamodules/generic/imagenette.py +144 -0
- quadra/datamodules/generic/mnist.py +81 -0
- quadra/datamodules/generic/mvtec.py +58 -0
- quadra/datamodules/generic/oxford_pet.py +163 -0
- quadra/datamodules/patch.py +190 -0
- quadra/datamodules/segmentation.py +742 -0
- quadra/datamodules/ssl.py +140 -0
- quadra/datasets/__init__.py +17 -0
- quadra/datasets/anomaly.py +287 -0
- quadra/datasets/classification.py +241 -0
- quadra/datasets/patch.py +138 -0
- quadra/datasets/segmentation.py +239 -0
- quadra/datasets/ssl.py +110 -0
- quadra/losses/__init__.py +0 -0
- quadra/losses/classification/__init__.py +6 -0
- quadra/losses/classification/asl.py +83 -0
- quadra/losses/classification/focal.py +320 -0
- quadra/losses/classification/prototypical.py +148 -0
- quadra/losses/ssl/__init__.py +17 -0
- quadra/losses/ssl/barlowtwins.py +47 -0
- quadra/losses/ssl/byol.py +37 -0
- quadra/losses/ssl/dino.py +129 -0
- quadra/losses/ssl/hyperspherical.py +45 -0
- quadra/losses/ssl/idmm.py +50 -0
- quadra/losses/ssl/simclr.py +67 -0
- quadra/losses/ssl/simsiam.py +30 -0
- quadra/losses/ssl/vicreg.py +76 -0
- quadra/main.py +49 -0
- quadra/metrics/__init__.py +3 -0
- quadra/metrics/segmentation.py +251 -0
- quadra/models/__init__.py +0 -0
- quadra/models/base.py +151 -0
- quadra/models/classification/__init__.py +8 -0
- quadra/models/classification/backbones.py +149 -0
- quadra/models/classification/base.py +92 -0
- quadra/models/evaluation.py +322 -0
- quadra/modules/__init__.py +0 -0
- quadra/modules/backbone.py +30 -0
- quadra/modules/base.py +312 -0
- quadra/modules/classification/__init__.py +3 -0
- quadra/modules/classification/base.py +327 -0
- quadra/modules/ssl/__init__.py +17 -0
- quadra/modules/ssl/barlowtwins.py +59 -0
- quadra/modules/ssl/byol.py +172 -0
- quadra/modules/ssl/common.py +285 -0
- quadra/modules/ssl/dino.py +186 -0
- quadra/modules/ssl/hyperspherical.py +206 -0
- quadra/modules/ssl/idmm.py +98 -0
- quadra/modules/ssl/simclr.py +73 -0
- quadra/modules/ssl/simsiam.py +68 -0
- quadra/modules/ssl/vicreg.py +67 -0
- quadra/optimizers/__init__.py +4 -0
- quadra/optimizers/lars.py +153 -0
- quadra/optimizers/sam.py +127 -0
- quadra/schedulers/__init__.py +3 -0
- quadra/schedulers/base.py +44 -0
- quadra/schedulers/warmup.py +127 -0
- quadra/tasks/__init__.py +24 -0
- quadra/tasks/anomaly.py +582 -0
- quadra/tasks/base.py +397 -0
- quadra/tasks/classification.py +1263 -0
- quadra/tasks/patch.py +492 -0
- quadra/tasks/segmentation.py +389 -0
- quadra/tasks/ssl.py +560 -0
- quadra/trainers/README.md +3 -0
- quadra/trainers/__init__.py +0 -0
- quadra/trainers/classification.py +179 -0
- quadra/utils/__init__.py +0 -0
- quadra/utils/anomaly.py +112 -0
- quadra/utils/classification.py +618 -0
- quadra/utils/deprecation.py +31 -0
- quadra/utils/evaluation.py +474 -0
- quadra/utils/export.py +585 -0
- quadra/utils/imaging.py +32 -0
- quadra/utils/logger.py +15 -0
- quadra/utils/mlflow.py +98 -0
- quadra/utils/model_manager.py +320 -0
- quadra/utils/models.py +523 -0
- quadra/utils/patch/__init__.py +15 -0
- quadra/utils/patch/dataset.py +1433 -0
- quadra/utils/patch/metrics.py +449 -0
- quadra/utils/patch/model.py +153 -0
- quadra/utils/patch/visualization.py +217 -0
- quadra/utils/resolver.py +42 -0
- quadra/utils/segmentation.py +31 -0
- quadra/utils/tests/__init__.py +0 -0
- quadra/utils/tests/fixtures/__init__.py +1 -0
- quadra/utils/tests/fixtures/dataset/__init__.py +39 -0
- quadra/utils/tests/fixtures/dataset/anomaly.py +124 -0
- quadra/utils/tests/fixtures/dataset/classification.py +406 -0
- quadra/utils/tests/fixtures/dataset/imagenette.py +53 -0
- quadra/utils/tests/fixtures/dataset/segmentation.py +161 -0
- quadra/utils/tests/fixtures/models/__init__.py +3 -0
- quadra/utils/tests/fixtures/models/anomaly.py +89 -0
- quadra/utils/tests/fixtures/models/classification.py +45 -0
- quadra/utils/tests/fixtures/models/segmentation.py +33 -0
- quadra/utils/tests/helpers.py +70 -0
- quadra/utils/tests/models.py +27 -0
- quadra/utils/utils.py +525 -0
- quadra/utils/validator.py +115 -0
- quadra/utils/visualization.py +422 -0
- quadra/utils/vit_explainability.py +349 -0
- quadra-2.2.7.dist-info/LICENSE +201 -0
- quadra-2.2.7.dist-info/METADATA +381 -0
- quadra-2.2.7.dist-info/RECORD +300 -0
- {quadra-0.0.1.dist-info → quadra-2.2.7.dist-info}/WHEEL +1 -1
- quadra-2.2.7.dist-info/entry_points.txt +3 -0
- quadra-0.0.1.dist-info/METADATA +0 -14
- quadra-0.0.1.dist-info/RECORD +0 -4
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: quadra
|
|
3
|
+
Version: 2.2.7
|
|
4
|
+
Summary: Deep Learning experiment orchestration library
|
|
5
|
+
Home-page: https://orobix.github.io/quadra
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: deep learning,experiment,lightning,hydra-core
|
|
8
|
+
Author: Federico Belotti
|
|
9
|
+
Author-email: federico.belotti@orobix.com
|
|
10
|
+
Requires-Python: >=3.9,<3.11
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Software Development
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Provides-Extra: onnx
|
|
23
|
+
Requires-Dist: albumentations (>=1.3,<1.4)
|
|
24
|
+
Requires-Dist: anomalib-orobix (==0.7.0.dev143)
|
|
25
|
+
Requires-Dist: boto3 (>=1.26,<1.27)
|
|
26
|
+
Requires-Dist: grad-cam-orobix (==1.5.3.dev001)
|
|
27
|
+
Requires-Dist: h5py (>=3.8,<3.9)
|
|
28
|
+
Requires-Dist: hydra_colorlog (>=1.2,<1.3)
|
|
29
|
+
Requires-Dist: hydra_core (>=1.3,<1.4)
|
|
30
|
+
Requires-Dist: hydra_optuna_sweeper (>=1.2,<1.3)
|
|
31
|
+
Requires-Dist: label_studio_converter (>=0.0,<0.1)
|
|
32
|
+
Requires-Dist: matplotlib (>=3.6,<3.7)
|
|
33
|
+
Requires-Dist: minio (>=7.1,<7.2)
|
|
34
|
+
Requires-Dist: mlflow-skinny (>=2.3.1,<3.0.0)
|
|
35
|
+
Requires-Dist: nvitop (>=0.11,<0.12)
|
|
36
|
+
Requires-Dist: onnx (==1.15.0) ; extra == "onnx"
|
|
37
|
+
Requires-Dist: onnxconverter-common (>=1.14.0,<2.0.0) ; extra == "onnx"
|
|
38
|
+
Requires-Dist: onnxruntime_gpu (==1.17.0) ; extra == "onnx"
|
|
39
|
+
Requires-Dist: onnxsim (==0.4.28) ; extra == "onnx"
|
|
40
|
+
Requires-Dist: opencv_python_headless (>=4.7.0,<4.8.0)
|
|
41
|
+
Requires-Dist: pandas (<2.0)
|
|
42
|
+
Requires-Dist: pillow (>=9.3,<9.4)
|
|
43
|
+
Requires-Dist: pydantic (==1.10.10)
|
|
44
|
+
Requires-Dist: python_dotenv (>=0.21,<0.22)
|
|
45
|
+
Requires-Dist: pytorch_lightning (>=2.1,<2.2)
|
|
46
|
+
Requires-Dist: rich (>=13.2,<13.3)
|
|
47
|
+
Requires-Dist: scikit_learn (>=1.2,<1.3)
|
|
48
|
+
Requires-Dist: scikit_multilearn (>=0.2,<0.3)
|
|
49
|
+
Requires-Dist: seaborn (>=0.12,<0.13)
|
|
50
|
+
Requires-Dist: segmentation_models_pytorch-orobix (==0.3.3.dev1)
|
|
51
|
+
Requires-Dist: tensorboard (>=2.11,<2.12)
|
|
52
|
+
Requires-Dist: timm (==0.9.12)
|
|
53
|
+
Requires-Dist: torch (==2.1.2)
|
|
54
|
+
Requires-Dist: torchinfo (>=1.8,<1.9)
|
|
55
|
+
Requires-Dist: torchmetrics (>=0.10,<0.11)
|
|
56
|
+
Requires-Dist: torchsummary (>=1.5,<1.6)
|
|
57
|
+
Requires-Dist: torchvision (>=0.16,<0.17)
|
|
58
|
+
Requires-Dist: tripy (>=1.0,<1.1)
|
|
59
|
+
Requires-Dist: typing_extensions (==4.11.0) ; python_version < "3.10"
|
|
60
|
+
Requires-Dist: xxhash (>=3.2,<3.3)
|
|
61
|
+
Project-URL: Repository, https://github.com/orobix/quadra
|
|
62
|
+
Description-Content-Type: text/markdown
|
|
63
|
+
|
|
64
|
+
<h1></h1>
|
|
65
|
+
<p align="center">
|
|
66
|
+
<img src="https://github.com/orobix/quadra/raw/main/docs/images/quadra_text_logo.png" alt="Quadra Logo" width="100%">
|
|
67
|
+
</p>
|
|
68
|
+
|
|
69
|
+
<p align="center">
|
|
70
|
+
<a href="https://orobix.github.io/quadra/latest/index.html">Docs</a> •
|
|
71
|
+
<a href="https://orobix.github.io/quadra/latest/tutorials/datamodules.html">Tutorials</a> •
|
|
72
|
+
<a href="https://orobix.github.io/quadra/latest/tutorials/configurations.html">Configurations</a>
|
|
73
|
+
</p>
|
|
74
|
+
|
|
75
|
+
<div align="center">
|
|
76
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
77
|
+
<img
|
|
78
|
+
src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json"
|
|
79
|
+
alt="ruff"
|
|
80
|
+
></a>
|
|
81
|
+
<a href="https://github.com/pre-commit/pre-commit"><img
|
|
82
|
+
src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white"
|
|
83
|
+
alt="pre-commit"
|
|
84
|
+
/></a>
|
|
85
|
+
<a href="https://github.com/econchick/interrogate"><img
|
|
86
|
+
src="https://github.com/orobix/quadra/raw/main/docs/images/interrogate_badge.svg"
|
|
87
|
+
alt="interrogate"
|
|
88
|
+
/></a>
|
|
89
|
+
<a href="https://github.com/PyCQA/pylint"><img
|
|
90
|
+
src="https://img.shields.io/badge/linting-pylint-yellowgreen"
|
|
91
|
+
alt="pylint"
|
|
92
|
+
/></a>
|
|
93
|
+
<a href="https://mypy-lang.org/"><img
|
|
94
|
+
src="https://www.mypy-lang.org/static/mypy_badge.svg"
|
|
95
|
+
alt="Checked with mypy"
|
|
96
|
+
/></a>
|
|
97
|
+
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
______________________________________________________________________
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
`Quadra` aims to simplify deep learning experimenting process, allowing researchers or developers to compare, monitor, and share their experiments quickly. It provides a simple and flexible way to train and deploy deep learning models using YAML configuration files and open-source tools such as [Hydra](https://hydra.cc/docs/intro/), [Lightning](https://www.pytorchlightning.ai/index.html) framework, and [Pytorch](https://pytorch.org/). It lets you compose your experiment configurations from single command line interface, so you can conduct multiple experiments with different settings and hyperparameters. Every experiment can be logged using integrations provided by [Lightning](https://www.pytorchlightning.ai/index.html) framework such [Mlflow](https://mlflow.org/).
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## Quick Start Guide
|
|
107
|
+
|
|
108
|
+
If you use pip to manage your packages, you can install `quadra` from PyPi by running the following command:
|
|
109
|
+
```shell
|
|
110
|
+
pip install quadra
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If instead you prefer to use poetry, you can install `quadra` from PyPi by running the following command:
|
|
114
|
+
```shell
|
|
115
|
+
poetry add quadra
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
If you don't have virtual environment ready, Let's set up our environment for using the `quadra` library. We have two parts in this guide: Common setup and Environment-specific setup.
|
|
119
|
+
|
|
120
|
+
### Using Conda
|
|
121
|
+
|
|
122
|
+
Create and activate a new `Conda` environment.
|
|
123
|
+
|
|
124
|
+
```shell
|
|
125
|
+
conda create -n myenv python=3.10
|
|
126
|
+
conda activate myenv
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Using Python Virtualenv
|
|
130
|
+
|
|
131
|
+
Create and activate a new virtual environment.
|
|
132
|
+
|
|
133
|
+
```shell
|
|
134
|
+
# replace `myenv` with the name of your virtual environment
|
|
135
|
+
python3 -m venv myenv
|
|
136
|
+
source myenv/bin/activate
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Common Setup
|
|
140
|
+
|
|
141
|
+
1. **Check your git version**:
|
|
142
|
+
Make sure you have git version 2.10 or higher, to avoid any installation failures.
|
|
143
|
+
```shell
|
|
144
|
+
git --version
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
2. **Upgrade pip**:
|
|
148
|
+
```shell
|
|
149
|
+
pip install --upgrade pip
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
3. Install the package
|
|
153
|
+
|
|
154
|
+
* **Install the `quadra` package** with pip:
|
|
155
|
+
```shell
|
|
156
|
+
pip install quadra
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
* **Install the `quadra` package** with poetry:
|
|
160
|
+
```shell
|
|
161
|
+
curl -sSL https://install.python-poetry.org | python3 -
|
|
162
|
+
poetry add quadra
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
4. **Run from CLI**:
|
|
166
|
+
Run the following command to check if the installation was successful:
|
|
167
|
+
```shell
|
|
168
|
+
quadra experiment=default
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Setup `Mlflow` (Optional)
|
|
172
|
+
|
|
173
|
+
To use Mlflow and leverage its functionalities such as saving models, logging metrics, saving artifacts, and visualizing results, you need to ensure that the Mlflow server is running. You can find more information about Mlflow [here](https://mlflow.org/).
|
|
174
|
+
|
|
175
|
+
By default, the logger configuration is set to Mlflow, and experiments expect the `MLFLOW_TRACKING_URI` environment variable to be set to the address of the Mlflow server. There are two ways to set this variable:
|
|
176
|
+
|
|
177
|
+
**Using the command line:**
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
export MLFLOW_TRACKING_URI=http://localhost:5000
|
|
181
|
+
```
|
|
182
|
+
This command sets the `MLFLOW_TRACKING_URI` variable to `http://localhost:5000`. Replace this with the actual address of your Mlflow server if it's running on a different host or port.
|
|
183
|
+
|
|
184
|
+
**Adding it to your environment file:**
|
|
185
|
+
|
|
186
|
+
`Quadra` uses environment variables to store credentials and other sensitive information. Thanks to [`python-dotenv`](https://pypi.org/project/python-dotenv/) library, you can create a `.env` file in the main folder of your project and store the credentials there. During the runtime, the library will automatically load the environment variables from the `.env` file. You can also add the `MLFLOW_TRACKING_URI` variable to your environment file (e.g., `.env`). Open the file in a text editor and add the following line:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
MLFLOW_TRACKING_URI=http://localhost:5000
|
|
190
|
+
```
|
|
191
|
+
Again, modify the address if your Mlflow server is running on a different host or port.
|
|
192
|
+
|
|
193
|
+
By setting the `MLFLOW_TRACKING_URI` variable using either method, you configure the logger to connect to the Mlflow server, enabling you to utilize its features effectively.
|
|
194
|
+
|
|
195
|
+
The `export` command is specific to Unix-based systems like Linux or macOS. If you are using a different operating system, refer to the appropriate method for setting environment variables.
|
|
196
|
+
|
|
197
|
+
## Run Example Experiments
|
|
198
|
+
|
|
199
|
+
`quadra` provides a set of example experiments that can be used to test the installation and to provide some example configuration files.
|
|
200
|
+
|
|
201
|
+
By default all the experiments will run on the `GPU 0`, to run it on the `CPU` you can specify a different `trainer` configuration parameter:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
quadra <configurations> trainer=lightning_cpu
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Classification Training
|
|
208
|
+
|
|
209
|
+
To run a simple classification training on the [Imagenette dataset](https://github.com/fastai/imagenette) with a Resnet18 architecture run the following command:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
quadra experiment=generic/imagenette/classification/default logger=csv
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
This will train the model for 20 epochs and log the metrics in a csv file, at the end of the training a `torchscript` model will be saved for inference alongside some output images.
|
|
216
|
+
|
|
217
|
+
By default the experiment will run on the GPU 0, to run it on the CPU you can specify a different `trainer` configuration parameter.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### Segmentation Training
|
|
221
|
+
|
|
222
|
+
To run a simple segmentation training on the [Oxford pet](https://www.robots.ox.ac.uk/~vgg/data/pets/) dataset with a Unet architecture run the following command:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
quadra experiment=generic/oxford_pet/segmentation/smp logger=csv
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
This will make use of the [segmentation models pytorch](https://github.com/qubvel/segmentation_models.pytorch) library to train the model for 10 epochs, logging the metrics to a csv file. At the end of the training a torchscript model will be saved for inference alongside some output images.
|
|
229
|
+
|
|
230
|
+
### (SSL) Self-supervised Learning Training
|
|
231
|
+
|
|
232
|
+
On the same dataset we can run a simple SSL training using the BYOL algorithm with the following command:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
quadra experiment=generic/imagenette/ssl/byol logger=csv
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
BYOL is not the only SSL algorithm available, you can find a list of all the available algorithms under `quadra/configs/experiment/generic/imagenette/ssl` folder.
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
### Anomaly Detection Training
|
|
242
|
+
|
|
243
|
+
To run a simple anomaly detection training on the [MNIST dataset](http://yann.lecun.com/exdb/mnist/) using the PADIM algorithm run the following command:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
quadra experiment=generic/mnist/anomaly/padim logger=csv
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
This will run an anomaly detection considering on of the classes as good (default is the number 9) and the rest as anomalies.
|
|
250
|
+
|
|
251
|
+
This will make use of the [anomalib](https://github.com/openvinotoolkit/anomalib) library to train the model. Many different algorithms are available, you can find them under `quadra/configs/experiment/generic/mnist/anomaly` folder.
|
|
252
|
+
|
|
253
|
+
## Running with Custom Datasets
|
|
254
|
+
|
|
255
|
+
Each task comes with a default configuration file that can be customized for your needs. Each example experiment we have seen so far uses a default configuration file that can be found under `quadra/configs/experiment/base/<task>/<config_name>.yaml`.
|
|
256
|
+
|
|
257
|
+
Let's see how we can customize the configuration file to run the classification experiment on a custom dataset.
|
|
258
|
+
|
|
259
|
+
Structure your dataset in the following way:
|
|
260
|
+
|
|
261
|
+
```tree
|
|
262
|
+
dataset/
|
|
263
|
+
├── class_1
|
|
264
|
+
│ ├── abc.xyz
|
|
265
|
+
│ └── ...
|
|
266
|
+
├── class_2
|
|
267
|
+
│ ├── abc.xyz
|
|
268
|
+
│ └── ...
|
|
269
|
+
├── class_3
|
|
270
|
+
│ ├── abc.xyz
|
|
271
|
+
│ └── ...
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Create a new experiment configuration file under `quadra/configs/experiment/custom/<config_name>.yaml` with the following content:
|
|
275
|
+
|
|
276
|
+
```yaml
|
|
277
|
+
# @package _global_
|
|
278
|
+
defaults:
|
|
279
|
+
- base/classification/classification # extends the default classification configuration
|
|
280
|
+
|
|
281
|
+
core:
|
|
282
|
+
name: <your-custom-experiment-name> # name of the experiment
|
|
283
|
+
|
|
284
|
+
model:
|
|
285
|
+
num_classes: <number-of_classes-you-have> # number of classes in your dataset
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Run the experiment with the following command:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
quadra experiment=custom/<config_name> logger=csv
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
It will run the experiment using the configuration file you have just created and it will apply the default parameters from the classification configuration file. Furthermore, it will log the metrics to a csv file. You can add or customize the parameters in the configuration file to fit your needs.
|
|
295
|
+
|
|
296
|
+
For more information about advanced usage, please check [tutorials](https://orobix.github.io/quadra/latest/tutorials/configurations.html) and [task specific examples](https://orobix.github.io/quadra/latest/tutorials/examples/classification.html).
|
|
297
|
+
|
|
298
|
+
## Development
|
|
299
|
+
|
|
300
|
+
First clone the repository from Github
|
|
301
|
+
|
|
302
|
+
First clone the repository from `Github`, then we need to install the package with optional dependencies (generally in editable mode) and enable the pre-commit hooks.
|
|
303
|
+
|
|
304
|
+
1. `git clone https://github.com/orobix/quadra.git && cd quadra`
|
|
305
|
+
2. Install poetry `curl -sSL https://install.python-poetry.org | python3 -`
|
|
306
|
+
3. Install the required poetry plugins
|
|
307
|
+
```
|
|
308
|
+
poetry self add poetry-bumpversion
|
|
309
|
+
poetry self add poetry-dotenv-plugin
|
|
310
|
+
```
|
|
311
|
+
4. Install `quadra` package in editable mode `poetry install --with test,dev,docs --all-extras`
|
|
312
|
+
5. Install pre-commit hooks `pre-commit install`
|
|
313
|
+
6. (Optional) Eventually build documentation by calling required commands (see below).
|
|
314
|
+
|
|
315
|
+
Now you can start developing and the pre-commit hooks will run automatically to prevent you from committing code that does not pass the linting and formatting checks.
|
|
316
|
+
|
|
317
|
+
We rely on a combination of `Pylint`, `Mypy` and `Ruff` to enforce code quality.
|
|
318
|
+
|
|
319
|
+
## Building Documentations
|
|
320
|
+
|
|
321
|
+
1. Activate your virtual environment.
|
|
322
|
+
2. Install the `quadra` package with at least `doc` version.
|
|
323
|
+
3. To run the webserver for real-time rendering and editing run `mkdocs serve` and visit `http://localhost:8000/`.
|
|
324
|
+
4. If you want to export the static website to a specific folder `mkdocs build -d <Destination Folder>`
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
## Acknowledgements
|
|
328
|
+
|
|
329
|
+
This project is based on many open-source libraries and frameworks, we would like to thank all the contributors for their work. Here is a list of the main libraries and frameworks we use:
|
|
330
|
+
|
|
331
|
+
- [Pytorch](https://pytorch.org/) and [Pytorch Lightning](https://lightning.ai/) for training and deploying deep learning models. These two libraries are core part of training and testing tasks that allow us to run experiments on different devices in agile way.
|
|
332
|
+
- Pretrained models are usually loaded from [Pytorch Hub](https://pytorch.org/hub/) or [Pytorch-image-models](https://github.com/huggingface/pytorch-image-models) (or called as `timm`).
|
|
333
|
+
- Each specific task may rely on different libraries. For example, `segmentation` task uses [Segmentation_models.pytorch](https://github.com/qubvel/segmentation_models.pytorch) for loading backbones. The `anomaly detection` task uses a fork of [Anomalib](https://github.com/openvinotoolkit/anomalib) maintained by Orobix on [this repository](https://github.com/orobix/anomalib). We use light-weight ML models from [scikit-learn](https://scikit-learn.org/). We have also implementation of some SOTA models inside our library.
|
|
334
|
+
- Data processing and augmentation are done using [Albumentations](https://albumentations.ai/docs/) and [OpenCV](https://opencv.org/).
|
|
335
|
+
- [Hydra](https://hydra.cc/docs/intro/) for composing configurations and running experiments. Hydra is a powerful framework that allows us to compose configurations from command line interface and run multiple experiments with different settings and hyperparameters. We have followed suggestions from `Configuring Experiments` section of [Hydra documentation](https://hydra.cc/docs/patterns/configuring_experiments/) and [lightning-hydra-template](https://github.com/ashleve/lightning-hydra-template) repository.
|
|
336
|
+
- Documentation website is using [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) and [MkDocs](https://www.mkdocs.org/). For code documentation we are using [Mkdocstrings](https://mkdocstrings.github.io/). For releasing software versions we combine [Bumpver](https://github.com/mbarkhau/bumpver) and [Mike](https://github.com/jimporter/mike).
|
|
337
|
+
- Models can be exported in different ways (`torchscript` or `torch` file). We have also added [ONNX](https://onnx.ai/) support for some models.
|
|
338
|
+
- Testing framework is based on [Pytest](https://docs.pytest.org/en/) and related plug-ins.
|
|
339
|
+
- Code quality is ensured by [pre-commit](https://pre-commit.com/) hooks. We are using [Ruff](https://github.com/astral-sh/ruff) for linting, enforcing code quality and formatting, [Pylint](https://www.pylint.org/) for in depth linting and [Mypy](https://mypy.readthedocs.io/en/stable/) for type checking.
|
|
340
|
+
|
|
341
|
+
## FAQ
|
|
342
|
+
|
|
343
|
+
**How can I fix errors related to `GL` when I install full `opencv` package?**
|
|
344
|
+
|
|
345
|
+
If you are running on a remote server without a display and you are using `opencv-python` instead of `opencv-python-headless` you can run the following command to fix the issue:
|
|
346
|
+
|
|
347
|
+
It can be solved by correctly linking the `libGL.so.1` library:
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
# Check where the library is located
|
|
351
|
+
find /usr -name libGL.so.1
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# if the library is located in /usr/lib/x86_64-linux-gnu
|
|
356
|
+
# link it to /usr/lib
|
|
357
|
+
sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
or installing following packages (depending on your OS this may vary):
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
sudo apt-get install libgl1-mesa-glx
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
**How can I run multiple experiments with single command?**
|
|
368
|
+
|
|
369
|
+
You can run multiple experiments with a single command by passing `--multirun` flag:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
quadra <configurations> --multirun
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
For example if you want to run same experiment with different seeds you can run:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
quadra experiment=generic/imagenette/classification/default trainer=lightning_cpu logger=csv core.seed=1,2,3 --multirun
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
|