nyoki-mtl / keras-facenet

Facenet implementation by Keras2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Core ML model output

ozgurshn opened this issue · comments

Core ML model output seems not scaled, how much scale should I apply while converting?
Keras output:
array([[-2.6317966e-01, -3.3678617e-02, 2.2661042e+00, -6.7546511e-01,
2.6711123e+00, 2.1380582e+00, 3.1932313e+00, -1.0266680e+00,
-1.2064759e+00, -3.7772853e+00, 1.4777870e+00, -4.5663638e+00,
5.3783691e-01, 6.9581866e-01, -3.2163723e+00, -2.2745862e+00,
1.9304838e+00, -4.4520035e+00, -1.1737602e+00, -4.1146436e+00,
2.8376224e+00, -6.1216235e+00, 8.1349170e-01, 4.7025423e+00,
2.4575691e+00, 4.7649293e+00, 3.1503294e+00, 1.7728921e-02,
-3.4083718e-01, -5.7512856e+00, -1.0213958e+00, 5.9897904e+00,
-2.0491607e+00, 2.1902418e+00, -2.5166994e-01, 1.1277127e+00,
4.1162009e+00, -2.1709535e+00, 4.1017589e-01, 7.4210954e-01,
2.5226521e+00, -2.1406457e-01, 1.8106477e+00, 7.8078407e-01,
-5.4581828e+00, 3.3939710e+00, 3.6321692e+00, 5.1154441e-01,
-5.9473997e-01, -6.4269938e+00, 4.8341846e+00, 1.7983266e+00,
9.3833292e-01, 1.2895137e+00, 1.9546670e+00, 6.5272875e+00,
9.4690269e-01, -5.3456831e+00, 2.5641103e+00, 4.0326028e+00,
-2.4558032e+00, -6.3662320e-01, 1.0621898e+00, 1.5926079e+00,
5.3224262e-02, 1.2270166e+00, 2.2601867e+00, 7.6212996e-01,
4.0221577e+00, 3.7582583e+00, 1.6832346e+00, 3.1141477e+00,
-2.5827744e+00, 3.7479327e+00, -2.5769188e+00, 3.5341086e+00,
-1.0932776e+00, 2.3388093e+00, -3.6909742e+00, -3.2998741e+00,
-1.4890214e-02, 2.6787040e+00, 1.6687028e+00, -1.0944015e+00,
6.9286877e-01, 1.8361024e+00, 4.1195717e+00, -6.4409890e+00,
9.2169154e-01, 2.6727970e+00, 2.2134098e-01, -3.7779233e+00,
8.3170211e-01, -2.0311317e+00, 6.9612050e-01, 7.6587849e+00,
3.3811717e+00, -3.0122232e+00, 2.9068935e+00, 2.9820104e+00,
-3.9757938e+00, -3.4195602e+00, -1.9991946e-01, 2.5219235e-01,
-3.4377544e+00, -7.1006083e-01, -5.6879859e+00, 3.5768299e+00,
1.8099457e+00, -1.5660530e+00, -5.2569504e+00, -1.1321362e+00,
2.7814114e+00, -3.8275607e+00, 3.7700075e-01, 2.9798200e+00,
-1.3275119e+00, 8.1083018e-01, -8.8596046e-01, -6.0629940e+00,
1.9946741e+00, -4.0994754e+00, 3.5792630e+00, 1.3484008e+00,
-1.8742681e-04, 1.3709370e+00, 3.6508691e+00, -3.8959811e+00]],
dtype=float32)
Converted model output:
[855.0784912109375,-4063.724365234375,737.659912109375,-7393.7275390625,-2245.569580078125,-1595.0166015625,-2120.451904296875,3890.713623046875,509.8944702148438,-3713.39208984375,-166.2485809326172,2475.9208984375,12017.4716796875,1453.450561523438,-4773.72509765625,-3715.33837890625,1487.673828125,-2976.453369140625,2839.177734375,987.212646484375,-139.4358978271484,-1500.54736328125,-1800.843627929688,2315.100830078125,2692.251220703125,1220.254272460938,8099.76123046875,-2944.90283203125,-1743.339721679688,-7470.42041015625,-2737.231689453125,4109.24609375,8797.529296875,-2345.7978515625,-7959.0234375,332.7884826660156,2513.694091796875,550.3179321289062,-1115.5908203125,1945.220092773438,3336.918212890625,1632.697387695312,435.2661743164062,1182.497314453125,-3632.15478515625,-2488.587890625,-566.3248901367188,-66.20777130126953,6390.865234375,-10544.40625,3047.216552734375,2446.52197265625,-3668.0166015625,-3492.718017578125,2651.781494140625,-1474.755859375,-407.1371154785156,-1065.56591796875,83.17457580566406,890.1207885742188,871.6825561523438,-945.396728515625,-3681.1923828125,2485.04736328125,3726.015380859375,-1097.35205078125,1911.19677734375,-2232.069580078125,1297.970458984375,-1134.264770507812,-4204.21142578125,3786.914794921875,-2623.253173828125,-1265.18505859375,1580.590454101562,-5637.24072265625,-2561.71240234375,314.7735595703125,2296.7470703125,-5458.6435546875,-388.1426696777344,3363.203857421875,2543.2294921875,2422.521240234375,-1095.759887695312,7738.43359375,-63.55666732788086,-5111.3408203125,-4203.83837890625,3556.224609375,2779.212890625,118.7055282592773,924.0149536132812,-5947.62548828125,1709.426879882812,6934.91650390625,4084.002197265625,-1921.875854492188,1726.5087890625,453.2798767089844,-857.8190307617188,-566.110595703125,5079.982421875,351.6022644042969,-6870.47802734375,2958.294921875,-4496.14794921875,1221.89111328125,-1598.419189453125,-2361.905517578125,-6226.74462890625,-1889.393798828125,-171.6868286132812,-2751.922607421875,2748.287841796875,3023.27392578125,-5400.4267578125,1489.955200195312,6292.98828125,-3763.5556640625,-2693.62060546875,-763.9926147460938,-3135.6083984375,4158.576171875,2564.194580078125,-1977.328979492188,352.8983154296875,-95.43745422363281]
converted model output with 1/255 scale:
[22.72692,-111.8219,21.57746,-205.979,-62.09193,-43.63466,-59.90541,105.5358,13.35077,-102.3288,-4.489635,66.16525,330.7473,41.02428,-131.7471,-101.4517,41.12999,-79.95216,79.33298,25.1811,-3.271009,-39.42453,-51.64153,63.79717,73.8793,35.71499,223.8051,-79.38886,-47.4924,-205.7483,-75.49256,114.1817,242.6053,-62.9214,-216.9569,9.832993,68.27296,13.29188,-28.98055,55.34957,91.76531,43.88745,13.52798,32.19314,-102.5722,-70.43962,-14.59233,-4.072866,176.7958,-292.1834,82.75787,68.06502,-100.6124,-96.46475,73.84764,-40.1497,-11.05663,-29.77695,2.676188,21.43342,22.9453,-27.11697,-101.4999,71.70054,102.3595,-28.63747,53.31374,-59.51252,37.61403,-32.10843,-116.7825,103.3929,-68.22962,-37.54702,42.9712,-152.4216,-69.04482,8.215605,63.2452,-151.812,-11.31077,91.50224,68.38104,70.26328,-26.96819,211.9508,-1.72123,-140.1563,-116.7873,101.6846,77.99618,4.845797,24.48302,-165.1091,46.5722,191.0615,111.0762,-53.38795,47.65784,10.37083,-23.10145,-12.50677,140.9233,8.339808,-187.8266,82.70412,-125.4531,34.69426,-45.9505,-68.5683,-168.2019,-50.66414,-6.257753,-73.38413,78.46208,84.6222,-147.3123,42.28506,176.3857,-100.7463,-75.18451,-20.3528,-85.68301,115.6824,72.76437,-57.86979,12.71073,-1.227953]

I added scale layer as seen here now outputs are more acceptable.