Skip to content

Commit

Permalink
Merge pull request #474 from jabooth/hdf5abletopickle
Browse files Browse the repository at this point in the history
remove HDF5able making room for h5it
  • Loading branch information
jabooth committed Oct 14, 2014
2 parents 3903a26 + 2845e57 commit e1b182f
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 71 deletions.
1 change: 0 additions & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ requirements:
- pillow 2.5.1

# Menpo Project
- hdf5able 0.3.3
- cyassimp 0.2.0
- menpo-pyvrml97 2.3.0a4 # [not py3k]

Expand Down
4 changes: 1 addition & 3 deletions menpo/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import abc
import os.path

from hdf5able import HDF5able

# To debug the Copyable interface, simply uncomment lines 11-23 below and the
# four lines in the copy() method.
# Then you can call print_copyable_log() to see exactly what types have been
Expand All @@ -23,7 +21,7 @@
# print(' {:15}| {}'.format(k, ', '.join(v)))


class Copyable(HDF5able):
class Copyable(object):
"""
Efficient copying of classes containing numpy arrays.
Expand Down
3 changes: 1 addition & 2 deletions menpo/fit/fittingresult.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import division
import abc
from hdf5able import HDF5able
import numpy as np

from menpo.shape.pointcloud import PointCloud
Expand Down Expand Up @@ -424,7 +423,7 @@ def error_images(self):
return error_images


class SerializableFittingResult(HDF5able, FittingResult):
class SerializableFittingResult(FittingResult):
r"""
Designed to allow the fitting results to be easily serializable. In
comparison to the other fitting result objects, the serializable fitting
Expand Down
19 changes: 1 addition & 18 deletions menpo/fitmultilevel/aam/base.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from __future__ import division

import numpy as np
from hdf5able import HDF5able, SerializableCallable

from menpo.shape import TriMesh
from menpo.fitmultilevel.base import DeformableModel, name_of_callable
from .builder import build_patch_reference_frame, build_reference_frame


class AAM(DeformableModel, HDF5able):
class AAM(DeformableModel):
r"""
Active Appearance Model class.
Expand Down Expand Up @@ -73,22 +72,6 @@ def __init__(self, shape_models, appearance_models, n_training_images,
self.downscale = downscale
self.scaled_shape_models = scaled_shape_models

def h5_dict_to_serializable_dict(self):
import menpo.transform
d = self.__dict__.copy()
transform = d.pop('transform')
d['transform'] = SerializableCallable(transform, [menpo.transform])

features = d.pop('features')
if self.pyramid_on_features:
# features is a single callable
d['features'] = SerializableCallable(features, [menpo.feature])
else:
# features is a list of callables
d['features'] = [SerializableCallable(f, [menpo.feature])
for f in features]
return d

@property
def n_levels(self):
"""
Expand Down
3 changes: 1 addition & 2 deletions menpo/fitmultilevel/fittingresult.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division

from itertools import chain
from hdf5able import HDF5able

from menpo.transform import Scale
from menpo.fit.fittingresult import FittingResult
Expand Down Expand Up @@ -268,7 +267,7 @@ def aam_reconstructions(self):
return aam_reconstructions


class SerializableMultilevelFittingResult(HDF5able, FittingResult):
class SerializableMultilevelFittingResult(FittingResult):
r"""
Designed to allow the fitting results to be easily serializable. In
comparison to the other fitting result objects, the serializable fitting
Expand Down
4 changes: 2 additions & 2 deletions menpo/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .input import (load, import_image, import_images,
from .input import (import_image, import_images,
import_mesh, import_meshes, import_builtin_asset,
import_landmark_file, import_landmark_files,
data_path_to, data_dir_path, ls_builtin_assets,
mesh_paths, image_paths, landmark_file_paths)
from .output import (save, export_image, export_landmark_file, export_mesh,
from .output import (export_image, export_landmark_file, export_mesh,
export_textured_mesh)
2 changes: 1 addition & 1 deletion menpo/io/input/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .base import (load, import_image, import_images,
from .base import (import_image, import_images,
import_mesh, import_meshes, import_builtin_asset,
import_landmark_file, import_landmark_files,
data_path_to, data_dir_path, ls_builtin_assets,
Expand Down
20 changes: 0 additions & 20 deletions menpo/io/input/base.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
import abc
import os
from glob import glob

from pathlib import Path
import hdf5able

from ..utils import _norm_path
from menpo import menpo_src_dir_path
from menpo.visualize import progress_bar_str, print_dynamic


def load(path):
r"""
Load a given HDF5 file of serialized Menpo objects or base types.
Parameters
----------
path : `str`
A path to a HDF5 file that conforms to the hdf5able specification.
Returns
-------
hdf5able :
Any collection of HDF5able objects.
"""
return hdf5able.load(_norm_path(path))


def data_dir_path():
r"""A path to the Menpo built in ./data folder on this machine.
Expand Down
2 changes: 1 addition & 1 deletion menpo/io/output/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .base import (save, export_landmark_file, export_image, export_mesh,
from .base import (export_landmark_file, export_image, export_mesh,
export_textured_mesh)
19 changes: 0 additions & 19 deletions menpo/io/output/base.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
from pathlib import Path
from hdf5able import save as h5_save

from .extensions import landmark_types, image_types, mesh_types
from ..utils import _norm_path


def save(path, hdf5able):
r"""
Serialized a collection of Menpo objects and base types to disk in a
HDF5 file container.
Parameters
----------
path : `str`
A path to a HDF5 file that conforms to the hdf5able specification.
hdf5able : `HDF5able` or base types
Any collection of base types (dict, list, str, etc) along with any
HDG5able Menpo type.
"""
h5_save(_norm_path(path), hdf5able)


def export_landmark_file(fp, landmark_group, extension=None,
overwrite=False):
r"""
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
'wrapt==1.9.0',

'menpo-pyvrml97==2.3.0a4',
'cyassimp==0.2.0',
'hdf5able==0.3.3']
'cyassimp==0.2.0']

if sys.version_info.major == 2:
install_requires.append('pathlib==1.0')
Expand Down

0 comments on commit e1b182f

Please sign in to comment.