Cannot use FaceCrop with a video sequence where all frames do not have annotations
I have a video file with the missing annotations on some frames:
{
"0": {},
"1": {},
"2": {},
"3": {},
"4": {},
"5": {},
"6": {},
"7": {},
"8": {},
"9": {},
"10": {},
"11": {},
"12": {},
"13": {},
"14": {},
"15": {
"reye": [
635,
239
],
"leye": [
618,
647
],
}
and I want to use it FaceCrop wrapped in bob.bio.video with this video file. However it fails with:
bob.bio.base@2018-02-14 18:21:41,462 -- ERROR: During the execution, an exception was raised: At least one of the expected annotations '['leye', 'reye']' are not given in 'dict_keys([])'.
Traceback (most recent call last):
File "bin/verify.py", line 77, in <module>
sys.exit(bob.bio.base.script.verify.main())
File "src/bob.bio.base/bob/bio/base/script/verify.py", line 435, in main
verify(args, command_line_parameters)
File "src/bob.bio.base/bob/bio/base/script/verify.py", line 415, in verify
if not execute(args):
File "src/bob.bio.base/bob/bio/base/script/verify.py", line 264, in execute
force = args.force)
File "src/bob.bio.base/bob/bio/base/tools/preprocessor.py", line 81, in preprocess
preprocessed_data = preprocessor(data, annotations)
File "src/bob.bio.video/bob/bio/video/preprocessor/Wrapper.py", line 126, in __call__
preprocessed = self.preprocessor(frame, annots)
File "src/bob.bio.face/bob/bio/face/preprocessor/FaceCrop.py", line 208, in __call__
image = self.crop_face(image, annotations)
File "src/bob.bio.face/bob/bio/face/preprocessor/FaceCrop.py", line 154, in crop_face
raise ValueError("At least one of the expected annotations '%s' are not given in '%s'." % (self.cropped_keys, annotations.keys()))
ValueError: At least one of the expected annotations '['leye', 'reye']' are not given in 'dict_keys([])'.
What is the best strategy to avoid this error? I want the preprocessing to continue and drop those frames.