spacr 0.5.0__py3-none-any.whl → 0.9.1__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 (100) hide show
  1. spacr/__init__.py +0 -2
  2. spacr/__main__.py +3 -3
  3. spacr/core.py +13 -106
  4. spacr/gui_core.py +2 -77
  5. spacr/gui_utils.py +1 -13
  6. spacr/io.py +24 -25
  7. spacr/mediar.py +12 -8
  8. spacr/plot.py +50 -135
  9. spacr/settings.py +42 -30
  10. spacr/submodules.py +11 -1
  11. spacr/timelapse.py +7 -79
  12. spacr/utils.py +152 -61
  13. {spacr-0.5.0.dist-info → spacr-0.9.1.dist-info}/METADATA +62 -62
  14. spacr-0.9.1.dist-info/RECORD +109 -0
  15. {spacr-0.5.0.dist-info → spacr-0.9.1.dist-info}/WHEEL +1 -1
  16. spacr/resources/MEDIAR/.gitignore +0 -18
  17. spacr/resources/MEDIAR/LICENSE +0 -21
  18. spacr/resources/MEDIAR/README.md +0 -189
  19. spacr/resources/MEDIAR/SetupDict.py +0 -39
  20. spacr/resources/MEDIAR/__pycache__/SetupDict.cpython-39.pyc +0 -0
  21. spacr/resources/MEDIAR/__pycache__/evaluate.cpython-39.pyc +0 -0
  22. spacr/resources/MEDIAR/__pycache__/generate_mapping.cpython-39.pyc +0 -0
  23. spacr/resources/MEDIAR/__pycache__/main.cpython-39.pyc +0 -0
  24. spacr/resources/MEDIAR/config/baseline.json +0 -60
  25. spacr/resources/MEDIAR/config/mediar_example.json +0 -72
  26. spacr/resources/MEDIAR/config/pred/pred_mediar.json +0 -17
  27. spacr/resources/MEDIAR/config/step1_pretraining/phase1.json +0 -55
  28. spacr/resources/MEDIAR/config/step1_pretraining/phase2.json +0 -58
  29. spacr/resources/MEDIAR/config/step2_finetuning/finetuning1.json +0 -66
  30. spacr/resources/MEDIAR/config/step2_finetuning/finetuning2.json +0 -66
  31. spacr/resources/MEDIAR/config/step3_prediction/base_prediction.json +0 -16
  32. spacr/resources/MEDIAR/config/step3_prediction/ensemble_tta.json +0 -23
  33. spacr/resources/MEDIAR/core/BasePredictor.py +0 -120
  34. spacr/resources/MEDIAR/core/BaseTrainer.py +0 -240
  35. spacr/resources/MEDIAR/core/Baseline/Predictor.py +0 -59
  36. spacr/resources/MEDIAR/core/Baseline/Trainer.py +0 -113
  37. spacr/resources/MEDIAR/core/Baseline/__init__.py +0 -2
  38. spacr/resources/MEDIAR/core/Baseline/__pycache__/Predictor.cpython-39.pyc +0 -0
  39. spacr/resources/MEDIAR/core/Baseline/__pycache__/Trainer.cpython-39.pyc +0 -0
  40. spacr/resources/MEDIAR/core/Baseline/__pycache__/__init__.cpython-39.pyc +0 -0
  41. spacr/resources/MEDIAR/core/Baseline/__pycache__/utils.cpython-39.pyc +0 -0
  42. spacr/resources/MEDIAR/core/Baseline/utils.py +0 -80
  43. spacr/resources/MEDIAR/core/MEDIAR/EnsemblePredictor.py +0 -105
  44. spacr/resources/MEDIAR/core/MEDIAR/Predictor.py +0 -234
  45. spacr/resources/MEDIAR/core/MEDIAR/Trainer.py +0 -172
  46. spacr/resources/MEDIAR/core/MEDIAR/__init__.py +0 -3
  47. spacr/resources/MEDIAR/core/MEDIAR/__pycache__/EnsemblePredictor.cpython-39.pyc +0 -0
  48. spacr/resources/MEDIAR/core/MEDIAR/__pycache__/Predictor.cpython-39.pyc +0 -0
  49. spacr/resources/MEDIAR/core/MEDIAR/__pycache__/Trainer.cpython-39.pyc +0 -0
  50. spacr/resources/MEDIAR/core/MEDIAR/__pycache__/__init__.cpython-39.pyc +0 -0
  51. spacr/resources/MEDIAR/core/MEDIAR/__pycache__/utils.cpython-39.pyc +0 -0
  52. spacr/resources/MEDIAR/core/MEDIAR/utils.py +0 -429
  53. spacr/resources/MEDIAR/core/__init__.py +0 -2
  54. spacr/resources/MEDIAR/core/__pycache__/BasePredictor.cpython-39.pyc +0 -0
  55. spacr/resources/MEDIAR/core/__pycache__/BaseTrainer.cpython-39.pyc +0 -0
  56. spacr/resources/MEDIAR/core/__pycache__/__init__.cpython-39.pyc +0 -0
  57. spacr/resources/MEDIAR/core/__pycache__/utils.cpython-39.pyc +0 -0
  58. spacr/resources/MEDIAR/core/utils.py +0 -40
  59. spacr/resources/MEDIAR/evaluate.py +0 -71
  60. spacr/resources/MEDIAR/generate_mapping.py +0 -121
  61. spacr/resources/MEDIAR/image/examples/img1.tiff +0 -0
  62. spacr/resources/MEDIAR/image/examples/img2.tif +0 -0
  63. spacr/resources/MEDIAR/image/failure_cases.png +0 -0
  64. spacr/resources/MEDIAR/image/mediar_framework.png +0 -0
  65. spacr/resources/MEDIAR/image/mediar_model.PNG +0 -0
  66. spacr/resources/MEDIAR/image/mediar_results.png +0 -0
  67. spacr/resources/MEDIAR/main.py +0 -125
  68. spacr/resources/MEDIAR/predict.py +0 -70
  69. spacr/resources/MEDIAR/requirements.txt +0 -14
  70. spacr/resources/MEDIAR/train_tools/__init__.py +0 -3
  71. spacr/resources/MEDIAR/train_tools/__pycache__/__init__.cpython-39.pyc +0 -0
  72. spacr/resources/MEDIAR/train_tools/__pycache__/measures.cpython-39.pyc +0 -0
  73. spacr/resources/MEDIAR/train_tools/__pycache__/utils.cpython-39.pyc +0 -0
  74. spacr/resources/MEDIAR/train_tools/data_utils/__init__.py +0 -1
  75. spacr/resources/MEDIAR/train_tools/data_utils/__pycache__/__init__.cpython-39.pyc +0 -0
  76. spacr/resources/MEDIAR/train_tools/data_utils/__pycache__/datasetter.cpython-39.pyc +0 -0
  77. spacr/resources/MEDIAR/train_tools/data_utils/__pycache__/transforms.cpython-39.pyc +0 -0
  78. spacr/resources/MEDIAR/train_tools/data_utils/__pycache__/utils.cpython-39.pyc +0 -0
  79. spacr/resources/MEDIAR/train_tools/data_utils/custom/CellAware.py +0 -88
  80. spacr/resources/MEDIAR/train_tools/data_utils/custom/LoadImage.py +0 -161
  81. spacr/resources/MEDIAR/train_tools/data_utils/custom/NormalizeImage.py +0 -77
  82. spacr/resources/MEDIAR/train_tools/data_utils/custom/__init__.py +0 -3
  83. spacr/resources/MEDIAR/train_tools/data_utils/custom/__pycache__/CellAware.cpython-39.pyc +0 -0
  84. spacr/resources/MEDIAR/train_tools/data_utils/custom/__pycache__/LoadImage.cpython-39.pyc +0 -0
  85. spacr/resources/MEDIAR/train_tools/data_utils/custom/__pycache__/NormalizeImage.cpython-39.pyc +0 -0
  86. spacr/resources/MEDIAR/train_tools/data_utils/custom/__pycache__/__init__.cpython-39.pyc +0 -0
  87. spacr/resources/MEDIAR/train_tools/data_utils/custom/modalities.pkl +0 -0
  88. spacr/resources/MEDIAR/train_tools/data_utils/datasetter.py +0 -208
  89. spacr/resources/MEDIAR/train_tools/data_utils/transforms.py +0 -148
  90. spacr/resources/MEDIAR/train_tools/data_utils/utils.py +0 -84
  91. spacr/resources/MEDIAR/train_tools/measures.py +0 -200
  92. spacr/resources/MEDIAR/train_tools/models/MEDIARFormer.py +0 -102
  93. spacr/resources/MEDIAR/train_tools/models/__init__.py +0 -1
  94. spacr/resources/MEDIAR/train_tools/models/__pycache__/MEDIARFormer.cpython-39.pyc +0 -0
  95. spacr/resources/MEDIAR/train_tools/models/__pycache__/__init__.cpython-39.pyc +0 -0
  96. spacr/resources/MEDIAR/train_tools/utils.py +0 -70
  97. spacr-0.5.0.dist-info/RECORD +0 -190
  98. {spacr-0.5.0.dist-info → spacr-0.9.1.dist-info}/LICENSE +0 -0
  99. {spacr-0.5.0.dist-info → spacr-0.9.1.dist-info}/entry_points.txt +0 -0
  100. {spacr-0.5.0.dist-info → spacr-0.9.1.dist-info}/top_level.txt +0 -0
