quadra 0.0.1__py3-none-any.whl → 2.1.13__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.
Files changed (302) hide show
  1. hydra_plugins/quadra_searchpath_plugin.py +30 -0
  2. quadra/__init__.py +6 -0
  3. quadra/callbacks/__init__.py +0 -0
  4. quadra/callbacks/anomalib.py +289 -0
  5. quadra/callbacks/lightning.py +501 -0
  6. quadra/callbacks/mlflow.py +291 -0
  7. quadra/callbacks/scheduler.py +69 -0
  8. quadra/configs/__init__.py +0 -0
  9. quadra/configs/backbone/caformer_m36.yaml +8 -0
  10. quadra/configs/backbone/caformer_s36.yaml +8 -0
  11. quadra/configs/backbone/convnextv2_base.yaml +8 -0
  12. quadra/configs/backbone/convnextv2_femto.yaml +8 -0
  13. quadra/configs/backbone/convnextv2_tiny.yaml +8 -0
  14. quadra/configs/backbone/dino_vitb8.yaml +12 -0
  15. quadra/configs/backbone/dino_vits8.yaml +12 -0
  16. quadra/configs/backbone/dinov2_vitb14.yaml +12 -0
  17. quadra/configs/backbone/dinov2_vits14.yaml +12 -0
  18. quadra/configs/backbone/efficientnet_b0.yaml +8 -0
  19. quadra/configs/backbone/efficientnet_b1.yaml +8 -0
  20. quadra/configs/backbone/efficientnet_b2.yaml +8 -0
  21. quadra/configs/backbone/efficientnet_b3.yaml +8 -0
  22. quadra/configs/backbone/efficientnetv2_s.yaml +8 -0
  23. quadra/configs/backbone/levit_128s.yaml +8 -0
  24. quadra/configs/backbone/mnasnet0_5.yaml +9 -0
  25. quadra/configs/backbone/resnet101.yaml +8 -0
  26. quadra/configs/backbone/resnet18.yaml +8 -0
  27. quadra/configs/backbone/resnet18_ssl.yaml +8 -0
  28. quadra/configs/backbone/resnet50.yaml +8 -0
  29. quadra/configs/backbone/smp.yaml +9 -0
  30. quadra/configs/backbone/tiny_vit_21m_224.yaml +9 -0
  31. quadra/configs/backbone/unetr.yaml +15 -0
  32. quadra/configs/backbone/vit16_base.yaml +9 -0
  33. quadra/configs/backbone/vit16_small.yaml +9 -0
  34. quadra/configs/backbone/vit16_tiny.yaml +9 -0
  35. quadra/configs/backbone/xcit_tiny_24_p8_224.yaml +9 -0
  36. quadra/configs/callbacks/all.yaml +32 -0
  37. quadra/configs/callbacks/default.yaml +37 -0
  38. quadra/configs/callbacks/default_anomalib.yaml +67 -0
  39. quadra/configs/config.yaml +33 -0
  40. quadra/configs/core/default.yaml +11 -0
  41. quadra/configs/datamodule/base/anomaly.yaml +16 -0
  42. quadra/configs/datamodule/base/classification.yaml +21 -0
  43. quadra/configs/datamodule/base/multilabel_classification.yaml +23 -0
  44. quadra/configs/datamodule/base/segmentation.yaml +18 -0
  45. quadra/configs/datamodule/base/segmentation_multiclass.yaml +20 -0
  46. quadra/configs/datamodule/base/sklearn_classification.yaml +23 -0
  47. quadra/configs/datamodule/base/sklearn_classification_patch.yaml +17 -0
  48. quadra/configs/datamodule/base/ssl.yaml +21 -0
  49. quadra/configs/datamodule/generic/imagenette/classification/base.yaml +9 -0
  50. quadra/configs/datamodule/generic/imagenette/ssl/base.yaml +10 -0
  51. quadra/configs/datamodule/generic/mnist/anomaly/base.yaml +14 -0
  52. quadra/configs/datamodule/generic/mvtec/anomaly/base.yaml +14 -0
  53. quadra/configs/datamodule/generic/oxford_pet/segmentation/base.yaml +9 -0
  54. quadra/configs/experiment/base/anomaly/cfa.yaml +47 -0
  55. quadra/configs/experiment/base/anomaly/cflow.yaml +47 -0
  56. quadra/configs/experiment/base/anomaly/csflow.yaml +48 -0
  57. quadra/configs/experiment/base/anomaly/draem.yaml +51 -0
  58. quadra/configs/experiment/base/anomaly/efficient_ad.yaml +43 -0
  59. quadra/configs/experiment/base/anomaly/fastflow.yaml +46 -0
  60. quadra/configs/experiment/base/anomaly/inference.yaml +21 -0
  61. quadra/configs/experiment/base/anomaly/padim.yaml +37 -0
  62. quadra/configs/experiment/base/anomaly/patchcore.yaml +37 -0
  63. quadra/configs/experiment/base/classification/classification.yaml +73 -0
  64. quadra/configs/experiment/base/classification/classification_evaluation.yaml +25 -0
  65. quadra/configs/experiment/base/classification/multilabel_classification.yaml +41 -0
  66. quadra/configs/experiment/base/classification/sklearn_classification.yaml +27 -0
  67. quadra/configs/experiment/base/classification/sklearn_classification_patch.yaml +25 -0
  68. quadra/configs/experiment/base/classification/sklearn_classification_patch_test.yaml +18 -0
  69. quadra/configs/experiment/base/classification/sklearn_classification_test.yaml +25 -0
  70. quadra/configs/experiment/base/segmentation/smp.yaml +30 -0
  71. quadra/configs/experiment/base/segmentation/smp_evaluation.yaml +17 -0
  72. quadra/configs/experiment/base/segmentation/smp_multiclass.yaml +26 -0
  73. quadra/configs/experiment/base/segmentation/smp_multiclass_evaluation.yaml +18 -0
  74. quadra/configs/experiment/base/ssl/barlow.yaml +48 -0
  75. quadra/configs/experiment/base/ssl/byol.yaml +43 -0
  76. quadra/configs/experiment/base/ssl/dino.yaml +46 -0
  77. quadra/configs/experiment/base/ssl/linear_eval.yaml +52 -0
  78. quadra/configs/experiment/base/ssl/simclr.yaml +48 -0
  79. quadra/configs/experiment/base/ssl/simsiam.yaml +53 -0
  80. quadra/configs/experiment/custom/cls.yaml +12 -0
  81. quadra/configs/experiment/default.yaml +15 -0
  82. quadra/configs/experiment/generic/imagenette/classification/default.yaml +20 -0
  83. quadra/configs/experiment/generic/imagenette/ssl/barlow.yaml +14 -0
  84. quadra/configs/experiment/generic/imagenette/ssl/byol.yaml +14 -0
  85. quadra/configs/experiment/generic/imagenette/ssl/dino.yaml +14 -0
  86. quadra/configs/experiment/generic/imagenette/ssl/simclr.yaml +14 -0
  87. quadra/configs/experiment/generic/imagenette/ssl/simsiam.yaml +14 -0
  88. quadra/configs/experiment/generic/mnist/anomaly/cfa.yaml +34 -0
  89. quadra/configs/experiment/generic/mnist/anomaly/cflow.yaml +33 -0
  90. quadra/configs/experiment/generic/mnist/anomaly/csflow.yaml +33 -0
  91. quadra/configs/experiment/generic/mnist/anomaly/draem.yaml +33 -0
  92. quadra/configs/experiment/generic/mnist/anomaly/fastflow.yaml +29 -0
  93. quadra/configs/experiment/generic/mnist/anomaly/inference.yaml +27 -0
  94. quadra/configs/experiment/generic/mnist/anomaly/padim.yaml +37 -0
  95. quadra/configs/experiment/generic/mnist/anomaly/patchcore.yaml +37 -0
  96. quadra/configs/experiment/generic/mvtec/anomaly/cfa.yaml +34 -0
  97. quadra/configs/experiment/generic/mvtec/anomaly/cflow.yaml +33 -0
  98. quadra/configs/experiment/generic/mvtec/anomaly/csflow.yaml +33 -0
  99. quadra/configs/experiment/generic/mvtec/anomaly/draem.yaml +33 -0
  100. quadra/configs/experiment/generic/mvtec/anomaly/efficient_ad.yaml +38 -0
  101. quadra/configs/experiment/generic/mvtec/anomaly/fastflow.yaml +29 -0
  102. quadra/configs/experiment/generic/mvtec/anomaly/inference.yaml +27 -0
  103. quadra/configs/experiment/generic/mvtec/anomaly/padim.yaml +37 -0
  104. quadra/configs/experiment/generic/mvtec/anomaly/patchcore.yaml +37 -0
  105. quadra/configs/experiment/generic/oxford_pet/segmentation/smp.yaml +27 -0
  106. quadra/configs/export/default.yaml +13 -0
  107. quadra/configs/hydra/anomaly_custom.yaml +15 -0
  108. quadra/configs/hydra/default.yaml +14 -0
  109. quadra/configs/inference/default.yaml +26 -0
  110. quadra/configs/logger/comet.yaml +10 -0
  111. quadra/configs/logger/csv.yaml +5 -0
  112. quadra/configs/logger/mlflow.yaml +12 -0
  113. quadra/configs/logger/tensorboard.yaml +8 -0
  114. quadra/configs/loss/asl.yaml +7 -0
  115. quadra/configs/loss/barlow.yaml +2 -0
  116. quadra/configs/loss/bce.yaml +1 -0
  117. quadra/configs/loss/byol.yaml +1 -0
  118. quadra/configs/loss/cross_entropy.yaml +1 -0
  119. quadra/configs/loss/dino.yaml +8 -0
  120. quadra/configs/loss/simclr.yaml +2 -0
  121. quadra/configs/loss/simsiam.yaml +1 -0
  122. quadra/configs/loss/smp_ce.yaml +3 -0
  123. quadra/configs/loss/smp_dice.yaml +2 -0
  124. quadra/configs/loss/smp_dice_multiclass.yaml +2 -0
  125. quadra/configs/loss/smp_mcc.yaml +2 -0
  126. quadra/configs/loss/vicreg.yaml +5 -0
  127. quadra/configs/model/anomalib/cfa.yaml +35 -0
  128. quadra/configs/model/anomalib/cflow.yaml +30 -0
  129. quadra/configs/model/anomalib/csflow.yaml +34 -0
  130. quadra/configs/model/anomalib/dfm.yaml +19 -0
  131. quadra/configs/model/anomalib/draem.yaml +29 -0
  132. quadra/configs/model/anomalib/efficient_ad.yaml +31 -0
  133. quadra/configs/model/anomalib/fastflow.yaml +32 -0
  134. quadra/configs/model/anomalib/padim.yaml +32 -0
  135. quadra/configs/model/anomalib/patchcore.yaml +36 -0
  136. quadra/configs/model/barlow.yaml +16 -0
  137. quadra/configs/model/byol.yaml +25 -0
  138. quadra/configs/model/classification.yaml +10 -0
  139. quadra/configs/model/dino.yaml +26 -0
  140. quadra/configs/model/logistic_regression.yaml +4 -0
  141. quadra/configs/model/multilabel_classification.yaml +9 -0
  142. quadra/configs/model/simclr.yaml +18 -0
  143. quadra/configs/model/simsiam.yaml +24 -0
  144. quadra/configs/model/smp.yaml +4 -0
  145. quadra/configs/model/smp_multiclass.yaml +4 -0
  146. quadra/configs/model/vicreg.yaml +16 -0
  147. quadra/configs/optimizer/adam.yaml +5 -0
  148. quadra/configs/optimizer/adamw.yaml +3 -0
  149. quadra/configs/optimizer/default.yaml +4 -0
  150. quadra/configs/optimizer/lars.yaml +8 -0
  151. quadra/configs/optimizer/sgd.yaml +4 -0
  152. quadra/configs/scheduler/default.yaml +5 -0
  153. quadra/configs/scheduler/rop.yaml +5 -0
  154. quadra/configs/scheduler/step.yaml +3 -0
  155. quadra/configs/scheduler/warmrestart.yaml +2 -0
  156. quadra/configs/scheduler/warmup.yaml +6 -0
  157. quadra/configs/task/anomalib/cfa.yaml +5 -0
  158. quadra/configs/task/anomalib/cflow.yaml +5 -0
  159. quadra/configs/task/anomalib/csflow.yaml +5 -0
  160. quadra/configs/task/anomalib/draem.yaml +5 -0
  161. quadra/configs/task/anomalib/efficient_ad.yaml +5 -0
  162. quadra/configs/task/anomalib/fastflow.yaml +5 -0
  163. quadra/configs/task/anomalib/inference.yaml +3 -0
  164. quadra/configs/task/anomalib/padim.yaml +5 -0
  165. quadra/configs/task/anomalib/patchcore.yaml +5 -0
  166. quadra/configs/task/classification.yaml +6 -0
  167. quadra/configs/task/classification_evaluation.yaml +6 -0
  168. quadra/configs/task/default.yaml +1 -0
  169. quadra/configs/task/segmentation.yaml +9 -0
  170. quadra/configs/task/segmentation_evaluation.yaml +3 -0
  171. quadra/configs/task/sklearn_classification.yaml +13 -0
  172. quadra/configs/task/sklearn_classification_patch.yaml +11 -0
  173. quadra/configs/task/sklearn_classification_patch_test.yaml +8 -0
  174. quadra/configs/task/sklearn_classification_test.yaml +8 -0
  175. quadra/configs/task/ssl.yaml +2 -0
  176. quadra/configs/trainer/lightning_cpu.yaml +36 -0
  177. quadra/configs/trainer/lightning_gpu.yaml +35 -0
  178. quadra/configs/trainer/lightning_gpu_bf16.yaml +36 -0
  179. quadra/configs/trainer/lightning_gpu_fp16.yaml +36 -0
  180. quadra/configs/trainer/lightning_multigpu.yaml +37 -0
  181. quadra/configs/trainer/sklearn_classification.yaml +7 -0
  182. quadra/configs/transforms/byol.yaml +47 -0
  183. quadra/configs/transforms/byol_no_random_resize.yaml +61 -0
  184. quadra/configs/transforms/default.yaml +37 -0
  185. quadra/configs/transforms/default_numpy.yaml +24 -0
  186. quadra/configs/transforms/default_resize.yaml +22 -0
  187. quadra/configs/transforms/dino.yaml +63 -0
  188. quadra/configs/transforms/linear_eval.yaml +18 -0
  189. quadra/datamodules/__init__.py +20 -0
  190. quadra/datamodules/anomaly.py +180 -0
  191. quadra/datamodules/base.py +375 -0
  192. quadra/datamodules/classification.py +1003 -0
  193. quadra/datamodules/generic/__init__.py +0 -0
  194. quadra/datamodules/generic/imagenette.py +144 -0
  195. quadra/datamodules/generic/mnist.py +81 -0
  196. quadra/datamodules/generic/mvtec.py +58 -0
  197. quadra/datamodules/generic/oxford_pet.py +163 -0
  198. quadra/datamodules/patch.py +190 -0
  199. quadra/datamodules/segmentation.py +742 -0
  200. quadra/datamodules/ssl.py +140 -0
  201. quadra/datasets/__init__.py +17 -0
  202. quadra/datasets/anomaly.py +287 -0
  203. quadra/datasets/classification.py +241 -0
  204. quadra/datasets/patch.py +138 -0
  205. quadra/datasets/segmentation.py +239 -0
  206. quadra/datasets/ssl.py +110 -0
  207. quadra/losses/__init__.py +0 -0
  208. quadra/losses/classification/__init__.py +6 -0
  209. quadra/losses/classification/asl.py +83 -0
  210. quadra/losses/classification/focal.py +320 -0
  211. quadra/losses/classification/prototypical.py +148 -0
  212. quadra/losses/ssl/__init__.py +17 -0
  213. quadra/losses/ssl/barlowtwins.py +47 -0
  214. quadra/losses/ssl/byol.py +37 -0
  215. quadra/losses/ssl/dino.py +129 -0
  216. quadra/losses/ssl/hyperspherical.py +45 -0
  217. quadra/losses/ssl/idmm.py +50 -0
  218. quadra/losses/ssl/simclr.py +67 -0
  219. quadra/losses/ssl/simsiam.py +30 -0
  220. quadra/losses/ssl/vicreg.py +76 -0
  221. quadra/main.py +46 -0
  222. quadra/metrics/__init__.py +3 -0
  223. quadra/metrics/segmentation.py +251 -0
  224. quadra/models/__init__.py +0 -0
  225. quadra/models/base.py +151 -0
  226. quadra/models/classification/__init__.py +8 -0
  227. quadra/models/classification/backbones.py +149 -0
  228. quadra/models/classification/base.py +92 -0
  229. quadra/models/evaluation.py +322 -0
  230. quadra/modules/__init__.py +0 -0
  231. quadra/modules/backbone.py +30 -0
  232. quadra/modules/base.py +312 -0
  233. quadra/modules/classification/__init__.py +3 -0
  234. quadra/modules/classification/base.py +331 -0
  235. quadra/modules/ssl/__init__.py +17 -0
  236. quadra/modules/ssl/barlowtwins.py +59 -0
  237. quadra/modules/ssl/byol.py +172 -0
  238. quadra/modules/ssl/common.py +285 -0
  239. quadra/modules/ssl/dino.py +186 -0
  240. quadra/modules/ssl/hyperspherical.py +206 -0
  241. quadra/modules/ssl/idmm.py +98 -0
  242. quadra/modules/ssl/simclr.py +73 -0
  243. quadra/modules/ssl/simsiam.py +68 -0
  244. quadra/modules/ssl/vicreg.py +67 -0
  245. quadra/optimizers/__init__.py +4 -0
  246. quadra/optimizers/lars.py +153 -0
  247. quadra/optimizers/sam.py +127 -0
  248. quadra/schedulers/__init__.py +3 -0
  249. quadra/schedulers/base.py +44 -0
  250. quadra/schedulers/warmup.py +127 -0
  251. quadra/tasks/__init__.py +24 -0
  252. quadra/tasks/anomaly.py +582 -0
  253. quadra/tasks/base.py +397 -0
  254. quadra/tasks/classification.py +1264 -0
  255. quadra/tasks/patch.py +492 -0
  256. quadra/tasks/segmentation.py +389 -0
  257. quadra/tasks/ssl.py +560 -0
  258. quadra/trainers/README.md +3 -0
  259. quadra/trainers/__init__.py +0 -0
  260. quadra/trainers/classification.py +179 -0
  261. quadra/utils/__init__.py +0 -0
  262. quadra/utils/anomaly.py +112 -0
  263. quadra/utils/classification.py +618 -0
  264. quadra/utils/deprecation.py +31 -0
  265. quadra/utils/evaluation.py +474 -0
  266. quadra/utils/export.py +579 -0
  267. quadra/utils/imaging.py +32 -0
  268. quadra/utils/logger.py +15 -0
  269. quadra/utils/mlflow.py +98 -0
  270. quadra/utils/model_manager.py +320 -0
  271. quadra/utils/models.py +524 -0
  272. quadra/utils/patch/__init__.py +15 -0
  273. quadra/utils/patch/dataset.py +1433 -0
  274. quadra/utils/patch/metrics.py +449 -0
  275. quadra/utils/patch/model.py +153 -0
  276. quadra/utils/patch/visualization.py +217 -0
  277. quadra/utils/resolver.py +42 -0
  278. quadra/utils/segmentation.py +31 -0
  279. quadra/utils/tests/__init__.py +0 -0
  280. quadra/utils/tests/fixtures/__init__.py +1 -0
  281. quadra/utils/tests/fixtures/dataset/__init__.py +39 -0
  282. quadra/utils/tests/fixtures/dataset/anomaly.py +124 -0
  283. quadra/utils/tests/fixtures/dataset/classification.py +406 -0
  284. quadra/utils/tests/fixtures/dataset/imagenette.py +53 -0
  285. quadra/utils/tests/fixtures/dataset/segmentation.py +161 -0
  286. quadra/utils/tests/fixtures/models/__init__.py +3 -0
  287. quadra/utils/tests/fixtures/models/anomaly.py +89 -0
  288. quadra/utils/tests/fixtures/models/classification.py +45 -0
  289. quadra/utils/tests/fixtures/models/segmentation.py +33 -0
  290. quadra/utils/tests/helpers.py +70 -0
  291. quadra/utils/tests/models.py +27 -0
  292. quadra/utils/utils.py +525 -0
  293. quadra/utils/validator.py +115 -0
  294. quadra/utils/visualization.py +422 -0
  295. quadra/utils/vit_explainability.py +349 -0
  296. quadra-2.1.13.dist-info/LICENSE +201 -0
  297. quadra-2.1.13.dist-info/METADATA +386 -0
  298. quadra-2.1.13.dist-info/RECORD +300 -0
  299. {quadra-0.0.1.dist-info → quadra-2.1.13.dist-info}/WHEEL +1 -1
  300. quadra-2.1.13.dist-info/entry_points.txt +3 -0
  301. quadra-0.0.1.dist-info/METADATA +0 -14
  302. quadra-0.0.1.dist-info/RECORD +0 -4
@@ -0,0 +1,386 @@
1
+ Metadata-Version: 2.1
2
+ Name: quadra
3
+ Version: 2.1.13
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.dev134)
25
+ Requires-Dist: boto3 (>=1.26,<1.27)
26
+ Requires-Dist: grad_cam (==1.4.6)
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 @ git+https://github.com/qubvel/segmentation_models.pytorch@7b381f899ed472a477a89d381689caf535b5d0a6
51
+ Requires-Dist: tensorboard (>=2.11,<2.12)
52
+ Requires-Dist: timm (==0.9.12)
53
+ Requires-Dist: torch @ https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp310-cp310-linux_x86_64.whl ; sys_platform == "linux" and python_version == "3.10"
54
+ Requires-Dist: torch @ https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp310-cp310-win_amd64.whl ; sys_platform == "win32" and python_version == "3.10"
55
+ Requires-Dist: torch @ https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp39-cp39-linux_x86_64.whl ; sys_platform == "linux" and python_version == "3.9"
56
+ Requires-Dist: torch @ https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp39-cp39-win_amd64.whl ; sys_platform == "win32" and python_version == "3.9"
57
+ Requires-Dist: torchinfo (>=1.8,<1.9)
58
+ Requires-Dist: torchmetrics (>=0.10,<0.11)
59
+ Requires-Dist: torchsummary (>=1.5,<1.6)
60
+ Requires-Dist: torchvision (>=0.16,<0.17)
61
+ Requires-Dist: tripy (>=1.0,<1.1)
62
+ Requires-Dist: typing_extensions (==4.11.0) ; python_version < "3.10"
63
+ Requires-Dist: xxhash (>=3.2,<3.3)
64
+ Project-URL: Repository, https://github.com/orobix/quadra
65
+ Description-Content-Type: text/markdown
66
+
67
+ <h1></h1>
68
+ <p align="center">
69
+ <img src="docs/images/quadra_text_logo.png" alt="Quadra Logo" width="100%">
70
+ </p>
71
+
72
+ <p align="center">
73
+ <a href="https://orobix.github.io/quadra/latest/index.html">Docs</a> •
74
+ <a href="https://orobix.github.io/quadra/latest/tutorials/datamodules.html">Tutorials</a> •
75
+ <a href="https://orobix.github.io/quadra/latest/tutorials/configurations.html">Configurations</a>
76
+ </p>
77
+
78
+ <div align="center">
79
+ <a href="https://github.com/astral-sh/ruff">
80
+ <img
81
+ src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json"
82
+ alt="ruff"
83
+ ></a>
84
+ <a href="https://github.com/pre-commit/pre-commit"><img
85
+ src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white"
86
+ alt="pre-commit"
87
+ /></a>
88
+ <a href="https://github.com/econchick/interrogate"><img
89
+ src="docs/images/interrogate_badge.svg"
90
+ alt="interrogate"
91
+ /></a>
92
+ <a href="https://github.com/PyCQA/pylint"><img
93
+ src="https://img.shields.io/badge/linting-pylint-yellowgreen"
94
+ alt="pylint"
95
+ /></a>
96
+ <a href="https://mypy-lang.org/"><img
97
+ src="https://www.mypy-lang.org/static/mypy_badge.svg"
98
+ alt="Checked with mypy"
99
+ /></a>
100
+
101
+ </div>
102
+
103
+ ______________________________________________________________________
104
+
105
+
106
+ `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/).
107
+
108
+
109
+ ## Quick Start Guide
110
+
111
+ Currently we support installing from source since the library is not yet available on `PyPI` and currently supported Python versions are `3.9` and `3.10`.
112
+
113
+ If you use pip to manage your packages, you can install `quadra` from source by running the following command:
114
+ ```shell
115
+ pip install git+https://github.com/orobix/quadra.git
116
+ ```
117
+
118
+ If instead you prefer to use poetry, you can install `quadra` from source by running the following command:
119
+ ```shell
120
+ poetry add git+https://github.com/orobix/quadra.git
121
+ ```
122
+
123
+ 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.
124
+
125
+ ### Using Conda
126
+
127
+ Create and activate a new `Conda` environment.
128
+
129
+ ```shell
130
+ conda create -n myenv python=3.10
131
+ conda activate myenv
132
+ ```
133
+
134
+ ### Using Python Virtualenv
135
+
136
+ Create and activate a new virtual environment.
137
+
138
+ ```shell
139
+ # replace `myenv` with the name of your virtual environment
140
+ python3 -m venv myenv
141
+ source myenv/bin/activate
142
+ ```
143
+
144
+ ### Common Setup
145
+
146
+ 1. **Check your git version**:
147
+ Make sure you have git version 2.10 or higher, to avoid any installation failures.
148
+ ```shell
149
+ git --version
150
+ ```
151
+
152
+ 2. **Upgrade pip**:
153
+ ```shell
154
+ pip install --upgrade pip
155
+ ```
156
+
157
+ 3. Install the package
158
+
159
+ * **Install the `quadra` package** with pip:
160
+ ```shell
161
+ pip install git+https://github.com/orobix/quadra.git
162
+ ```
163
+
164
+ * **Install the `quadra` package** with poetry:
165
+ ```shell
166
+ curl -sSL https://install.python-poetry.org | python3 -
167
+ poetry add git+https://github.com/orobix/quadra.git
168
+ ```
169
+
170
+ 4. **Run from CLI**:
171
+ Run the following command to check if the installation was successful:
172
+ ```shell
173
+ quadra experiment=default
174
+ ```
175
+
176
+ ### Setup `Mlflow` (Optional)
177
+
178
+ 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/).
179
+
180
+ 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:
181
+
182
+ **Using the command line:**
183
+
184
+ ```
185
+ export MLFLOW_TRACKING_URI=http://localhost:5000
186
+ ```
187
+ 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.
188
+
189
+ **Adding it to your environment file:**
190
+
191
+ `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:
192
+
193
+ ```
194
+ MLFLOW_TRACKING_URI=http://localhost:5000
195
+ ```
196
+ Again, modify the address if your Mlflow server is running on a different host or port.
197
+
198
+ 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.
199
+
200
+ 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.
201
+
202
+ ## Run Example Experiments
203
+
204
+ `quadra` provides a set of example experiments that can be used to test the installation and to provide some example configuration files.
205
+
206
+ 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:
207
+
208
+ ```bash
209
+ quadra <configurations> trainer=lightning_cpu
210
+ ```
211
+
212
+ ### Classification Training
213
+
214
+ To run a simple classification training on the [Imagenette dataset](https://github.com/fastai/imagenette) with a Resnet18 architecture run the following command:
215
+
216
+ ```bash
217
+ quadra experiment=generic/imagenette/classification/default logger=csv
218
+ ```
219
+
220
+ 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.
221
+
222
+ By default the experiment will run on the GPU 0, to run it on the CPU you can specify a different `trainer` configuration parameter.
223
+
224
+
225
+ ### Segmentation Training
226
+
227
+ 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:
228
+
229
+ ```bash
230
+ quadra experiment=generic/oxford_pet/segmentation/smp logger=csv
231
+ ```
232
+
233
+ 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.
234
+
235
+ ### (SSL) Self-supervised Learning Training
236
+
237
+ On the same dataset we can run a simple SSL training using the BYOL algorithm with the following command:
238
+
239
+ ```bash
240
+ quadra experiment=generic/imagenette/ssl/byol logger=csv
241
+ ```
242
+
243
+ BYOL is not the only SSL algorithm available, you can find a list of all the available algorithms under `quadra/experiment/generic/imagenette/ssl` folder.
244
+
245
+
246
+ ### Anomaly Detection Training
247
+
248
+ 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:
249
+
250
+ ```bash
251
+ quadra experiment=generic/mnist/anomaly/padim logger=csv
252
+ ```
253
+
254
+ This will run an anomaly detection considering on of the classes as good (default is the number 9) and the rest as anomalies.
255
+
256
+ 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/experiment/generic/mnist/anomaly` folder.
257
+
258
+ ## Running with Custom Datasets
259
+
260
+ 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/experiment/base/<task>/<config_name>.yaml`.
261
+
262
+ Let's see how we can customize the configuration file to run the classification experiment on a custom dataset.
263
+
264
+ Structure your dataset in the following way:
265
+
266
+ ```tree
267
+ dataset/
268
+ ├── class_1
269
+ │ ├── abc.xyz
270
+ │ └── ...
271
+ ├── class_2
272
+ │ ├── abc.xyz
273
+ │ └── ...
274
+ ├── class_3
275
+ │ ├── abc.xyz
276
+ │ └── ...
277
+ ```
278
+
279
+ Create a new experiment configuration file under `quadra/configs/experiment/custom/<config_name>.yaml` with the following content:
280
+
281
+ ```yaml
282
+ # @package _global_
283
+ defaults:
284
+ - base/classification/classification # extends the default classification configuration
285
+
286
+ core:
287
+ name: <your-custom-experiment-name> # name of the experiment
288
+
289
+ model:
290
+ num_classes: <number-of_classes-you-have> # number of classes in your dataset
291
+ ```
292
+
293
+ Run the experiment with the following command:
294
+
295
+ ```bash
296
+ quadra experiment=custom/<config_name> logger=csv
297
+ ```
298
+
299
+ 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.
300
+
301
+ 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).
302
+
303
+ ## Development
304
+
305
+ First clone the repository from Github
306
+
307
+ 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.
308
+
309
+ 1. `git clone https://github.com/orobix/quadra.git && cd quadra`
310
+ 2. Install poetry `curl -sSL https://install.python-poetry.org | python3 -`
311
+ 3. Install the required poetry plugins
312
+ ```
313
+ poetry self add poetry-bumpversion
314
+ poetry self add poetry-dotenv-plugin
315
+ ```
316
+ 4. Install `quadra` package in editable mode `poetry install --with test,dev,docs --all-extras`
317
+ 5. Install pre-commit hooks `pre-commit install`
318
+ 6. (Optional) Eventually build documentation by calling required commands (see below).
319
+
320
+ 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.
321
+
322
+ We rely on a combination of `Pylint`, `Mypy` and `Ruff` to enforce code quality.
323
+
324
+ ## Building Documentations
325
+
326
+ 1. Activate your virtual environment.
327
+ 2. Install the `quadra` package with at least `doc` version.
328
+ 3. To run the webserver for real-time rendering and editing run `mkdocs serve` and visit `http://localhost:8000/`.
329
+ 4. If you want to export the static website to a specific folder `mkdocs build -d <Destination Folder>`
330
+
331
+
332
+ ## Acknowledgements
333
+
334
+ 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:
335
+
336
+ - [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.
337
+ - 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`).
338
+ - 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.
339
+ - Data processing and augmentation are done using [Albumentations](https://albumentations.ai/docs/) and [OpenCV](https://opencv.org/).
340
+ - [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.
341
+ - 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).
342
+ - Models can be exported in different ways (`torchscript` or `torch` file). We have also added [ONNX](https://onnx.ai/) support for some models.
343
+ - Testing framework is based on [Pytest](https://docs.pytest.org/en/) and related plug-ins.
344
+ - 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.
345
+
346
+ ## FAQ
347
+
348
+ **How can I fix errors related to `GL` when I install full `opencv` package?**
349
+
350
+ 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:
351
+
352
+ It can be solved by correctly linking the `libGL.so.1` library:
353
+
354
+ ```bash
355
+ # Check where the library is located
356
+ find /usr -name libGL.so.1
357
+ ```
358
+
359
+ ```bash
360
+ # if the library is located in /usr/lib/x86_64-linux-gnu
361
+ # link it to /usr/lib
362
+ sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so
363
+ ```
364
+
365
+ or installing following packages (depending on your OS this may vary):
366
+
367
+ ```bash
368
+ sudo apt-get install libgl1-mesa-glx
369
+ ```
370
+
371
+
372
+ **How can I run multiple experiments with single command?**
373
+
374
+ You can run multiple experiments with a single command by passing `--multirun` flag:
375
+
376
+ ```bash
377
+ quadra <configurations> --multirun
378
+ ```
379
+
380
+ For example if you want to run same experiment with different seeds you can run:
381
+
382
+ ```bash
383
+ quadra experiment=generic/imagenette/classification/default trainer=lightning_cpu logger=csv core.seed=1,2,3 --multirun
384
+ ```
385
+
386
+