Adds HDF5able serialization support to Menpo #427
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Serialization of Menpo datatypes has long been on our wishlist (#164, see there for detailed discussion). This PR adds solid serialization support to Menpo in a fundamental way.
The actual meat of this solution is a separate package called hdf5able. This package defines a standardized approach for serializing and de-serializing basic Python types to and from HDF5 files. It also provides a class called
HDF5able
. Any custom subclass ofHDF5able
can also be safely serialized to disk. This PR:HDF5able
as a superclass ofCopyable
, making most Menpo types serializable, with no extra effort.fit
package) need to specialize a few methods ofHDF5able
to be serializable. Support is added forAAM
serialization in this PR. Future small PR's in Menpo can add support to classes as we go.menpo.io.load(path)
andmenpo.io.save(path, objects)
. These are the new API for saving Menpo objects.Note that because HDF5 is an open standard, any files saved out from Menpo can be easily inspected by any number of tools. Matlab also supports HDF5, so immediately Menpo data can be read into Matlab (we may right a small Matlab function to make this easier to encourage support).