biapy 3.3.1__tar.gz → 3.3.3__tar.gz

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 (146) hide show
  1. {biapy-3.3.1/biapy.egg-info → biapy-3.3.3}/PKG-INFO +13 -8
  2. {biapy-3.3.1 → biapy-3.3.3}/README.md +12 -7
  3. {biapy-3.3.1 → biapy-3.3.3}/biapy/_biapy.py +15 -5
  4. {biapy-3.3.1 → biapy-3.3.3}/biapy/config/config.py +17 -20
  5. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/pre_processing.py +14 -8
  6. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/base_workflow.py +65 -62
  7. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/check_configuration.py +33 -44
  8. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/detection.py +15 -15
  9. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/instance_seg.py +94 -24
  10. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/semantic_seg.py +1 -1
  11. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/super_resolution.py +5 -5
  12. {biapy-3.3.1 → biapy-3.3.3/biapy.egg-info}/PKG-INFO +13 -8
  13. {biapy-3.3.1 → biapy-3.3.3}/biapy.egg-info/SOURCES.txt +1 -0
  14. biapy-3.3.3/img/BiaPy_presentation_and_demo_at_RTmfm.jpg +0 -0
  15. {biapy-3.3.1 → biapy-3.3.3}/main.py +4 -3
  16. {biapy-3.3.1 → biapy-3.3.3}/pyproject.toml +1 -1
  17. {biapy-3.3.1 → biapy-3.3.3}/setup.py +1 -1
  18. {biapy-3.3.1 → biapy-3.3.3}/templates/denoising/2d_denoising.yaml +1 -4
  19. {biapy-3.3.1 → biapy-3.3.3}/templates/denoising/3d_denoising.yaml +1 -4
  20. {biapy-3.3.1 → biapy-3.3.3}/templates/detection/2d_detection.yaml +1 -4
  21. {biapy-3.3.1 → biapy-3.3.3}/templates/detection/3d_detection.yaml +0 -3
  22. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/2d_instance_segmentation.yaml +1 -4
  23. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/3d_instance_segmentation.yaml +1 -4
  24. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/MitoEM_paper/mitoem.yaml +0 -4
  25. {biapy-3.3.1 → biapy-3.3.3}/templates/self-supervised/2d_self-supervised.yaml +1 -4
  26. {biapy-3.3.1 → biapy-3.3.3}/templates/self-supervised/3d_self-supervised.yaml +1 -4
  27. {biapy-3.3.1 → biapy-3.3.3}/templates/semantic_segmentation/2d_semantic_segmentation.yaml +1 -4
  28. {biapy-3.3.1 → biapy-3.3.3}/templates/semantic_segmentation/3d_semantic_segmentation.yaml +1 -4
  29. {biapy-3.3.1 → biapy-3.3.3}/templates/super-resolution/3d_super-resolution.yaml +0 -3
  30. {biapy-3.3.1 → biapy-3.3.3}/.gitignore +0 -0
  31. {biapy-3.3.1 → biapy-3.3.3}/CODE_OF_CONDUCT.md +0 -0
  32. {biapy-3.3.1 → biapy-3.3.3}/LICENSE.md +0 -0
  33. {biapy-3.3.1 → biapy-3.3.3}/biapy/__init__.py +0 -0
  34. {biapy-3.3.1 → biapy-3.3.3}/biapy/config/__init__.py +0 -0
  35. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/__init__.py +0 -0
  36. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/data_2D_manipulation.py +0 -0
  37. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/data_3D_manipulation.py +0 -0
  38. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/__init__.py +0 -0
  39. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/augmentors.py +0 -0
  40. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/pair_base_data_generator.py +0 -0
  41. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/pair_data_2D_generator.py +0 -0
  42. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/pair_data_3D_generator.py +0 -0
  43. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/single_base_data_generator.py +0 -0
  44. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/single_data_2D_generator.py +0 -0
  45. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/single_data_3D_generator.py +0 -0
  46. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/test_pair_data_generators.py +0 -0
  47. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/generators/test_single_data_generator.py +0 -0
  48. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/post_processing/__init__.py +0 -0
  49. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/post_processing/post_processing.py +0 -0
  50. {biapy-3.3.1 → biapy-3.3.3}/biapy/data/post_processing/smooth_tiled_predictions.py +0 -0
  51. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/__init__.py +0 -0
  52. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/classification.py +0 -0
  53. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/denoising.py +0 -0
  54. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/metrics.py +0 -0
  55. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/schedulers/warmup_cosine_decay.py +0 -0
  56. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/self_supervised.py +0 -0
  57. {biapy-3.3.1 → biapy-3.3.3}/biapy/engine/train_engine.py +0 -0
  58. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/__init__.py +0 -0
  59. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/attention_unet.py +0 -0
  60. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/blocks.py +0 -0
  61. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/dfcan.py +0 -0
  62. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/edsr.py +0 -0
  63. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/efficientnet.py +0 -0
  64. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/mae.py +0 -0
  65. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/multiresunet.py +0 -0
  66. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/rcan.py +0 -0
  67. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/resunet++.py +0 -0
  68. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/resunet.py +0 -0
  69. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/seunet.py +0 -0
  70. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/simple_cnn.py +0 -0
  71. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/tr_layers.py +0 -0
  72. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/unet.py +0 -0
  73. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/unetr.py +0 -0
  74. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/vit.py +0 -0
  75. {biapy-3.3.1 → biapy-3.3.3}/biapy/models/wdsr.py +0 -0
  76. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/callbacks.py +0 -0
  77. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/env/Dockerfile +0 -0
  78. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/env/Dockerfile_CUDA10.2 +0 -0
  79. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/env/create_docker_image.sh +0 -0
  80. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/matching.py +0 -0
  81. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/misc.py +0 -0
  82. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/calculate_detection_metrics.py +0 -0
  83. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/calculate_metrics_3D.py +0 -0
  84. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/create_probability_csv.py +0 -0
  85. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/crop_2D_dataset.py +0 -0
  86. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/crop_3D_dataset.py +0 -0
  87. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/crop_and_discard_3D_dataset.py +0 -0
  88. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/detection_plots.py +0 -0
  89. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/detection_probs_to_points.py +0 -0
  90. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/fill_holes_in_seg_masks.py +0 -0
  91. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/filter_close_points.py +0 -0
  92. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/from_class_csv_to_folders.py +0 -0
  93. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/h5_to_tif.py +0 -0
  94. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/h5_to_zarr.py +0 -0
  95. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/merge_dataset_channels.py +0 -0
  96. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/order_axes.py +0 -0
  97. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/scripts/tif_to_h5.py +0 -0
  98. {biapy-3.3.1 → biapy-3.3.3}/biapy/utils/util.py +0 -0
  99. {biapy-3.3.1 → biapy-3.3.3}/biapy.egg-info/dependency_links.txt +0 -0
  100. {biapy-3.3.1 → biapy-3.3.3}/biapy.egg-info/requires.txt +0 -0
  101. {biapy-3.3.1 → biapy-3.3.3}/biapy.egg-info/top_level.txt +0 -0
  102. {biapy-3.3.1 → biapy-3.3.3}/img/BiaPy-Euro-BioImaging-youtube.png +0 -0
  103. {biapy-3.3.1 → biapy-3.3.3}/img/BiaPy-workflow-readme.svg +0 -0
  104. {biapy-3.3.1 → biapy-3.3.3}/img/BiaPy_GUI_main_page.png +0 -0
  105. {biapy-3.3.1 → biapy-3.3.3}/img/MitoEM_teaser_cable_length_split.png +0 -0
  106. {biapy-3.3.1 → biapy-3.3.3}/img/biapy_logo.png +0 -0
  107. {biapy-3.3.1 → biapy-3.3.3}/img/complex_MOAS.png +0 -0
  108. {biapy-3.3.1 → biapy-3.3.3}/img/cyst_instance_prediction.gif +0 -0
  109. {biapy-3.3.1 → biapy-3.3.3}/img/cyst_sample.gif +0 -0
  110. {biapy-3.3.1 → biapy-3.3.3}/img/domain_EM.jpg +0 -0
  111. {biapy-3.3.1 → biapy-3.3.3}/img/halo_instances.png +0 -0
  112. {biapy-3.3.1 → biapy-3.3.3}/img/unet_attn_stable.png +0 -0
  113. {biapy-3.3.1 → biapy-3.3.3}/img/wound_diagram_VQVAE.png +0 -0
  114. {biapy-3.3.1 → biapy-3.3.3}/notebooks/BiaPy_Inference.ipynb +0 -0
  115. {biapy-3.3.1 → biapy-3.3.3}/notebooks/classification/BiaPy_2D_Classification.ipynb +0 -0
  116. {biapy-3.3.1 → biapy-3.3.3}/notebooks/classification/BiaPy_2D_Classification_Butterfly.ipynb +0 -0
  117. {biapy-3.3.1 → biapy-3.3.3}/notebooks/classification/BiaPy_3D_Classification.ipynb +0 -0
  118. {biapy-3.3.1 → biapy-3.3.3}/notebooks/denoising/BiaPy_2D_Denoising.ipynb +0 -0
  119. {biapy-3.3.1 → biapy-3.3.3}/notebooks/denoising/BiaPy_3D_Denoising.ipynb +0 -0
  120. {biapy-3.3.1 → biapy-3.3.3}/notebooks/detection/BiaPy_2D_Detection.ipynb +0 -0
  121. {biapy-3.3.1 → biapy-3.3.3}/notebooks/detection/BiaPy_3D_Detection.ipynb +0 -0
  122. {biapy-3.3.1 → biapy-3.3.3}/notebooks/instance_segmentation/BiaPy_2D_Instance_Segmentation.ipynb +0 -0
  123. {biapy-3.3.1 → biapy-3.3.3}/notebooks/instance_segmentation/BiaPy_3D_Instance_Segmentation.ipynb +0 -0
  124. {biapy-3.3.1 → biapy-3.3.3}/notebooks/self-supervised/BiaPy_2D_Self_Supervision.ipynb +0 -0
  125. {biapy-3.3.1 → biapy-3.3.3}/notebooks/self-supervised/BiaPy_3D_Self_Supervision.ipynb +0 -0
  126. {biapy-3.3.1 → biapy-3.3.3}/notebooks/semantic_segmentation/BiaPy_2D_Semantic_Segmentation.ipynb +0 -0
  127. {biapy-3.3.1 → biapy-3.3.3}/notebooks/semantic_segmentation/BiaPy_3D_Semantic_Segmentation.ipynb +0 -0
  128. {biapy-3.3.1 → biapy-3.3.3}/notebooks/super-resolution/BiaPy_2D_Super_Resolution.ipynb +0 -0
  129. {biapy-3.3.1 → biapy-3.3.3}/notebooks/super-resolution/BiaPy_3D_Super_Resolution.ipynb +0 -0
  130. {biapy-3.3.1 → biapy-3.3.3}/setup.cfg +0 -0
  131. {biapy-3.3.1 → biapy-3.3.3}/templates/classification/2d_classification.yaml +0 -0
  132. {biapy-3.3.1 → biapy-3.3.3}/templates/classification/2d_classification_rgb.yaml +0 -0
  133. {biapy-3.3.1 → biapy-3.3.3}/templates/classification/3d_classification.yaml +0 -0
  134. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/CartoCell_paper/CartoCell - Inference workflow (Phase 5).ipynb +0 -0
  135. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/CartoCell_paper/CartoCell - Training workflow (Phase 2).ipynb +0 -0
  136. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/CartoCell_paper/cartocell_inference.yaml +0 -0
  137. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/CartoCell_paper/cartocell_training.yaml +0 -0
  138. {biapy-3.3.1 → biapy-3.3.3}/templates/instance_segmentation/CartoCell_paper/model_weights_cartocell.h5 +0 -0
  139. {biapy-3.3.1 → biapy-3.3.3}/templates/semantic_segmentation/stable_paper/semantic_segmentation_workflow.ipynb +0 -0
  140. {biapy-3.3.1 → biapy-3.3.3}/templates/sota_implementations/Casser_workflow.ipynb +0 -0
  141. {biapy-3.3.1 → biapy-3.3.3}/templates/sota_implementations/Cheng_2D_workflow.ipynb +0 -0
  142. {biapy-3.3.1 → biapy-3.3.3}/templates/sota_implementations/Cheng_3D_workflow.ipynb +0 -0
  143. {biapy-3.3.1 → biapy-3.3.3}/templates/sota_implementations/Oztel_workflow.ipynb +0 -0
  144. {biapy-3.3.1 → biapy-3.3.3}/templates/sota_implementations/Xiao_workflow.ipynb +0 -0
  145. {biapy-3.3.1 → biapy-3.3.3}/templates/super-resolution/2d_super-resolution.yaml +0 -0
  146. {biapy-3.3.1 → biapy-3.3.3}/templates/super-resolution/2d_super-resolution_rgb.yaml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biapy
