Commit f13ed706 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Use bob.bio.base read_annotations utility

parent b72dabe9
Pipeline #45903 failed with stage
in 32 minutes and 33 seconds
......@@ -61,7 +61,7 @@ Examples:
@click.option(
"-x",
"--annotations-extension",
default = ".json",
default = "json",
  • I don't like this change. The filename extension always includes the leading ., everywhere inside of Bob and also outside. It would be better to modify the annotation_extension in line 199 instead.

  • yes, I think adding two click options: 1 for extension and 1 for type would fix this issue as well.

  • Yes, consistency is important. I added an option to specify the type of annotations as well, that will be passed to read_annotations.

Please register or sign in to reply
show_default=True,
help="Annotations files have the given filename extension.",
)
Please register or sign in to reply
......@@ -193,12 +193,10 @@ def display_face_annotations(
annotations = {}
if annotations_dir is not None:
# Loads the corresponding annotations file
annotations_file = os.path.join(annotations_dir, sample.key + annotations_extension)
annotations_file = os.path.join(annotations_dir, sample.key + '.' + annotations_extension)
if os.path.exists(annotations_file):
logger.info("Loading annotations from file %s", annotations_file)
with open(annotations_file) as f: # TODO remove and use bob.db.base.read_annotations_file
annotations=json.load(f)
# annotations = bob.db.base.read_annotation_file(annotations_file, args.annotations_type)
annotations = bob.db.base.read_annotation_file(annotations_file, annotations_extension)
else:
logger.warn("Could not find annotation file %s", annotations_file)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment