Skip to content

Commit

Permalink
Merge pull request #18 from menpo/version_fixes
Browse files Browse the repository at this point in the history
Update to Menpo 0.4.0 and fix test failures
  • Loading branch information
Patrick Snape committed Feb 5, 2015
2 parents e427b28 + b8bd1e6 commit e5362aa
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 44 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ install:
- wget https://raw.githubusercontent.com/jabooth/condaci/v0.2.0/condaci.py -O condaci.py
- python condaci.py setup $PYTHON_VERSION --channel $BINSTAR_USER
- export PATH=$HOME/miniconda/bin:$PATH
- conda config --add channels $BINSTAR_USER/channel/master

script:
- python condaci.py auto ./conda --binstaruser $BINSTAR_USER --binstarkey $BINSTAR_KEY
Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ platform:
init:
- ps: Start-FileDownload 'https://raw.githubusercontent.com/jabooth/condaci/v0.2.0/condaci.py' C:\\condaci.py; echo "Done"
- cmd: python C:\\condaci.py setup %PYTHON_VERSION% --channel %BINSTAR_USER%
- cmd: C:\\Miniconda\\Scripts\\conda config --add channels %BINSTAR_USER%/channel/master

install:
- cmd: C:\\Miniconda\\python C:\\condaci.py auto ./conda --binstaruser %BINSTAR_USER% --binstarkey %BINSTAR_KEY%
Expand Down
6 changes: 2 additions & 4 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ requirements:

run:
- python
- menpo
- numpy 1.9.0
- scipy 0.14.0
- scikit-learn 0.15.2
- menpo 0.4.0|>=0.4.1,<0.5.0 # Make sure we ignore the alpha
- scikit-learn 0.15.*

test:
requires:
Expand Down
7 changes: 4 additions & 3 deletions menpofit/sdm/fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ def __str__(self):
out = "Supervised Descent Method\n" \
" - Non-Parametric '{}' Regressor\n" \
" - {} training images.\n".format(
self._fitters[0].regressor.__name__, self._n_training_images)
name_of_callable(self._fitters[0].regressor),
self._n_training_images)
# small strings about number of channels, channels string and downscale
down_str = []
for j in range(self.n_levels):
Expand Down Expand Up @@ -254,7 +255,7 @@ def __str__(self):
return "{}Supervised Descent Method for AAMs:\n" \
" - Parametric '{}' Regressor\n" \
" - {} training images.\n".format(
self.aam.__str__(), self._fitters[0].regressor.__name__,
self.aam.__str__(), name_of_callable(self._fitters[0].regressor),
self._n_training_images)


