forked from chhan95/Tumor-segementation_PAIP2019
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_infer.py
36 lines (30 loc) · 1.22 KB
/
run_infer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""run_infer.py
Usage:
run_infer.py [options] [--help]
run_infer.py --version
run_infer.py (-h | --help)
Options:
-h --help Show this screen.
--version Show version.
--gpu=<id> GPU , only one gpu can be used. [default: 4]
--input_path=<path> Input WSI folder(.svs file only)[default: ./dataset]
--output_path=<path> output of th model[default: ./output]
--step_size=<n> step_size for sliding window[default: 256]
--rescale=<n> generate thumbnail with the scale factor of real number in the interval (0,1) [default: -1]
"""
from docopt import docopt
from termcolor import cprint
import os
import torch
from infer import inferManager
if __name__ == '__main__':
args = docopt(__doc__, help=False,options_first=True,version='PAIP2019 v.0.2')
##GPU
gpu_list=args.pop("--gpu")
os.environ['CUDA_VISIBLE_DEVICES'] = gpu_list
nr_gpus = torch.cuda.device_count()
cprint("Detect GPU: %d" % nr_gpus,"red")
args = {k.replace('--', '') : v for k, v in args.items()}
##check args
infer=inferManager.InferManager(args)
infer.run()