In [1]:
%matplotlib inline
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
repeat = 1

Load test data


In [4]:
import menpo.io as mio
from menpo.landmark import labeller, ibug_face_49
from menpofast.utils import convert_from_menpo

path = '/data/'
group = 'ibug_face_49'

test_images = []
for i in mio.import_images(path + 'PhD/DataBases/faces/afw/', verbose=True, 
                           max_images=None):
    
    # convert the image from menpo Image to menpofast Image (channels at front)
    i = convert_from_menpo(i)
    
    labeller(i, 'PTS', eval(group))
    i.crop_to_landmarks_proportion_inplace(0.5, group='PTS')
    i = i.rescale_landmarks_to_diagonal_range(200, group=group)
    
    if i.n_channels == 3:
        i = i.as_greyscale(mode='average')
    test_images.append(i)


- Loading 337 assets: [====================] 100%

In [5]:
from menpo.visualize import visualize_images

visualize_images(test_images)


Unified HDMs and HPDMs

Load


In [6]:
from alabortcvpr2015.utils import pickle_load

unified = pickle_load(path + 'PhD/Models/unified_lfpw_fast_dsift')

AIC + RLMS

Test


In [7]:
sampling_mask = np.require(np.zeros(unified.parts_shape), dtype=np.bool)
sampling_mask[2::6, 2::6] = True

imshow(sampling_mask)


Out[7]:
<matplotlib.image.AxesImage at 0x7f6aaea9f190>

In [8]:
from alabortcvpr2015.unified import PartsUnifiedFitter, AICRLMS

fitter = PartsUnifiedFitter(unified, algorithm_cls=AICRLMS, n_shape=[3, 12],
                            n_appearance=[25, 50], sampling_mask=sampling_mask)

In [16]:
all_fitter_results = []

for k in np.arange(0.998004, 0.9980041, 0.0000002):
    
    fitter_results = []

    for seed in xrange(repeat):

        np.random.seed(seed=seed)

        for j, i in enumerate(test_images):

            gt_s = i.landmarks[group].lms
            s = fitter.perturb_shape(gt_s, noise_std=0.05)

            fr = fitter.fit(i, s, gt_shape=gt_s, max_iters=20, prior=False, a=k)

            fitter_results.append(fr)
            fr.downscale = 0.5

    all_fitter_results.append(fitter_results)
    
    print 'a = ', k 
    print 'mean error: ', np.mean([fr.final_error() for fr in fitter_results])


a =  0.998004
mean error:  0.0330901171393

Visualize Results


In [21]:
from menpofit.visualize import visualize_fitting_results
    
visualize_fitting_results(fitter_results)


Save Results


In [31]:
from alabortcvpr2015.utils import pickle_dump
from alabortcvpr2015.result import SerializableResult

results = [SerializableResult('none', fr.shapes(), fr.n_iters, 'AICRLMS', fr.gt_shape) 
           for fr in fitter_results]

pickle_dump(results, path + 'PhD/Results/unified_aicrlms_lfpw_fast_dsift')

Timing

Total


In [22]:
%timeit fitter.fit(i, s, gt_shape=gt_s, max_iters=20, prior=False)


1 loops, best of 3: 216 ms per loop

Per Line


In [33]:
import line_profiler
import IPython

ip = IPython.get_ipython()
ip.define_magic('lprun', line_profiler.magic_lprun)

In [34]:
from alabortcvpr2015.unified import AICRLMS

%lprun -f AICRLMS.run fitter.fit(i, s, gt_shape=gt_s, max_iters=20)



PIC + RLMS

Test


In [35]:
sampling_mask = np.require(np.zeros(unified.parts_shape), dtype=np.bool)
sampling_mask[2::6, 2::6] = True

imshow(sampling_mask)


Out[35]:
<matplotlib.image.AxesImage at 0x7f87ee247310>

In [36]:
from alabortcvpr2015.unified import PartsUnifiedFitter, PICRLMS

fitter = PartsUnifiedFitter(unified, algorithm_cls=PICRLMS, n_shape=[3, 12],
                            sampling_mask=sampling_mask)

In [37]:
fitter_results = []

for seed in xrange(repeat):
    
    np.random.seed(seed=seed)

    for j, i in enumerate(test_images):
    
        gt_s = i.landmarks[group].lms
        s = fitter.perturb_shape(gt_s, noise_std=0.05)

        fr = fitter.fit(i, s, gt_shape=gt_s, max_iters=20, prior=False)

        fitter_results.append(fr)
        fr.downscale = 0.5

        print 'Image: ', j
        print fr


Image:  0
Initial error: 0.1901
Final error: 0.0296
Image:  1
Initial error: 0.1168
Final error: 0.0384
Image:  2
Initial error: 0.1417
Final error: 0.0855
Image:  3
Initial error: 0.0961
Final error: 0.1167
Image:  4
Initial error: 0.0718
Final error: 0.0321
Image:  5
Initial error: 0.1356
Final error: 0.0223
Image:  6
Initial error: 0.0936
Final error: 0.0345
Image:  7
Initial error: 0.0812
Final error: 0.0511
Image:  8
Initial error: 0.0862
Final error: 0.0540
Image:  9
Initial error: 0.0503
Final error: 0.0359
Image:  10
Initial error: 0.1415
Final error: 0.0282
Image:  11
Initial error: 0.1348
Final error: 0.0531
Image:  12
Initial error: 0.1588
Final error: 0.1350
Image:  13
Initial error: 0.1048
Final error: 0.0947
Image:  14
Initial error: 0.0674
Final error: 0.0699
Image:  15
Initial error: 0.1479
Final error: 0.1228
Image:  16
Initial error: 0.0898
Final error: 0.0396
Image:  17
Initial error: 0.0480
Final error: 0.0292
Image:  18
Initial error: 0.0778
Final error: 0.0531
Image:  19
Initial error: 0.0720
Final error: 0.0259
Image:  20
Initial error: 0.1320
Final error: 0.0687
Image:  21
Initial error: 0.1229
Final error: 0.0479
Image:  22
Initial error: 0.0831
Final error: 0.0635
Image:  23
Initial error: 0.0569
Final error: 0.0519
Image:  24
Initial error: 0.0763
Final error: 0.0460
Image:  25
Initial error: 0.1508
Final error: 0.0875
Image:  26
Initial error: 0.1081
Final error: 0.0365
Image:  27
Initial error: 0.1883
Final error: 0.0930
Image:  28
Initial error: 0.0683
Final error: 0.0432
Image:  29
Initial error: 0.1376
Final error: 0.0575
Image:  30
Initial error: 0.1032
Final error: 0.0689
Image:  31
Initial error: 0.0936
Final error: 0.0642
Image:  32
Initial error: 0.0802
Final error: 0.0685
Image:  33
Initial error: 0.0961
Final error: 0.0510
Image:  34
Initial error: 0.1091
Final error: 0.0426
Image:  35
Initial error: 0.0878
Final error: 0.0467
Image:  36
Initial error: 0.1323
Final error: 0.0291
Image:  37
Initial error: 0.0679
Final error: 0.0157
Image:  38
Initial error: 0.0923
Final error: 0.0550
Image:  39
Initial error: 0.0729
Final error: 0.0451
Image:  40
Initial error: 0.0562
Final error: 0.0262
Image:  41
Initial error: 0.1573
Final error: 0.0223
Image:  42
Initial error: 0.0875
Final error: 0.0242
Image:  43
Initial error: 0.0699
Final error: 0.0252
Image:  44
Initial error: 0.0924
Final error: 0.0223
Image:  45
Initial error: 0.1607
Final error: 0.0967
Image:  46
Initial error: 0.0764
Final error: 0.0280
Image:  47
Initial error: 0.1192
Final error: 0.0397
Image:  48
Initial error: 0.0587
Final error: 0.0414
Image:  49
Initial error: 0.1534
Final error: 0.0318
Image:  50
Initial error: 0.0687
Final error: 0.0787
Image:  51
Initial error: 0.0428
Final error: 0.0234
Image:  52
Initial error: 0.0593
Final error: 0.0379
Image:  53
Initial error: 0.0795
Final error: 0.0366
Image:  54
Initial error: 0.1212
Final error: 0.0277
Image:  55
Initial error: 0.1250
Final error: 0.0429
Image:  56
Initial error: 0.0814
Final error: 0.0221
Image:  57
Initial error: 0.1300
Final error: 0.0421
Image:  58
Initial error: 0.0824
Final error: 0.0453
Image:  59
Initial error: 0.1013
Final error: 0.0436
Image:  60
Initial error: 0.0636
Final error: 0.0371
Image:  61
Initial error: 0.0915
Final error: 0.0361
Image:  62
Initial error: 0.0712
Final error: 0.0278
Image:  63
Initial error: 0.0757
Final error: 0.0264
Image:  64
Initial error: 0.1079
Final error: 0.0160
Image:  65
Initial error: 0.0914
Final error: 0.0332
Image:  66
Initial error: 0.0950
Final error: 0.0368
Image:  67
Initial error: 0.1594
Final error: 0.0645
Image:  68
Initial error: 0.0495
Final error: 0.0229
Image:  69
Initial error: 0.1644
Final error: 0.0387
Image:  70
Initial error: 0.1069
Final error: 0.0535
Image:  71
Initial error: 0.0826
Final error: 0.0284
Image:  72
Initial error: 0.0613
Final error: 0.0254
Image:  73
Initial error: 0.1358
Final error: 0.0277
Image:  74
Initial error: 0.0833
Final error: 0.0489
Image:  75
Initial error: 0.1008
Final error: 0.0272
Image:  76
Initial error: 0.0869
Final error: 0.0243
Image:  77
Initial error: 0.0875
Final error: 0.0584
Image:  78
Initial error: 0.1000
Final error: 0.0535
Image:  79
Initial error: 0.0616
Final error: 0.0427
Image:  80
Initial error: 0.0971
Final error: 0.0460
Image:  81
Initial error: 0.0958
Final error: 0.0304
Image:  82
Initial error: 0.0972
Final error: 0.0474
Image:  83
Initial error: 0.1173
Final error: 0.0243
Image:  84
Initial error: 0.0952
Final error: 0.0254
Image:  85
Initial error: 0.0782
Final error: 0.0408
Image:  86
Initial error: 0.0606
Final error: 0.0312
Image:  87
Initial error: 0.0759
Final error: 0.0402
Image:  88
Initial error: 0.0729
Final error: 0.0331
Image:  89
Initial error: 0.1006
Final error: 0.0603
Image:  90
Initial error: 0.1244
Final error: 0.0598
Image:  91
Initial error: 0.0845
Final error: 0.0380
Image:  92
Initial error: 0.0686
Final error: 0.0211
Image:  93
Initial error: 0.0684
Final error: 0.0208
Image:  94
Initial error: 0.1136
Final error: 0.0214
Image:  95
Initial error: 0.1887
Final error: 0.0210
Image:  96
Initial error: 0.1009
Final error: 0.0163
Image:  97
Initial error: 0.0879
Final error: 0.0283
Image:  98
Initial error: 0.1226
Final error: 0.0426
Image:  99
Initial error: 0.1407
Final error: 0.0988
Image:  100
Initial error: 0.0628
Final error: 0.0346
Image:  101
Initial error: 0.1226
Final error: 0.0551
Image:  102
Initial error: 0.1099
Final error: 0.0282
Image:  103
Initial error: 0.1015
Final error: 0.0397
Image:  104
Initial error: 0.1485
Final error: 0.0758
Image:  105
Initial error: 0.1228
Final error: 0.0380
Image:  106
Initial error: 0.1525
Final error: 0.0662
Image:  107
Initial error: 0.1161
Final error: 0.0224
Image:  108
Initial error: 0.0569
Final error: 0.0289
Image:  109
Initial error: 0.0704
Final error: 0.0248
Image:  110
Initial error: 0.0428
Final error: 0.0202
Image:  111
Initial error: 0.1437
Final error: 0.1035
Image:  112
Initial error: 0.0832
Final error: 0.0497
Image:  113
Initial error: 0.1244
Final error: 0.0295
Image:  114
Initial error: 0.0378
Final error: 0.0340
Image:  115
Initial error: 0.0606
Final error: 0.0304
Image:  116
Initial error: 0.1167
Final error: 0.0980
Image:  117
Initial error: 0.2048
Final error: 0.0438
Image:  118
Initial error: 0.1218
Final error: 0.0488
Image:  119
Initial error: 0.1186
Final error: 0.0475
Image:  120
Initial error: 0.1711
Final error: 0.0700
Image:  121
Initial error: 0.1080
Final error: 0.0283
Image:  122
Initial error: 0.0750
Final error: 0.0396
Image:  123
Initial error: 0.1526
Final error: 0.0179
Image:  124
Initial error: 0.1055
Final error: 0.0466
Image:  125
Initial error: 0.0822
Final error: 0.0524
Image:  126
Initial error: 0.1558
Final error: 0.0703
Image:  127
Initial error: 0.0568
Final error: 0.0394
Image:  128
Initial error: 0.1096
Final error: 0.0419
Image:  129
Initial error: 0.1105
Final error: 0.0258
Image:  130
Initial error: 0.1689
Final error: 0.1511
Image:  131
Initial error: 0.1021
Final error: 0.0793
Image:  132
Initial error: 0.1852
Final error: 0.0238
Image:  133
Initial error: 0.0545
Final error: 0.0154
Image:  134
Initial error: 0.0507
Final error: 0.0345
Image:  135
Initial error: 0.0913
Final error: 0.0355
Image:  136
Initial error: 0.1549
Final error: 0.0245
Image:  137
Initial error: 0.0578
Final error: 0.0266
Image:  138
Initial error: 0.0958
Final error: 0.0270
Image:  139
Initial error: 0.1818
Final error: 0.0678
Image:  140
Initial error: 0.1360
Final error: 0.1251
Image:  141
Initial error: 0.0763
Final error: 0.0452
Image:  142
Initial error: 0.1113
Final error: 0.0403
Image:  143
Initial error: 0.0700
Final error: 0.0367
Image:  144
Initial error: 0.1043
Final error: 0.0270
Image:  145
Initial error: 0.1375
Final error: 0.1115
Image:  146
Initial error: 0.0744
Final error: 0.0265
Image:  147
Initial error: 0.0801
Final error: 0.0361
Image:  148
Initial error: 0.1294
Final error: 0.0958
Image:  149
Initial error: 0.1027
Final error: 0.0558
Image:  150
Initial error: 0.1115
Final error: 0.0264
Image:  151
Initial error: 0.1487
Final error: 0.0511
Image:  152
Initial error: 0.1259
Final error: 0.0348
Image:  153
Initial error: 0.0515
Final error: 0.0197
Image:  154
Initial error: 0.1111
Final error: 0.0408
Image:  155
Initial error: 0.0449
Final error: 0.0267
Image:  156
Initial error: 0.0813
Final error: 0.0184
Image:  157
Initial error: 0.0608
Final error: 0.0210
Image:  158
Initial error: 0.0521
Final error: 0.0190
Image:  159
Initial error: 0.0575
Final error: 0.0329
Image:  160
Initial error: 0.1074
Final error: 0.0280
Image:  161
Initial error: 0.0963
Final error: 0.0639
Image:  162
Initial error: 0.1719
Final error: 0.0797
Image:  163
Initial error: 0.0793
Final error: 0.0529
Image:  164
Initial error: 0.0943
Final error: 0.0483
Image:  165
Initial error: 0.0622
Final error: 0.0441
Image:  166
Initial error: 0.0949
Final error: 0.0290
Image:  167
Initial error: 0.1881
Final error: 0.0398
Image:  168
Initial error: 0.1491
Final error: 0.0586
Image:  169
Initial error: 0.0982
Final error: 0.0447
Image:  170
Initial error: 0.0586
Final error: 0.0310
Image:  171
Initial error: 0.1394
Final error: 0.0658
Image:  172
Initial error: 0.0550
Final error: 0.0169
Image:  173
Initial error: 0.0898
Final error: 0.0402
Image:  174
Initial error: 0.0552
Final error: 0.0230
Image:  175
Initial error: 0.1028
Final error: 0.0336
Image:  176
Initial error: 0.0756
Final error: 0.0530
Image:  177
Initial error: 0.0755
Final error: 0.0275
Image:  178
Initial error: 0.0828
Final error: 0.0359
Image:  179
Initial error: 0.1073
Final error: 0.0278
Image:  180
Initial error: 0.0496
Final error: 0.0374
Image:  181
Initial error: 0.1641
Final error: 0.1024
Image:  182
Initial error: 0.0510
Final error: 0.0251
Image:  183
Initial error: 0.1775
Final error: 0.0586
Image:  184
Initial error: 0.0611
Final error: 0.0271
Image:  185
Initial error: 0.0727
Final error: 0.0223
Image:  186
Initial error: 0.0590
Final error: 0.0247
Image:  187
Initial error: 0.1514
Final error: 0.0173
Image:  188
Initial error: 0.0538
Final error: 0.0163
Image:  189
Initial error: 0.0843
Final error: 0.0170
Image:  190
Initial error: 0.0873
Final error: 0.0478
Image:  191
Initial error: 0.0587
Final error: 0.0479
Image:  192
Initial error: 0.0674
Final error: 0.0384
Image:  193
Initial error: 0.1489
Final error: 0.0425
Image:  194
Initial error: 0.0975
Final error: 0.0212
Image:  195
Initial error: 0.0898
Final error: 0.0583
Image:  196
Initial error: 0.0494
Final error: 0.0184
Image:  197
Initial error: 0.0991
Final error: 0.0289
Image:  198
Initial error: 0.1222
Final error: 0.0659
Image:  199
Initial error: 0.0862
Final error: 0.0277
Image:  200
Initial error: 0.0903
Final error: 0.0212
Image:  201
Initial error: 0.0762
Final error: 0.0362
Image:  202
Initial error: 0.1155
Final error: 0.0482
Image:  203
Initial error: 0.1492
Final error: 0.1031
Image:  204
Initial error: 0.0907
Final error: 0.0526
Image:  205
Initial error: 0.0734
Final error: 0.0243
Image:  206
Initial error: 0.0948
Final error: 0.0257
Image:  207
Initial error: 0.1216
Final error: 0.0341
Image:  208
Initial error: 0.0771
Final error: 0.0195
Image:  209
Initial error: 0.0422
Final error: 0.0210
Image:  210
Initial error: 0.1333
Final error: 0.0270
Image:  211
Initial error: 0.0834
Final error: 0.0394
Image:  212
Initial error: 0.1854
Final error: 0.1258
Image:  213
Initial error: 0.1062
Final error: 0.0416
Image:  214
Initial error: 0.0957
Final error: 0.0240
Image:  215
Initial error: 0.1027
Final error: 0.0670
Image:  216
Initial error: 0.0892
Final error: 0.0221
Image:  217
Initial error: 0.0925
Final error: 0.0270
Image:  218
Initial error: 0.0745
Final error: 0.0225
Image:  219
Initial error: 0.1090
Final error: 0.0416
Image:  220
Initial error: 0.1361
Final error: 0.0866
Image:  221
Initial error: 0.0666
Final error: 0.0288
Image:  222
Initial error: 0.0678
Final error: 0.0178
Image:  223
Initial error: 0.1586
Final error: 0.0593
Image:  224
Initial error: 0.1526
Final error: 0.0417
Image:  225
Initial error: 0.2090
Final error: 0.1387
Image:  226
Initial error: 0.1128
Final error: 0.0269
Image:  227
Initial error: 0.0898
Final error: 0.0342
Image:  228
Initial error: 0.0908
Final error: 0.0288
Image:  229
Initial error: 0.0593
Final error: 0.0276
Image:  230
Initial error: 0.0852
Final error: 0.0453
Image:  231
Initial error: 0.0443
Final error: 0.0296
Image:  232
Initial error: 0.1095
Final error: 0.0289
Image:  233
Initial error: 0.0855
Final error: 0.0629
Image:  234
Initial error: 0.1054
Final error: 0.0388
Image:  235
Initial error: 0.1545
Final error: 0.0430
Image:  236
Initial error: 0.0801
Final error: 0.0415
Image:  237
Initial error: 0.0601
Final error: 0.0346
Image:  238
Initial error: 0.1567
Final error: 0.0848
Image:  239
Initial error: 0.1396
Final error: 0.0311
Image:  240
Initial error: 0.1231
Final error: 0.0749
Image:  241
Initial error: 0.0666
Final error: 0.0238
Image:  242
Initial error: 0.0958
Final error: 0.0357
Image:  243
Initial error: 0.1070
Final error: 0.0290
Image:  244
Initial error: 0.0509
Final error: 0.0233
Image:  245
Initial error: 0.0739
Final error: 0.0375
Image:  246
Initial error: 0.0728
Final error: 0.0243
Image:  247
Initial error: 0.1347
Final error: 0.0697
Image:  248
Initial error: 0.1272
Final error: 0.0611
Image:  249
Initial error: 0.0984
Final error: 0.0619
Image:  250
Initial error: 0.1075
Final error: 0.0639
Image:  251
Initial error: 0.1331
Final error: 0.0708
Image:  252
Initial error: 0.1433
Final error: 0.0578
Image:  253
Initial error: 0.0685
Final error: 0.0229
Image:  254
Initial error: 0.0630
Final error: 0.0316
Image:  255
Initial error: 0.0459
Final error: 0.0265
Image:  256
Initial error: 0.0747
Final error: 0.0398
Image:  257
Initial error: 0.0725
Final error: 0.0333
Image:  258
Initial error: 0.1123
Final error: 0.1047
Image:  259
Initial error: 0.1034
Final error: 0.0409
Image:  260
Initial error: 0.1354
Final error: 0.0333
Image:  261
Initial error: 0.0949
Final error: 0.1154
Image:  262
Initial error: 0.0755
Final error: 0.0283
Image:  263
Initial error: 0.1938
Final error: 0.0498
Image:  264
Initial error: 0.1221
Final error: 0.0380
Image:  265
Initial error: 0.0692
Final error: 0.0503
Image:  266
Initial error: 0.0687
Final error: 0.0315
Image:  267
Initial error: 0.0950
Final error: 0.0356
Image:  268
Initial error: 0.0592
Final error: 0.0369
Image:  269
Initial error: 0.0706
Final error: 0.0270
Image:  270
Initial error: 0.0820
Final error: 0.0322
Image:  271
Initial error: 0.1286
Final error: 0.0609
Image:  272
Initial error: 0.0488
Final error: 0.0301
Image:  273
Initial error: 0.0920
Final error: 0.0357
Image:  274
Initial error: 0.0750
Final error: 0.0363
Image:  275
Initial error: 0.1011
Final error: 0.0288
Image:  276
Initial error: 0.0893
Final error: 0.0550
Image:  277
Initial error: 0.1085
Final error: 0.0600
Image:  278
Initial error: 0.1851
Final error: 0.0997
Image:  279
Initial error: 0.0895
Final error: 0.0536
Image:  280
Initial error: 0.0609
Final error: 0.0309
Image:  281
Initial error: 0.0930
Final error: 0.0258
Image:  282
Initial error: 0.1040
Final error: 0.0455
Image:  283
Initial error: 0.0547
Final error: 0.0385
Image:  284
Initial error: 0.0886
Final error: 0.0319
Image:  285
Initial error: 0.1320
Final error: 0.0412
Image:  286
Initial error: 0.0441
Final error: 0.0201
Image:  287
Initial error: 0.0723
Final error: 0.0236
Image:  288
Initial error: 0.0772
Final error: 0.0253
Image:  289
Initial error: 0.1218
Final error: 0.0194
Image:  290
Initial error: 0.0624
Final error: 0.0309
Image:  291
Initial error: 0.1479
Final error: 0.0599
Image:  292
Initial error: 0.0802
Final error: 0.0310
Image:  293
Initial error: 0.1215
Final error: 0.0373
Image:  294
Initial error: 0.1178
Final error: 0.0440
Image:  295
Initial error: 0.0594
Final error: 0.0420
Image:  296
Initial error: 0.0670
Final error: 0.0334
Image:  297
Initial error: 0.0947
Final error: 0.0215
Image:  298
Initial error: 0.0775
Final error: 0.0334
Image:  299
Initial error: 0.1092
Final error: 0.0379
Image:  300
Initial error: 0.0962
Final error: 0.0571
Image:  301
Initial error: 0.0988
Final error: 0.0689
Image:  302
Initial error: 0.0822
Final error: 0.0297
Image:  303
Initial error: 0.0678
Final error: 0.0354
Image:  304
Initial error: 0.0979
Final error: 0.0563
Image:  305
Initial error: 0.0926
Final error: 0.0351
Image:  306
Initial error: 0.0862
Final error: 0.0384
Image:  307
Initial error: 0.1036
Final error: 0.0684
Image:  308
Initial error: 0.1466
Final error: 0.0220
Image:  309
Initial error: 0.0613
Final error: 0.0220
Image:  310
Initial error: 0.1195
Final error: 0.0377
Image:  311
Initial error: 0.0686
Final error: 0.0558
Image:  312
Initial error: 0.0797
Final error: 0.0272
Image:  313
Initial error: 0.0550
Final error: 0.0202
Image:  314
Initial error: 0.1632
Final error: 0.0352
Image:  315
Initial error: 0.1003
Final error: 0.0339
Image:  316
Initial error: 0.1446
Final error: 0.0215
Image:  317
Initial error: 0.1497
Final error: 0.0375
Image:  318
Initial error: 0.1020
Final error: 0.0290
Image:  319
Initial error: 0.1199
Final error: 0.0377
Image:  320
Initial error: 0.0859
Final error: 0.0346
Image:  321
Initial error: 0.1501
Final error: 0.1658
Image:  322
Initial error: 0.0829
Final error: 0.0239
Image:  323
Initial error: 0.0927
Final error: 0.0371
Image:  324
Initial error: 0.1040
Final error: 0.0268
Image:  325
Initial error: 0.0737
Final error: 0.0253
Image:  326
Initial error: 0.0911
Final error: 0.0339
Image:  327
Initial error: 0.0793
Final error: 0.0330
Image:  328
Initial error: 0.0980
Final error: 0.0745
Image:  329
Initial error: 0.1300
Final error: 0.0967
Image:  330
Initial error: 0.0816
Final error: 0.0513
Image:  331
Initial error: 0.0612
Final error: 0.0525
Image:  332
Initial error: 0.0915
Final error: 0.0633
Image:  333
Initial error: 0.0619
Final error: 0.0181
Image:  334
Initial error: 0.1202
Final error: 0.0317
Image:  335
Initial error: 0.0628
Final error: 0.0282
Image:  336
Initial error: 0.0860
Final error: 0.0429

Visualize Results


In [38]:
from menpofit.visualize import visualize_fitting_results
    
visualize_fitting_results(fitter_results)


Save Results


In [39]:
from alabortcvpr2015.utils import pickle_dump
from alabortcvpr2015.result import SerializableResult

results = [SerializableResult('none', fr.shapes(), fr.n_iters, 'PICRLMS', fr.gt_shape) 
           for fr in fitter_results]

pickle_dump(results, path + 'PhD/Results/unified_picrlms_lfpw_fast_dsift')

Timing

Total


In [40]:
%timeit fitter.fit(i, s, gt_shape=gt_s, max_iters=20, prior=False)


10 loops, best of 3: 106 ms per loop

Per line


In [41]:
import line_profiler
import IPython

ip = IPython.get_ipython()
ip.define_magic('lprun', line_profiler.magic_lprun)

In [42]:
from alabortcvpr2015.unified import PICRLMS

%lprun -f PICRLMS.run fitter.fit(i, s, gt_shape=gt_s, max_iters=20)




In [42]: