Commit cbe36aaf authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Annotations might not be ordered

parent 56451883
......@@ -4,6 +4,7 @@ from import reader
from bob.ip.base import scale, block, block_output_shape
from bob.ip.color import rgb_to_yuv, rgb_to_hsv
from bob.ip.facedetect import bounding_box_from_annotation
from collections import OrderedDict
from functools import partial
import numpy
import six
......@@ -108,14 +109,12 @@ def yield_faces(database, padfile, cropper, normalizer=None):
if annotations is None:
raise ValueError("No annotations were returned.")
if normalizer is None:
annotations_gen = annotations.items()
annotations_gen = normalizer(annotations)
if normalizer is not None:
annotations = OrderedDict(normalizer(annotations))
# normalize annotations and crop faces
for _, annot in annotations_gen:
frame =
for frame_id, frame in enumerate(frames_gen):
annot = annotations.get(str(frame_id), None)
if annot is None:
face = cropper(frame, annotations=annot)
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