Skip to content

Commit

Permalink
Update finetuning
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinpape committed Jul 28, 2024
1 parent c72c43f commit e372f96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ logs/
checkpoints/
__pycache__/
sync_annotations_from_hlrn.sh
sync_annotations_to_hlrn.sh
1 change: 1 addition & 0 deletions data_prep/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
overlaps/
13 changes: 8 additions & 5 deletions finetune_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,28 @@ def get_paths(name):


def run_training(name):
with_segmentation_decoder = True
with_segmentation_decoder = False

train_images, train_labels, val_images, val_labels = get_paths(name)

num_workers = 0
patch_shape = (1024, 1024)

train_ds = default_sam_dataset(
raw_paths=train_images, raw_key=None,
label_paths=train_labels, label_key=None,
patch_shape=[1024, 1024], with_segmentation_decoder=with_segmentation_decoder,
patch_shape=patch_shape, with_segmentation_decoder=with_segmentation_decoder,
n_samples=50,
)
train_loader = get_data_loader(train_ds, shuffle=True, batch_size=1)
train_loader = get_data_loader(train_ds, shuffle=True, batch_size=1, num_workers=num_workers)

val_ds = default_sam_dataset(
raw_paths=val_images, raw_key=None,
label_paths=val_labels, label_key=None,
patch_shape=[1024, 1024], with_segmentation_decoder=with_segmentation_decoder,
patch_shape=patch_shape, with_segmentation_decoder=with_segmentation_decoder,
is_train=False, n_samples=4,
)
val_loader = get_data_loader(val_ds, shuffle=True, batch_size=1)
val_loader = get_data_loader(val_ds, shuffle=True, batch_size=1, num_workers=num_workers)

train_sam_for_configuration(
name="organoid_model", configuration="CPU",
Expand Down

0 comments on commit e372f96

Please sign in to comment.