Skip to content
Snippets Groups Projects
Commit f13ed706 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Use bob.bio.base read_annotations utility

parent b72dabe9
No related branches found
No related tags found
1 merge request!80Port display-face-annotations script
Pipeline #45903 failed
...@@ -61,7 +61,7 @@ Examples: ...@@ -61,7 +61,7 @@ Examples:
@click.option( @click.option(
"-x", "-x",
"--annotations-extension", "--annotations-extension",
default = ".json", default = "json",
  • Maintainer

    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.

  • Owner

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

  • Author Owner

    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, show_default=True,
help="Annotations files have the given filename extension.", help="Annotations files have the given filename extension.",
) )
...@@ -193,12 +193,10 @@ def display_face_annotations( ...@@ -193,12 +193,10 @@ def display_face_annotations(
annotations = {} annotations = {}
if annotations_dir is not None: if annotations_dir is not None:
# Loads the corresponding annotations file # 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): if os.path.exists(annotations_file):
logger.info("Loading annotations from file %s", 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 = bob.db.base.read_annotation_file(annotations_file, annotations_extension)
annotations=json.load(f)
# annotations = bob.db.base.read_annotation_file(annotations_file, args.annotations_type)
else: else:
logger.warn("Could not find annotation file %s", annotations_file) logger.warn("Could not find annotation file %s", annotations_file)
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment