|
@@ -3,21 +3,15 @@ if __name__ != '__main__': raise Exception("Do not import me!")
|
|
|
import sys
|
|
|
sys.path.insert(0, "..")
|
|
|
|
|
|
-try:
|
|
|
- from yaml import CLoader as Loader, CDumper as Dumper
|
|
|
-except ImportError:
|
|
|
- from yaml import Loader, Dumper
|
|
|
-
|
|
|
-import yaml
|
|
|
import logging
|
|
|
import numpy as np
|
|
|
import matplotlib.pyplot as plt
|
|
|
-from matplotlib.patches import Rectangle
|
|
|
|
|
|
from argparse import ArgumentParser
|
|
|
|
|
|
from nabirds import NAB_Annotations, CUB_Annotations
|
|
|
|
|
|
+
|
|
|
def init_logger(args):
|
|
|
fmt = "%(levelname)s - [%(asctime)s] %(filename)s:%(lineno)d [%(funcName)s]: %(message)s"
|
|
|
logging.basicConfig(
|
|
@@ -55,7 +49,7 @@ def main(args):
|
|
|
|
|
|
logging.info("Loading \"{}\" annnotations from \"{}\"".format(args.dataset, args.data))
|
|
|
annot = annotation_cls.get(args.dataset.lower())(
|
|
|
- args.info, args.parts, args.feature_model)
|
|
|
+ args.data, args.parts, args.feature_model)
|
|
|
|
|
|
logging.info("Loaded data from \"{}\"".format(annot.root))
|
|
|
|
|
@@ -84,6 +78,7 @@ def main(args):
|
|
|
im, parts, label = data[i]
|
|
|
|
|
|
fig1, axs = plt.subplots(2, 1, figsize=(16,9))
|
|
|
+
|
|
|
axs[0].axis("off")
|
|
|
axs[0].set_title("Visible Parts")
|
|
|
axs[0].imshow(im)
|
|
@@ -115,8 +110,9 @@ def main(args):
|
|
|
|
|
|
parser = ArgumentParser()
|
|
|
|
|
|
-parser.add_argument("info")
|
|
|
-
|
|
|
+parser.add_argument("data",
|
|
|
+ help="Folder containing the dataset with images and annotation files or dataset info file",
|
|
|
+ type=str)
|
|
|
|
|
|
parser.add_argument("--dataset",
|
|
|
help="Possible datasets: NAB, CUB",
|
|
@@ -166,6 +162,7 @@ parser.add_argument("--parts_in_bb",
|
|
|
action="store_true")
|
|
|
|
|
|
|
|
|
+
|
|
|
parser.add_argument(
|
|
|
'--logfile', type=str, default='',
|
|
|
help='File for logging output')
|
|
@@ -179,5 +176,3 @@ parser.add_argument(
|
|
|
help='random seed')
|
|
|
|
|
|
main(parser.parse_args())
|
|
|
-
|
|
|
-
|