Commit 03121b15 authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Updated BATL HLDI, load and annotations methods

parent c7544a31
Pipeline #17589 failed with stage
in 30 minutes and 49 seconds
...@@ -28,7 +28,8 @@ class BatlPadFile(PadFile): ...@@ -28,7 +28,8 @@ class BatlPadFile(PadFile):
reference_stream_type="color", reference_stream_type="color",
warp_to_reference=True, warp_to_reference=True,
convert_to_rgb=False, convert_to_rgb=False,
crop=None): crop=None,
video_data_only=True):
""" """
Parameters Parameters
...@@ -58,6 +59,7 @@ class BatlPadFile(PadFile): ...@@ -58,6 +59,7 @@ class BatlPadFile(PadFile):
self.warp_to_reference = warp_to_reference # True self.warp_to_reference = warp_to_reference # True
self.convert_to_rgb = convert_to_rgb # False self.convert_to_rgb = convert_to_rgb # False
self.crop = crop # None self.crop = crop # None
self.video_data_only = video_data_only # return video data only if True
def load(self, directory=None, extension='.hdf5', frame_selector=FrameSelector(selection_style='all')): def load(self, directory=None, extension='.hdf5', frame_selector=FrameSelector(selection_style='all')):
...@@ -74,6 +76,11 @@ class BatlPadFile(PadFile): ...@@ -74,6 +76,11 @@ class BatlPadFile(PadFile):
for modality in data.keys(): for modality in data.keys():
if modality != 'rppg': if modality != 'rppg':
data[modality] = frame_selector(data[modality]) data[modality] = frame_selector(data[modality])
if self.video_data_only:
data = data['video']
return data return data
...@@ -241,18 +248,18 @@ class BatlPadDatabase(PadDatabase): ...@@ -241,18 +248,18 @@ class BatlPadDatabase(PadDatabase):
if not os.path.isfile(file_path): # no file with annotations if not os.path.isfile(file_path): # no file with annotations
video = f.f.load(self, directory=self.original_directory, video = f.f.load(directory=self.original_directory,
extension=self.original_extension, extension=self.original_extension,
modality="color", # TODO: this parameter is currently missing in bob.db.batl, add it there modality="color", # TODO: this parameter is currently missing in bob.db.batl, add it there
reference_stream_type="color", reference_stream_type="color",
warp_to_reference=False, warp_to_reference=False,
convert_to_rgb=False, convert_to_rgb=False,
crop=None, crop=None,
max_frames=None) max_frames=None)['video']
annotations = {} annotations = {}
for idx, image in enumerate(video): for idx, image in enumerate(video.as_array()):
frame_annotations = detect_face_landmarks_in_image(image, method = self.landmark_detect_method) frame_annotations = detect_face_landmarks_in_image(image, method = self.landmark_detect_method)
......
Supports Markdown
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