Skip to content

Commit

Permalink
Trying to use the Zarr loader
Browse files Browse the repository at this point in the history
  • Loading branch information
smishra3 committed Oct 16, 2024
1 parent 76eeab4 commit 349a5e5
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
18 changes: 18 additions & 0 deletions configs/data/local/segmentation_all_cells_mask_from_zarr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
_target_: cyto_dl.datamodules.multidim_image.make_multidim_image_dataloader #MultiDimImageDataset #dataframe.DataframeDatamodule

num_workers: 0
batch_size: 1
pin_memory: True
#persistent_workers: False


csv_path:
img_path_column: movie_path
channel_column: bf_channel
#fms_id_column: fms_id
out_key: ${source_col}
transforms:
- _target_: monai.transforms.ToTensor
- _target_: monai.transforms.NormalizeIntensity


44 changes: 44 additions & 0 deletions configs/experiment/local/eval_scale1_new.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# @package _global_
# to execute this experiment run:
# python train.py experiment=example
defaults:
- override /data: local/segmentation_all_cells_mask_from_zarr.yaml
- override /model: local/segmentation_all_cells_mask.yaml
- override /callbacks: default.yaml
- override /trainer: gpu.yaml
- override /logger: mlflow.yaml

# all parameters below will be merged with parameters from default configurations set above
# this allows you to overwrite only specified parameters

tags: ["dev"]
seed: 12345

experiment_name: train_cytogfp_seg_model_v0
run_name: test_v0_patch1
source_col: raw
target_col: seg
spatial_dims: 3
raw_im_channels: 1
checkpoint:
ckpt_path: /allen/aics/assay-dev/users/Suraj/EMT_Work/image_analysis_test/EMT_image_analysis/Colony_mask_training_inference/all_cells_mask_seg_model_checkpoint.ckpt
trainer:
max_epochs: 1000
devices: [0]

model:
compile: True
#save_dir: /allen/aics/assay-dev/users/Suraj/EMT_Work/image_analysis_test/EMT_image_analysis/Colony_mask_training_inference/eval_whole_movie_multiscale_patch1_zarr_aws

data:
csv_path: /allen/aics/assay-dev/users/Suraj/EMT_Work/image_analysis_test/EMT_image_analysis/Colony_mask_training_inference/sample_csv/predict_all_cells_mask_zarr_aws_v0.csv #path to csv containing test movies
#batch_size: 1
_aux:
patch_shape: [16, 128, 128]

callbacks:
predict_saving:
_target_: cyto_dl.callbacks.ImageSaver
save_dir: /allen/aics/assay-dev/users/Suraj/EMT_Work/image_analysis_test/EMT_image_analysis/Colony_mask_training_inference/eval_whole_movie_multiscale_patch1_zarr_aws
stages: ["predict"]
save_input: False
54 changes: 54 additions & 0 deletions configs/model/local/segmentation_all_cells_mask.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
_target_: cyto_dl.models.im2im.MultiTaskIm2Im

save_images_every_n_epochs: 50
save_dir: ${paths.output_dir}

x_key: ${source_col}
# patch_shape:

backbone:
_target_: monai.networks.nets.DynUNet
spatial_dims: ${spatial_dims}
in_channels: ${raw_im_channels}
out_channels: 1
strides: [1, 2, 2, 2]
kernel_size: [3, 3, 3, 3]
upsample_kernel_size: [2, 2, 2]
dropout: 0.0
res_block: True

task_heads: ${kv_to_dict:${model._aux._tasks}}

optimizer:
generator:
_partial_: True
_target_: torch.optim.Adam
lr: 0.0001
weight_decay: 0.0001

lr_scheduler:
generator:
_partial_: True
_target_: torch.optim.lr_scheduler.ExponentialLR
gamma: 0.995

inference_args:
sw_batch_size: 1
roi_size: ${data._aux.patch_shape}

_aux:
_tasks:
- - ${target_col}
- _target_: cyto_dl.nn.BaseHead
loss:
_target_: monai.losses.GeneralizedDiceFocalLoss ##Main loss
sigmoid: True
postprocess:
input:
_target_: cyto_dl.models.im2im.utils.postprocessing.ActThreshLabel
rescale_dtype: numpy.uint8
prediction:
_target_: cyto_dl.models.im2im.utils.postprocessing.ActThreshLabel
activation:
_target_: torch.nn.Sigmoid
rescale_dtype: numpy.uint8

0 comments on commit 349a5e5

Please sign in to comment.