@@ -1,189 +0,0 @@
1
-
2
- # **MEDIAR: Harmony of Data-Centric and Model-Centric for Multi-Modality Microscopy**
3
- ![1-2](https://user-images.githubusercontent.com/12638561/207771867-0b1414f2-cf48-4747-9cda-3304e6d86bfd.png)
4
-
5
-
6
- This repository provides an official implementation of [MEDIAR: MEDIAR: Harmony of Data-Centric and Model-Centric for Multi-Modality Microscopy](https://arxiv.org/abs/2212.03465), which achieved the ***"1st winner"*** in the [NeurIPS-2022 Cell Segmentation Challenge](https://neurips22-cellseg.grand-challenge.org/).
7
-
8
- To access and try mediar directly, please see links below.
9
- - <a href="https://colab.research.google.com/drive/1iFnGu6A_p-5s_eATjNtfjb9-MR5L3pLB?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
10
- - [Huggingface Space](https://huggingface.co/spaces/ghlee94/MEDIAR?logs=build)
11
- - [Napari Plugin](https://github.com/joonkeekim/mediar-napari)
12
- - [Docker Image](https://hub.docker.com/repository/docker/joonkeekim/mediar/general)
13
-
14
- # 1. MEDIAR Overview
15
- <img src="./image/mediar_framework.png" width="1200"/>
16
-
17
- MEIDAR is a framework for efficient cell instance segmentation of multi-modality microscopy images. The above figure illustrates an overview of our approach. MEDIAR harmonizes data-centric and model-centric approaches as the learning and inference strategies, achieving a **0.9067** Mean F1-score on the validation datasets. We provide a brief description of methods that combined in the MEDIAR. Please refer to our paper for more information.
18
- # 2. Methods
19
-
20
- ## **Data-Centric**
21
- - **Cell Aware Augmentation** : We apply two novel cell-aware augmentations. *cell-wisely intensity is randomization* (Cell Intensity Diversification) and *cell-wise boundary pixels exclusion* in the label. The boundary exclusion is adopted only in the pre-training phase.
22
-
23
- - **Two-phase Pretraining and Fine-tuning** : To extract knowledge from large public datasets, we first pretrained our model on public sets, then fine-tune.
24
- - Pretraining : We use 7,2412 labeled images from four public datasets for pretraining: OmniPose, CellPose, LiveCell and DataScienceBowl-2018. MEDIAR takes two different phases for the pretraining. the MEDIAR-Former model with encoder parameters initialized from ImageNet-1k pretraining.
25
-
26
- - Fine-tuning : We use two different model for ensemble. First model is fine-tuned 200 epochs using target datasets. Second model is fine-tuned 25 epochs using both target and public datsets.
27
-
28
- - **Modality Discovery & Amplified Sampling** : To balance towards the latent modalities in the datasets, we conduct K-means clustering and discover 40 modalities. In the training phase, we over-sample the minor cluster samples.
29
-
30
- - **Cell Memory Replay** : We concatenate the data from the public dataset with a small portion to the batch and train with boundary-excluded labels.
31
-
32
- ## **Model-Centric**
33
- - **MEDIAR-Former Architecture** : MEDIAR-Former follows the design paradigm of U-Net, but use SegFormer and MA-Net for the encoder and decoder. The two heads of MEDIAR-Former predicts cell probability and gradieng flow.
34
-
35
- <img src="./image/mediar_model.PNG" width="1200"/>
36
-
37
- - **Gradient Flow Tracking** : We utilize gradient flow tracking proposed by [CellPose](https://github.com/MouseLand/cellpose).
38
-
39
- - **Ensemble with Stochastic TTA**: During the inference, the MEIDAR conduct prediction as sliding-window manner with importance map generated by the gaussian filter. We use two fine-tuned models from phase1 and phase2 pretraining, and ensemble their outputs by summation. For each outputs, test-time augmentation is used.
40
- # 3. Experiments
41
-
42
- ### **Dataset**
43
- - Official Dataset
44
- - We are provided the target dataset from [Weakly Supervised Cell Segmentation in Multi-modality High-Resolution Microscopy Images](https://neurips22-cellseg.grand-challenge.org/). It consists of 1,000 labeled images, 1,712 unlabeled images and 13 unlabeled whole slide image from various microscopy types, tissue types, and staining types. Validation set is given with 101 images including 1 whole slide image.
45
-
46
- - Public Dataset
47
- - [OmniPose](http://www.cellpose.org/dataset_omnipose) : contains mixtures of 14 bacterial species. We only use 611 bacterial cell microscopy images and discard 118 worm images.
48
- - [CellPose](https://www.cellpose.org/dataset) : includes Cytoplasm, cellular microscopy, fluorescent cells images. We used 551 images by discarding 58 non-microscopy images. We convert all images as gray-scale.
49
- - [LiveCell](https://github.com/sartorius-research/LIVECell) : is a large-scale dataset with 5,239 images containing 1,686,352 individual cells annotated by trained crowdsources from 8 distinct cell types.
50
- - [DataScienceBowl 2018](https://www.kaggle.com/competitions/sartorius-cell-instance-segmentation/overview) : 841 images contain 37,333 cells from 22 cell types, 15 image resolutions, and five visually similar groups.
51
-
52
- ### **Testing steps**
53
- - **Ensemble Prediction with TTA** : MEDIAR uses sliding-window inference with the overlap size between the adjacent patches as 0.6 and gaussian importance map. To predict the different views on the image, MEDIAR uses Test-Time Augmentation (TTA) for the model prediction and ensemble two models described in **Two-phase Pretraining and Fine-tuning**.
54
-
55
- - **Inference time** : MEDIAR conducts most images in less than 1sec and it depends on the image size and the number of cells, even with ensemble prediction with TTA. Detailed evaluation-time results are in the paper.
56
-
57
- ### **Preprocessing & Augmentations**
58
- | Strategy | Type | Probability |
59
- |----------|:-------------|------|
60
- | `Clip` | Pre-processing | . |
61
- | `Normalization` | Pre-processing | . |
62
- | `Scale Intensity` | Pre-processing | . |
63
- | `Zoom` | Spatial Augmentation | 0.5 |
64
- | `Spatial Crop` | Spatial Augmentation | 1.0 |
65
- | `Axis Flip` | Spatial Augmentation | 0.5 |
66
- | `Rotation` | Spatial Augmentation | 0.5 |
67
- | `Cell-Aware Intensity` | Intensity Augmentation | 0.25 |
68
- | `Gaussian Noise` | Intensity Augmentation | 0.25 |
69
- | `Contrast Adjustment` | Intensity Augmentation | 0.25 |
70
- | `Gaussian Smoothing` | Intensity Augmentation | 0.25 |
71
- | `Histogram Shift` | Intensity Augmentation | 0.25 |
72
- | `Gaussian Sharpening` | Intensity Augmentation | 0.25 |
73
- | `Boundary Exclusion` | Others | . |
74
-
75
-
76
- | Learning Setups | Pretraining | Fine-tuning |
77
- |----------------------------------------------------------------------|---------------------------------------------------------|---------------------------------------------------------|
78
- | Initialization (Encoder) | Imagenet-1k pretrained | from Pretraining |
79
- | Initialization (Decoder, Head) | He normal initialization | from Pretraining|
80
- | Batch size | 9 | 9 |
81
- | Total epochs | 80 (60) | 200 (25) |
82
- | Optimizer | AdamW | AdamW |
83
- | Initial learning rate (lr) | 5e-5 | 2e-5 |
84
- | Lr decay schedule | Cosine scheduler (100 interval) | Cosine scheduler (100 interval) |
85
- | Loss function | MSE, BCE | MSE, BCE |
86
-
87
- # 4. Results
88
- ### **Validation Dataset**
89
- - Quantitative Evaluation
90
- - Our MEDIAR achieved **0.9067** validation mean F1-score.
91
- - Qualitative Evaluation
92
- <img src="./image/mediar_results.png" width="1200"/>
93
-
94
- - Failure Cases
95
- <img src="./image/failure_cases.png" width="1200"/>
96
-
97
- ### **Test Dataset**
98
- ![F1_osilab](https://user-images.githubusercontent.com/12638561/207772559-2185b79c-8288-4556-a3b4-9bd1d359fceb.png)
99
- ![RunningTime_osilab](https://user-images.githubusercontent.com/12638561/207772555-c3b29071-6e03-4985-837a-da7b3dd3b65d.png)
100
-
101
-
102
- # 5. Reproducing
103
-
104
- ### **Our Environment**
105
- | Computing Infrastructure| |
106
- |-------------------------|----------------------------------------------------------------------|
107
- | System | Ubuntu 18.04.5 LTS |
108
- | CPU | AMD EPYC 7543 32-Core Processor CPU@2.26GHz |
109
- | RAM | 500GB; 3.125MT/s |
110
- | GPU (number and type) | NVIDIA A5000 (24GB) 2ea |
111
- | CUDA version | 11.7 |
112
- | Programming language | Python 3.9 |
113
- | Deep learning framework | Pytorch (v1.12, with torchvision v0.13.1) |
114
- | Code dependencies | MONAI (v0.9.0), Segmentation Models (v0.3.0) |
115
- | Specific dependencies | None |
116
-
117
- To install requirements:
118
-
119
- ```
120
- pip install -r requirements.txt
121
- wandb off
122
- ```
123
-
124
- ## Dataset
125
- - The datasets directories under the root should the following structure:
126
-
127
- ```
128
- Root
129
- ├── Datasets
130
- │ ├── images (images can have various extensions: .tif, .tiff, .png, .bmp ...)
131
- │ │ ├── cell_00001.png
132
- │ │ ├── cell_00002.tif
133
- │ │ ├── cell_00003.xxx
134
- │ │ ├── ...
135
- │ └── labels (labels must have .tiff extension.)
136
- │ │ ├── cell_00001_label.tiff
137
- │ │ ├── cell_00002.label.tiff
138
- │ │ ├── cell_00003.label.tiff
139
- │ │ ├── ...
140
- └── ...
141
- ```
142
-
143
- Before execute the codes, run the follwing code to generate path mappting json file:
144
-
145
- ```python
146
- python ./generate_mapping.py --root=<path_to_data>
147
- ```
148
-
149
- ## Training
150
-
151
- To train the model(s) in the paper, run the following command:
152
-
153
- ```python
154
- python ./main.py --config_path=<path_to_config>
155
- ```
156
- Configuration files are in `./config/*`. We provide the pretraining, fine-tuning, and prediction configs. You can refer to the configuration options in the `./config/mediar_example.json`. We also implemented the official challenge baseline code in our framework. You can run the baseline code by running the `./config/baseline.json`.
157
-
158
- ## Inference
159
-
160
- To conduct prediction on the testing cases, run the following command:
161
-
162
- ```python
163
- python predict.py --config_path=<path_to_config>
164
- ```
165
-
166
- ## Evaluation
167
- If you have the labels run the following command for evaluation:
168
-
169
- ```python
170
- python ./evaluate.py --pred_path=<path_to_prediciton_results> --gt_path=<path_to_ground_truth_labels>
171
- ```
172
-
173
- The configuration files for `predict.py` is slightly different. Please refer to the config files in `./config/step3_prediction/*`.
174
- ## Trained Models
175
-
176
- You can download MEDIAR pretrained and finetuned models here:
177
-
178
- - [Google Drive Link](https://drive.google.com/drive/folders/1RgMxHIT7WsKNjir3wXSl7BrzlpS05S18?usp=share_link).
179
-
180
- ## Citation of this Work
181
- ```
182
- @article{lee2022mediar,
183
- title={Mediar: Harmony of data-centric and model-centric for multi-modality microscopy},
184
- author={Lee, Gihun and Kim, SangMook and Kim, Joonkee and Yun, Se-Young},
185
- journal={arXiv preprint arXiv:2212.03465},
186
- year={2022}
187
- }
188
- ```
189
-
@@ -1,39 +0,0 @@
1
- import torch.optim as optim
2
- import torch.optim.lr_scheduler as lr_scheduler
3
- import monai
4
-
5
- import core
6
- from train_tools import models
7
- from train_tools.models import *
8
-
9
- __all__ = ["TRAINER", "OPTIMIZER", "SCHEDULER"]
10
-
11
- TRAINER = {
12
- "baseline": core.Baseline.Trainer,
13
- "mediar": core.MEDIAR.Trainer,
14
- }
15
-
16
- PREDICTOR = {
17
- "baseline": core.Baseline.Predictor,
18
- "mediar": core.MEDIAR.Predictor,
19
- "ensemble_mediar": core.MEDIAR.EnsemblePredictor,
20
- }
21
-
22
- MODELS = {
23
- "unet": monai.networks.nets.UNet,
24
- "unetr": monai.networks.nets.unetr.UNETR,
25
- "swinunetr": monai.networks.nets.SwinUNETR,
26
- "mediar-former": models.MEDIARFormer,
27
- }
28
-
29
- OPTIMIZER = {
30
- "sgd": optim.SGD,
31
- "adam": optim.Adam,
32
- "adamw": optim.AdamW,
33
- }
34
-
35
- SCHEDULER = {
36
- "step": lr_scheduler.StepLR,
37
- "multistep": lr_scheduler.MultiStepLR,
38
- "cosine": lr_scheduler.CosineAnnealingLR,
39
- }
@@ -1,60 +0,0 @@
1
- {
2
- "data_setups":{
3
- "labeled":{
4
- "root": "/home/gihun/data/CellSeg/",
5
- "mapping_file": "./train_tools/data_utils/mapping_labeled.json",
6
- "tuning_mapping_file": "/home/gihun/CellSeg/train_tools/data_utils/mapping_tuning.json",
7
- "batch_size": 8,
8
- "valid_portion": 0.1
9
- },
10
- "unlabeled":{
11
- "enabled": false
12
- },
13
- "public":{
14
- "enabled": false
15
- }
16
- },
17
- "train_setups":{
18
- "model":{
19
- "name": "swinunetr",
20
- "params": {
21
- "img_size": 512,
22
- "in_channels": 3,
23
- "out_channels": 3,
24
- "spatial_dims": 2
25
- },
26
- "pretrained":{
27
- "enabled": false
28
- }
29
- },
30
- "trainer": {
31
- "name": "baseline",
32
- "params": {
33
- "num_epochs": 200,
34
- "valid_frequency": 1,
35
- "device": "cuda:0",
36
- "algo_params": {}
37
- }
38
- },
39
- "optimizer":{
40
- "name": "adamw",
41
- "params": {"lr": 5e-5}
42
- },
43
- "scheduler":{
44
- "enabled": false
45
- },
46
- "seed": 19940817
47
- },
48
- "pred_setups":{
49
- "input_path":"/home/gihun/data/CellSeg/Official/TuningSet",
50
- "output_path": "./results/baseline",
51
- "make_submission": true,
52
- "exp_name": "baseline",
53
- "algo_params": {}
54
- },
55
- "wandb_setups":{
56
- "project": "CellSeg",
57
- "group": "Baseline",
58
- "name": "baseline"
59
- }
60
- }
@@ -1,72 +0,0 @@
1
- {
2
- "data_setups":{
3
- "labeled":{
4
- "root": "/home/gihun/data/CellSeg/",
5
- "mapping_file": "./train_tools/data_utils/mapping_labeled.json",
6
- "amplified": false,
7
- "batch_size": 8,
8
- "valid_portion": 0.1
9
- },
10
- "public":{
11
- "enabled": true,
12
- "params":{
13
- "root": "/home/gihun/data/CellSeg/",
14
- "mapping_file": "./train_tools/data_utils/mapping_public.json",
15
- "batch_size": 1
16
- }
17
- },
18
- "unlabeled":{
19
- "enabled": false
20
- }
21
- },
22
- "train_setups":{
23
- "model":{
24
- "name": "mediar-former",
25
- "params": {
26
- "encoder_name": "mit_b5",
27
- "encoder_weights": "imagenet",
28
- "decoder_channels": [1024, 512, 256, 128, 64],
29
- "decoder_pab_channels": 256,
30
- "in_channels": 3,
31
- "classes": 3
32
- },
33
- "pretrained":{
34
- "enabled": false,
35
- "weights": "./weights/pretrained/phase2.pth",
36
- "strict": false
37
- }
38
- },
39
- "trainer": {
40
- "name": "mediar",
41
- "params": {
42
- "num_epochs": 200,
43
- "valid_frequency": 1,
44
- "device": "cuda:0",
45
- "amp": true,
46
- "algo_params": {"with_public": false}
47
- }
48
- },
49
- "optimizer":{
50
- "name": "adamw",
51
- "params": {"lr": 5e-5}
52
- },
53
- "scheduler":{
54
- "enabled": true,
55
- "name": "cosine",
56
- "params": {"T_max": 100, "eta_min": 1e-7}
57
- },
58
- "seed": 19940817
59
- },
60
- "pred_setups":{
61
- "input_path":"/home/gihun/data/CellSeg/Official/TuningSet",
62
- "output_path": "./mediar_example",
63
- "make_submission": true,
64
- "exp_name": "mediar_example",
65
- "algo_params": {"use_tta": false}
66
- },
67
- "wandb_setups":{
68
- "project": "CellSeg",
69
- "group": "MEDIAR",
70
- "name": "mediar_example"
71
- }
72
- }
@@ -1,17 +0,0 @@
1
- {
2
- "pred_setups":{
3
- "name": "medair",
4
- "input_path":"input_path",
5
- "output_path": "./test",
6
- "make_submission": true,
7
- "model_path": "model_path",
8
- "device": "cuda:0",
9
- "model":{
10
- "name": "mediar-former",
11
- "params": {},
12
- "pretrained":{
13
- "enabled": false
14
- }
15
- }
16
- }
17
- }
@@ -1,55 +0,0 @@
1
- {
2
- "data_setups":{
3
- "labeled":{
4
- "root": "/home/gihun/MEDIAR/",
5
- "mapping_file": "./train_tools/data_utils/mapping_public.json",
6
- "mapping_file_tuning": "/home/gihun/MEDIAR/train_tools/data_utils/mapping_tuning.json",
7
- "batch_size": 9,
8
- "valid_portion": 0
9
- },
10
- "public":{
11
- "enabled": false,
12
- "params":{}
13
- }
14
- },
15
- "train_setups":{
16
- "model":{
17
- "name": "mediar-former",
18
- "params": {},
19
- "pretrained":{
20
- "enabled": false
21
- }
22
- },
23
- "trainer": {
24
- "name": "mediar",
25
- "params": {
26
- "num_epochs": 80,
27
- "valid_frequency": 10,
28
- "device": "cuda:0",
29
- "amp": true,
30
- "algo_params": {"with_public": false}
31
- }
32
- },
33
- "optimizer":{
34
- "name": "adamw",
35
- "ft_rate": 1.0,
36
- "params": {"lr": 5e-5}
37
- },
38
- "scheduler":{
39
- "enabled": true,
40
- "name": "cosine",
41
- "params": {"T_max": 80, "eta_min": 1e-6}
42
- },
43
- "seed": 19940817
44
- },
45
- "pred_setups":{
46
- "input_path":"/home/gihun/MEDIAR/data/Official/Tuning/images",
47
- "output_path": "./mediar_pretrained_phase1",
48
- "make_submission": false
49
- },
50
- "wandb_setups":{
51
- "project": "CellSeg",
52
- "group": "Pretraining",
53
- "name": "phase1"
54
- }
55
- }
@@ -1,58 +0,0 @@
1
- {
2
- "data_setups":{
3
- "labeled":{
4
- "root": "/home/gihun/MEDIAR/",
5
- "mapping_file": "./train_tools/data_utils/mapping_labeled.json",
6
- "mapping_file_tuning": "/home/gihun/MEDIAR/train_tools/data_utils/mapping_tuning.json",
7
- "join_mapping_file": "./train_tools/data_utils/mapping_public.json",
8
- "batch_size": 9,
9
- "valid_portion": 0
10
- },
11
- "unlabeled":{
12
- "enabled": false
13
- },
14
- "public":{
15
- "enabled": false
16
- }
17
- },
18
- "train_setups":{
19
- "model":{
20
- "name": "mediar-former",
21
- "params": {},
22
- "pretrained":{
23
- "enabled": false
24
- }
25
- },
26
- "trainer": {
27
- "name": "mediar",
28
- "params": {
29
- "num_epochs": 60,
30
- "valid_frequency": 10,
31
- "device": "cuda:0",
32
- "amp": true,
33
- "algo_params": {"with_public": false}
34
- }
35
- },
36
- "optimizer":{
37
- "name": "adamw",
38
- "ft_rate": 1.0,
39
- "params": {"lr": 5e-5}
40
- },
41
- "scheduler":{
42
- "enabled": true,
43
- "name": "cosine",
44
- "params": {"T_max": 60, "eta_min": 1e-6}
45
- },
46
- "seed": 19940817
47
- },
48
- "pred_setups":{
49
- "input_path":"/home/gihun/MEDIAR/data/Official/Tuning/images",
50
- "output_path": "./mediar_pretrain_phase2",
51
- "make_submission": false
52
- },
53
- "wandb_setups":{
54
- "project": "CellSeg",
55
- "group": "Pretraining",
56
- "name": "phase2"
57
- }
58
- }
@@ -1,66 +0,0 @@
1
- {
2
- "data_setups":{
3
- "labeled":{
4
- "root": "/home/gihun/MEDIAR/",
5
- "mapping_file": "./train_tools/data_utils/mapping_labeled.json",
6
- "mapping_file_tuning": "/home/gihun/MEDIAR/train_tools/data_utils/mapping_tuning.json",
7
- "amplified": true,
8
- "batch_size": 8,
9
- "valid_portion": 0.0
10
- },
11
- "public":{
12
- "enabled": false,
13
- "params":{
14
- "root": "/home/gihun/MEDIAR/",
15
- "mapping_file": "./train_tools/data_utils/mapping_public.json",
16
- "batch_size": 1
17
- }
18
- },
19
- "unlabeled":{
20
- "enabled": false
21
- }
22
- },
23
- "train_setups":{
24
- "model":{
25
- "name": "mediar-former",
26
- "params": {},
27
- "pretrained":{
28
- "enabled": true,
29
- "weights": "./weights/pretrained/phase1.pth",
30
- "strict": false
31
- }
32
- },
33
- "trainer": {
34
- "name": "mediar",
35
- "params": {
36
- "num_epochs": 200,
37
- "valid_frequency": 1,
38
- "device": "cuda:7",
39
- "amp": true,
40
- "algo_params": {"with_public": false}
41
- }
42
- },
43
- "optimizer":{
44
- "name": "adamw",
45
- "params": {"lr": 2e-5}
46
- },
47
- "scheduler":{
48
- "enabled": true,
49
- "name": "cosine",
50
- "params": {"T_max": 100, "eta_min": 1e-7}
51
- },
52
- "seed": 19940817
53
- },
54
- "pred_setups":{
55
- "input_path":"/home/gihun/MEDIAR/data/Official/Tuning/images",
56
- "output_path": "./results/",
57
- "make_submission": true,
58
- "exp_name": "mediar_from_phase1",
59
- "algo_params": {"use_tta": false}
60
- },
61
- "wandb_setups":{
62
- "project": "CellSeg",
63
- "group": "Fine-tuning",
64
- "name": "from_phase1"
65
- }
66
- }
@@ -1,66 +0,0 @@
1
- {
2
- "data_setups":{
3
- "labeled":{
4
- "root": "/home/gihun/MEDIAR/",
5
- "mapping_file": "./train_tools/data_utils/mapping_labeled.json",
6
- "mapping_file_tuning": "/home/gihun/MEDIAR/train_tools/data_utils/mapping_tuning.json",
7
- "amplified": true,
8
- "batch_size": 8,
9
- "valid_portion": 0.0
10
- },
11
- "public":{
12
- "enabled": true,
13
- "params":{
14
- "root": "/home/gihun/MEDIAR/",
15
- "mapping_file": "./train_tools/data_utils/mapping_public.json",
16
- "batch_size": 1
17
- }
18
- },
19
- "unlabeled":{
20
- "enabled": false
21
- }
22
- },
23
- "train_setups":{
24
- "model":{
25
- "name": "mediar-former",
26
- "params": {},
27
- "pretrained":{
28
- "enabled": true,
29
- "weights": "./weights/pretrained/phase2.pth",
30
- "strict": false
31
- }
32
- },
33
- "trainer": {
34
- "name": "mediar",
35
- "params": {
36
- "num_epochs": 50,
37
- "valid_frequency": 1,
38
- "device": "cuda:0",
39
- "amp": true,
40
- "algo_params": {"with_public": true}
41
- }
42
- },
43
- "optimizer":{
44
- "name": "adamw",
45
- "params": {"lr": 2e-5}
46
- },
47
- "scheduler":{
48
- "enabled": true,
49
- "name": "cosine",
50
- "params": {"T_max": 100, "eta_min": 1e-7}
51
- },
52
- "seed": 19940817
53
- },
54
- "pred_setups":{
55
- "input_path":"/home/gihun/MEDIAR/data/Official/Tuning/images",
56
- "output_path": "./results/from_phase2",
57
- "make_submission": true,
58
- "exp_name": "mediar_from_phase2",
59
- "algo_params": {"use_tta": false}
60
- },
61
- "wandb_setups":{
62
- "project": "CellSeg",
63
- "group": "Fine-tuning",
64
- "name": "from_phase2"
65
- }
66
- }
@@ -1,16 +0,0 @@
1
- {
2
- "pred_setups":{
3
- "name": "mediar",
4
- "input_path":"/home/gihun/MEDIAR/data/Official/Tuning/images",
5
- "output_path": "./results/mediar_base_prediction",
6
- "make_submission": true,
7
- "model_path": "./weights/finetuned/from_phase1.pth",
8
- "device": "cuda:7",
9
- "model":{
10
- "name": "mediar-former",
11
- "params": {}
12
- },
13
- "exp_name": "mediar_p1_base",
14
- "algo_params": {"use_tta": false}
15
- }
16
- }