In [1]:
%matplotlib inline
%pylab inline
Populating the interactive namespace from numpy and matplotlib
In [2]:
repeat = 1
In [3]:
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 [4]:
from menpo.visualize import visualize_images
visualize_images(test_images)
In [5]:
from alabortcvpr2015.utils import pickle_load
unified = pickle_load(path + 'PhD/Models/unified_lfpw_fast_dsift0')
sampling_mask = np.require(np.zeros(unified.parts_shape), dtype=np.bool)
sampling_mask[2::6, 2::6] = True
imshow(sampling_mask)
Out[5]:
<matplotlib.image.AxesImage at 0x7f0e181c7d90>
In [6]:
from alabortcvpr2015.utils import pickle_load
from alabortcvpr2015.unified import PartsUnifiedFitter, AICRLMS
from alabortcvpr2015.utils import pickle_dump
from alabortcvpr2015.result import SerializableResult
for k in xrange(7, 8):
unified = pickle_load(path + 'PhD/Models/unified_lfpw_fast_dsift' + str(k))
n_a = np.minimum(50, unified.appearance_models[1].n_components) - 1
fitter = PartsUnifiedFitter(unified, algorithm_cls=AICRLMS, n_shape=[3, 12],
n_appearance=[25, n_a], sampling_mask=sampling_mask)
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
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_afw_fast_dsift' + str(k))
Image: 0
Initial error: 0.1908
Final error: 0.0172
Image: 1
Initial error: 0.1166
Final error: 0.0190
Image: 2
Initial error: 0.1387
Final error: 0.0448
Image: 3
Initial error: 0.0942
Final error: 0.0239
Image: 4
Initial error: 0.0722
Final error: 0.0184
Image: 5
Initial error: 0.1358
Final error: 0.0145
Image: 6
Initial error: 0.0966
Final error: 0.0178
Image: 7
Initial error: 0.0792
Final error: 0.0189
Image: 8
Initial error: 0.0847
Final error: 0.0541
Image: 9
Initial error: 0.0493
Final error: 0.0258
Image: 10
Initial error: 0.1396
Final error: 0.0251
Image: 11
Initial error: 0.1332
Final error: 0.0247
Image: 12
Initial error: 0.1621
Final error: 0.0430
Image: 13
Initial error: 0.1072
Final error: 0.0388
Image: 14
Initial error: 0.0678
Final error: 0.0637
Image: 15
Initial error: 0.1480
Final error: 0.0347
Image: 16
Initial error: 0.0874
Final error: 0.0256
Image: 17
Initial error: 0.0455
Final error: 0.0183
Image: 18
Initial error: 0.0779
Final error: 0.0251
Image: 19
Initial error: 0.0739
Final error: 0.0216
Image: 20
Initial error: 0.1331
Final error: 0.0249
Image: 21
Initial error: 0.1206
Final error: 0.0197
Image: 22
Initial error: 0.0855
Final error: 0.0220
Image: 23
Initial error: 0.0561
Final error: 0.0420
Image: 24
Initial error: 0.0724
Final error: 0.0348
Image: 25
Initial error: 0.1538
Final error: 0.0503
Image: 26
Initial error: 0.1075
Final error: 0.0222
Image: 27
Initial error: 0.1895
Final error: 0.2010
Image: 28
Initial error: 0.0716
Final error: 0.0270
Image: 29
Initial error: 0.1385
Final error: 0.0440
Image: 30
Initial error: 0.1037
Final error: 0.0406
Image: 31
Initial error: 0.0958
Final error: 0.0328
Image: 32
Initial error: 0.0816
Final error: 0.0326
Image: 33
Initial error: 0.0970
Final error: 0.0453
Image: 34
Initial error: 0.1045
Final error: 0.0346
Image: 35
Initial error: 0.0891
Final error: 0.0277
Image: 36
Initial error: 0.1333
Final error: 0.0264
Image: 37
Initial error: 0.0691
Final error: 0.0169
Image: 38
Initial error: 0.0953
Final error: 0.0399
Image: 39
Initial error: 0.0744
Final error: 0.0336
Image: 40
Initial error: 0.0564
Final error: 0.0266
Image: 41
Initial error: 0.1577
Final error: 0.0289
Image: 42
Initial error: 0.0864
Final error: 0.0549
Image: 43
Initial error: 0.0683
Final error: 0.0220
Image: 44
Initial error: 0.0910
Final error: 0.0160
Image: 45
Initial error: 0.1634
Final error: 0.0589
Image: 46
Initial error: 0.0756
Final error: 0.0202
Image: 47
Initial error: 0.1189
Final error: 0.0549
Image: 48
Initial error: 0.0544
Final error: 0.0263
Image: 49
Initial error: 0.1533
Final error: 0.0240
Image: 50
Initial error: 0.0650
Final error: 0.0723
Image: 51
Initial error: 0.0424
Final error: 0.0213
Image: 52
Initial error: 0.0584
Final error: 0.0328
Image: 53
Initial error: 0.0781
Final error: 0.0258
Image: 54
Initial error: 0.1218
Final error: 0.0180
Image: 55
Initial error: 0.1241
Final error: 0.0422
Image: 56
Initial error: 0.0820
Final error: 0.0140
Image: 57
Initial error: 0.1319
Final error: 0.0317
Image: 58
Initial error: 0.0823
Final error: 0.0329
Image: 59
Initial error: 0.1025
Final error: 0.0330
Image: 60
Initial error: 0.0630
Final error: 0.0223
Image: 61
Initial error: 0.0886
Final error: 0.0189
Image: 62
Initial error: 0.0696
Final error: 0.0159
Image: 63
Initial error: 0.0761
Final error: 0.0176
Image: 64
Initial error: 0.1079
Final error: 0.0152
Image: 65
Initial error: 0.0921
Final error: 0.0135
Image: 66
Initial error: 0.0967
Final error: 0.0253
Image: 67
Initial error: 0.1600
Final error: 0.0303
Image: 68
Initial error: 0.0491
Final error: 0.0186
Image: 69
Initial error: 0.1672
Final error: 0.0311
Image: 70
Initial error: 0.1052
Final error: 0.0519
Image: 71
Initial error: 0.0836
Final error: 0.0223
Image: 72
Initial error: 0.0564
Final error: 0.0196
Image: 73
Initial error: 0.1353
Final error: 0.0255
Image: 74
Initial error: 0.0861
Final error: 0.0325
Image: 75
Initial error: 0.1000
Final error: 0.0188
Image: 76
Initial error: 0.0857
Final error: 0.0336
Image: 77
Initial error: 0.0872
Final error: 0.0335
Image: 78
Initial error: 0.1003
Final error: 0.0462
Image: 79
Initial error: 0.0648
Final error: 0.0451
Image: 80
Initial error: 0.0953
Final error: 0.0218
Image: 81
Initial error: 0.0960
Final error: 0.0206
Image: 82
Initial error: 0.0977
Final error: 0.0285
Image: 83
Initial error: 0.1158
Final error: 0.0296
Image: 84
Initial error: 0.0942
Final error: 0.0218
Image: 85
Initial error: 0.0763
Final error: 0.0296
Image: 86
Initial error: 0.0590
Final error: 0.0267
Image: 87
Initial error: 0.0752
Final error: 0.0356
Image: 88
Initial error: 0.0772
Final error: 0.0238
Image: 89
Initial error: 0.1005
Final error: 0.0508
Image: 90
Initial error: 0.1256
Final error: 0.0267
Image: 91
Initial error: 0.0877
Final error: 0.0361
Image: 92
Initial error: 0.0682
Final error: 0.0206
Image: 93
Initial error: 0.0661
Final error: 0.0197
Image: 94
Initial error: 0.1105
Final error: 0.0180
Image: 95
Initial error: 0.1893
Final error: 0.1126
Image: 96
Initial error: 0.1012
Final error: 0.0172
Image: 97
Initial error: 0.0901
Final error: 0.0188
Image: 98
Initial error: 0.1195
Final error: 0.0402
Image: 99
Initial error: 0.1410
Final error: 0.0374
Image: 100
Initial error: 0.0610
Final error: 0.0291
Image: 101
Initial error: 0.1252
Final error: 0.0277
Image: 102
Initial error: 0.1080
Final error: 0.0258
Image: 103
Initial error: 0.0985
Final error: 0.0992
Image: 104
Initial error: 0.1488
Final error: 0.0267
Image: 105
Initial error: 0.1223
Final error: 0.0273
Image: 106
Initial error: 0.1551
Final error: 0.0464
Image: 107
Initial error: 0.1195
Final error: 0.0151
Image: 108
Initial error: 0.0560
Final error: 0.0186
Image: 109
Initial error: 0.0699
Final error: 0.0182
Image: 110
Initial error: 0.0394
Final error: 0.0213
Image: 111
Initial error: 0.1464
Final error: 0.0326
Image: 112
Initial error: 0.0813
Final error: 0.0420
Image: 113
Initial error: 0.1235
Final error: 0.0249
Image: 114
Initial error: 0.0377
Final error: 0.0337
Image: 115
Initial error: 0.0626
Final error: 0.0299
Image: 116
Initial error: 0.1192
Final error: 0.0258
Image: 117
Initial error: 0.2063
Final error: 0.0765
Image: 118
Initial error: 0.1226
Final error: 0.0236
Image: 119
Initial error: 0.1173
Final error: 0.0260
Image: 120
Initial error: 0.1689
Final error: 0.1586
Image: 121
Initial error: 0.1076
Final error: 0.0177
Image: 122
Initial error: 0.0748
Final error: 0.0245
Image: 123
Initial error: 0.1528
Final error: 0.0173
Image: 124
Initial error: 0.1059
Final error: 0.0301
Image: 125
Initial error: 0.0785
Final error: 0.0356
Image: 126
Initial error: 0.1551
Final error: 0.0764
Image: 127
Initial error: 0.0569
Final error: 0.0294
Image: 128
Initial error: 0.1112
Final error: 0.0284
Image: 129
Initial error: 0.1097
Final error: 0.0166
Image: 130
Initial error: 0.1723
Final error: 0.1902
Image: 131
Initial error: 0.1004
Final error: 0.0315
Image: 132
Initial error: 0.1862
Final error: 0.0566
Image: 133
Initial error: 0.0523
Final error: 0.0161
Image: 134
Initial error: 0.0502
Final error: 0.0295
Image: 135
Initial error: 0.0908
Final error: 0.0233
Image: 136
Initial error: 0.1576
Final error: 0.0174
Image: 137
Initial error: 0.0558
Final error: 0.0204
Image: 138
Initial error: 0.0959
Final error: 0.0209
Image: 139
Initial error: 0.1829
Final error: 0.1771
Image: 140
Initial error: 0.1409
Final error: 0.0642
Image: 141
Initial error: 0.0771
Final error: 0.0680
Image: 142
Initial error: 0.1097
Final error: 0.0350
Image: 143
Initial error: 0.0679
Final error: 0.0262
Image: 144
Initial error: 0.1067
Final error: 0.0181
Image: 145
Initial error: 0.1365
Final error: 0.0359
Image: 146
Initial error: 0.0784
Final error: 0.0195
Image: 147
Initial error: 0.0766
Final error: 0.0272
Image: 148
Initial error: 0.1250
Final error: 0.0685
Image: 149
Initial error: 0.1049
Final error: 0.0273
Image: 150
Initial error: 0.1120
Final error: 0.0164
Image: 151
Initial error: 0.1488
Final error: 0.0526
Image: 152
Initial error: 0.1270
Final error: 0.0158
Image: 153
Initial error: 0.0515
Final error: 0.0189
Image: 154
Initial error: 0.1090
Final error: 0.0293
Image: 155
Initial error: 0.0418
Final error: 0.0189
Image: 156
Initial error: 0.0789
Final error: 0.0195
Image: 157
Initial error: 0.0581
Final error: 0.0159
Image: 158
Initial error: 0.0475
Final error: 0.0158
Image: 159
Initial error: 0.0560
Final error: 0.0209
Image: 160
Initial error: 0.1039
Final error: 0.0195
Image: 161
Initial error: 0.0929
Final error: 0.0548
Image: 162
Initial error: 0.1711
Final error: 0.0251
Image: 163
Initial error: 0.0767
Final error: 0.0294
Image: 164
Initial error: 0.0939
Final error: 0.0241
Image: 165
Initial error: 0.0633
Final error: 0.0297
Image: 166
Initial error: 0.0921
Final error: 0.0168
Image: 167
Initial error: 0.1894
Final error: 0.0129
Image: 168
Initial error: 0.1466
Final error: 0.0340
Image: 169
Initial error: 0.0997
Final error: 0.0355
Image: 170
Initial error: 0.0544
Final error: 0.0224
Image: 171
Initial error: 0.1386
Final error: 0.0498
Image: 172
Initial error: 0.0537
Final error: 0.0228
Image: 173
Initial error: 0.0871
Final error: 0.0282
Image: 174
Initial error: 0.0556
Final error: 0.0246
Image: 175
Initial error: 0.1034
Final error: 0.0233
Image: 176
Initial error: 0.0741
Final error: 0.0355
Image: 177
Initial error: 0.0757
Final error: 0.0149
Image: 178
Initial error: 0.0850
Final error: 0.0222
Image: 179
Initial error: 0.1097
Final error: 0.0270
Image: 180
Initial error: 0.0484
Final error: 0.0249
Image: 181
Initial error: 0.1651
Final error: 0.1351
Image: 182
Initial error: 0.0480
Final error: 0.0224
Image: 183
Initial error: 0.1777
Final error: 0.0243
Image: 184
Initial error: 0.0606
Final error: 0.0279
Image: 185
Initial error: 0.0718
Final error: 0.0213
Image: 186
Initial error: 0.0569
Final error: 0.0169
Image: 187
Initial error: 0.1528
Final error: 0.0218
Image: 188
Initial error: 0.0534
Final error: 0.0180
Image: 189
Initial error: 0.0816
Final error: 0.0179
Image: 190
Initial error: 0.0908
Final error: 0.0215
Image: 191
Initial error: 0.0573
Final error: 0.0343
Image: 192
Initial error: 0.0667
Final error: 0.0221
Image: 193
Initial error: 0.1489
Final error: 0.0223
Image: 194
Initial error: 0.0962
Final error: 0.0168
Image: 195
Initial error: 0.0868
Final error: 0.0347
Image: 196
Initial error: 0.0485
Final error: 0.0138
Image: 197
Initial error: 0.0984
Final error: 0.0190
Image: 198
Initial error: 0.1219
Final error: 0.0245
Image: 199
Initial error: 0.0872
Final error: 0.0189
Image: 200
Initial error: 0.0875
Final error: 0.0156
Image: 201
Initial error: 0.0772
Final error: 0.0177
Image: 202
Initial error: 0.1170
Final error: 0.0237
Image: 203
Initial error: 0.1497
Final error: 0.0383
Image: 204
Initial error: 0.0924
Final error: 0.0330
Image: 205
Initial error: 0.0712
Final error: 0.0239
Image: 206
Initial error: 0.0936
Final error: 0.0171
Image: 207
Initial error: 0.1222
Final error: 0.0206
Image: 208
Initial error: 0.0779
Final error: 0.0191
Image: 209
Initial error: 0.0382
Final error: 0.0158
Image: 210
Initial error: 0.1334
Final error: 0.0328
Image: 211
Initial error: 0.0792
Final error: 0.0278
Image: 212
Initial error: 0.1859
Final error: 0.0308
Image: 213
Initial error: 0.1045
Final error: 0.0304
Image: 214
Initial error: 0.0962
Final error: 0.0148
Image: 215
Initial error: 0.1036
Final error: 0.0844
Image: 216
Initial error: 0.0925
Final error: 0.0167
Image: 217
Initial error: 0.0915
Final error: 0.0237
Image: 218
Initial error: 0.0750
Final error: 0.0193
Image: 219
Initial error: 0.1082
Final error: 0.0247
Image: 220
Initial error: 0.1344
Final error: 0.0407
Image: 221
Initial error: 0.0676
Final error: 0.0220
Image: 222
Initial error: 0.0670
Final error: 0.0186
Image: 223
Initial error: 0.1560
Final error: 0.0586
Image: 224
Initial error: 0.1490
Final error: 0.0217
Image: 225
Initial error: 0.2057
Final error: 0.0362
Image: 226
Initial error: 0.1137
Final error: 0.0197
Image: 227
Initial error: 0.0868
Final error: 0.0231
Image: 228
Initial error: 0.0917
Final error: 0.0210
Image: 229
Initial error: 0.0558
Final error: 0.0271
Image: 230
Initial error: 0.0820
Final error: 0.0415
Image: 231
Initial error: 0.0404
Final error: 0.0313
Image: 232
Initial error: 0.1113
Final error: 0.0236
Image: 233
Initial error: 0.0828
Final error: 0.0463
Image: 234
Initial error: 0.1071
Final error: 0.0452
Image: 235
Initial error: 0.1547
Final error: 0.0321
Image: 236
Initial error: 0.0785
Final error: 0.0458
Image: 237
Initial error: 0.0592
Final error: 0.0328
Image: 238
Initial error: 0.1585
Final error: 0.0457
Image: 239
Initial error: 0.1400
Final error: 0.0186
Image: 240
Initial error: 0.1244
Final error: 0.0656
Image: 241
Initial error: 0.0671
Final error: 0.0202
Image: 242
Initial error: 0.0980
Final error: 0.0291
Image: 243
Initial error: 0.1044
Final error: 0.1123
Image: 244
Initial error: 0.0515
Final error: 0.0202
Image: 245
Initial error: 0.0714
Final error: 0.0257
Image: 246
Initial error: 0.0704
Final error: 0.0186
Image: 247
Initial error: 0.1363
Final error: 0.0247
Image: 248
Initial error: 0.1299
Final error: 0.0299
Image: 249
Initial error: 0.1013
Final error: 0.0334
Image: 250
Initial error: 0.1102
Final error: 0.0290
Image: 251
Initial error: 0.1336
Final error: 0.0203
Image: 252
Initial error: 0.1397
Final error: 0.0256
Image: 253
Initial error: 0.0675
Final error: 0.0212
Image: 254
Initial error: 0.0598
Final error: 0.0186
Image: 255
Initial error: 0.0442
Final error: 0.0229
Image: 256
Initial error: 0.0701
Final error: 0.0354
Image: 257
Initial error: 0.0702
Final error: 0.0280
Image: 258
Initial error: 0.1081
Final error: 0.0499
Image: 259
Initial error: 0.0996
Final error: 0.0222
Image: 260
Initial error: 0.1357
Final error: 0.0960
Image: 261
Initial error: 0.0947
Final error: 0.0694
Image: 262
Initial error: 0.0755
Final error: 0.0235
Image: 263
Initial error: 0.1904
Final error: 0.0187
Image: 264
Initial error: 0.1209
Final error: 0.0290
Image: 265
Initial error: 0.0670
Final error: 0.0310
Image: 266
Initial error: 0.0718
Final error: 0.0241
Image: 267
Initial error: 0.0941
Final error: 0.0240
Image: 268
Initial error: 0.0556
Final error: 0.0284
Image: 269
Initial error: 0.0680
Final error: 0.0138
Image: 270
Initial error: 0.0796
Final error: 0.0188
Image: 271
Initial error: 0.1281
Final error: 0.0387
Image: 272
Initial error: 0.0473
Final error: 0.0186
Image: 273
Initial error: 0.0921
Final error: 0.0233
Image: 274
Initial error: 0.0740
Final error: 0.0258
Image: 275
Initial error: 0.1008
Final error: 0.0272
Image: 276
Initial error: 0.0924
Final error: 0.0285
Image: 277
Initial error: 0.1111
Final error: 0.0403
Image: 278
Initial error: 0.1860
Final error: 0.1034
Image: 279
Initial error: 0.0914
Final error: 0.0496
Image: 280
Initial error: 0.0629
Final error: 0.0316
Image: 281
Initial error: 0.0957
Final error: 0.0195
Image: 282
Initial error: 0.1015
Final error: 0.0227
Image: 283
Initial error: 0.0559
Final error: 0.0402
Image: 284
Initial error: 0.0907
Final error: 0.0582
Image: 285
Initial error: 0.1344
Final error: 0.0280
Image: 286
Initial error: 0.0393
Final error: 0.0169
Image: 287
Initial error: 0.0689
Final error: 0.0205
Image: 288
Initial error: 0.0765
Final error: 0.0181
Image: 289
Initial error: 0.1240
Final error: 0.0138
Image: 290
Initial error: 0.0645
Final error: 0.0250
Image: 291
Initial error: 0.1447
Final error: 0.0171
Image: 292
Initial error: 0.0770
Final error: 0.0175
Image: 293
Initial error: 0.1223
Final error: 0.0185
Image: 294
Initial error: 0.1146
Final error: 0.0224
Image: 295
Initial error: 0.0556
Final error: 0.0288
Image: 296
Initial error: 0.0700
Final error: 0.0302
Image: 297
Initial error: 0.0939
Final error: 0.0179
Image: 298
Initial error: 0.0767
Final error: 0.0287
Image: 299
Initial error: 0.1080
Final error: 0.0300
Image: 300
Initial error: 0.0980
Final error: 0.0251
Image: 301
Initial error: 0.1019
Final error: 0.0363
Image: 302
Initial error: 0.0817
Final error: 0.0244
Image: 303
Initial error: 0.0685
Final error: 0.0345
Image: 304
Initial error: 0.0977
Final error: 0.0374
Image: 305
Initial error: 0.0909
Final error: 0.0795
Image: 306
Initial error: 0.0885
Final error: 0.0217
Image: 307
Initial error: 0.1006
Final error: 0.0667
Image: 308
Initial error: 0.1471
Final error: 0.0148
Image: 309
Initial error: 0.0582
Final error: 0.0139
Image: 310
Initial error: 0.1210
Final error: 0.0208
Image: 311
Initial error: 0.0656
Final error: 0.0197
Image: 312
Initial error: 0.0829
Final error: 0.0213
Image: 313
Initial error: 0.0537
Final error: 0.0124
Image: 314
Initial error: 0.1645
Final error: 0.0358
Image: 315
Initial error: 0.1012
Final error: 0.0294
Image: 316
Initial error: 0.1442
Final error: 0.0205
Image: 317
Initial error: 0.1482
Final error: 0.0596
Image: 318
Initial error: 0.1000
Final error: 0.0242
Image: 319
Initial error: 0.1182
Final error: 0.0211
Image: 320
Initial error: 0.0825
Final error: 0.0282
Image: 321
Initial error: 0.1488
Final error: 0.1247
Image: 322
Initial error: 0.0841
Final error: 0.0206
Image: 323
Initial error: 0.0906
Final error: 0.0247
Image: 324
Initial error: 0.1037
Final error: 0.0261
Image: 325
Initial error: 0.0743
Final error: 0.0252
Image: 326
Initial error: 0.0902
Final error: 0.0272
Image: 327
Initial error: 0.0757
Final error: 0.0165
Image: 328
Initial error: 0.0993
Final error: 0.0289
Image: 329
Initial error: 0.1342
Final error: 0.1649
Image: 330
Initial error: 0.0781
Final error: 0.0288
Image: 331
Initial error: 0.0585
Final error: 0.0181
Image: 332
Initial error: 0.0919
Final error: 0.0360
Image: 333
Initial error: 0.0630
Final error: 0.0169
Image: 334
Initial error: 0.1222
Final error: 0.0232
Image: 335
Initial error: 0.0624
Final error: 0.0215
Image: 336
Initial error: 0.0866
Final error: 0.0318
In [7]:
from alabortcvpr2015.utils import pickle_load
unified = pickle_load(path + 'PhD/Models/unified_lfpw_fast_dsift0')
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 0x7f0e15d43b90>
In [8]:
from alabortcvpr2015.utils import pickle_load
from alabortcvpr2015.unified import PartsUnifiedFitter, PICRLMS
from alabortcvpr2015.utils import pickle_dump
from alabortcvpr2015.result import SerializableResult
for k in xrange(7, 8):
unified = pickle_load(path + 'PhD/Models/unified_lfpw_fast_dsift' + str(k))
n_a = np.minimum(50, unified.appearance_models[1].n_components) - 1
fitter = PartsUnifiedFitter(unified, algorithm_cls=PICRLMS, n_shape=[3, 12],
n_appearance=[25, n_a], sampling_mask=sampling_mask)
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
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_afw_fast_dsift' + str(k))
Image: 0
Initial error: 0.1908
Final error: 0.0341
Image: 1
Initial error: 0.1166
Final error: 0.0389
Image: 2
Initial error: 0.1387
Final error: 0.0798
Image: 3
Initial error: 0.0942
Final error: 0.0958
Image: 4
Initial error: 0.0722
Final error: 0.0325
Image: 5
Initial error: 0.1358
Final error: 0.0254
Image: 6
Initial error: 0.0966
Final error: 0.0333
Image: 7
Initial error: 0.0792
Final error: 0.0452
Image: 8
Initial error: 0.0847
Final error: 0.0491
Image: 9
Initial error: 0.0493
Final error: 0.0332
Image: 10
Initial error: 0.1396
Final error: 0.0304
Image: 11
Initial error: 0.1332
Final error: 0.0747
Image: 12
Initial error: 0.1621
Final error: 0.1341
Image: 13
Initial error: 0.1072
Final error: 0.0954
Image: 14
Initial error: 0.0678
Final error: 0.0721
Image: 15
Initial error: 0.1480
Final error: 0.1096
Image: 16
Initial error: 0.0874
Final error: 0.0346
Image: 17
Initial error: 0.0455
Final error: 0.0257
Image: 18
Initial error: 0.0779
Final error: 0.0490
Image: 19
Initial error: 0.0739
Final error: 0.0286
Image: 20
Initial error: 0.1331
Final error: 0.0766
Image: 21
Initial error: 0.1206
Final error: 0.0281
Image: 22
Initial error: 0.0855
Final error: 0.0471
Image: 23
Initial error: 0.0561
Final error: 0.0485
Image: 24
Initial error: 0.0724
Final error: 0.0385
Image: 25
Initial error: 0.1538
Final error: 0.0740
Image: 26
Initial error: 0.1075
Final error: 0.0388
Image: 27
Initial error: 0.1895
Final error: 0.0987
Image: 28
Initial error: 0.0716
Final error: 0.0425
Image: 29
Initial error: 0.1385
Final error: 0.0599
Image: 30
Initial error: 0.1037
Final error: 0.0864
Image: 31
Initial error: 0.0958
Final error: 0.0721
Image: 32
Initial error: 0.0816
Final error: 0.0746
Image: 33
Initial error: 0.0970
Final error: 0.0491
Image: 34
Initial error: 0.1045
Final error: 0.0436
Image: 35
Initial error: 0.0891
Final error: 0.0331
Image: 36
Initial error: 0.1333
Final error: 0.0243
Image: 37
Initial error: 0.0691
Final error: 0.0146
Image: 38
Initial error: 0.0953
Final error: 0.0502
Image: 39
Initial error: 0.0744
Final error: 0.0445
Image: 40
Initial error: 0.0564
Final error: 0.0280
Image: 41
Initial error: 0.1577
Final error: 0.0252
Image: 42
Initial error: 0.0864
Final error: 0.0225
Image: 43
Initial error: 0.0683
Final error: 0.0260
Image: 44
Initial error: 0.0910
Final error: 0.0205
Image: 45
Initial error: 0.1634
Final error: 0.0690
Image: 46
Initial error: 0.0756
Final error: 0.0280
Image: 47
Initial error: 0.1189
Final error: 0.0481
Image: 48
Initial error: 0.0544
Final error: 0.0319
Image: 49
Initial error: 0.1533
Final error: 0.0414
Image: 50
Initial error: 0.0650
Final error: 0.0665
Image: 51
Initial error: 0.0424
Final error: 0.0221
Image: 52
Initial error: 0.0584
Final error: 0.0388
Image: 53
Initial error: 0.0781
Final error: 0.0347
Image: 54
Initial error: 0.1218
Final error: 0.0237
Image: 55
Initial error: 0.1241
Final error: 0.0426
Image: 56
Initial error: 0.0820
Final error: 0.0224
Image: 57
Initial error: 0.1319
Final error: 0.0476
Image: 58
Initial error: 0.0823
Final error: 0.0426
Image: 59
Initial error: 0.1025
Final error: 0.0333
Image: 60
Initial error: 0.0630
Final error: 0.0297
Image: 61
Initial error: 0.0886
Final error: 0.0283
Image: 62
Initial error: 0.0696
Final error: 0.0211
Image: 63
Initial error: 0.0761
Final error: 0.0227
Image: 64
Initial error: 0.1079
Final error: 0.0138
Image: 65
Initial error: 0.0921
Final error: 0.0270
Image: 66
Initial error: 0.0967
Final error: 0.0332
Image: 67
Initial error: 0.1600
Final error: 0.0663
Image: 68
Initial error: 0.0491
Final error: 0.0215
Image: 69
Initial error: 0.1672
Final error: 0.0387
Image: 70
Initial error: 0.1052
Final error: 0.0560
Image: 71
Initial error: 0.0836
Final error: 0.0311
Image: 72
Initial error: 0.0564
Final error: 0.0241
Image: 73
Initial error: 0.1353
Final error: 0.0276
Image: 74
Initial error: 0.0861
Final error: 0.0433
Image: 75
Initial error: 0.1000
Final error: 0.0303
Image: 76
Initial error: 0.0857
Final error: 0.0249
Image: 77
Initial error: 0.0872
Final error: 0.0560
Image: 78
Initial error: 0.1003
Final error: 0.0504
Image: 79
Initial error: 0.0648
Final error: 0.0377
Image: 80
Initial error: 0.0953
Final error: 0.0404
Image: 81
Initial error: 0.0960
Final error: 0.0262
Image: 82
Initial error: 0.0977
Final error: 0.0450
Image: 83
Initial error: 0.1158
Final error: 0.0216
Image: 84
Initial error: 0.0942
Final error: 0.0231
Image: 85
Initial error: 0.0763
Final error: 0.0341
Image: 86
Initial error: 0.0590
Final error: 0.0278
Image: 87
Initial error: 0.0752
Final error: 0.0379
Image: 88
Initial error: 0.0772
Final error: 0.0307
Image: 89
Initial error: 0.1005
Final error: 0.0522
Image: 90
Initial error: 0.1256
Final error: 0.0508
Image: 91
Initial error: 0.0877
Final error: 0.0351
Image: 92
Initial error: 0.0682
Final error: 0.0218
Image: 93
Initial error: 0.0661
Final error: 0.0212
Image: 94
Initial error: 0.1105
Final error: 0.0187
Image: 95
Initial error: 0.1893
Final error: 0.0243
Image: 96
Initial error: 0.1012
Final error: 0.0188
Image: 97
Initial error: 0.0901
Final error: 0.0230
Image: 98
Initial error: 0.1195
Final error: 0.0428
Image: 99
Initial error: 0.1410
Final error: 0.0855
Image: 100
Initial error: 0.0610
Final error: 0.0336
Image: 101
Initial error: 0.1252
Final error: 0.0484
Image: 102
Initial error: 0.1080
Final error: 0.0321
Image: 103
Initial error: 0.0985
Final error: 0.0386
Image: 104
Initial error: 0.1488
Final error: 0.0793
Image: 105
Initial error: 0.1223
Final error: 0.0349
Image: 106
Initial error: 0.1551
Final error: 0.0654
Image: 107
Initial error: 0.1195
Final error: 0.0261
Image: 108
Initial error: 0.0560
Final error: 0.0235
Image: 109
Initial error: 0.0699
Final error: 0.0224
Image: 110
Initial error: 0.0394
Final error: 0.0193
Image: 111
Initial error: 0.1464
Final error: 0.1011
Image: 112
Initial error: 0.0813
Final error: 0.0517
Image: 113
Initial error: 0.1235
Final error: 0.0312
Image: 114
Initial error: 0.0377
Final error: 0.0297
Image: 115
Initial error: 0.0626
Final error: 0.0317
Image: 116
Initial error: 0.1192
Final error: 0.0796
Image: 117
Initial error: 0.2063
Final error: 0.0712
Image: 118
Initial error: 0.1226
Final error: 0.0458
Image: 119
Initial error: 0.1173
Final error: 0.0430
Image: 120
Initial error: 0.1689
Final error: 0.0722
Image: 121
Initial error: 0.1076
Final error: 0.0227
Image: 122
Initial error: 0.0748
Final error: 0.0373
Image: 123
Initial error: 0.1528
Final error: 0.0171
Image: 124
Initial error: 0.1059
Final error: 0.0494
Image: 125
Initial error: 0.0785
Final error: 0.0459
Image: 126
Initial error: 0.1551
Final error: 0.0727
Image: 127
Initial error: 0.0569
Final error: 0.0360
Image: 128
Initial error: 0.1112
Final error: 0.0431
Image: 129
Initial error: 0.1097
Final error: 0.0232
Image: 130
Initial error: 0.1723
Final error: 0.1470
Image: 131
Initial error: 0.1004
Final error: 0.0384
Image: 132
Initial error: 0.1862
Final error: 0.0254
Image: 133
Initial error: 0.0523
Final error: 0.0178
Image: 134
Initial error: 0.0502
Final error: 0.0310
Image: 135
Initial error: 0.0908
Final error: 0.0312
Image: 136
Initial error: 0.1576
Final error: 0.0220
Image: 137
Initial error: 0.0558
Final error: 0.0233
Image: 138
Initial error: 0.0959
Final error: 0.0271
Image: 139
Initial error: 0.1829
Final error: 0.0713
Image: 140
Initial error: 0.1409
Final error: 0.1311
Image: 141
Initial error: 0.0771
Final error: 0.0437
Image: 142
Initial error: 0.1097
Final error: 0.0339
Image: 143
Initial error: 0.0679
Final error: 0.0377
Image: 144
Initial error: 0.1067
Final error: 0.0262
Image: 145
Initial error: 0.1365
Final error: 0.1166
Image: 146
Initial error: 0.0784
Final error: 0.0222
Image: 147
Initial error: 0.0766
Final error: 0.0251
Image: 148
Initial error: 0.1250
Final error: 0.0928
Image: 149
Initial error: 0.1049
Final error: 0.0463
Image: 150
Initial error: 0.1120
Final error: 0.0249
Image: 151
Initial error: 0.1488
Final error: 0.0491
Image: 152
Initial error: 0.1270
Final error: 0.0337
Image: 153
Initial error: 0.0515
Final error: 0.0208
Image: 154
Initial error: 0.1090
Final error: 0.0400
Image: 155
Initial error: 0.0418
Final error: 0.0260
Image: 156
Initial error: 0.0789
Final error: 0.0210
Image: 157
Initial error: 0.0581
Final error: 0.0206
Image: 158
Initial error: 0.0475
Final error: 0.0167
Image: 159
Initial error: 0.0560
Final error: 0.0330
Image: 160
Initial error: 0.1039
Final error: 0.0240
Image: 161
Initial error: 0.0929
Final error: 0.0527
Image: 162
Initial error: 0.1711
Final error: 0.0871
Image: 163
Initial error: 0.0767
Final error: 0.0474
Image: 164
Initial error: 0.0939
Final error: 0.0443
Image: 165
Initial error: 0.0633
Final error: 0.0449
Image: 166
Initial error: 0.0921
Final error: 0.0303
Image: 167
Initial error: 0.1894
Final error: 0.0392
Image: 168
Initial error: 0.1466
Final error: 0.0550
Image: 169
Initial error: 0.0997
Final error: 0.0460
Image: 170
Initial error: 0.0544
Final error: 0.0284
Image: 171
Initial error: 0.1386
Final error: 0.0549
Image: 172
Initial error: 0.0537
Final error: 0.0204
Image: 173
Initial error: 0.0871
Final error: 0.0358
Image: 174
Initial error: 0.0556
Final error: 0.0232
Image: 175
Initial error: 0.1034
Final error: 0.0304
Image: 176
Initial error: 0.0741
Final error: 0.0509
Image: 177
Initial error: 0.0757
Final error: 0.0243
Image: 178
Initial error: 0.0850
Final error: 0.0319
Image: 179
Initial error: 0.1097
Final error: 0.0273
Image: 180
Initial error: 0.0484
Final error: 0.0366
Image: 181
Initial error: 0.1651
Final error: 0.0901
Image: 182
Initial error: 0.0480
Final error: 0.0216
Image: 183
Initial error: 0.1777
Final error: 0.0699
Image: 184
Initial error: 0.0606
Final error: 0.0314
Image: 185
Initial error: 0.0718
Final error: 0.0207
Image: 186
Initial error: 0.0569
Final error: 0.0246
Image: 187
Initial error: 0.1528
Final error: 0.0194
Image: 188
Initial error: 0.0534
Final error: 0.0155
Image: 189
Initial error: 0.0816
Final error: 0.0178
Image: 190
Initial error: 0.0908
Final error: 0.0371
Image: 191
Initial error: 0.0573
Final error: 0.0408
Image: 192
Initial error: 0.0667
Final error: 0.0358
Image: 193
Initial error: 0.1489
Final error: 0.0376
Image: 194
Initial error: 0.0962
Final error: 0.0195
Image: 195
Initial error: 0.0868
Final error: 0.0512
Image: 196
Initial error: 0.0485
Final error: 0.0159
Image: 197
Initial error: 0.0984
Final error: 0.0250
Image: 198
Initial error: 0.1219
Final error: 0.0720
Image: 199
Initial error: 0.0872
Final error: 0.0262
Image: 200
Initial error: 0.0875
Final error: 0.0228
Image: 201
Initial error: 0.0772
Final error: 0.0341
Image: 202
Initial error: 0.1170
Final error: 0.0554
Image: 203
Initial error: 0.1497
Final error: 0.0996
Image: 204
Initial error: 0.0924
Final error: 0.0494
Image: 205
Initial error: 0.0712
Final error: 0.0245
Image: 206
Initial error: 0.0936
Final error: 0.0270
Image: 207
Initial error: 0.1222
Final error: 0.0346
Image: 208
Initial error: 0.0779
Final error: 0.0196
Image: 209
Initial error: 0.0382
Final error: 0.0234
Image: 210
Initial error: 0.1334
Final error: 0.0288
Image: 211
Initial error: 0.0792
Final error: 0.0406
Image: 212
Initial error: 0.1859
Final error: 0.1193
Image: 213
Initial error: 0.1045
Final error: 0.0427
Image: 214
Initial error: 0.0962
Final error: 0.0173
Image: 215
Initial error: 0.1036
Final error: 0.0341
Image: 216
Initial error: 0.0925
Final error: 0.0226
Image: 217
Initial error: 0.0915
Final error: 0.0236
Image: 218
Initial error: 0.0750
Final error: 0.0219
Image: 219
Initial error: 0.1082
Final error: 0.0377
Image: 220
Initial error: 0.1344
Final error: 0.0933
Image: 221
Initial error: 0.0676
Final error: 0.0285
Image: 222
Initial error: 0.0670
Final error: 0.0199
Image: 223
Initial error: 0.1560
Final error: 0.0554
Image: 224
Initial error: 0.1490
Final error: 0.0639
Image: 225
Initial error: 0.2057
Final error: 0.1447
Image: 226
Initial error: 0.1137
Final error: 0.0280
Image: 227
Initial error: 0.0868
Final error: 0.0302
Image: 228
Initial error: 0.0917
Final error: 0.0236
Image: 229
Initial error: 0.0558
Final error: 0.0247
Image: 230
Initial error: 0.0820
Final error: 0.0517
Image: 231
Initial error: 0.0404
Final error: 0.0257
Image: 232
Initial error: 0.1113
Final error: 0.0261
Image: 233
Initial error: 0.0828
Final error: 0.0543
Image: 234
Initial error: 0.1071
Final error: 0.0402
Image: 235
Initial error: 0.1547
Final error: 0.0336
Image: 236
Initial error: 0.0785
Final error: 0.0312
Image: 237
Initial error: 0.0592
Final error: 0.0313
Image: 238
Initial error: 0.1585
Final error: 0.0767
Image: 239
Initial error: 0.1400
Final error: 0.0293
Image: 240
Initial error: 0.1244
Final error: 0.0708
Image: 241
Initial error: 0.0671
Final error: 0.0232
Image: 242
Initial error: 0.0980
Final error: 0.0345
Image: 243
Initial error: 0.1044
Final error: 0.0273
Image: 244
Initial error: 0.0515
Final error: 0.0215
Image: 245
Initial error: 0.0714
Final error: 0.0288
Image: 246
Initial error: 0.0704
Final error: 0.0244
Image: 247
Initial error: 0.1363
Final error: 0.0679
Image: 248
Initial error: 0.1299
Final error: 0.0644
Image: 249
Initial error: 0.1013
Final error: 0.0726
Image: 250
Initial error: 0.1102
Final error: 0.0645
Image: 251
Initial error: 0.1336
Final error: 0.0632
Image: 252
Initial error: 0.1397
Final error: 0.0499
Image: 253
Initial error: 0.0675
Final error: 0.0188
Image: 254
Initial error: 0.0598
Final error: 0.0288
Image: 255
Initial error: 0.0442
Final error: 0.0254
Image: 256
Initial error: 0.0701
Final error: 0.0377
Image: 257
Initial error: 0.0702
Final error: 0.0335
Image: 258
Initial error: 0.1081
Final error: 0.0940
Image: 259
Initial error: 0.0996
Final error: 0.0293
Image: 260
Initial error: 0.1357
Final error: 0.0302
Image: 261
Initial error: 0.0947
Final error: 0.1009
Image: 262
Initial error: 0.0755
Final error: 0.0291
Image: 263
Initial error: 0.1904
Final error: 0.0430
Image: 264
Initial error: 0.1209
Final error: 0.0381
Image: 265
Initial error: 0.0670
Final error: 0.0413
Image: 266
Initial error: 0.0718
Final error: 0.0247
Image: 267
Initial error: 0.0941
Final error: 0.0325
Image: 268
Initial error: 0.0556
Final error: 0.0339
Image: 269
Initial error: 0.0680
Final error: 0.0229
Image: 270
Initial error: 0.0796
Final error: 0.0274
Image: 271
Initial error: 0.1281
Final error: 0.0524
Image: 272
Initial error: 0.0473
Final error: 0.0272
Image: 273
Initial error: 0.0921
Final error: 0.0389
Image: 274
Initial error: 0.0740
Final error: 0.0345
Image: 275
Initial error: 0.1008
Final error: 0.0252
Image: 276
Initial error: 0.0924
Final error: 0.0497
Image: 277
Initial error: 0.1111
Final error: 0.0581
Image: 278
Initial error: 0.1860
Final error: 0.1163
Image: 279
Initial error: 0.0914
Final error: 0.0515
Image: 280
Initial error: 0.0629
Final error: 0.0309
Image: 281
Initial error: 0.0957
Final error: 0.0260
Image: 282
Initial error: 0.1015
Final error: 0.0397
Image: 283
Initial error: 0.0559
Final error: 0.0430
Image: 284
Initial error: 0.0907
Final error: 0.0289
Image: 285
Initial error: 0.1344
Final error: 0.0394
Image: 286
Initial error: 0.0393
Final error: 0.0174
Image: 287
Initial error: 0.0689
Final error: 0.0220
Image: 288
Initial error: 0.0765
Final error: 0.0228
Image: 289
Initial error: 0.1240
Final error: 0.0187
Image: 290
Initial error: 0.0645
Final error: 0.0304
Image: 291
Initial error: 0.1447
Final error: 0.0507
Image: 292
Initial error: 0.0770
Final error: 0.0321
Image: 293
Initial error: 0.1223
Final error: 0.0306
Image: 294
Initial error: 0.1146
Final error: 0.0399
Image: 295
Initial error: 0.0556
Final error: 0.0402
Image: 296
Initial error: 0.0700
Final error: 0.0317
Image: 297
Initial error: 0.0939
Final error: 0.0184
Image: 298
Initial error: 0.0767
Final error: 0.0320
Image: 299
Initial error: 0.1080
Final error: 0.0334
Image: 300
Initial error: 0.0980
Final error: 0.0479
Image: 301
Initial error: 0.1019
Final error: 0.0680
Image: 302
Initial error: 0.0817
Final error: 0.0287
Image: 303
Initial error: 0.0685
Final error: 0.0346
Image: 304
Initial error: 0.0977
Final error: 0.0564
Image: 305
Initial error: 0.0909
Final error: 0.0294
Image: 306
Initial error: 0.0885
Final error: 0.0375
Image: 307
Initial error: 0.1006
Final error: 0.0508
Image: 308
Initial error: 0.1471
Final error: 0.0224
Image: 309
Initial error: 0.0582
Final error: 0.0202
Image: 310
Initial error: 0.1210
Final error: 0.0289
Image: 311
Initial error: 0.0656
Final error: 0.0326
Image: 312
Initial error: 0.0829
Final error: 0.0239
Image: 313
Initial error: 0.0537
Final error: 0.0183
Image: 314
Initial error: 0.1645
Final error: 0.0401
Image: 315
Initial error: 0.1012
Final error: 0.0366
Image: 316
Initial error: 0.1442
Final error: 0.0233
Image: 317
Initial error: 0.1482
Final error: 0.0314
Image: 318
Initial error: 0.1000
Final error: 0.0334
Image: 319
Initial error: 0.1182
Final error: 0.0359
Image: 320
Initial error: 0.0825
Final error: 0.0360
Image: 321
Initial error: 0.1488
Final error: 0.1680
Image: 322
Initial error: 0.0841
Final error: 0.0212
Image: 323
Initial error: 0.0906
Final error: 0.0386
Image: 324
Initial error: 0.1037
Final error: 0.0294
Image: 325
Initial error: 0.0743
Final error: 0.0233
Image: 326
Initial error: 0.0902
Final error: 0.0311
Image: 327
Initial error: 0.0757
Final error: 0.0244
Image: 328
Initial error: 0.0993
Final error: 0.0727
Image: 329
Initial error: 0.1342
Final error: 0.1137
Image: 330
Initial error: 0.0781
Final error: 0.0430
Image: 331
Initial error: 0.0585
Final error: 0.0289
Image: 332
Initial error: 0.0919
Final error: 0.0616
Image: 333
Initial error: 0.0630
Final error: 0.0176
Image: 334
Initial error: 0.1222
Final error: 0.0320
Image: 335
Initial error: 0.0624
Final error: 0.0231
Image: 336
Initial error: 0.0866
Final error: 0.0414
Content source: jalabort/alabortcvpr2015
Similar notebooks: