3-olivetti-face

Author

math4mad

1. load package

Code
include("./olivetti-face-code/1-dataprocessing.jl")

import MLJ: transform, inverse_transform
using MLJ,DataFrames,CSV,Random,JLSO,GLMakie
Random.seed!(4545343)
TaskLocalRNG()

2. import data

Code
(Xtrain, Xtest), (ytrain, ytest)=load_olivetti_faces()
((320×4096 DataFrame
 Row  x1         x2        x3         x4        x5        x6        x7        ⋯
     │ Float64    Float64   Float64    Float64   Float64   Float64   Float64   ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ 0.595041   0.640496  0.615702   0.644628  0.68595   0.72314   0.731405  ⋯
   2 │ 0.103306   0.219008  0.177686   0.219008  0.392562  0.57438   0.669422
   3 │ 0.289256   0.338843  0.417355   0.504132  0.553719  0.561983  0.582645
   4 │ 0.528926   0.797521  0.826446   0.822314  0.822314  0.818182  0.805785
   5 │ 0.161157   0.202479  0.268595   0.334711  0.384298  0.392562  0.396694  ⋯
   6 │ 0.169422   0.293388  0.561983   0.677686  0.727273  0.756198  0.768595
   7 │ 0.136364   0.177686  0.235537   0.289256  0.334711  0.363636  0.396694
   8 │ 0.768595   0.756198  0.743802   0.743802  0.752066  0.747934  0.735537
   9 │ 0.144628   0.210744  0.285124   0.342975  0.392562  0.404959  0.409091  ⋯
  10 │ 0.566116   0.595041  0.603306   0.619835  0.636364  0.640496  0.661157
  11 │ 0.524793   0.53719   0.578512   0.628099  0.669422  0.690083  0.68595
  ⋮  │     ⋮         ⋮          ⋮         ⋮         ⋮         ⋮         ⋮      ⋱
 311 │ 0.181818   0.338843  0.355372   0.404959  0.438017  0.458678  0.471074
 312 │ 0.454545   0.528926  0.644628   0.747934  0.780992  0.780992  0.801653  ⋯
 313 │ 0.553719   0.607438  0.636364   0.64876   0.652893  0.64876   0.673554
 314 │ 0.0909091  0.136364  0.177686   0.231405  0.363636  0.504132  0.541322
 315 │ 0.252066   0.252066  0.252066   0.252066  0.256198  0.239669  0.235537
 316 │ 0.326446   0.483471  0.524793   0.599174  0.665289  0.702479  0.702479  ⋯
 317 │ 0.53719    0.57438   0.553719   0.615702  0.38843   0.487603  0.690083
 318 │ 0.128099   0.18595   0.247934   0.31405   0.38843   0.46281   0.520661
 319 │ 0.586777   0.702479  0.731405   0.731405  0.743802  0.772727  0.793388
 320 │ 0.136364   0.107438  0.0909091  0.115702  0.115702  0.119835  0.181818  ⋯
                                               4089 columns and 299 rows omitted, 80×4096 DataFrame
 Row  x1        x2        x3        x4        x5        x6        x7        x ⋯
     │ Float64   Float64   Float64   Float64   Float64   Float64   Float64   F ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ 0.219008  0.235537  0.252066  0.326446  0.392562  0.553719  0.714876  0 ⋯
   2 │ 0.194215  0.268595  0.367769  0.487603  0.545455  0.561983  0.578512  0
   3 │ 0.210744  0.206612  0.194215  0.181818  0.219008  0.239669  0.256198  0
   4 │ 0.392562  0.475207  0.661157  0.590909  0.471074  0.545455  0.673554  0
   5 │ 0.719008  0.727273  0.72314   0.714876  0.72314   0.731405  0.739669  0 ⋯
   6 │ 0.429752  0.458678  0.549587  0.623967  0.673554  0.714876  0.72314   0
   7 │ 0.289256  0.157025  0.14876   0.190083  0.169422  0.194215  0.404959  0
   8 │ 0.628099  0.665289  0.68595   0.694215  0.719008  0.731405  0.752066  0
   9 │ 0.479339  0.549587  0.628099  0.690083  0.677686  0.652893  0.640496  0 ⋯
  10 │ 0.677686  0.677686  0.681818  0.706612  0.731405  0.739669  0.756198  0
  11 │ 0.123967  0.132231  0.11157   0.11157   0.119835  0.136364  0.136364  0
  ⋮  │    ⋮         ⋮         ⋮         ⋮         ⋮         ⋮         ⋮        ⋱
  71 │ 0.123967  0.128099  0.115702  0.136364  0.115702  0.107438  0.115702  0
  72 │ 0.384298  0.22314   0.22314   0.305785  0.429752  0.508265  0.557851  0 ⋯
  73 │ 0.409091  0.590909  0.657025  0.681818  0.694215  0.731405  0.760331  0
  74 │ 0.487603  0.330578  0.252066  0.38843   0.785124  0.789256  0.780992  0
  75 │ 0.285124  0.285124  0.272727  0.214876  0.169422  0.165289  0.264463  0
  76 │ 0.136364  0.132231  0.123967  0.119835  0.11157   0.128099  0.132231  0 ⋯
  77 │ 0.243802  0.243802  0.247934  0.247934  0.252066  0.256198  0.256198  0
  78 │ 0.603306  0.586777  0.541322  0.603306  0.603306  0.607438  0.64876   0
  79 │ 0.772727  0.764463  0.752066  0.764463  0.785124  0.793388  0.797521  0
  80 │ 0.475207  0.491736  0.5       0.512397  0.524793  0.528926  0.545455  0 ⋯
                                                4089 columns and 59 rows omitted), (CategoricalArrays.CategoricalValue{Int64, UInt32}[27, 3, 39, 10, 23, 24, 23, 30, 23, 14  …  21, 26, 5, 35, 28, 9, 31, 0, 15, 37], CategoricalArrays.CategoricalValue{Int64, UInt32}[6, 35, 6, 31, 5, 4, 3, 2, 19, 4  …  32, 29, 22, 36, 12, 32, 16, 14, 3, 20]))

