|
@@ -1,29 +1,45 @@
|
|
|
+import os
|
|
|
from cvargparse import BaseParser, Arg
|
|
|
|
|
|
from cvdatasets.annotations import AnnotationType
|
|
|
|
|
|
from cvdatasets.utils import read_info_file
|
|
|
|
|
|
-DEFAULT_INFO_FILE="/home/korsch/Data/info.yml"
|
|
|
+DEFAULT_INFO_FILE=os.environ.get("DATA")#"/home/korsch/Data/info.yml"
|
|
|
|
|
|
-info_file = read_info_file(DEFAULT_INFO_FILE)
|
|
|
|
|
|
def parse_args():
|
|
|
|
|
|
- parser = BaseParser([
|
|
|
- Arg("data", default=DEFAULT_INFO_FILE),
|
|
|
- Arg("dataset", choices=info_file.DATASETS.keys()),
|
|
|
- Arg("parts", default="GLOBAL", choices=info_file.PARTS.keys()),
|
|
|
-
|
|
|
- Arg("--feature_model", "-fm",
|
|
|
- choices=["inception", "inception_tf", "resnet"]),
|
|
|
-
|
|
|
+ parser = BaseParser()
|
|
|
+ data_help = "YAML file containing dataset and model descriptions"
|
|
|
+ dataset_help = "Dataset to display"
|
|
|
+ parts_help = "Part annotations to display"
|
|
|
+
|
|
|
+ if DEFAULT_INFO_FILE is None:
|
|
|
+
|
|
|
+ parser.add_args([
|
|
|
+ Arg("data", help=data_help),
|
|
|
+ Arg("dataset", help=dataset_help),
|
|
|
+ Arg("parts", help=parts_help),
|
|
|
+ ], group_name="Dataset arguments")
|
|
|
+ else:
|
|
|
+ info_file = read_info_file(DEFAULT_INFO_FILE)
|
|
|
+ parser.add_args([
|
|
|
+ Arg("data", default=DEFAULT_INFO_FILE,
|
|
|
+ help=data_help),
|
|
|
+ Arg("dataset", choices=info_file.DATASETS.keys(),
|
|
|
+ help=dataset_help),
|
|
|
+ Arg("parts", default="CUB200_GLOBAL", choices=info_file.PARTS.keys(),
|
|
|
+ help=parts_help),
|
|
|
+ ], group_name="Dataset arguments")
|
|
|
+
|
|
|
+
|
|
|
+ parser.add_args([
|
|
|
Arg("--subset", "-sub",
|
|
|
help="Possible subsets: train, test",
|
|
|
choices=["train", "test"],
|
|
|
default="train", type=str),
|
|
|
|
|
|
-
|
|
|
Arg("--start", "-s",
|
|
|
help="Image id to start with",
|
|
|
type=int, default=0),
|
|
@@ -35,8 +51,18 @@ def parse_args():
|
|
|
Arg("--only_class",
|
|
|
help="display only the given class",
|
|
|
type=int, default=-1),
|
|
|
+ ], group_name="Sample selection arguments")
|
|
|
|
|
|
+ parser.add_args([
|
|
|
+ Arg("--feature_model", "-fm",
|
|
|
+ choices=["inception", "inception_tf", "resnet"]),
|
|
|
+ Arg("--features",
|
|
|
+ help="pre-extracted train and test features",
|
|
|
+ default=[None, None],
|
|
|
+ nargs=2, type=str),
|
|
|
+ ], group_name="Feature arguments")
|
|
|
|
|
|
+ parser.add_args([
|
|
|
Arg("--rnd",
|
|
|
help="select random subset of present parts",
|
|
|
action="store_true"),
|
|
@@ -64,12 +90,6 @@ def parse_args():
|
|
|
action="store_true"),
|
|
|
|
|
|
|
|
|
- Arg("--features",
|
|
|
- help="pre-extracted train and test features",
|
|
|
- default=[None, None],
|
|
|
- nargs=2, type=str),
|
|
|
-
|
|
|
-
|
|
|
Arg("--ratio",
|
|
|
help="Part extraction ratio",
|
|
|
type=float, default=.2),
|
|
@@ -81,12 +101,8 @@ def parse_args():
|
|
|
Arg("--uniform_parts", "-u",
|
|
|
help="Do not use GT parts, but sample parts uniformly from the image",
|
|
|
action="store_true"),
|
|
|
+ ], group_name="Display options")
|
|
|
|
|
|
-
|
|
|
- Arg('--seed', type=int, default=12311123,
|
|
|
- help='random seed'),
|
|
|
-
|
|
|
- ])
|
|
|
-
|
|
|
+ parser.add_args([Arg('--seed', type=int, default=12311123, help='random seed')])
|
|
|
parser.init_logger()
|
|
|
return parser.parse_args()
|