3
- Version: 3.3.1
3
+ Version: 3.3.3
4
4
  Summary: BiaPy: Bioimage analysis pipelines in Python
5
5
  Home-page: https://github.com/BiaPyX/BiaPy
6
6
  Author: BiaPy Contributors
@@ -52,29 +52,34 @@ Requires-Dist: imagecodecs>=2023.3.16
52
52
  <img src="https://img.shields.io/badge/IEEE-Paper-00629B.svg" /></a>
53
53
  </p>
54
54
 
55
- [BiaPy](https://github.com/BiaPyX/BiaPy) is an open source Python library for building bioimage analysis pipelines. This repository is actively under development by the Biomedical Computer Vision group at the [University of the Basque Country](https://www.ehu.eus/en/en-home) and the [Donostia International Physics Center](http://dipc.ehu.es/).
55
+ [BiaPy](https://biapyx.github.io) is an open source ready-to-use all-in-one library that provides deep-learning workflows for a large variety of bioimage analysis tasks, including 2D and 3D [semantic segmentation](https://biapy.readthedocs.io/en/latest/workflows/semantic_segmentation.html), [instance segmentation](https://biapy.readthedocs.io/en/latest/workflows/instance_segmentation.html), [object detection](https://biapy.readthedocs.io/en/latest/workflows/detection.html), [image denoising](https://biapy.readthedocs.io/en/latest/workflows/denoising.html), [single image super-resolution](https://biapy.readthedocs.io/en/latest/workflows/super_resolution.html), [self-supervised learning](https://biapy.readthedocs.io/en/latest/workflows/self_supervision.html) and [image classification](https://biapy.readthedocs.io/en/latest/workflows/classification.html).
56
+
57
+ BiaPy is a versatile platform designed to accommodate both proficient computer scientists and users less experienced in programming. It offers diverse and user-friendly access points to our workflows.
58
+
59
+ This repository is actively under development by the Biomedical Computer Vision group at the [University of the Basque Country](https://www.ehu.eus/en/en-home) and the [Donostia International Physics Center](http://dipc.ehu.es/).
56
60
 
57
- The library provides an easy way to create image processing pipelines that are typically used in the analysis of biology microscopy images in 2D and 3D. Namely, BiaPy contains ready-to-use solutions for the tasks of [semantic segmentation](https://biapy.readthedocs.io/en/latest/workflows/semantic_segmentation.html), [instance segmentation](https://biapy.readthedocs.io/en/latest/workflows/instance_segmentation.html), [object detection](https://biapy.readthedocs.io/en/latest/workflows/detection.html), [image denoising](https://biapy.readthedocs.io/en/latest/workflows/denoising.html), [single image super-resolution](https://biapy.readthedocs.io/en/latest/workflows/super_resolution.html), [self-supervised learning](https://biapy.readthedocs.io/en/latest/workflows/self_supervision.html) and [image classification](https://biapy.readthedocs.io/en/latest/workflows/classification.html). The source code is based on Pytorch as backend. Given BiaPy’s deep learning based core, a machine with a graphics processing unit (GPU) is recommended for fast training and execution.
58
61
  ![BiaPy workflows](https://raw.githubusercontent.com/BiaPyX/BiaPy/master/img/BiaPy-workflow-readme.svg)
59
62
 
60
63
  ## Description video
61
- Find a gentle introduction to BiaPy in this video of Ignacio Arganda-Carreras in [the Virtual Pub of Euro-BioImaging](https://www.eurobioimaging.eu/about-us/virtual-pub):
64
+ Find a comprehensive overview of BiaPy and its functionality in the following videos:
65
+
66
+ | [![BiaPy history and GUI demo](./img/BiaPy_presentation_and_demo_at_RTmfm.jpg)](https://www.youtube.com/watch?v=Gnm-VsZQ6Cc "BiaPy: a ready-to-use library for Bioimage Analysis Pipelines") <br> <span style="font-weight:normal">BiaPy history and GUI demo at [RTmfm](https://rtmfm.cnrs.fr/en/) by Ignacio Arganda-Carreras and Daniel Franco-Barranco.</span> |
67
+ |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
68
+ | [![BiaPy presentation](./img/BiaPy-Euro-BioImaging-youtube.png)](https://youtu.be/6eYtX-ySpc0 "BiaPy: a ready-to-use library for Bioimage Analysis Pipelines") <br> BiaPy presentation at [Virtual Pub of Euro-BioImaging](https://www.eurobioimaging.eu/) by Ignacio Arganda-Carreras. | | | | |
62
69
 
63
- [![BiaPy description video](./img/BiaPy-Euro-BioImaging-youtube.png)](https://www.youtube.com/watch?v=t5cqpjWQS9Q "BiaPy: a ready-to-use library for Bioimage Analysis Pipelines")
64
70
  ## User interface
65
71
 
66
72
  You can also use BiaPy through our graphical user interface (GUI).
67
73
 
68
74
  ![BiaPy GUI](https://raw.githubusercontent.com/BiaPyX/BiaPy/master/img/BiaPy_GUI_main_page.png)
69
75
 
70
- ### Download BiaPy GUI for you OS
76
+ ## Download BiaPy GUI for you OS
71
77
 
72
78
  - [Windows 64-bit](https://drive.google.com/uc?export=download&id=1iV0wzdFhpCpBCBgsameGyT3iFyQ6av5o)
73
79
  - [Linux 64-bit](https://drive.google.com/uc?export=download&id=13jllkLTR6S3yVZLRdMwhWUu7lq3HyJsD)
74
80
  - [macOS 64-bit](https://drive.google.com/uc?export=download&id=1fIpj9A8SWIN1fABEUAS--DNhOHzqSL7f)
75
81
 
76
- ### Project's page
77
- [[BiaPy GUI](https://github.com/BiaPyX/BiaPy-GUI)]
82
+ Project's page: [[BiaPy GUI](https://github.com/BiaPyX/BiaPy-GUI)]
78
83
 
79
84
  ## Applications using BiaPy
80
85
 
@@ -17,29 +17,34 @@
17
17
  <img src="https://img.shields.io/badge/IEEE-Paper-00629B.svg" /></a>
18
18
  </p>
19
19
 
20
- [BiaPy](https://github.com/BiaPyX/BiaPy) is an open source Python library for building bioimage analysis pipelines. This repository is actively under development by the Biomedical Computer Vision group at the [University of the Basque Country](https://www.ehu.eus/en/en-home) and the [Donostia International Physics Center](http://dipc.ehu.es/).
20
+ [BiaPy](https://biapyx.github.io) is an open source ready-to-use all-in-one library that provides deep-learning workflows for a large variety of bioimage analysis tasks, including 2D and 3D [semantic segmentation](https://biapy.readthedocs.io/en/latest/workflows/semantic_segmentation.html), [instance segmentation](https://biapy.readthedocs.io/en/latest/workflows/instance_segmentation.html), [object detection](https://biapy.readthedocs.io/en/latest/workflows/detection.html), [image denoising](https://biapy.readthedocs.io/en/latest/workflows/denoising.html), [single image super-resolution](https://biapy.readthedocs.io/en/latest/workflows/super_resolution.html), [self-supervised learning](https://biapy.readthedocs.io/en/latest/workflows/self_supervision.html) and [image classification](https://biapy.readthedocs.io/en/latest/workflows/classification.html).
21
+
22
+ BiaPy is a versatile platform designed to accommodate both proficient computer scientists and users less experienced in programming. It offers diverse and user-friendly access points to our workflows.
23
+
24
+ This repository is actively under development by the Biomedical Computer Vision group at the [University of the Basque Country](https://www.ehu.eus/en/en-home) and the [Donostia International Physics Center](http://dipc.ehu.es/).
21
25
 
22
- The library provides an easy way to create image processing pipelines that are typically used in the analysis of biology microscopy images in 2D and 3D. Namely, BiaPy contains ready-to-use solutions for the tasks of [semantic segmentation](https://biapy.readthedocs.io/en/latest/workflows/semantic_segmentation.html), [instance segmentation](https://biapy.readthedocs.io/en/latest/workflows/instance_segmentation.html), [object detection](https://biapy.readthedocs.io/en/latest/workflows/detection.html), [image denoising](https://biapy.readthedocs.io/en/latest/workflows/denoising.html), [single image super-resolution](https://biapy.readthedocs.io/en/latest/workflows/super_resolution.html), [self-supervised learning](https://biapy.readthedocs.io/en/latest/workflows/self_supervision.html) and [image classification](https://biapy.readthedocs.io/en/latest/workflows/classification.html). The source code is based on Pytorch as backend. Given BiaPy’s deep learning based core, a machine with a graphics processing unit (GPU) is recommended for fast training and execution.
23
26
  ![BiaPy workflows](https://raw.githubusercontent.com/BiaPyX/BiaPy/master/img/BiaPy-workflow-readme.svg)
24
27
 
25
28
  ## Description video
26
- Find a gentle introduction to BiaPy in this video of Ignacio Arganda-Carreras in [the Virtual Pub of Euro-BioImaging](https://www.eurobioimaging.eu/about-us/virtual-pub):
29
+ Find a comprehensive overview of BiaPy and its functionality in the following videos:
30
+
31
+ | [![BiaPy history and GUI demo](./img/BiaPy_presentation_and_demo_at_RTmfm.jpg)](https://www.youtube.com/watch?v=Gnm-VsZQ6Cc "BiaPy: a ready-to-use library for Bioimage Analysis Pipelines") <br> <span style="font-weight:normal">BiaPy history and GUI demo at [RTmfm](https://rtmfm.cnrs.fr/en/) by Ignacio Arganda-Carreras and Daniel Franco-Barranco.</span> |
32
+ |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
33
+ | [![BiaPy presentation](./img/BiaPy-Euro-BioImaging-youtube.png)](https://youtu.be/6eYtX-ySpc0 "BiaPy: a ready-to-use library for Bioimage Analysis Pipelines") <br> BiaPy presentation at [Virtual Pub of Euro-BioImaging](https://www.eurobioimaging.eu/) by Ignacio Arganda-Carreras. | | | | |
27
34
 
28
- [![BiaPy description video](./img/BiaPy-Euro-BioImaging-youtube.png)](https://www.youtube.com/watch?v=t5cqpjWQS9Q "BiaPy: a ready-to-use library for Bioimage Analysis Pipelines")
29
35
  ## User interface
30
36
 
31
37
  You can also use BiaPy through our graphical user interface (GUI).
32
38
 
33
39
  ![BiaPy GUI](https://raw.githubusercontent.com/BiaPyX/BiaPy/master/img/BiaPy_GUI_main_page.png)
34
40
 
35
- ### Download BiaPy GUI for you OS
41
+ ## Download BiaPy GUI for you OS
36
42
 
37
43
  - [Windows 64-bit](https://drive.google.com/uc?export=download&id=1iV0wzdFhpCpBCBgsameGyT3iFyQ6av5o)
38
44
  - [Linux 64-bit](https://drive.google.com/uc?export=download&id=13jllkLTR6S3yVZLRdMwhWUu7lq3HyJsD)
39
45
  - [macOS 64-bit](https://drive.google.com/uc?export=download&id=1fIpj9A8SWIN1fABEUAS--DNhOHzqSL7f)
40
46
 
41
- ### Project's page
42
- [[BiaPy GUI](https://github.com/BiaPyX/BiaPy-GUI)]
47
+ Project's page: [[BiaPy GUI](https://github.com/BiaPyX/BiaPy-GUI)]
43
48
 
44
49
  ## Applications using BiaPy
45
50
 
@@ -290,12 +290,23 @@ class BiaPy():
290
290
  output_sample_path = os.path.join(bmz_cfg['build_dir'], "test-output.npy")
291
291
  test_input = self.workflow.bmz_test_input if 'test_input' not in bmz_cfg else bmz_cfg['test_input']
292
292
  test_output = self.workflow.bmz_test_output if 'test_output' not in bmz_cfg else bmz_cfg['test_output']
293
+
293
294
  if test_input.ndim == 3:
294
295
  np.save(input_sample_path, test_input.permute((2, 0 ,1)).unsqueeze(0))
295
- np.save(output_sample_path, test_output.permute((2, 0 ,1)).unsqueeze(0))
296
+ in_axis = ["bcyx"]
296
297
  else:
297
298
  np.save(input_sample_path, test_input.permute((3, 0 ,1, 2)).unsqueeze(0))
299
+ in_axis = ["bczyx"]
300
+
301
+ if test_output.ndim == 3:
302
+ np.save(output_sample_path, test_output.permute((2, 0 ,1)).unsqueeze(0))
303
+ out_axis = ["bcyx"]
304
+ elif test_output.ndim == 4:
298
305
  np.save(output_sample_path, test_output.permute((3, 0 ,1, 2)).unsqueeze(0))
306
+ out_axis = ["bczyx"]
307
+ else:
308
+ np.save(output_sample_path, test_output.unsqueeze(0))
309
+ out_axis = ["bc"]
299
310
 
300
311
  # Name of the model
301
312
  if 'model_name' in bmz_cfg:
@@ -359,8 +370,8 @@ class BiaPy():
359
370
  # these are passed as list because we support multiple inputs / outputs per model
360
371
  test_inputs=[input_sample_path],
361
372
  test_outputs=[output_sample_path],
362
- input_axes=["bcyx"] if 'input_axes' not in bmz_cfg else bmz_cfg['input_axes'],
363
- output_axes=["bcyx"] if 'output_axes' not in bmz_cfg else bmz_cfg['output_axes'],
373
+ input_axes=in_axis if 'input_axes' not in bmz_cfg else bmz_cfg['input_axes'],
374
+ output_axes=out_axis if 'output_axes' not in bmz_cfg else bmz_cfg['output_axes'],
364
375
  # where to save the model zip, how to call the model and a short description of it
365
376
  output_path=os.path.join(bmz_cfg['build_dir'], "model.zip"),
366
377
  name=model_name,
@@ -395,5 +406,4 @@ class BiaPy():
395
406
  dist.barrier()
396
407
  dist.destroy_process_group()
397
408
 
398
- print("FINISHED JOB {} !!".format(self.job_identifier))
399
- sys.exit(0)
409
+ print("FINISHED JOB {} !!".format(self.job_identifier))
@@ -229,7 +229,7 @@ class Config:
229
229
 
230
230
  # Resize datasets
231
231
  _C.DATA.PREPROCESS.RESIZE = CN()
232
- _C.DATA.PREPROCESS.RESIZE.ACTIVATE = False
232
+ _C.DATA.PREPROCESS.RESIZE.ENABLE = False
233
233
  # Desired resize size. when using 3D data, size must be also in 3D (ex. (512,512,512))
234
234
  _C.DATA.PREPROCESS.RESIZE.OUTPUT_SHAPE = (512,512)
235
235
  # interpolation order: {0: Nearest-neighbor, 1: Bi-linear (default), 2: Bi-quadratic, 3: Bi-cubic, 4: Bi-quartic, 5: Bi-quintic}
@@ -237,7 +237,7 @@ class Config:
237
237
  # Points outside the boundaries of the input are filled according to the given mode: {‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’}
238
238
  _C.DATA.PREPROCESS.RESIZE.MODE = 'reflect'
239
239
  # Used in conjunction with mode ‘constant’, the value outside the image boundaries.
240
- _C.DATA.PREPROCESS.RESIZE.CVAL = 0
240
+ _C.DATA.PREPROCESS.RESIZE.CVAL = 0.
241
241
  # Whether to clip the output to the range of values of the input image.
242
242
  _C.DATA.PREPROCESS.RESIZE.CLIP = True
243
243
  # Whether to keep the original range of values.
@@ -247,7 +247,7 @@ class Config:
247
247
 
248
248
  # Gaussian blur
249
249
  _C.DATA.PREPROCESS.GAUSSIAN_BLUR = CN()
250
- _C.DATA.PREPROCESS.GAUSSIAN_BLUR.ACTIVATE = False
250
+ _C.DATA.PREPROCESS.GAUSSIAN_BLUR.ENABLE = False
251
251
  # Standard deviation for Gaussian kernel.
252
252
  _C.DATA.PREPROCESS.GAUSSIAN_BLUR.SIGMA = 1
253
253
  # The mode parameter determines how the array borders are handled: {‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’} ‘constant’ value = 0
@@ -258,20 +258,17 @@ class Config:
258
258
 
259
259
  # Median blur
260
260
  _C.DATA.PREPROCESS.MEDIAN_BLUR = CN()
261
- _C.DATA.PREPROCESS.MEDIAN_BLUR.ACTIVATE = False
262
- # is a N-D array of 1’s and 0’s with the same number of dimension than image.
263
- # If None, footprint will be a N-D array with 3 elements for each dimension (e.g., vector, square, cube, etc.)
264
- _C.DATA.PREPROCESS.MEDIAN_BLUR.FOOTPRINT = None
261
+ _C.DATA.PREPROCESS.MEDIAN_BLUR.ENABLE = False
265
262
 
266
- # Histogram matching
263
+ # Histogram matching. More info at: https://en.wikipedia.org/wiki/Histogram_matching
267
264
  _C.DATA.PREPROCESS.MATCH_HISTOGRAM = CN()
268
- _C.DATA.PREPROCESS.MATCH_HISTOGRAM.ACTIVATE = False
265
+ _C.DATA.PREPROCESS.MATCH_HISTOGRAM.ENABLE = False
269
266
  # the path of the reference images, from which the reference histogram will be extracted
270
267
  _C.DATA.PREPROCESS.MATCH_HISTOGRAM.REFERENCE_PATH = os.path.join("user_data", 'test', 'x')
271
268
 
272
- # Contrast Limited Adaptive Histogram Equalization
269
+ # Contrast Limited Adaptive Histogram Equalization. More info at: https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE
273
270
  _C.DATA.PREPROCESS.CLAHE = CN()
274
- _C.DATA.PREPROCESS.CLAHE.ACTIVATE = False
271
+ _C.DATA.PREPROCESS.CLAHE.ENABLE = False
275
272
  # Defines the shape of contextual regions used in the algorithm.
276
273
  # By default, kernel_size is 1/8 of image height by 1/8 of its width.
277
274
  _C.DATA.PREPROCESS.CLAHE.KERNEL_SIZE = None
@@ -280,7 +277,7 @@ class Config:
280
277
 
281
278
  # Canny or edge detection (only 2D - grayscale or RGB)
282
279
  _C.DATA.PREPROCESS.CANNY = CN()
283
- _C.DATA.PREPROCESS.CANNY.ACTIVATE = False
280
+ _C.DATA.PREPROCESS.CANNY.ENABLE = False
284
281
  # Lower bound for hysteresis thresholding (linking edges). If None, low_threshold is set to 10% of dtype’s max.
285
282
  _C.DATA.PREPROCESS.CANNY.LOW_THRESHOLD = None
286
283
  # Upper bound for hysteresis thresholding (linking edges). If None, high_threshold is set to 20% of dtype’s max.
@@ -787,14 +784,12 @@ class Config:
787
784
  _C.TEST.AUGMENTATION = False
788
785
  # Whether to evaluate or not
789
786
  _C.TEST.EVALUATE = True
790
- # Stack 2D images into a 3D image and then process it entirely instead of going image per image. This stacks
791
- # images that have been merged with 'TEST.STATS.MERGE_PATCHES' = True or 'TEST.STATS.FULL_IMG' (priorizes this later)
787
+ # Stack 2D images into a 3D image and then process it entirely instead of going image per image
792
788
  _C.TEST.ANALIZE_2D_IMGS_AS_3D_STACK = False
793
789
 
794
- _C.TEST.STATS = CN()
795
- _C.TEST.STATS.PER_PATCH = False
796
- _C.TEST.STATS.MERGE_PATCHES = False # Only used when _C.TEST.STATS.PER_PATCH = True
797
- _C.TEST.STATS.FULL_IMG = True # Only when if PROBLEM.NDIM = '2D' as 3D images are huge for the GPU
790
+ # If PROBLEM.NDIM = '2D' this can be activated to process each image entirely instead of patch by patch. Only can be done
791
+ # if the neural network is fully convolutional
792
+ _C.TEST.FULL_IMG = False
798
793
 
799
794
  ### Instance segmentation
800
795
  # Whether to calculate matching statistics (average overlap, accuracy, recall, precision, etc.)
@@ -833,8 +828,7 @@ class Config:
833
828
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
834
829
  # Post-processing
835
830
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
836
- # When PROBLEM.NDIM = '2D' only applies when _C.TEST.STATS.FULL_IMG = True, if PROBLEM.NDIM = '3D' is applied
837
- # when _C.TEST.STATS.MERGE_PATCHES = True
831
+ # When PROBLEM.NDIM = '2D' only applies when _C.TEST.ANALIZE_2D_IMGS_AS_3D_STACK = True
838
832
  _C.TEST.POST_PROCESSING = CN()
839
833
  _C.TEST.POST_PROCESSING.YZ_FILTERING = False
840
834
  _C.TEST.POST_PROCESSING.YZ_FILTERING_SIZE = 5
@@ -961,6 +955,9 @@ class Config:
961
955
  _C.PATHS.RESULT_DIR.PER_IMAGE_POST_PROCESSING = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'per_image_post_processing')
962
956
  _C.PATHS.RESULT_DIR.FULL_IMAGE = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'full_image')
963
957
  _C.PATHS.RESULT_DIR.FULL_IMAGE_BIN = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'full_image_binarized')
958
+ _C.PATHS.RESULT_DIR.FULL_IMAGE_INSTANCES = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'full_image_instances')
959
+ _C.PATHS.RESULT_DIR.FULL_IMAGE_POST_PROCESSING = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'full_image_post_processing')
960
+ _C.PATHS.RESULT_DIR.AS_3D_STACK = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'as_3d_stack')
964
961
  _C.PATHS.RESULT_DIR.AS_3D_STACK_POST_PROCESSING = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'as_3d_stack_post_processing')
965
962
  _C.PATHS.RESULT_DIR.DET_LOCAL_MAX_COORDS_CHECK = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'per_image_local_max_check')
966
963
  _C.PATHS.RESULT_DIR.DET_ASSOC_POINTS = os.path.join(_C.PATHS.RESULT_DIR.PATH, 'point_associations')
@@ -1172,10 +1172,10 @@ def preprocess_data(cfg, x_data=[], y_data=[], is_2d=True, is_y_mask=False):
1172
1172
  In case of using a list, the format of the images remains the same. Each item in the list
1173
1173
  corresponds to a different image.
1174
1174
 
1175
- is_2d: Bool, optional
1175
+ is_2d: bool, optional
1176
1176
  A boolean flag indicating whether the reference data for histogram matching is 2D or not. Defaults to True.
1177
1177
 
1178
- is_y_mask: Bool, optional
1178
+ is_y_mask: bool, optional
1179
1179
  is_y_mask is a boolean parameter that indicates whether the y_data is a mask or not. If
1180
1180
  it is set to True, the resize operation for y_data will use the nearest neighbor interpolation
1181
1181
  method (order=0), otherwise it will use the interpolation method specified in the cfg.RESIZE.ORDER
@@ -1190,7 +1190,8 @@ def preprocess_data(cfg, x_data=[], y_data=[], is_2d=True, is_y_mask=False):
1190
1190
  Preprocessed data. The same structure and dimensionality of the given data will be returned.
1191
1191
  """
1192
1192
 
1193
- if cfg.RESIZE.ACTIVATE:
1193
+ if cfg.RESIZE.ENABLE:
1194
+ print("Preprocessing: applying resize . . .")
1194
1195
  if len(x_data) > 0:
1195
1196
  x_data = resize_images(x_data,
1196
1197
  output_shape = cfg.RESIZE.OUTPUT_SHAPE,
@@ -1215,27 +1216,32 @@ def preprocess_data(cfg, x_data=[], y_data=[], is_2d=True, is_y_mask=False):
1215
1216
  )
1216
1217
 
1217
1218
  if len(x_data) > 0:
1218
- if cfg.GAUSSIAN_BLUR.ACTIVATE:
1219
+ if cfg.GAUSSIAN_BLUR.ENABLE:
1220
+ print("Preprocessing: applying gaussian blur . . .")
1219
1221
  x_data = apply_gaussian_blur(x_data,
1220
1222
  sigma = cfg.GAUSSIAN_BLUR.SIGMA,
1221
1223
  mode = cfg.GAUSSIAN_BLUR.MODE,
1222
1224
  channel_axis = cfg.GAUSSIAN_BLUR.CHANNEL_AXIS,
1223
1225
  )
1224
- if cfg.MEDIAN_BLUR.ACTIVATE:
1226
+ if cfg.MEDIAN_BLUR.ENABLE:
1227
+ print("Preprocessing: applying median blur . . .")
1225
1228
  x_data = apply_median_blur(x_data,
1226
1229
  footprint = cfg.MEDIAN_BLUR.FOOTPRINT,
1227
1230
  )
1228
- if cfg.MATCH_HISTOGRAM.ACTIVATE:
1231
+ if cfg.MATCH_HISTOGRAM.ENABLE:
1232
+ print("Preprocessing: applying histogram matching . . .")
1229
1233
  x_data = apply_histogram_matching(x_data,
1230
1234
  reference_path = cfg.MATCH_HISTOGRAM.REFERENCE_PATH,
1231
1235
  is_2d = is_2d,
1232
1236
  )
1233
- if cfg.CLAHE.ACTIVATE:
1237
+ if cfg.CLAHE.ENABLE:
1238
+ print("Preprocessing: applying CLAHE . . .")
1234
1239
  x_data = apply_clahe(x_data,
1235
1240
  kernel_size = cfg.CLAHE.KERNEL_SIZE,
1236
1241
  clip_limit = cfg.CLAHE.CLIP_LIMIT,
1237
1242
  )
1238
- if cfg.CANNY.ACTIVATE:
1243
+ if cfg.CANNY.ENABLE:
1244
+ print("Preprocessing: applying Canny . . .")
1239
1245
  x_data = detect_edges(x_data,
1240
1246
  low_threshold = cfg.CANNY.LOW_THRESHOLD,
1241
1247
  high_threshold = cfg.CANNY.HIGH_THRESHOLD,
@@ -59,7 +59,7 @@ class Base_Workflow(metaclass=ABCMeta):
59
59
  self.cross_val_samples_ids = None
60
60
  self.post_processing = {}
61
61
  self.post_processing['per_image'] = False
62
- self.post_processing['all_images'] = False
62
+ self.post_processing['as_3D_stack'] = False
63
63
  self.test_filenames = None
64
64
  self.metrics = []
65
65
  self.data_norm = None
@@ -88,18 +88,20 @@ class Base_Workflow(metaclass=ABCMeta):
88
88
  self.stats['patch_counter'] = 0
89
89
 
90
90
  # Merging the image
91
- self.stats['iou_per_image'] = 0
92
- self.stats['ov_iou_per_image'] = 0
91
+ self.stats['iou_merge_patches'] = 0
92
+ self.stats['ov_iou_merge_patches'] = 0
93
+ self.stats['iou_merge_patches_post'] = 0
94
+ self.stats['ov_iou_merge_patches_post'] = 0
95
+
96
+ # As 3D stack
97
+ self.stats['iou_as_3D_stack_post'] = 0
98
+ self.stats['ov_iou_as_3D_stack_post'] = 0
93
99
 
94
100
  # Full image
95
101
  self.stats['loss'] = 0
96
102
  self.stats['iou'] = 0
97
103
  self.stats['ov_iou'] = 0
98
104
 
99
- # Post processing
100
- self.stats['iou_post'] = 0
101
- self.stats['ov_iou_post'] = 0
102
-
103
105
  self.world_size = get_world_size()
104
106
  self.global_rank = get_rank()
105
107
  if self.cfg.TEST.BY_CHUNKS.ENABLE and self.cfg.PROBLEM.NDIM == '3D':
@@ -111,7 +113,7 @@ class Base_Workflow(metaclass=ABCMeta):
111
113
  # Test variables
112
114
  if self.cfg.TEST.ANALIZE_2D_IMGS_AS_3D_STACK and self.cfg.PROBLEM.NDIM == "2D":
113
115
  if self.cfg.TEST.POST_PROCESSING.YZ_FILTERING or self.cfg.TEST.POST_PROCESSING.Z_FILTERING:
114
- self.post_processing['all_images'] = True
116
+ self.post_processing['as_3D_stack'] = True
115
117
  elif self.cfg.PROBLEM.NDIM == "3D":
116
118
  if self.cfg.TEST.POST_PROCESSING.YZ_FILTERING or self.cfg.TEST.POST_PROCESSING.Z_FILTERING:
117
119
  self.post_processing['per_image'] = True
@@ -588,7 +590,7 @@ class Base_Workflow(metaclass=ABCMeta):
588
590
  if self.val_generator is not None:
589
591
  print("Val loss: {}".format(val_best_loss))
590
592
  for i in range(len(self.metric_names)):
591
- print("Val {}: {}".format(self.metric_names[i], val_best_metric))
593
+ print("Val {}: {}".format(self.metric_names[i], val_best_metric[i]))
592
594
 
593
595
  print('Finished Training')
594
596
 
@@ -1119,7 +1121,7 @@ class Base_Workflow(metaclass=ABCMeta):
1119
1121
  #################
1120
1122
  ### PER PATCH ###
1121
1123
  #################
1122
- if self.cfg.TEST.STATS.PER_PATCH:
1124
+ if not self.cfg.TEST.FULL_IMG or self.cfg.PROBLEM.NDIM == '3D':
1123
1125
  # Reflect data to complete the needed shape
1124
1126
  if self.cfg.DATA.REFLECT_TO_COMPLETE_SHAPE:
1125
1127
  reflected_orig_shape = self._X.shape
@@ -1278,49 +1280,45 @@ class Base_Workflow(metaclass=ABCMeta):
1278
1280
  save_tif(np.expand_dims(pred,0), self.cfg.PATHS.RESULT_DIR.PER_IMAGE, self.processing_filenames,
1279
1281
  verbose=self.cfg.TEST.VERBOSE)
1280
1282
 
1281
- #########################
1282
- ### MERGE PATCH STATS ###
1283
- #########################
1284
- if self.cfg.TEST.STATS.MERGE_PATCHES:
1285
- if self.cfg.DATA.TEST.LOAD_GT and self.cfg.PROBLEM.INSTANCE_SEG.DATA_CHANNELS != "Dv2":
1286
- if self._Y.ndim > pred.ndim: self._Y = self._Y[0]
1287
- if self.cfg.LOSS.TYPE != 'MASKED_BCE':
1288
- _iou_per_image = jaccard_index_numpy((self._Y>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8))
1289
- _ov_iou_per_image = voc_calculation((self._Y>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8),
1290
- _iou_per_image)
1291
- else:
1292
- exclusion_mask = self._Y < 2
1293
- binY = self._Y * exclusion_mask.astype( float )
1294
- _iou_per_image = jaccard_index_numpy((binY>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8))
1295
- _ov_iou_per_image = voc_calculation((binY>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8),
1296
- _iou_per_image)
1297
- self.stats['iou_per_image'] += _iou_per_image
1298
- self.stats['ov_iou_per_image'] += _ov_iou_per_image
1299
-
1300
- ############################
1301
- ### POST-PROCESSING (3D) ###
1302
- ############################
1303
- if self.post_processing['per_image']:
1304
- pred, _iou_post, _ov_iou_post = apply_post_processing(self.cfg, pred, self._Y)
1305
- self.stats['iou_post'] += _iou_post
1306
- self.stats['ov_iou_post'] += _ov_iou_post
1307
- if pred.ndim == 4:
1308
- save_tif(np.expand_dims(pred,0), self.cfg.PATHS.RESULT_DIR.PER_IMAGE_POST_PROCESSING,
1309
- self.processing_filenames, verbose=self.cfg.TEST.VERBOSE)
1310
- else:
1311
- save_tif(pred, self.cfg.PATHS.RESULT_DIR.PER_IMAGE_POST_PROCESSING, self.processing_filenames,
1312
- verbose=self.cfg.TEST.VERBOSE)
1283
+ if self.cfg.DATA.TEST.LOAD_GT and self.cfg.PROBLEM.INSTANCE_SEG.DATA_CHANNELS != "Dv2":
1284
+ if self._Y.ndim > pred.ndim: self._Y = self._Y[0]
1285
+ if self.cfg.LOSS.TYPE != 'MASKED_BCE':
1286
+ _iou_merge_patches = jaccard_index_numpy((self._Y>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8))
1287
+ _ov_iou_merge_patches = voc_calculation((self._Y>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8),
1288
+ _iou_merge_patches)
1289
+ else:
1290
+ exclusion_mask = self._Y < 2
1291
+ binY = self._Y * exclusion_mask.astype( float )
1292
+ _iou_merge_patches = jaccard_index_numpy((binY>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8))
1293
+ _ov_iou_merge_patches = voc_calculation((binY>0.5).astype(np.uint8), (pred>0.5).astype(np.uint8),
1294
+ _iou_merge_patches)
1295
+ self.stats['iou_merge_patches'] += _iou_merge_patches
1296
+ self.stats['ov_iou_merge_patches'] += _ov_iou_merge_patches
1297
+
1298
+ ############################
1299
+ ### POST-PROCESSING (3D) ###
1300
+ ############################
1301
+ if self.post_processing['per_image']:
1302
+ pred, _iou_post, _ov_iou_post = apply_post_processing(self.cfg, pred, self._Y)
1303
+ self.stats['iou_merge_patches_post'] += _iou_post
1304
+ self.stats['ov_iou_merge_patches_post'] += _ov_iou_post
1305
+ if pred.ndim == 4:
1306
+ save_tif(np.expand_dims(pred,0), self.cfg.PATHS.RESULT_DIR.PER_IMAGE_POST_PROCESSING,
1307
+ self.processing_filenames, verbose=self.cfg.TEST.VERBOSE)
1308
+ else:
1309
+ save_tif(pred, self.cfg.PATHS.RESULT_DIR.PER_IMAGE_POST_PROCESSING, self.processing_filenames,
1310
+ verbose=self.cfg.TEST.VERBOSE)
1313
1311
 
1314
1312
  self.after_merge_patches(pred)
1315
1313
 
1316
- if not self.cfg.TEST.STATS.FULL_IMG and self.cfg.TEST.ANALIZE_2D_IMGS_AS_3D_STACK:
1314
+ if self.cfg.TEST.ANALIZE_2D_IMGS_AS_3D_STACK:
1317
1315
  self.all_pred.append(pred)
1318
1316
  if self.cfg.DATA.TEST.LOAD_GT: self.all_gt.append(self._Y)
1319
1317
 
1320
1318
  ##################
1321
1319
  ### FULL IMAGE ###
1322
1320
  ##################
1323
- if self.cfg.TEST.STATS.FULL_IMG and self.cfg.PROBLEM.NDIM == '2D':
1321
+ if self.cfg.TEST.FULL_IMG and self.cfg.PROBLEM.NDIM == '2D':
1324
1322
  self._X, o_test_shape = check_downsample_division(self._X, len(self.cfg.MODEL.FEATURE_MAPS)-1)
1325
1323
  if self.cfg.DATA.TEST.LOAD_GT:
1326
1324
  self._Y, _ = check_downsample_division(self._Y, len(self.cfg.MODEL.FEATURE_MAPS)-1)
@@ -1398,18 +1396,21 @@ class Base_Workflow(metaclass=ABCMeta):
1398
1396
  self.stats['iou_per_crop'] = self.stats['iou_per_crop'] / self.stats['patch_counter'] if self.stats['patch_counter'] != 0 else 0
1399
1397
 
1400
1398
  # Merge patches
1401
- self.stats['iou_per_image'] = self.stats['iou_per_image'] / image_counter
1402
- self.stats['ov_iou_per_image'] = self.stats['ov_iou_per_image'] / image_counter
1399
+ self.stats['iou_merge_patches'] = self.stats['iou_merge_patches'] / image_counter
1400
+ self.stats['ov_iou_merge_patches'] = self.stats['ov_iou_merge_patches'] / image_counter
1403
1401
 
1404
1402
  # Full image
1405
1403
  self.stats['iou'] = self.stats['iou'] / image_counter
1406
1404
  self.stats['loss'] = self.stats['loss'] / image_counter
1407
1405
  self.stats['ov_iou'] = self.stats['ov_iou'] / image_counter
1408
1406
 
1409
- if self.post_processing['per_image'] or self.post_processing['all_images']:
1410
- self.stats['iou_post'] = self.stats['iou_post'] / image_counter
1411
- self.stats['ov_iou_post'] = self.stats['ov_iou_post'] / image_counter
1412
-
1407
+ if self.post_processing['per_image']:
1408
+ self.stats['iou_merge_patches_post'] = self.stats['iou_merge_patches_post'] / image_counter
1409
+ self.stats['ov_iou_merge_patches_post'] = self.stats['ov_iou_merge_patches_post'] / image_counter
1410
+ if self.post_processing['as_3D_stack']:
1411
+ self.stats['iou_as_3D_stack_post'] = self.stats['iou_as_3D_stack_post'] / image_counter
1412
+ self.stats['ov_iou_as_3D_stack_post'] = self.stats['ov_iou_as_3D_stack_post'] / image_counter
1413
+
1413
1414
  def print_stats(self, image_counter):
1414
1415
  """
1415
1416
  Print statistics.
@@ -1421,15 +1422,14 @@ class Base_Workflow(metaclass=ABCMeta):
1421
1422
  """
1422
1423
  self.normalize_stats(image_counter)
1423
1424
  if self.cfg.DATA.TEST.LOAD_GT:
1424
- if self.cfg.TEST.STATS.PER_PATCH:
1425
+ if not self.cfg.TEST.FULL_IMG:
1425
1426
  print("Loss (per patch): {}".format(self.stats['loss_per_crop']))
1426
1427
  print("Test Foreground IoU (per patch): {}".format(self.stats['iou_per_crop']))
1427
1428
  print(" ")
1428
- if self.cfg.TEST.STATS.MERGE_PATCHES:
1429
- print("Test Foreground IoU (merge patches): {}".format(self.stats['iou_per_image']))
1430
- print("Test Overall IoU (merge patches): {}".format(self.stats['ov_iou_per_image']))
1431
- print(" ")
1432
- if self.cfg.TEST.STATS.FULL_IMG:
1429
+ print("Test Foreground IoU (merge patches): {}".format(self.stats['iou_merge_patches']))
1430
+ print("Test Overall IoU (merge patches): {}".format(self.stats['ov_iou_merge_patches']))
1431
+ print(" ")
1432
+ else:
1433
1433
  print("Loss (per image): {}".format(self.stats['loss']))
1434
1434
  print("Test Foreground IoU (per image): {}".format(self.stats['iou']))
1435
1435
  print("Test Overall IoU (per image): {}".format(self.stats['ov_iou']))
@@ -1439,11 +1439,14 @@ class Base_Workflow(metaclass=ABCMeta):
1439
1439
  """
1440
1440
  Print post-processing statistics.
1441
1441
  """
1442
- if self.post_processing['per_image'] or self.post_processing['all_images']:
1443
- print("Test Foreground IoU (post-processing): {}".format(self.stats['iou_post']))
1444
- print("Test Overall IoU (post-processing): {}".format(self.stats['ov_iou_post']))
1442
+ if self.post_processing['per_image']:
1443
+ print("Test Foreground IoU (merge patches - post-processing): {}".format(self.stats['iou_merge_patches_post']))
1444
+ print("Test Overall IoU (merge patches - post-processing): {}".format(self.stats['ov_iou_merge_patches_post']))
1445
1445
  print(" ")
1446
-
1446
+ if self.post_processing['as_3D_stack']:
1447
+ print("Test Foreground IoU (as 3D stack - post-processing): {}".format(self.stats['iou_as_3D_stack_post']))
1448
+ print("Test Overall IoU (as 3D stack - post-processing): {}".format(self.stats['ov_iou_as_3D_stack_post']))
1449
+ print(" ")
1447
1450
 
1448
1451
  @abstractmethod
1449
1452
  def after_merge_patches(self, pred):
@@ -1525,10 +1528,10 @@ class Base_Workflow(metaclass=ABCMeta):
1525
1528
  ############################
1526
1529
  ### POST-PROCESSING (2D) ###
1527
1530
  ############################
1528
- if self.post_processing['all_images']:
1531
+ if self.post_processing['as_3D_stack']:
1529
1532
  self.all_pred = np.concatenate(self.all_pred)
1530
1533
  self.all_gt = np.concatenate(self.all_gt) if self.cfg.DATA.TEST.LOAD_GT else None
1531
- self.all_pred, self.stats['iou_post'], self.stats['ov_iou_post'] = apply_post_processing(self.cfg, self.all_pred, self.all_gt)
1534
+ self.all_pred, self.stats['iou_as_3D_stack_post'], self.stats['ov_iou_as_3D_stack_post'] = apply_post_processing(self.cfg, self.all_pred, self.all_gt)
1532
1535
  save_tif(np.expand_dims(self.all_pred,0), self.cfg.PATHS.RESULT_DIR.AS_3D_STACK_POST_PROCESSING, verbose=self.cfg.TEST.VERBOSE)
1533
1536
 
1534
1537
  def extract_patch_from_dataset(data, cfg, input_queue, extract_info_queue, verbose=False):