Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion slide2vec/hs2p
Submodule hs2p updated 1 files
+6 −0 hs2p/tiling.py
14 changes: 13 additions & 1 deletion slide2vec/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def get_args_parser(add_help: bool = True):
parser.add_argument(
"--skip-datetime", action="store_true", help="skip run id datetime prefix"
)
parser.add_argument(
"--tiling-only", action="store_true", help="only run slide tiling"
)
parser.add_argument(
"--run-on-cpu", action="store_true", help="run inference on cpu"
)
Expand Down Expand Up @@ -154,11 +157,20 @@ def main(args):
hf_login()

root_dir = "slide2vec/hs2p"
run_tiling(root_dir, cfg_path, output_dir)
if cfg.resume:
# need to remove the dirname to avoid nested output directories
hs2p_output_dir = output_dir.parent
else:
hs2p_output_dir = output_dir
run_tiling(root_dir, cfg_path, hs2p_output_dir)

print("Tiling completed.")
print("=+=" * 10)

if args.tiling_only:
print("Tiling only flag set, exiting.")
return

features_dir = output_dir / "features"
if cfg.wandb.enable:
stop_event = threading.Event()
Expand Down
1 change: 1 addition & 0 deletions slide2vec/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def __init__(
arch=options.arch,
pretrained_weights=options.pretrained_weights,
input_size=options.patch_size,
patch_size=options.token_size,
)
model = RegionFeatureExtractor(tile_encoder)
elif options.level == "slide":
Expand Down
Loading