Skip to content

Commit

Permalink
Minor touch-up to finetuning directory (#577)
Browse files Browse the repository at this point in the history
Refactors the `finetuning` directory and moves old scripts under the `outdated` directory in the respective parent folders
  • Loading branch information
anwai98 authored May 2, 2024
1 parent 562bcb2 commit 79dff63
Show file tree
Hide file tree
Showing 44 changed files with 43 additions and 124 deletions.
6 changes: 6 additions & 0 deletions finetuning/evaluation/mitonet_baseline.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# NOTE:
# This script below the following:
# - stacks indivudual slice images into one volume for segmenting in empanada-napari
# - evaluates the segmentations with the mean segmentation accuracy metric


import os
from glob import glob

Expand Down
26 changes: 26 additions & 0 deletions finetuning/generalists/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Segment Anything Finetuning for Generalists Models

Code for finetuning segment anything data on multiple microscopy datasets.

## Finetuning Scripts

- `training/`: The finetuning scripts for the two microscopy domains covered by `micro_sam`.
- Light Microscopy (LM)
- `light_microscopy/obtain_lm_datasets.py`: Scripts for getting the dataloader from multipe LM datasets.
- `light_microscopy/train_lm_generalist.py`: Finetuning on multiple LM datasets.
- Electron Microscopy (EM)
- `mito_nuc/obtain_mito_nuc_em_datasets.py`: Scripts for getting the dataloader from multiple EM datasets.
- `mito_nuc/train_mito_nuc_em_generalist.py`: Finetuning on multiple EM datasets for segmenting mitochondria and nuclei.


## Experimental Scripts
These scripts are a work-in-progress and often under active development.

- `training/histopathology`: Finetuning Segment Anything on Histopathology datasets.
- `training/electron_microscopy/boundaries`: Finetuning Segment Anything on Electron Microscopy datasets for segmenting boundary-based dense structures.

> For details on how to run the scripts from above: `python <DATASET>_finetuning.py -h`

## Outdated Scripts
The scripts located at `outdated/` are not in working purpose with the latest version of `micro-sam`.
24 changes: 0 additions & 24 deletions finetuning/generalists/export_generalist_model.py

This file was deleted.

82 changes: 0 additions & 82 deletions finetuning/generalists/generate_model_comparison.py

This file was deleted.

File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions finetuning/generalists/precompute_prompts.sbatch

This file was deleted.

7 changes: 6 additions & 1 deletion finetuning/specialists/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Segment Anything Finetuning for Specific Datasets
# Segment Anything Finetuning for Specialist Models

Code for finetuning segment anything data on specific microscopy datasets.

Expand All @@ -17,3 +17,8 @@ Code for finetuning segment anything data on specific microscopy datasets.
> For details on how to run the scripts from above: `python <DATASET>_finetuning.py -h`
- `resource_efficient_finetuning`: The experiments for finetuning a custom dataset on limited resources.


## Outdated Scripts
The scripts located at `outdated/` are not in working purpose with the latest version of `micro-sam`.
- It comprises of extensive experiments on "LIVECell" specialist, located at `outdated/livecell/`.
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Finetuning Segment Anything for LiveCELL
# Finetuning Segment Anything for LIVECell

TODO: explain the set-up

These experiments are implemented for a slurm cluster with access to GPUs (and you ideally need access to A100s or H100s with 80GB of memory, if you only use ViT-b then using a GPU with 32 GB or 40 GB should suffice.)
These experiments are implemented for a slurm cluster with access to GPUs (and you ideally need access to A100s or H100s with 80GB of memory, if you only use ViT Base then using a GPU with 32 GB or 40 GB should suffice.)

## Training

TODO: add training code and explain how to run it
The relevant scripts are located in the top-level `finetuning` directory at: `finetuning/livecell_finetuning.py`.

## Evaluation

To run the evaluation experiments for the Segment Anything Models on LiveCELL follow these steps:
To run the evaluation experiments for the Segment Anything Models on LIVECell follow these steps:

- Preparation:
- Go to the `evaluation` directory.
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion finetuning/specialists/resource-efficient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Fixed parameters:

### GPU Resources

(32G CPU memory, 8 CPU cores)
(32GB CPU memory, 8 CPU cores)

1. `gtx1080`:
- `vit_t`: finetune all layers
Expand Down

0 comments on commit 79dff63

Please sign in to comment.