Skip to content

Improve FrameContainer and FrameSelector to be more memory efficient

Amir MOHAMMADI requested to merge frame-container-load-subset into master
  • FrameContainers can now load a subset of themselves from an HDF5 file
  • FrameSelectors now can handle bob.io.video.reader instances to avoid loading the whole video into memory.

For example, you can do:

path = '.../fc.hdf5'
with bob.io.base.HDF5File(path) as f:
    # load only a subset of the FrameContainer
    fc = bob.bio.video.FrameContainer().load(f, selection_style="spread", max_number_of_frames=20)

and

path = '.../video.mp4'
fs = bob.bio.video.FrameSelector(selection_style="spread", max_number_of_frames=20)
fc = fs(bob.io.video.reader(path))  # only loads 20 frames into memory
Edited by Amir MOHAMMADI

Merge request reports

Loading