Expand Down Expand Up @@ -299,5 +300,5 @@ def __str__(self):
return "{}Supervised Descent Method for CLMs:\n" \
" - Parametric '{}' Regressor\n" \
" - {} training images.\n".format(
self.clm.__str__(), self._fitters[0].regressor.__name__,
self.clm.__str__(), name_of_callable(self._fitters[0].regressor),
self._n_training_images)
30 changes: 15 additions & 15 deletions menpofit/test/aam_fitter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,87 +421,87 @@ def aam_helper(aam, algorithm, im_number, max_iters, initial_error,

@attr('fuzzy')
def test_alternating_ic():
aam_helper(aam, AlternatingInverseCompositional, 0, 6, 0.09062, 0.05606,
aam_helper(aam, AlternatingInverseCompositional, 0, 6, 0.09062, 0.05607,
'me_norm')


@attr('fuzzy')
def test_adaptive_ic():
aam_helper(aam, AdaptiveInverseCompositional, 1, 5, 0.07697, 0.0255,
aam_helper(aam, AdaptiveInverseCompositional, 1, 5, 0.07697, 0.02552,
'me_norm')


@attr('fuzzy')
def test_simultaneous_ic():
aam_helper(aam, SimultaneousInverseCompositional, 2, 7, 0.12616, 0.11566,
aam_helper(aam, SimultaneousInverseCompositional, 2, 7, 0.12616, 0.12156,
'me_norm')


@attr('fuzzy')
def test_projectout_ic():
aam_helper(aam, ProjectOutInverseCompositional, 3, 6, 0.10796, 0.07286,
aam_helper(aam, ProjectOutInverseCompositional, 3, 6, 0.10796, 0.07346,
'me_norm')


@attr('fuzzy')
def test_alternating_fa():
aam_helper(aam, AlternatingForwardAdditive, 0, 8, 0.09062, 0.07053,
aam_helper(aam, AlternatingForwardAdditive, 0, 8, 0.09062, 0.07225,
'me_norm')


@attr('fuzzy')
def test_adaptive_fa():
aam_helper(aam, AdaptiveForwardAdditive, 1, 6, 0.07697, 0.04921, 'me_norm')
aam_helper(aam, AdaptiveForwardAdditive, 1, 6, 0.07697, 0.04834, 'me_norm')


@attr('fuzzy')
def test_simultaneous_fa():
aam_helper(aam, SimultaneousForwardAdditive, 2, 5, 0.12616, 0.12627,
aam_helper(aam, SimultaneousForwardAdditive, 2, 5, 0.12616, 0.11151,
'me_norm')


@attr('fuzzy')
def test_projectout_fa():
aam_helper(aam, ProjectOutForwardAdditive, 3, 6, 0.10796, 0.09725,
aam_helper(aam, ProjectOutForwardAdditive, 3, 6, 0.10796, 0.09702,
'me_norm')


@attr('fuzzy')
def test_alternating_fc():
aam_helper(aam, AlternatingForwardCompositional, 0, 6, 0.09062, 0.07109,
aam_helper(aam, AlternatingForwardCompositional, 0, 6, 0.09062, 0.07129,
'me_norm')

@attr('fuzzy')
def test_adaptive_fc():
aam_helper(aam, AdaptiveForwardCompositional, 1, 6, 0.07697, 0.04778,
aam_helper(aam, AdaptiveForwardCompositional, 1, 6, 0.07697, 0.04784,
'me_norm')


@attr('fuzzy')
def test_simultaneous_fc():
aam_helper(aam, SimultaneousForwardCompositional, 2, 5, 0.12616, 0.11505,
aam_helper(aam, SimultaneousForwardCompositional, 2, 5, 0.12616, 0.11738,
'me_norm')


@attr('fuzzy')
def test_projectout_fc():
aam_helper(aam, ProjectOutForwardCompositional, 3, 6, 0.10796, 0.08451,
aam_helper(aam, ProjectOutForwardCompositional, 3, 6, 0.10796, 0.0861,
'me_norm')


@attr('fuzzy')
def test_probabilistic_ic():
aam_helper(aam2, ProbabilisticInverseCompositional, 0, 6, 0.08605, 0.08923,
aam_helper(aam2, ProbabilisticInverseCompositional, 0, 6, 0.08605, 0.08924,
'me_norm')


@attr('fuzzy')
def test_probabilistic_fa():
aam_helper(aam2, ProbabilisticForwardAdditive, 1, 7, 0.09051, 0.08708,
aam_helper(aam2, ProbabilisticForwardAdditive, 1, 7, 0.09051, 0.08679,
'me_norm')


@attr('fuzzy')
def test_probabilistic_fc():
aam_helper(aam2, ProbabilisticForwardCompositional, 2, 6, 0.11714,
0.11697, 'me_norm')
0.11704, 'me_norm')
8 changes: 4 additions & 4 deletions menpofit/test/atm_fitter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,21 +424,21 @@ def atm_helper(atm, algorithm, im_number, max_iters, initial_error,

@attr('fuzzy')
def test_ic():
atm_helper(atm1, ImageInverseCompositional, 0, 6, 0.09062, 0.06783,
atm_helper(atm1, ImageInverseCompositional, 0, 6, 0.09062, 0.06788,
'me_norm')


@attr('fuzzy')
def test_fa():
atm_helper(atm2, ImageForwardAdditive, 1, 8, 0.09051, 0.08237, 'me_norm')
atm_helper(atm2, ImageForwardAdditive, 1, 8, 0.09051, 0.08188, 'me_norm')


@attr('fuzzy')
def test_fc():
atm_helper(atm3, ImageForwardCompositional, 2, 6, 0.12615, 0.07522,
atm_helper(atm3, ImageForwardCompositional, 2, 6, 0.12615, 0.08255,
'me_norm')

@attr('fuzzy')
def test_ic_2():
atm_helper(atm4, ImageInverseCompositional, 3, 7, 0.09748, 0.09509,
atm_helper(atm4, ImageInverseCompositional, 3, 7, 0.09748, 0.09511,
'me_norm')
19 changes: 8 additions & 11 deletions menpofit/test/clm_fitter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,37 +306,34 @@
clm = CLMBuilder(classifier_trainers=linear_svm_lr,
patch_shape=(8, 8),
features=sparse_hog,
normalization_diagonal=150,
n_levels=3,
normalization_diagonal=100,
n_levels=2,
downscale=1.1,
scaled_shape_models=True,
max_shape_components=[1, 2, 3],
max_shape_components=[2, 2],
boundary=3).build(training_images)


def test_clm():
assert (clm.n_training_images == 4)
assert (clm.n_levels == 3)
assert (clm.n_levels == 2)
assert (clm.downscale == 1.1)
#assert (clm.features[0] == sparse_hog and len(clm.features) == 1)
assert_allclose(np.around(clm.reference_shape.range()), (109., 103.))
assert_allclose(np.around(clm.reference_shape.range()), (72., 69.))
assert clm.scaled_shape_models
assert clm.pyramid_on_features
assert_allclose(clm.patch_shape, (8, 8))
assert_allclose([clm.shape_models[j].n_components
for j in range(clm.n_levels)], (1, 2, 3))
assert_allclose(clm.n_classifiers_per_level, [68, 68, 68])
for j in range(clm.n_levels)], (2, 2))
assert_allclose(clm.n_classifiers_per_level, [68, 68])

ran_0 = np.random.randint(0, clm.n_classifiers_per_level[0])
ran_1 = np.random.randint(0, clm.n_classifiers_per_level[1])
ran_2 = np.random.randint(0, clm.n_classifiers_per_level[2])

assert (name_of_callable(clm.classifiers[0][ran_0])
== 'linear_svm_lr')
assert (name_of_callable(clm.classifiers[1][ran_1])
== 'linear_svm_lr')
assert (name_of_callable(clm.classifiers[2][ran_2])
== 'linear_svm_lr')


@raises(ValueError)
Expand All @@ -346,7 +343,7 @@ def test_n_shape_1_exception():

@raises(ValueError)
def test_n_shape_2_exception():
fitter = GradientDescentCLMFitter(clm, n_shape=[10, 20])
fitter = GradientDescentCLMFitter(clm, n_shape=[10, 20, 3])


def test_perturb_shape():
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
author='The Menpo Development Team',
author_email='[email protected]',
packages=find_packages(),
install_requires=['numpy==1.9.0',
'scipy==0.14.0',
'menpo==0.4.0a3'
],
tests_require=['nose==1.3.4', 'mock==1.0.1']
install_requires=['menpo>=0.4.0,<0.5',
'scikit-learn>=0.15.2,<0.16.0'],
tests_require=['nose', 'mock']
)

0 comments on commit e5362aa

Please sign in to comment.