Skip to content

Instantly share code, notes, and snippets.

@j-adamczyk
Created August 6, 2020 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-adamczyk/48c158e3384a9836e601f89357921b68 to your computer and use it in GitHub Desktop.
Save j-adamczyk/48c158e3384a9836e601f89357921b68 to your computer and use it in GitHub Desktop.
import argparse
def _get_parsed_args() -> argparse.Namespace:
"""
Create an argument parser and parse arguments.
:return: parsed arguments as a Namespace object
"""
parser = argparse.ArgumentParser(description="Detectron2 demo")
# default model is the one with the 2nd highest mask AP
# (Average Precision) and very high speed from Detectron2 model zoo
parser.add_argument(
"--base_model",
default="COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml",
help="Base model to be used for training. This is most often "
"appropriate link to Detectron2 model zoo."
)
parser.add_argument(
"--images",
nargs="+",
help="A list of space separated image files that will be processed. "
"Results will be saved next to the original images with "
"'_processed_' appended to file name."
)
return parser.parse_args()
if __name__ == "__main__":
args = _get_parsed_args()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment