Skip to content

Commit ae1670f

Browse files
committed
Templates for SGN segmentation
1 parent ff84404 commit ae1670f

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=apply-unet-SGN
3+
#SBATCH -t 01:00:00 # estimated time, adapt to your needs
4+
5+
#SBATCH -p grete:shared # the partition
6+
#SBATCH -G A100:1 # For requesting 1 A100 GPU.
7+
#SBATCH -c 1
8+
#SBATCH --mem 24G
9+
#SBATCH -a 0-9
10+
11+
source ~/.bashrc
12+
micromamba activate micro-sam_gpu
13+
14+
# Print out some info.
15+
echo "Submitting job with sbatch from directory: ${SLURM_SUBMIT_DIR}"
16+
echo "Home directory: ${HOME}"
17+
echo "Working directory: $PWD"
18+
echo "Current node: ${SLURM_NODELIST}"
19+
20+
# Run the script
21+
22+
SCRIPT_REPO=/user/schilling40/u15000/flamingo-tools
23+
cd "$SCRIPT_REPO"/flamingo_tools/segmentation/ || exit
24+
25+
export SCRIPT_DIR=$SCRIPT_REPO/scripts
26+
27+
COCHLEA=$1
28+
29+
export INPUT=/mnt/vast-nhr/projects/nim00007/data/moser/cochlea-lightsheet/"$COCHLEA"/MLR214L_Calb1_PV_CR_012_fused.n5
30+
31+
export OUTPUT_FOLDER=/mnt/vast-nhr/projects/nim00007/data/moser/cochlea-lightsheet/predictions/"$COCHLEA"/SGN_v2
32+
33+
export MODEL=/mnt/lustre-grete/usr/u15000/checkpoints/cochlea_distance_unet_SGN_supervised_2025-05-27/
34+
export PREDICTION_INSTANCES=10
35+
export INPUT_KEY="setup1/timepoint0/s0"
36+
37+
echo "Input directory: ${INPUT}"
38+
echo "Output directory: ${OUTPUT_FOLDER}"
39+
echo "Model: ${MODEL}"
40+
41+
cmd_array=( 'import sys,os;'
42+
'sys.path.insert(0,os.environ["SCRIPT_DIR"]);'
43+
'import unet_prediction;'
44+
'unet_prediction.run_unet_prediction_slurm(input_path=os.environ["INPUT"],'
45+
'output_folder=os.environ["OUTPUT_FOLDER"],model_path=os.environ["MODEL"],'
46+
'input_key=os.environ["INPUT_KEY"],'
47+
'prediction_instances=os.environ["PREDICTION_INSTANCES"])')
48+
cmd="${cmd_array[*]}"
49+
python -c "$cmd"
50+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=mean-std-SGN
3+
#SBATCH -t 02:00:00 # estimated time, adapt to your needs
4+
5+
#SBATCH -p standard96s:shared # the partition
6+
#SBATCH -A nim00007
7+
#SBATCH -c 3
8+
#SBATCH --mem 128G
9+
10+
source ~/.bashrc
11+
micromamba activate flamingo13
12+
13+
# Run the script
14+
15+
SCRIPT_REPO=/user/schilling40/u15000/flamingo-tools
16+
cd "$SCRIPT_REPO"/flamingo_tools/segmentation/ || exit
17+
18+
export SCRIPT_DIR=$SCRIPT_REPO/scripts
19+
20+
COCHLEA=$1
21+
22+
export INPUT=/mnt/vast-nhr/projects/nim00007/data/moser/cochlea-lightsheet/"$COCHLEA"/GEK11L_PV_GFP_01_fused.n5
23+
export OUTPUT_FOLDER=/mnt/vast-nhr/projects/nim00007/data/moser/cochlea-lightsheet/predictions/"$COCHLEA"/SGN_v2
24+
export SEG_CLASS="sgn"
25+
export INPUT_KEY="setup0/timepoint0/s0"
26+
27+
if ! [[ -f $OUTPUT_FOLDER ]] ; then
28+
mkdir -p "$OUTPUT_FOLDER"
29+
fi
30+
31+
echo "Input directory: ${INPUT}"
32+
echo "Output directory: ${OUTPUT_FOLDER}"
33+
34+
cmd_array=( 'import sys,os;'
35+
'sys.path.insert(0,os.environ["SCRIPT_DIR"]);'
36+
'import unet_prediction;'
37+
'unet_prediction.run_unet_prediction_preprocess_slurm(input_path=os.environ["INPUT"],'
38+
'input_key=os.environ["INPUT_KEY"],'
39+
'output_folder=os.environ["OUTPUT_FOLDER"],seg_class=os.environ["SEG_CLASS"])')
40+
cmd="${cmd_array[*]}"
41+
python -c "$cmd"
42+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=segment-unet-SGN_M-LR-000214-L
3+
#SBATCH --time 10:00:00 # estimated time, adapt to your needs
4+
5+
#SBATCH -p standard96s:shared # the partition
6+
#SBATCH -A nim00007
7+
#SBATCH -c 8
8+
#SBATCH --mem 400G
9+
10+
source ~/.bashrc
11+
micromamba activate micro-sam_gpu
12+
13+
# Print out some info.
14+
echo "Submitting job with sbatch from directory: ${SLURM_SUBMIT_DIR}"
15+
echo "Home directory: ${HOME}"
16+
echo "Working directory: $PWD"
17+
echo "Current node: ${SLURM_NODELIST}"
18+
19+
# Run the script
20+
#python myprogram.py $SLURM_ARRAY_TASK_ID
21+
22+
SCRIPT_REPO=/user/schilling40/u15000/flamingo-tools
23+
cd "$SCRIPT_REPO"/flamingo_tools/segmentation/ || exit
24+
25+
COCHLEA=$1
26+
27+
export SCRIPT_DIR=$SCRIPT_REPO/scripts
28+
export OUTPUT_FOLDER=/mnt/vast-nhr/projects/nim00007/data/moser/cochlea-lightsheet/predictions/"$COCHLEA"/SGN_v2
29+
export MIN_SIZE=1000
30+
export BOUNDARY_DISTANCE_THRESHOLD=0.5
31+
32+
echo "Output directory: ${OUTPUT_FOLDER}"
33+
34+
cmd_array=( 'import sys,os;'
35+
'sys.path.insert(0,os.environ["SCRIPT_DIR"]);'
36+
'import unet_prediction;'
37+
'unet_prediction.run_unet_segmentation_slurm(output_folder=os.environ["OUTPUT_FOLDER"],'
38+
'min_size=os.environ["MIN_SIZE"])')
39+
cmd="${cmd_array[*]}"
40+
python -c "$cmd"
41+

0 commit comments

Comments
 (0)