-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinference_all.py
More file actions
36 lines (31 loc) · 1.18 KB
/
Copy pathinference_all.py
File metadata and controls
36 lines (31 loc) · 1.18 KB
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
#############
## Imports ##
#############
""" Global """
import os
import argparse
""" Local """
import constants
import utils
##########
## MAIN ##
##########
def parse_args():
parser = argparse.ArgumentParser(description="Arguments for training")
parser.add_argument("-i", "--image_folder", dest="image_folder", help="Path to image folder", required=True)
parser.add_argument("-m", "--model_path", dest="model_path", help="Path to the model weights", required=True)
parser.add_argument("-o", "--output_path", dest="output_path", help="Path to save the predicted masks", required=True)
parser.add_argument("-ps", "--patch_size", dest="patch_size", help="Patch size", default=constants.PATCH_SIZE, type=int)
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
img_ids = utils.get_img_ids(args.image_folder)
for img_id in img_ids:
print("==== {} ====".format(img_id))
command = "python inference.py -i \"{}/{}.jpg\" -m \"{}\" -o \"{}/{}_mask\" -ps {}".format(
args.image_folder, img_id,
args.model_path,
args.output_path, img_id,
args.patch_size
)
os.system(command)