Skip to content

Commit

Permalink
Make tile size required input for cli test command
Browse files Browse the repository at this point in the history
  • Loading branch information
jommarin committed Jul 24, 2024
1 parent 5a2e77b commit 276fdd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from deepliif.data import create_dataset, transform
from deepliif.models import init_nets, infer_modalities, infer_results_for_wsi, create_model
from deepliif.util import allowed_file, Visualizer, get_information, test_diff_original_serialized, disable_batchnorm_tracking_stats
from deepliif.util.util import mkdirs, check_multi_scale
from deepliif.util.util import mkdirs
# from deepliif.util import infer_results_for_wsi
from deepliif.options import Options, print_options

Expand Down Expand Up @@ -534,7 +534,7 @@ def serialize(model_dir, output_dir, device, verbose):
@cli.command()
@click.option('--input-dir', default='./Sample_Large_Tissues/', help='reads images from here')
@click.option('--output-dir', help='saves results here.')
@click.option('--tile-size', default=None, help='tile size')
@click.option('--tile-size', type=click.IntRange(min=1, max=None), required=True, help='tile size')
@click.option('--model-dir', default='./model-server/DeepLIIF_Latest_Model/', help='load models from here.')
@click.option('--gpu-ids', type=int, multiple=True, help='gpu-ids 0 gpu-ids 1 or gpu-ids -1 for CPU')
@click.option('--region-size', default=20000, help='Due to limits in the resources, the whole slide image cannot be processed in whole.'
Expand Down
7 changes: 1 addition & 6 deletions deepliif/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from dask import delayed, compute

from deepliif.util import *
from deepliif.util.util import tensor_to_pil, check_multi_scale
from deepliif.util.util import tensor_to_pil
from deepliif.data import transform
from deepliif.postprocessing import compute_results
from deepliif.options import Options, print_options
Expand Down Expand Up @@ -591,11 +591,6 @@ def infer_modalities(img, tile_size, model_dir, eager_mode=False,
opt.use_dp = False
#print_options(opt)

if not tile_size:
tile_size = check_multi_scale(Image.open('./images/target.png').convert('L'),
img.convert('L'))
tile_size = int(tile_size)

# for those with multiple input modalities, find the correct size to calculate overlap_size
input_no = opt.input_no if hasattr(opt, 'input_no') else 1
img_size = (img.size[0] / input_no, img.size[1]) # (width, height)
Expand Down

0 comments on commit 276fdd8

Please sign in to comment.