Skip to content

Commit 6e95660

Browse files
committed
make code more flexible
1 parent 8763e49 commit 6e95660

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

run_sbatch_revision.sbatch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#SBATCH -c 4 #4 #8
33
#SBATCH --mem 120G #120G #32G #64G #256G
44
#SBATCH -p grete:shared #grete:shared #grete-h100:shared
5-
#SBATCH -t 3:00:00 #6:00:00 #48:00:00
5+
#SBATCH -t 2:00:00 #6:00:00 #48:00:00
66
#SBATCH -G A100:1 #V100:1 #2 #A100:1 #gtx1080:2 #v100:1 #H100:1
77
#SBATCH --output=/user/muth9/u12095/synapse-net/slurm_revision/slurm-%j.out
88
#SBATCH -A nim00007 #SBATCH --constraint 80gb
99

1010
source ~/.bashrc
1111
conda activate synapse-net
12-
python /user/muth9/u12095/synapse-net/scripts/cooper/revision/thin_az_gt.py \
13-
-i /mnt/ceph-hdd/cold/nim00007/new_AZ_train_data/stem_for_eval/ \
14-
-o /mnt/ceph-hdd/cold/nim00007/new_AZ_train_data/stem_for_eval/
12+
python /user/muth9/u12095/synapse-net/scripts/cooper/revision/merge_az.py -v 6 \
13+
--names stem_for_eval \
14+
-i /mnt/ceph-hdd/cold/nim00007/new_AZ_train_data/

scripts/cooper/revision/az_prediction.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ def run_prediction(model, name, split_folder, version, split_names, in_path):
5454

5555

5656
def get_model(version):
57-
assert version in (3, 4, 5, 7)
57+
assert version in (3, 4, 5, 6, 7)
5858
split_folder = get_split_folder(version)
5959
if version == 3:
6060
model_path = os.path.join(split_folder, "checkpoints", "3D-AZ-model-TEM_STEM_ChemFix_wichmann-v3")
61+
elif version ==6:
62+
model_path = "/mnt/ceph-hdd/cold/nim00007/models/AZ/v6/"
6163
elif version == 7:
6264
model_path = "/mnt/lustre-emmy-hdd/usr/u12095/synapse_net/models/ConstantinAZ/checkpoints/v7/"
6365
else:

scripts/cooper/revision/merge_az.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@
1818

1919

2020
# STEM CROPPED IS OFTEN TOO SMALL!
21-
def merge_az(name, version, check):
21+
def merge_az(name, version, check, in_path):
2222
split_folder = get_split_folder(version)
2323

2424
if name == "stem_cropped":
2525
file_paths = glob(os.path.join("/mnt/ceph-hdd/cold/nim00007/new_AZ_train_data/stem_cropped", "*.h5"))
2626
file_names = [os.path.basename(path) for path in file_paths]
2727
else:
28-
file_names = get_file_names(name, split_folder, split_names=["train", "val", "test"])
28+
if in_path:
29+
file_paths = glob(os.path.join(in_path, name, "*.h5"))
30+
file_names = [os.path.basename(path) for path in file_paths]
31+
else:
32+
file_names = get_file_names(name, split_folder, split_names=["train", "val", "test"])
2933
seg_paths, gt_paths = get_paths(name, file_names)
3034

3135
for seg_path, gt_path in zip(seg_paths, gt_paths):
@@ -79,7 +83,7 @@ def visualize_merge(args):
7983
for name in args.names:
8084
if "endbulb" in name:
8185
continue
82-
merge_az(name, args.version, check=True)
86+
merge_az(name, args.version, check=True, in_path=args.in_path)
8387

8488

8589
def copy_az(name, version):
@@ -101,7 +105,7 @@ def run_merge(args):
101105
if "endbulb" in name:
102106
copy_az(name, args.version)
103107
else:
104-
merge_az(name, args.version, check=False)
108+
merge_az(name, args.version, check=False, in_path= args.in_path)
105109

106110

107111
def main():
@@ -110,6 +114,7 @@ def main():
110114
parser.add_argument("--visualize", action="store_true")
111115
parser.add_argument("--names", nargs="+", default=ALL_NAMES + ["endbulb_of_held_cropped"])
112116
parser.add_argument("--version", "-v", type=int, default=4)
117+
parser.add_argument("--in_path", "-i", default=None)
113118

114119
args = parser.parse_args()
115120
if args.visualize:

0 commit comments

Comments
 (0)