-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (43 loc) · 1.49 KB
/
main.py
File metadata and controls
49 lines (43 loc) · 1.49 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
37
38
39
40
41
42
43
44
45
46
47
48
49
import argparse
from cv2 import cv2
from segmentation import Segmentation
from inference import Inference
def main():
img, mask, maskDetails = Segmentation(
modelWeights=args.model_segmentation, cfgPath=args.cfg_path
).start_segmentation(img=cv2.imread(args.img_path + args.image))
Inference(img, mask, maskDetails, inpaintModel=args.model_inpainting).inference()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Image File Name")
parser.add_argument(
"--image",
type=str,
default="img.png",
help="Enter the image file name located at ./img_input/",
)
parser.add_argument(
"--model_segmentation",
type=str,
default="http://dl.fbaipublicfiles.com/detectron2/COCO-PanopticSegmentation/panoptic_fpn_R_50_3x/139514569/model_final_c10459.pkl",
help="Pre-trained Weights for Segmentation",
)
parser.add_argument(
"--cfg_path",
type=str,
default="COCO-PanopticSegmentation/panoptic_fpn_R_50_3x.yaml",
help="Path to model cfg file relative to './detectron2/model_zoo/configs' ",
)
parser.add_argument(
"--model_inpainting",
type=str,
default="./models/1000000.pth",
help="Weights for Inpainting relative to ./inpainting/",
)
parser.add_argument(
"--img_path",
type=str,
default="./img_input/",
help="Specify custom path for image",
)
args = parser.parse_args()
main()