Skip to content
Snippets Groups Projects
Commit a9962f1a authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Reverted quality assessment function

parent 29636955
No related branches found
No related tags found
1 merge request!32Quality check on the fly
Pipeline #
...@@ -54,8 +54,7 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor): ...@@ -54,8 +54,7 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
frame_selector=utils.FrameSelector(), frame_selector=utils.FrameSelector(),
quality_function=None, quality_function=None,
compressed_io=False, compressed_io=False,
read_original_data=None, read_original_data=None
quality_assessment_function=None
): ):
def _read_video_data(biofile, directory, extension): def _read_video_data(biofile, directory, extension):
...@@ -79,13 +78,11 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor): ...@@ -79,13 +78,11 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
preprocessor=preprocessor, preprocessor=preprocessor,
frame_selector=frame_selector, frame_selector=frame_selector,
compressed_io=compressed_io, compressed_io=compressed_io,
read_original_data=read_original_data, read_original_data=read_original_data
quality_assessment_function=quality_assessment_function
) )
self.quality_function = quality_function self.quality_function = quality_function
self.compressed_io = compressed_io self.compressed_io = compressed_io
self.quality_assessment_function = quality_assessment_function
def _check_data(self, frames): def _check_data(self, frames):
"""Checks if the given video is in the desired format.""" """Checks if the given video is in the desired format."""
...@@ -121,8 +118,6 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor): ...@@ -121,8 +118,6 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
annots = None annots = None
fc = utils.FrameContainer() fc = utils.FrameContainer()
quality_index = 0
for index, frame, _ in frames: for index, frame, _ in frames:
# if annotations are given, we take them # if annotations are given, we take them
if annotations is not None: annots = annotations[index] if index in annotations.keys() else None if annotations is not None: annots = annotations[index] if index in annotations.keys() else None
...@@ -138,15 +133,7 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor): ...@@ -138,15 +133,7 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
else: else:
quality = None quality = None
# add image to frame container # add image to frame container
if self.quality_assessment_function is not None: fc.add(index, preprocessed, quality)
if self.quality_assessment_function(quality): #quality satisfies our criteria
fc.add(quality_index, preprocessed) # no need to add quality here because we already addressed it
quality_index += 1
else:
fc.add(index, preprocessed, quality)
return fc return fc
...@@ -190,4 +177,4 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor): ...@@ -190,4 +177,4 @@ class Wrapper(bob.bio.base.preprocessor.Preprocessor):
if self.compressed_io: if self.compressed_io:
return utils.save_compressed(frames, filename, self.preprocessor.write_data) return utils.save_compressed(frames, filename, self.preprocessor.write_data)
else: else:
frames.save(bob.io.base.HDF5File(filename, 'w'), self.preprocessor.write_data) frames.save(bob.io.base.HDF5File(filename, 'w'), self.preprocessor.write_data)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment