Commit 82b7dd9a authored by Pavel KORSHUNOV's avatar Pavel KORSHUNOV

corrected indices selection

parent ec42a9cf
Pipeline #35605 failed with stage
in 4 minutes and 9 seconds
......@@ -42,6 +42,13 @@ class FrameSelector:
if selection_style == 'step' and neighbors >= (step_size-2):
self.neighbors = 1
def _add_indices_neighbors(self, indices):
indices_extended = list()
for j in range(self.neighbors):
indices_extended += [i + j for i in indices]
indices_extended = sorted(list(set(indices_extended)))
return indices_extended
def __call__(self, data, load_function = bob.io.base.load):
"""Selects frames and returns them in a FrameContainer.
Different ``data`` parameters are accepted:
......@@ -67,14 +74,12 @@ class FrameSelector:
elif self.selection == 'spread':
# get frames lineraly spread over all frames
indices = bob.bio.base.selected_indices(count-self.neighbors+1, self.max_frames)
for j in range(self.neighbors-1):
indices += [i+1 for i in indices]
indices = sorted(indices)
if self.neighbors > 1:
indices = self._add_indices_neighbors(indices)
elif self.selection == 'step':
indices = range(self.step//2, count-self.neighbors+1, self.step)[:self.max_frames]
for j in range(self.neighbors-1):
indices += [i+1 for i in indices]
indices = sorted(indices)
if self.neighbors > 1:
indices = self._add_indices_neighbors(indices)
elif self.selection == 'all':
indices = range(0, count)
......
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