3. train&save model

Code
    PCA = @load PCA pkg=MultivariateStats
    function  make_model(Xtr)
    return (dim)->begin
        model = PCA(maxoutdim=dim)
        mach = machine(model, Xtr) |> fit!
        try
            JLSO.save("./olivetti-face-code/models/of-model-$(dim)pcs.jlso",:pca=>mach)
            @info "$(dim) dimension pca model saved"
        catch e
            @warn "$(e) has problem"
        end
    end
end
make_ol_model=make_model(Xtrain)
make_ol_model.([1,2,3,100])
import MLJMultivariateStatsInterface ✔
[ Info: For silent loading, specify `verbosity=0`. 
[ Info: Training machine(PCA(maxoutdim = 1, …), …).
[ Info: 1 dimension pca model saved
[ Info: Training machine(PCA(maxoutdim = 2, …), …).
[ Info: 2 dimension pca model saved
[ Info: Training machine(PCA(maxoutdim = 3, …), …).
[ Info: 3 dimension pca model saved
[ Info: Training machine(PCA(maxoutdim = 100, …), …).
[ Info: 100 dimension pca model saved
4-element Vector{Nothing}:
 nothing
 nothing
 nothing
 nothing

4. imgs project to low dimension feature space

第三行是降维到 100的图片, 最后一行是原始图片

Code
include("./olivetti-face-code/3-transform-reconstruct-methods.jl")
cat=ytrain|>Array|>levels
rows,cols=size(Xtrain)

pick20=rand(1:rows,20)
pickXtrain=Xtrain[pick20,:]
pickytrain=ytrain[pick20]

pcaData=transform_to_2d(pickXtrain)
reconstructImgs=reconstruct_data(pcaData)

pcaData3=transform_to_3d(pickXtrain)
reconstructImgs3=reconstruct_data(pcaData3)

transform_to_100d=transform_to_pcadata1(100)
pcaData100=transform_to_100d(pickXtrain)
reconstructImgs100=reconstruct_data(pcaData100)

df=vcat(reconstructImgs,reconstructImgs3,reconstructImgs100,pickXtrain)
[ Info: 2 pca proceeding...
[ Info: imgs  reconstructing from 2 dimension
[ Info: 3 pca proceeding...
[ Info: imgs  reconstructing from 3 dimension
[ Info: 100 pca proceeding...
[ Info: imgs  reconstructing from 100 dimension
80×4096 DataFrame
3996 columns and 55 rows omitted
Row x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 x60 x61 x62 x63 x64 x65 x66 x67 x68 x69 x70 x71 x72 x73 x74 x75 x76 x77 x78 x79 x80 x81 x82 x83 x84 x85 x86 x87 x88 x89 x90 x91 x92 x93 x94 x95 x96 x97 x98 x99 x100
Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64
1 0.347498 0.356433 0.375264 0.39954 0.423023 0.452978 0.482274 0.503785 0.519725 0.526426 0.534472 0.539163 0.547752 0.548612 0.551928 0.550904 0.551664 0.551791 0.551633 0.553009 0.55499 0.553559 0.554242 0.549705 0.548917 0.549303 0.547618 0.548721 0.549941 0.548578 0.551999 0.555619 0.554749 0.551963 0.55098 0.546373 0.545315 0.541134 0.536055 0.52792 0.522628 0.516831 0.511274 0.504655 0.499186 0.492699 0.484203 0.473755 0.467841 0.459916 0.455482 0.448347 0.439979 0.425104 0.411437 0.39844 0.382408 0.353639 0.31849 0.290463 0.265268 0.24943 0.241055 0.238127 0.351332 0.360198 0.386193 0.412789 0.435357 0.465185 0.494089 0.513728 0.530586 0.537144 0.547946 0.551217 0.559378 0.561427 0.564977 0.567751 0.566366 0.565085 0.56924 0.573174 0.572161 0.569604 0.566815 0.564914 0.564524 0.557596 0.558352 0.557152 0.557154 0.556278 0.560522 0.565832 0.563424 0.56306 0.565221 0.564248
2 0.517323 0.574701 0.637824 0.689222 0.72297 0.752127 0.772595 0.782153 0.785537 0.786146 0.783327 0.780133 0.779794 0.77967 0.781213 0.783158 0.785168 0.787799 0.787414 0.786651 0.785654 0.78473 0.782535 0.778389 0.77507 0.774482 0.76858 0.763289 0.759652 0.754611 0.752834 0.75236 0.752247 0.750873 0.749019 0.74466 0.739307 0.73623 0.730776 0.723315 0.71545 0.708287 0.700588 0.692186 0.684442 0.678492 0.671835 0.660478 0.649346 0.641482 0.629974 0.617705 0.607259 0.598648 0.587301 0.570553 0.550199 0.523786 0.479269 0.431485 0.393957 0.361259 0.324836 0.291902 0.528134 0.591601 0.654956 0.704336 0.738806 0.766358 0.782817 0.788165 0.791302 0.791121 0.788372 0.784759 0.782904 0.783305 0.784144 0.786172 0.788562 0.791007 0.792148 0.791703 0.791692 0.789554 0.786332 0.783966 0.782476 0.779952 0.77532 0.76947 0.765259 0.76029 0.757802 0.756306 0.756551 0.756472 0.754564 0.753349
3 0.455477 0.50084 0.552429 0.598455 0.632881 0.665276 0.691794 0.709252 0.719167 0.724507 0.727599 0.729214 0.732596 0.734849 0.738048 0.740483 0.743513 0.746724 0.747753 0.748665 0.749276 0.749044 0.74841 0.745529 0.743752 0.743925 0.740204 0.737341 0.735166 0.73202 0.73156 0.732154 0.732169 0.731377 0.730696 0.7277 0.724582 0.722473 0.718304 0.712185 0.706117 0.700641 0.694664 0.687884 0.681925 0.676942 0.67095 0.66163 0.653022 0.645484 0.635839 0.625602 0.61635 0.606994 0.595671 0.579182 0.55828 0.530665 0.489583 0.447237 0.411732 0.3807 0.345804 0.314192 0.463803 0.51405 0.566475 0.610999 0.646321 0.677711 0.701414 0.715647 0.725785 0.730841 0.734172 0.735186 0.737466 0.7405 0.743267 0.746521 0.749267 0.751957 0.754201 0.755408 0.756075 0.755203 0.753704 0.752193 0.75157 0.749529 0.746794 0.742832 0.740361 0.73699 0.736155 0.736794 0.736799 0.736963 0.736569 0.736201
4 0.492681 0.545701 0.604579 0.65418 0.688534 0.719206 0.742301 0.755276 0.761411 0.764097 0.763782 0.762652 0.763831 0.764809 0.767088 0.769348 0.771877 0.774853 0.775133 0.775105 0.774789 0.774207 0.772673 0.769139 0.766482 0.766228 0.761244 0.756928 0.75385 0.749606 0.74831 0.74823 0.748198 0.74714 0.745818 0.742113 0.737702 0.735115 0.73026 0.723455 0.716371 0.709971 0.70303 0.695349 0.688389 0.682912 0.676623 0.666207 0.656128 0.648421 0.6376 0.626154 0.616217 0.607426 0.596155 0.579425 0.558691 0.531773 0.488627 0.442875 0.405965 0.37359 0.337113 0.303975 0.502506 0.561214 0.620418 0.668125 0.70333 0.73264 0.752192 0.761361 0.76744 0.769558 0.769319 0.767711 0.767541 0.769146 0.770824 0.773414 0.776077 0.778742 0.780323 0.78054 0.780879 0.779354 0.776937 0.774965 0.773855 0.771683 0.767801 0.762719 0.759217 0.754892 0.753002 0.752331 0.752536 0.75258 0.751278 0.750458
5 0.29635 0.316432 0.342945 0.379661 0.420254 0.463932 0.508857 0.550194 0.578874 0.598902 0.619163 0.635091 0.648517 0.658904 0.667377 0.67265 0.679779 0.685978 0.69198 0.698093 0.70337 0.705796 0.709692 0.711473 0.714286 0.716825 0.719362 0.722845 0.724127 0.726413 0.728762 0.731683 0.732428 0.734233 0.737424 0.739393 0.742698 0.744453 0.744741 0.743661 0.743079 0.743139 0.742534 0.740902 0.740493 0.739163 0.736219 0.733849 0.732359 0.726005 0.720441 0.715595 0.709853 0.700122 0.689728 0.672796 0.648359 0.61731 0.585088 0.554974 0.522202 0.490979 0.451311 0.413481 0.298332 0.32124 0.34822 0.383696 0.426408 0.470685 0.51574 0.556524 0.58668 0.607998 0.628121 0.643165 0.656573 0.668414 0.677084 0.68445 0.689845 0.694771 0.699857 0.705373 0.708829 0.712634 0.717139 0.718512 0.720587 0.721878 0.723959 0.725047 0.727263 0.728109 0.73073 0.736514 0.736631 0.737769 0.741301 0.743875
6 0.273376 0.291233 0.315289 0.351801 0.394404 0.440457 0.488757 0.53444 0.566325 0.589109 0.612345 0.630829 0.645824 0.657897 0.667388 0.673468 0.681562 0.68857 0.695628 0.702718 0.708802 0.711833 0.716513 0.719324 0.722957 0.72594 0.729544 0.733969 0.735672 0.738883 0.741491 0.744642 0.745594 0.748051 0.752019 0.755072 0.759475 0.762135 0.763357 0.763406 0.763834 0.764994 0.765403 0.764761 0.765395 0.764887 0.762721 0.761787 0.761482 0.755387 0.750232 0.746205 0.741081 0.731685 0.721646 0.704368 0.678884 0.647252 0.616316 0.587522 0.554519 0.522137 0.47958 0.438419 0.274456 0.295104 0.319089 0.354129 0.399222 0.446121 0.494946 0.540495 0.574049 0.598419 0.621257 0.638863 0.654002 0.667628 0.677388 0.68559 0.691805 0.69746 0.702958 0.709111 0.713233 0.718073 0.723841 0.725804 0.728387 0.730687 0.733447 0.735313 0.738258 0.73974 0.742658 0.749098 0.749415 0.750782 0.754889 0.758079
7 0.389424 0.423229 0.463541 0.504851 0.541002 0.577523 0.611146 0.637846 0.65518 0.666142 0.675991 0.683181 0.690643 0.695892 0.701089 0.704405 0.708857 0.713027 0.715869 0.71877 0.721219 0.721924 0.723074 0.721862 0.721873 0.722951 0.721706 0.721459 0.720776 0.71978 0.720595 0.722235 0.722477 0.722556 0.72332 0.72211 0.721532 0.720768 0.718232 0.713904 0.709951 0.706548 0.702623 0.697796 0.69396 0.690273 0.685295 0.678537 0.672766 0.665653 0.657837 0.649807 0.64193 0.632128 0.621026 0.604562 0.582594 0.553619 0.51621 0.479274 0.445369 0.415104 0.379869 0.347492 0.395106 0.432745 0.474102 0.51422 0.551629 0.587799 0.619853 0.644412 0.66248 0.673761 0.683846 0.690283 0.69709 0.703395 0.708434 0.713215 0.716733 0.720049 0.723472 0.726457 0.728084 0.728886 0.729583 0.729139 0.729548 0.728496 0.727772 0.72587 0.725305 0.723664 0.724415 0.727254 0.727169 0.727672 0.728901 0.729611
8 0.436103 0.474321 0.519536 0.561172 0.593157 0.624795 0.651505 0.669306 0.68009 0.685402 0.689172 0.69113 0.695395 0.697179 0.70029 0.701935 0.704398 0.706894 0.707566 0.708464 0.709265 0.708722 0.708269 0.704938 0.703272 0.703439 0.700014 0.697851 0.696319 0.693433 0.693731 0.694914 0.694726 0.693458 0.69263 0.689188 0.686367 0.683738 0.679282 0.672629 0.666607 0.660945 0.654942 0.648085 0.64211 0.636732 0.630147 0.620439 0.612247 0.604602 0.595969 0.586271 0.577131 0.566618 0.554781 0.539038 0.519239 0.491455 0.451434 0.411848 0.378459 0.350638 0.32144 0.296014 0.443617 0.485718 0.533112 0.574047 0.606519 0.637303 0.661646 0.676451 0.687578 0.692602 0.69715 0.69834 0.701622 0.704259 0.707065 0.71013 0.711947 0.713751 0.716338 0.718028 0.718281 0.716953 0.715053 0.713398 0.712766 0.709623 0.707521 0.704033 0.701984 0.699049 0.699212 0.700725 0.700219 0.700251 0.700312 0.699754
9 0.317283 0.332209 0.355093 0.386241 0.419365 0.457116 0.495344 0.528193 0.551452 0.56576 0.580815 0.59194 0.603336 0.609612 0.615867 0.618397 0.622763 0.62632 0.62966 0.63374 0.637613 0.638367 0.640894 0.639941 0.641215 0.642829 0.64357 0.646069 0.647357 0.648092 0.65094 0.654192 0.654234 0.654044 0.655436 0.65456 0.656009 0.65519 0.65316 0.649025 0.646424 0.643961 0.64123 0.637455 0.634873 0.63131 0.625953 0.620097 0.61673 0.609697 0.60467 0.59887 0.592007 0.580009 0.568184 0.552979 0.532206 0.502127 0.468704 0.43963 0.41022 0.385766 0.359822 0.337291 0.320017 0.336474 0.362769 0.394247 0.428167 0.466212 0.504371 0.536112 0.560614 0.575597 0.591785 0.601786 0.612995 0.620614 0.627089 0.632475 0.634913 0.637129 0.641833 0.646696 0.648213 0.649264 0.650618 0.650579 0.651596 0.649303 0.650848 0.65098 0.652268 0.652398 0.655767 0.661394 0.660401 0.660887 0.663855 0.664896
10 0.287526 0.289496 0.300971 0.32379 0.35161 0.38716 0.424685 0.456812 0.480717 0.494097 0.509505 0.520473 0.533061 0.537907 0.543671 0.544433 0.547409 0.549342 0.551665 0.555409 0.559388 0.559357 0.561982 0.559843 0.561067 0.56253 0.563498 0.567038 0.56942 0.570358 0.574575 0.578879 0.578469 0.577161 0.578027 0.575953 0.577621 0.575521 0.572645 0.567133 0.5643 0.561131 0.558029 0.553792 0.550851 0.546271 0.539531 0.53248 0.529533 0.522213 0.518992 0.513963 0.507117 0.4928 0.47988 0.466211 0.44788 0.417661 0.385861 0.361643 0.336354 0.318406 0.304273 0.294626 0.288994 0.290593 0.308217 0.332971 0.360687 0.396744 0.43493 0.466252 0.491568 0.505523 0.523176 0.5327 0.545277 0.551571 0.557775 0.562533 0.562936 0.563227 0.568455 0.57404 0.574553 0.574405 0.574592 0.57409 0.57493 0.570208 0.572749 0.573541 0.575403 0.576166 0.581349 0.588441 0.586407 0.586567 0.590222 0.590704
11 0.441812 0.486114 0.536457 0.582573 0.6184 0.652345 0.681004 0.701212 0.713125 0.720222 0.725175 0.728401 0.732738 0.736088 0.739939 0.742928 0.746601 0.750363 0.752082 0.753617 0.754733 0.754901 0.754758 0.752555 0.751295 0.751751 0.748695 0.746396 0.744458 0.741888 0.741555 0.742266 0.742423 0.74207 0.74189 0.739608 0.737174 0.735668 0.732108 0.726734 0.721307 0.716542 0.711212 0.705066 0.699772 0.695332 0.689866 0.681479 0.673606 0.666237 0.656802 0.64706 0.638196 0.629112 0.61804 0.601294 0.579669 0.551692 0.511375 0.469733 0.433975 0.402045 0.365024 0.330983 0.449603 0.498818 0.549586 0.594012 0.630993 0.664083 0.690154 0.707395 0.719647 0.726649 0.731648 0.734285 0.737617 0.741808 0.745267 0.749064 0.752378 0.755577 0.758066 0.759654 0.760766 0.760576 0.759902 0.758774 0.758474 0.757131 0.754797 0.751307 0.749279 0.746291 0.745596 0.746608 0.746767 0.747083 0.747032 0.747067
12 0.554789 0.629173 0.70723 0.769672 0.810644 0.842935 0.86464 0.875544 0.878358 0.880445 0.877424 0.874667 0.872885 0.874811 0.877097 0.881463 0.885406 0.890264 0.891325 0.891096 0.89003 0.890202 0.887948 0.885469 0.882289 0.881942 0.875834 0.869245 0.864192 0.858963 0.855393 0.853541 0.854047 0.854216 0.853131 0.85046 0.844913 0.843619 0.839371 0.833841 0.826375 0.820247 0.813133 0.805431 0.798258 0.793733 0.788981 0.779339 0.767757 0.760297 0.746427 0.733208 0.722795 0.717291 0.707432 0.688612 0.664921 0.638642 0.592085 0.537969 0.494947 0.453505 0.401138 0.350796 0.567201 0.650199 0.724801 0.783073 0.825994 0.856422 0.873182 0.879512 0.881872 0.883331 0.878878 0.876128 0.872611 0.874931 0.876227 0.879164 0.884329 0.889397 0.889879 0.888532 0.889913 0.889461 0.887902 0.886203 0.884994 0.885786 0.879891 0.873234 0.868325 0.862573 0.857703 0.85432 0.855965 0.856339 0.85357 0.853154
13 0.396561 0.437814 0.484407 0.53119 0.572021 0.611343 0.647322 0.676931 0.695621 0.708744 0.720017 0.728739 0.736278 0.743426 0.74952 0.754473 0.760397 0.766106 0.77022 0.773892 0.77672 0.77829 0.779812 0.77997 0.780471 0.781899 0.781098 0.780677 0.779496 0.77888 0.778922 0.779984 0.780644 0.781837 0.783388 0.783587 0.783473 0.784074 0.782626 0.779853 0.77662 0.774304 0.771195 0.767229 0.764216 0.761671 0.758054 0.752899 0.747508 0.740732 0.731933 0.723844 0.716299 0.708239 0.69807 0.680383 0.656193 0.626986 0.589206 0.549749 0.512952 0.477676 0.432906 0.390029 0.402588 0.448932 0.494433 0.538818 0.581717 0.620685 0.654824 0.682324 0.701743 0.715417 0.726034 0.734221 0.741077 0.749267 0.755097 0.760765 0.766106 0.77112 0.774421 0.777277 0.779949 0.782133 0.784318 0.784514 0.785325 0.786465 0.785452 0.783541 0.782999 0.781288 0.780988 0.783211 0.783936 0.784784 0.785874 0.787304
69 0.280992 0.194215 0.301653 0.487603 0.533058 0.541322 0.541322 0.582645 0.615702 0.603306 0.603306 0.657025 0.706612 0.727273 0.710744 0.727273 0.694215 0.702479 0.731405 0.768595 0.805785 0.801653 0.81405 0.81405 0.809917 0.818182 0.809917 0.818182 0.81405 0.822314 0.818182 0.81405 0.822314 0.81405 0.818182 0.822314 0.81405 0.822314 0.818182 0.822314 0.818182 0.809917 0.81405 0.818182 0.81405 0.809917 0.793388 0.780992 0.789256 0.760331 0.756198 0.772727 0.764463 0.719008 0.677686 0.640496 0.615702 0.595041 0.334711 0.289256 0.206612 0.198347 0.318182 0.376033 0.252066 0.194215 0.285124 0.458678 0.516529 0.528926 0.516529 0.570248 0.615702 0.619835 0.590909 0.64876 0.706612 0.727273 0.727273 0.72314 0.698347 0.702479 0.727273 0.772727 0.797521 0.805785 0.822314 0.818182 0.818182 0.822314 0.830578 0.822314 0.822314 0.822314 0.818182 0.818182 0.826446 0.81405 0.826446 0.822314
70 0.123967 0.0991735 0.123967 0.107438 0.107438 0.128099 0.128099 0.132231 0.14876 0.14876 0.161157 0.181818 0.177686 0.173554 0.181818 0.173554 0.165289 0.18595 0.152893 0.169422 0.157025 0.14876 0.161157 0.165289 0.194215 0.194215 0.210744 0.231405 0.260331 0.280992 0.305785 0.322314 0.322314 0.326446 0.326446 0.342975 0.367769 0.38843 0.38843 0.384298 0.429752 0.450413 0.466942 0.466942 0.471074 0.46281 0.466942 0.466942 0.479339 0.487603 0.495868 0.495868 0.458678 0.450413 0.433884 0.429752 0.384298 0.342975 0.305785 0.247934 0.227273 0.198347 0.181818 0.165289 0.115702 0.103306 0.128099 0.115702 0.128099 0.119835 0.140496 0.157025 0.161157 0.169422 0.157025 0.173554 0.190083 0.190083 0.18595 0.18595 0.165289 0.18595 0.161157 0.18595 0.177686 0.173554 0.173554 0.198347 0.190083 0.198347 0.22314 0.227273 0.256198 0.243802 0.260331 0.280992 0.309917 0.342975 0.359504 0.355372
71 0.603306 0.632231 0.652893 0.673554 0.677686 0.698347 0.731405 0.743802 0.752066 0.77686 0.780992 0.789256 0.793388 0.789256 0.785124 0.793388 0.797521 0.81405 0.81405 0.818182 0.822314 0.818182 0.822314 0.818182 0.830578 0.826446 0.834711 0.826446 0.822314 0.826446 0.822314 0.818182 0.818182 0.830578 0.834711 0.830578 0.822314 0.822314 0.818182 0.805785 0.801653 0.797521 0.801653 0.797521 0.793388 0.793388 0.789256 0.772727 0.760331 0.77686 0.77686 0.772727 0.764463 0.739669 0.72314 0.714876 0.694215 0.636364 0.590909 0.578512 0.557851 0.516529 0.438017 0.309917 0.590909 0.619835 0.64876 0.673554 0.673554 0.698347 0.727273 0.747934 0.764463 0.768595 0.77686 0.780992 0.789256 0.780992 0.780992 0.789256 0.785124 0.797521 0.81405 0.805785 0.818182 0.822314 0.809917 0.809917 0.826446 0.822314 0.830578 0.822314 0.822314 0.830578 0.830578 0.818182 0.81405 0.830578 0.834711 0.822314
72 0.392562 0.524793 0.619835 0.690083 0.739669 0.772727 0.801653 0.818182 0.826446 0.834711 0.826446 0.834711 0.834711 0.830578 0.838843 0.838843 0.834711 0.838843 0.842975 0.847107 0.85124 0.842975 0.85124 0.847107 0.85124 0.85124 0.842975 0.842975 0.842975 0.842975 0.838843 0.834711 0.838843 0.834711 0.838843 0.838843 0.838843 0.838843 0.834711 0.830578 0.822314 0.818182 0.801653 0.797521 0.789256 0.797521 0.77686 0.760331 0.714876 0.644628 0.590909 0.561983 0.491736 0.429752 0.347107 0.347107 0.276859 0.173554 0.173554 0.173554 0.202479 0.202479 0.214876 0.252066 0.475207 0.61157 0.673554 0.714876 0.752066 0.77686 0.81405 0.822314 0.826446 0.834711 0.834711 0.834711 0.830578 0.826446 0.834711 0.834711 0.834711 0.838843 0.847107 0.847107 0.847107 0.847107 0.842975 0.842975 0.842975 0.842975 0.838843 0.842975 0.847107 0.842975 0.842975 0.838843 0.838843 0.838843 0.838843 0.842975
73 0.512397 0.557851 0.619835 0.652893 0.665289 0.681818 0.694215 0.739669 0.760331 0.780992 0.789256 0.785124 0.785124 0.793388 0.793388 0.793388 0.797521 0.793388 0.805785 0.81405 0.81405 0.81405 0.826446 0.834711 0.834711 0.838843 0.830578 0.838843 0.838843 0.842975 0.847107 0.85124 0.85124 0.855372 0.85124 0.847107 0.85124 0.847107 0.838843 0.842975 0.830578 0.818182 0.81405 0.822314 0.809917 0.826446 0.81405 0.809917 0.81405 0.81405 0.809917 0.805785 0.801653 0.793388 0.780992 0.752066 0.727273 0.694215 0.661157 0.582645 0.487603 0.421488 0.338843 0.342975 0.53719 0.586777 0.623967 0.628099 0.64876 0.661157 0.694215 0.735537 0.760331 0.785124 0.780992 0.785124 0.789256 0.793388 0.789256 0.797521 0.801653 0.805785 0.81405 0.81405 0.81405 0.818182 0.822314 0.830578 0.838843 0.834711 0.834711 0.830578 0.847107 0.842975 0.847107 0.85124 0.85124 0.85124 0.85124 0.85124
74 0.260331 0.194215 0.144628 0.31405 0.483471 0.508265 0.524793 0.57438 0.595041 0.615702 0.623967 0.628099 0.636364 0.640496 0.644628 0.644628 0.669422 0.669422 0.661157 0.661157 0.669422 0.681818 0.669422 0.673554 0.68595 0.698347 0.694215 0.710744 0.681818 0.702479 0.694215 0.702479 0.694215 0.694215 0.702479 0.706612 0.714876 0.739669 0.756198 0.760331 0.768595 0.752066 0.735537 0.743802 0.752066 0.731405 0.727273 0.714876 0.714876 0.714876 0.710744 0.706612 0.698347 0.690083 0.677686 0.677686 0.677686 0.681818 0.677686 0.690083 0.657025 0.661157 0.669422 0.652893 0.268595 0.194215 0.128099 0.322314 0.483471 0.520661 0.553719 0.582645 0.586777 0.615702 0.628099 0.628099 0.636364 0.640496 0.64876 0.665289 0.681818 0.681818 0.673554 0.677686 0.673554 0.694215 0.681818 0.681818 0.690083 0.694215 0.698347 0.68595 0.690083 0.698347 0.690083 0.706612 0.710744 0.702479 0.698347 0.702479
75 0.661157 0.661157 0.665289 0.669422 0.702479 0.727273 0.743802 0.756198 0.768595 0.760331 0.756198 0.752066 0.756198 0.760331 0.768595 0.772727 0.785124 0.789256 0.789256 0.789256 0.780992 0.772727 0.768595 0.768595 0.764463 0.764463 0.764463 0.768595 0.756198 0.756198 0.743802 0.739669 0.747934 0.743802 0.731405 0.727273 0.719008 0.714876 0.706612 0.702479 0.698347 0.694215 0.690083 0.681818 0.677686 0.657025 0.636364 0.632231 0.619835 0.603306 0.590909 0.578512 0.566116 0.566116 0.545455 0.53719 0.516529 0.479339 0.450413 0.429752 0.417355 0.409091 0.367769 0.252066 0.652893 0.652893 0.652893 0.661157 0.673554 0.698347 0.727273 0.735537 0.756198 0.756198 0.747934 0.743802 0.747934 0.764463 0.772727 0.780992 0.789256 0.793388 0.797521 0.801653 0.797521 0.789256 0.780992 0.780992 0.77686 0.77686 0.768595 0.77686 0.764463 0.760331 0.764463 0.764463 0.764463 0.756198 0.747934 0.727273
76 0.743802 0.756198 0.764463 0.772727 0.780992 0.785124 0.797521 0.801653 0.801653 0.81405 0.818182 0.81405 0.822314 0.826446 0.830578 0.834711 0.834711 0.838843 0.842975 0.847107 0.842975 0.847107 0.847107 0.847107 0.85124 0.85124 0.847107 0.842975 0.842975 0.834711 0.830578 0.822314 0.818182 0.818182 0.818182 0.822314 0.822314 0.822314 0.826446 0.826446 0.818182 0.805785 0.797521 0.789256 0.793388 0.789256 0.77686 0.764463 0.764463 0.743802 0.735537 0.72314 0.714876 0.706612 0.690083 0.661157 0.636364 0.599174 0.528926 0.512397 0.293388 0.0743802 0.239669 0.219008 0.739669 0.752066 0.760331 0.77686 0.780992 0.789256 0.793388 0.801653 0.805785 0.81405 0.818182 0.81405 0.826446 0.830578 0.834711 0.834711 0.838843 0.842975 0.842975 0.847107 0.847107 0.847107 0.847107 0.842975 0.842975 0.85124 0.85124 0.847107 0.838843 0.830578 0.834711 0.826446 0.81405 0.81405 0.818182 0.822314
77 0.202479 0.256198 0.322314 0.450413 0.57438 0.665289 0.714876 0.768595 0.797521 0.81405 0.826446 0.830578 0.830578 0.834711 0.834711 0.834711 0.830578 0.838843 0.838843 0.838843 0.842975 0.842975 0.847107 0.842975 0.85124 0.85124 0.847107 0.847107 0.842975 0.842975 0.838843 0.842975 0.842975 0.838843 0.838843 0.838843 0.830578 0.830578 0.826446 0.822314 0.818182 0.809917 0.801653 0.789256 0.797521 0.780992 0.727273 0.652893 0.578512 0.528926 0.46281 0.338843 0.305785 0.338843 0.276859 0.210744 0.202479 0.247934 0.227273 0.214876 0.268595 0.239669 0.210744 0.194215 0.22314 0.297521 0.376033 0.508265 0.61157 0.673554 0.727273 0.77686 0.809917 0.822314 0.826446 0.826446 0.830578 0.834711 0.830578 0.834711 0.830578 0.834711 0.842975 0.842975 0.842975 0.847107 0.847107 0.847107 0.855372 0.85124 0.847107 0.85124 0.842975 0.842975 0.838843 0.838843 0.838843 0.842975 0.842975 0.838843
78 0.338843 0.458678 0.681818 0.772727 0.785124 0.81405 0.838843 0.85124 0.847107 0.85124 0.855372 0.855372 0.85124 0.85124 0.847107 0.847107 0.85124 0.847107 0.847107 0.838843 0.834711 0.826446 0.822314 0.822314 0.805785 0.785124 0.768595 0.760331 0.752066 0.735537 0.735537 0.764463 0.760331 0.756198 0.756198 0.756198 0.747934 0.752066 0.739669 0.735537 0.714876 0.710744 0.706612 0.710744 0.706612 0.694215 0.690083 0.681818 0.673554 0.673554 0.665289 0.64876 0.640496 0.644628 0.644628 0.623967 0.603306 0.595041 0.553719 0.512397 0.491736 0.433884 0.177686 0.190083 0.371901 0.516529 0.72314 0.789256 0.780992 0.809917 0.847107 0.855372 0.859504 0.859504 0.855372 0.859504 0.85124 0.855372 0.859504 0.859504 0.863636 0.859504 0.859504 0.85124 0.842975 0.834711 0.834711 0.830578 0.822314 0.801653 0.780992 0.764463 0.752066 0.731405 0.727273 0.747934 0.772727 0.764463 0.756198 0.768595
79 0.516529 0.46281 0.280992 0.252066 0.247934 0.367769 0.57438 0.615702 0.661157 0.615702 0.681818 0.702479 0.735537 0.739669 0.743802 0.768595 0.789256 0.793388 0.797521 0.81405 0.822314 0.822314 0.826446 0.830578 0.830578 0.834711 0.838843 0.834711 0.834711 0.834711 0.826446 0.830578 0.830578 0.830578 0.834711 0.834711 0.830578 0.830578 0.830578 0.822314 0.826446 0.818182 0.81405 0.809917 0.801653 0.801653 0.797521 0.785124 0.772727 0.747934 0.739669 0.731405 0.719008 0.714876 0.702479 0.690083 0.665289 0.644628 0.623967 0.603306 0.582645 0.578512 0.541322 0.603306 0.516529 0.450413 0.293388 0.243802 0.235537 0.396694 0.566116 0.632231 0.652893 0.64876 0.694215 0.719008 0.752066 0.764463 0.768595 0.789256 0.801653 0.805785 0.809917 0.822314 0.822314 0.822314 0.830578 0.830578 0.830578 0.826446 0.822314 0.826446 0.826446 0.826446 0.822314 0.818182 0.826446 0.830578 0.838843 0.838843
80 0.5 0.590909 0.628099 0.669422 0.68595 0.706612 0.72314 0.739669 0.743802 0.743802 0.768595 0.772727 0.77686 0.785124 0.789256 0.797521 0.805785 0.801653 0.818182 0.81405 0.81405 0.818182 0.818182 0.818182 0.822314 0.822314 0.822314 0.826446 0.830578 0.818182 0.818182 0.818182 0.81405 0.818182 0.81405 0.826446 0.826446 0.826446 0.81405 0.797521 0.81405 0.805785 0.809917 0.797521 0.793388 0.793388 0.793388 0.772727 0.760331 0.768595 0.752066 0.739669 0.72314 0.698347 0.673554 0.677686 0.619835 0.61157 0.586777 0.520661 0.421488 0.301653 0.177686 0.140496 0.549587 0.561983 0.61157 0.673554 0.694215 0.706612 0.727273 0.743802 0.743802 0.756198 0.780992 0.780992 0.785124 0.789256 0.793388 0.797521 0.801653 0.805785 0.822314 0.809917 0.81405 0.81405 0.81405 0.818182 0.822314 0.822314 0.822314 0.822314 0.830578 0.826446 0.818182 0.822314 0.818182 0.826446 0.809917 0.826446

plot reconstruct imgs

Code
function  plot_img(df)
    
    fig=Figure(resolution=(130*20,130*4))
    
    for i in 0:3
        for j in 1:20
            idx=i*20+j
            ax=Axis(fig[i+1,j],yreversed=true)
            img=df[idx,:]|>Array|>d->reshape(d,w,h)
            image!(ax,img)
            hidespines!(ax)
            hidedecorations!(ax)
        end
    end

    fig
    #save("./imgs/reconstruct-of-face.png",fig)
end


plot_img(df)