# Face recognition example 2

Hi
I have written this code, but I think the distance computation is wrong.
How should I compute the distance between image identity? ( i know that identity is a string, and I think I should use it to choose the corresponding vector of string from database )

[code removed]

But it doesn’t work!

ValueError Traceback (most recent call last)
in
1 # BEGIN UNIT TEST
----> 2 assert(np.allclose(verify(“images/camera_1.jpg”, “bertrand”, database, FRmodel), (0.54364836, True)))
3 assert(np.allclose(verify(“images/camera_3.jpg”, “bertrand”, database, FRmodel), (0.38616243, True)))
4 assert(np.allclose(verify(“images/camera_1.jpg”, “younes”, database, FRmodel), (1.3963861, False)))
5 assert(np.allclose(verify(“images/camera_3.jpg”, “younes”, database, FRmodel), (1.3872949, False)))

in verify(image_path, identity, database, model)
21 # Step 2: Compute distance with identity’s image (≈ 1 line)
22 #dist = np.linalg.norm(tf.subtract(encoding, database))
—> 23 dist = np.linalg.norm(tf.subtract(encoding , database),ord=2)
24
25 # Step 3: Open the door if dist < 0.7, else don’t open (≈ 3 lines)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 “”“Call target, and fall back on dispatchers if there is a TypeError.”“”
200 try:
→ 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a

/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/math_ops.py in subtract(x, y, name)
526 def subtract(x, y, name=None):
→ 527 return gen_math_ops.sub(x, y, name)
528
529

/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_math_ops.py in sub(x, y, name)
10459 try:
10460 return sub_eager_fallback(

10461 x, y, name=name, ctx=_ctx)
10462 except _core._SymbolicException:
10463 pass # Add nodes to the TensorFlow graph.

/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_math_ops.py in sub_eager_fallback(x, y, name, ctx)
10478
10479 def sub_eager_fallback(x, y, name, ctx):

10480 _attr_T, _inputs_T = _execute.args_to_matching_eager([x, y], ctx)
10481 (x, y) = _inputs_T
10482 _inputs_flat = [x, y]

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/execute.py in args_to_matching_eager(l, ctx, default_dtype)
261 ret.append(
262 ops.convert_to_tensor(
→ 263 t, dtype, preferred_dtype=default_dtype, ctx=ctx))
264 if dtype is None:
265 dtype = ret[-1].dtype

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1497
1498 if ret is None:
→ 1499 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1500
1501 if ret is NotImplemented:

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_tensor_conversion_function(v, dtype, name, as_ref)
336 as_ref=False):
337 _ = as_ref
→ 338 return constant(v, dtype=dtype, name=name)
339
340

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in constant(value, dtype, shape, name)
262 “”"
263 return _constant_impl(value, dtype, shape, name, verify_shape=False,
265
266

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast)
273 with trace.Trace(“tf.constant”):
274 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
→ 275 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
276
277 g = ops.get_default_graph()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
298 def _constant_eager_impl(ctx, value, dtype, shape, verify_shape):
299 “”“Implementation of eager constant.”“”
→ 300 t = convert_to_eager_tensor(value, ctx, dtype)
301 if shape is None:
302 return t

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
96 dtype = dtypes.as_dtype(dtype).as_datatype_enum
97 ctx.ensure_initialized()
—> 98 return ops.EagerTensor(value, ctx.device_name, dtype)
99
100

ValueError: Attempt to convert a value ({‘danielle’: array([[-0.02207781, 0.00791031, 0.01258595, -0.13589574, 0.01715434,
-0.06947228, 0.06668107, 0.08761657, 0.11076938, -0.11458161,
-0.05645429, 0.03268639, -0.04917502, 0.121949 , -0.053404 ,
-0.00307964, -0.03437706, -0.2574349 , -0.01171562, 0.0449688 ,
-0.05050321, 0.03761594, 0.05895153, 0.1024885 , 0.02789456,
0.01056059, 0.13784498, -0.09931968, -0.04448657, -0.01397782,
-0.06938626, -0.1726177 , -0.04336017, 0.13284433, -0.13176452,
0.09691006, -0.00146565, -0.04749465, 0.04309401, -0.12852818,
-0.17859127, 0.0017249 , -0.10666993, -0.00719534, 0.04102411,
-0.00510622, -0.18158264, -0.01496879, -0.10016451, 0.08398912,
-0.0913937 , 0.06843741, 0.02858014, -0.10796946, -0.14935881,
-0.00341475, -0.00716281, -0.02986746, -0.00745844, 0.06447879,
-0.11276068, 0.20205382, 0.00858871, 0.01293522, -0.06590242,
0.02055588, -0.12480178, 0.01437408, -0.11531278, 0.12422847,
0.12331534, 0.0282457 , -0.04892193, -0.23804745, 0.03455194,
-0.07520807, -0.07376161, -0.05909028, 0.02340194, -0.10988899,
-0.05644933, 0.02913118, -0.01364447, -0.04652436, 0.0398342 ,
0.04609641, 0.00935338, 0.01837851, 0.02625036, -0.17555262,
0.11401331, -0.07485796, 0.00825841, -0.02600367, 0.08246717,
0.03398185, -0.02075688, -0.01436882, -0.00805212, 0.13879423,
0.17638172, 0.05026089, 0.10321572, 0.01695524, -0.05489826,
-0.01372238, 0.01486209, -0.13586009, -0.16473062, -0.02085653,
0.07947639, -0.13640602, 0.13226302, 0.04150442, 0.04773447,
0.02208472, -0.06670811, 0.20771444, -0.0007773 , 0.04857094,
0.10559093, 0.0750401 , 0.00994036, -0.10619865, -0.00100924,
-0.1118835 , 0.12427836, 0.04014031]], dtype=float32), ‘younes’: array([[-0.04321318, 0.02769657, -0.11006958, -0.02181002, 0.0361076 ,
-0.04567481, 0.01104227, 0.01584494, -0.06034198, -0.06126552,
0.0367053 , -0.0961697 , 0.10318656, -0.01903944, 0.12444162,
0.14966834, -0.00199562, -0.15202114, -0.08695694, 0.13510859,
0.09610423, 0.01601152, -0.04747066, 0.09020006, -0.00961671,
-0.05942292, 0.02899237, -0.02146631, -0.15220118, 0.0368798 ,
0.0416105 , -0.03324282, 0.03212215, 0.15484709, -0.03253114,
0.13734712, -0.03606852, -0.19555247, -0.03386895, 0.13818501,
0.01098216, 0.05590549, 0.07494759, 0.10483894, 0.04818657,
-0.08864883, 0.18727289, 0.09609138, 0.07169709, 0.00777911,
-0.15267642, 0.02436381, -0.13910362, 0.0039113 , -0.00524665,
-0.14967895, -0.12527572, 0.13395001, 0.12619711, 0.12007804,
0.00050099, -0.04571898, -0.02791416, -0.0709733 , 0.04548422,
-0.08937513, -0.10754491, 0.07807689, -0.03811906, -0.00151604,
0.01220485, -0.05128336, 0.03364234, -0.0465657 , -0.07693271,
0.01517421, 0.12072732, 0.03137698, -0.01364717, 0.03496315,
-0.11779605, -0.06153855, 0.05707034, 0.12661062, 0.09578303,
0.03803825, -0.03495952, -0.12204698, 0.02412399, -0.11608049,
0.14219436, 0.0371909 , -0.00265473, -0.05039638, -0.06154344,
0.08947032, -0.1655471 , -0.0709753 , -0.1595776 , 0.15339436,
0.04463782, -0.0040457 , -0.08388816, 0.00045201, -0.16575857,
-0.17756593, 0.01101203, 0.02186302, -0.11264799, 0.07773093,
-0.02995123, -0.11883256, 0.19866861, 0.03217379, 0.02511462,
-0.07490952, 0.08095303, -0.0511429 , 0.01205289, 0.059333 ,
0.15104257, 0.01442077, -0.02418415, -0.11646816, -0.04839958,
-0.16343664, 0.09713519, 0.00650199]], dtype=float32), ‘tian’: array([[-0.11943815, -0.03729401, 0.05387153, -0.21834907, 0.04385884,
-0.03998504, 0.00792124, -0.00210086, 0.10333577, -0.09394953,
0.22474028, -0.03217068, -0.10707733, -0.10196973, 0.06954921,
0.15104936, 0.09850336, 0.00865499, -0.08510803, -0.06141582,
0.0425002 , -0.02814919, -0.15398033, 0.03207969, 0.05210845,
0.02018959, 0.04355913, 0.1276373 , -0.02541673, 0.07438343,
-0.04153778, 0.13911088, -0.09913685, 0.02014956, 0.12896426,
-0.02425526, -0.10472138, 0.0463118 , 0.19034518, 0.01312642,
-0.07159603, -0.09829997, -0.11554532, -0.1150769 , -0.10390544,
-0.18253353, -0.00799358, -0.08511647, -0.01962128, 0.12170069,
0.00293325, 0.09619283, 0.14161149, -0.06181092, 0.02214428,
0.0141409 , 0.09595593, -0.07918323, -0.15814082, 0.00483871,
-0.03916374, -0.0269347 , -0.02631993, 0.14880191, 0.19999771,
-0.00706418, 0.07797976, 0.06785144, 0.02939143, -0.03095348,
0.01127593, -0.06628962, 0.00134788, -0.1136556 , 0.04568795,
-0.00269152, -0.01118088, -0.04052252, -0.11473535, -0.05412082,
-0.08222061, -0.06125817, -0.0447464 , 0.01496259, 0.12708849,
0.06958998, 0.07132287, -0.06584803, -0.16007143, 0.08177138,
0.0974395 , -0.00579824, -0.04989013, -0.07603892, 0.09724031,
0.09526224, -0.06742492, 0.01659943, -0.09945711, -0.07554547,
0.02786485, 0.14648238, 0.01365446, -0.14197692, 0.00978314,
0.06244659, -0.07947431, -0.07006226, 0.03889122, -0.08277833,
0.02603666, 0.0531087 , 0.09889102, -0.07417643, 0.08186565,
-0.00468224, 0.05782678, 0.18273315, 0.02141328, 0.12284933,
-0.00275905, 0.04318797, 0.20690937, -0.07114249, 0.04290884,
-0.06534379, -0.06497782, 0.04810494]], dtype=float32), ‘andrew’: array([[ 0.02776698, -0.12175646, -0.15178506, -0.0610286 , 0.13308677,
-0.12051696, -0.04324671, 0.09415569, 0.08146267, -0.07160698,
0.02096476, -0.0726391 , 0.02349408, -0.21656589, -0.00526722,
-0.05325401, 0.09146392, -0.05054517, -0.04626625, -0.01311894,
-0.03258856, 0.06220504, -0.10511459, 0.18063726, -0.08864769,
0.00819441, 0.06476519, -0.0185525 , 0.07247531, -0.03859144,
0.06565541, 0.00918807, -0.02418127, -0.10228895, 0.07512202,
-0.03819725, -0.1376975 , 0.08259735, 0.03183962, 0.07841568,
-0.0496577 , -0.01509159, 0.14534318, -0.08423557, -0.06929796,
-0.15014018, 0.12417594, 0.01714504, -0.00870221, -0.00633979,
0.00864737, 0.09155844, 0.1119628 , -0.06846929, -0.07970549,
0.00226894, -0.01248629, -0.00298877, -0.05259267, -0.11347643,
-0.13318078, -0.08941191, -0.12010611, 0.17761517, 0.06212294,
0.09487099, 0.11582967, 0.04061528, -0.01869406, -0.07096609,
0.0448334 , -0.21719445, 0.03226213, -0.15475985, 0.02949611,
-0.0199297 , 0.01308866, 0.11681769, -0.21833152, -0.22664672,
-0.04743456, -0.02343504, -0.02167575, -0.01229129, 0.05873051,
0.03235221, 0.01883426, -0.13486947, -0.10924772, 0.05678901,
0.13296565, -0.02308032, -0.11299428, -0.06576509, 0.01028146,
0.05579836, -0.07602596, -0.13109207, -0.04752189, 0.01888844,
-0.0840285 , 0.15124954, 0.24218565, -0.03405876, -0.05484083,
0.05552977, 0.07697843, 0.03503966, 0.00672447, -0.09275209,
0.01907409, 0.10362497, 0.01806332, 0.08317351, -0.00390524,
-0.01344188, -0.08646795, 0.09531608, 0.00924717, -0.02763583,
-0.02081871, -0.05969387, 0.01700744, 0.00157882, 0.06588465,
-0.17005523, -0.02351138, -0.06050805]], dtype=float32), ‘kian’: array([[-0.11412565, -0.10340779, -0.07809147, -0.03147619, -0.01763916,
-0.06523111, 0.02861128, 0.00100287, 0.01058623, -0.05922053,
0.09836762, -0.06435175, -0.01190533, -0.06467687, -0.03796405,
0.03856449, 0.09536575, -0.02357581, 0.07657555, -0.20027393,
-0.07989761, -0.0354316 , 0.03685687, 0.09584761, 0.06027044,
0.102802 , 0.12235806, 0.06458876, -0.02108118, -0.04849019,
-0.10610197, 0.03471626, -0.07026929, 0.06191646, 0.1013197 ,
0.01215312, 0.10428242, 0.13829605, 0.16360578, -0.01910011,
0.0028953 , 0.07391546, 0.12145946, -0.00237975, -0.00678095,
0.00171456, 0.08047135, -0.18473281, 0.03718752, 0.02368625,
-0.10578796, 0.12779161, 0.10795467, -0.12782815, -0.03509172,
0.23318736, 0.0310738 , 0.06983373, 0.10987096, -0.03419933,
0.02939633, 0.08816053, -0.12732431, 0.05641897, 0.02516585,
0.16943592, 0.04541096, 0.13167271, -0.12617195, 0.02680606,
0.09747157, 0.06851081, 0.03508803, -0.15570852, 0.02271417,
0.07789652, -0.03057337, 0.07732681, -0.1704176 , -0.14048788,
-0.10063335, 0.02330282, -0.08078133, 0.0038917 , 0.02953976,
-0.02417765, 0.02415606, -0.02682053, -0.12427159, -0.05730311,
0.07516083, -0.03735033, -0.0754227 , -0.03105421, 0.05149177,
0.00256127, -0.08836024, -0.04085952, -0.09443004, 0.00862191,
0.0660685 , 0.01950349, 0.10551748, -0.18869698, -0.0063817 ,
0.09425347, 0.01763789, -0.07105211, -0.05878287, -0.03717925,
0.09722766, 0.07961001, 0.11736844, 0.08366775, -0.02803672,
0.05398035, -0.05640198, 0.07110722, -0.01840205, 0.18729612,
0.02008048, -0.02196488, 0.16960998, 0.02195128, 0.0635777 ,
-0.10590788, 0.26953366, -0.0768487 ]], dtype=float32), ‘dan’: array([[ 1.03299506e-02, -1.19284607e-01, -1.07221697e-02,
-1.09693699e-01, -2.80039925e-02, 6.80352375e-02,
3.43867601e-03, 4.48595099e-02, 9.83653888e-02,
-1.68169348e-03, 1.48204714e-01, -1.12832133e-02,
1.03188336e-01, -1.42673701e-01, -1.67807639e-02,
-2.04686206e-04, 6.15354143e-02, -1.76226765e-01,
6.46789968e-02, 5.27359080e-03, -8.57739151e-02,
2.44594440e-02, -1.10520996e-01, 1.24368332e-01,
3.91239338e-02, 1.44582670e-02, 2.00099990e-01,
8.59121904e-02, -1.29821286e-01, -1.04406469e-01,
-5.61522357e-02, 7.27837607e-02, -5.33430837e-02,
-1.44560784e-02, -3.77154686e-02, 6.31366000e-02,
-3.00952699e-02, 3.75554301e-02, 5.02012633e-02,
6.77068159e-02, 1.94866061e-02, -3.41097184e-04,
-2.85847411e-02, -1.19089037e-01, -1.84376895e-01,
-1.43267125e-01, 2.95039117e-02, -6.78081885e-02,
2.47377604e-02, 2.63163652e-02, -6.36448041e-02,
9.49229971e-02, 7.19852969e-02, -1.00192524e-01,
-2.44536866e-02, 1.35577083e-01, -2.85872687e-02,
-4.21997532e-02, -3.49330045e-02, -1.26125619e-01,
-4.92068157e-02, -3.98539007e-02, 5.05309105e-02,
1.29093781e-01, 9.75558385e-02, -6.34005712e-03,
1.95746571e-02, 3.83357927e-02, -7.49145970e-02,
-2.73858123e-02, 1.81267522e-02, -1.15424171e-01,
1.59817681e-01, -1.32265255e-01, 7.46619031e-02,
-1.34833818e-02, -7.40426183e-02, 7.43419677e-02,
-1.47109672e-01, -4.79128323e-02, -5.10853603e-02,
-1.19412594e-01, -1.03481859e-01, 9.25139114e-02,
1.03935942e-01, -9.24171647e-04, 1.06291905e-01,
-7.96444118e-02, -6.81325272e-02, 1.09897807e-01,
9.08962712e-02, -1.38583019e-01, -1.00467643e-02,
-5.18120080e-02, 1.45651147e-01, 9.53728557e-02,
-4.49726395e-02, -2.10923329e-02, -4.92058285e-02,
2.58102696e-02, 7.37864822e-02, 1.46778345e-01,
1.58169627e-01, -1.11977540e-01, 8.85709003e-03,
3.62276994e-02, -3.55499089e-02, -4.96830465e-03,
-1.48208756e-02, -2.25424334e-01, 1.89004526e-01,
2.28009950e-02, 9.35606584e-02, 1.02038302e-01,
5.98671697e-02, 6.65342808e-02, -1.17974639e-01,
1.58685029e-01, 9.61223394e-02, 1.54195487e-01,
-5.88071458e-02, -1.11332446e-01, -1.57419983e-02,
7.47208446e-02, 4.15802039e-02, -3.73938754e-02,
8.82889330e-02, 9.59988758e-02]], dtype=float32), ‘sebastiano’: array([[-0.06364934, -0.14617899, -0.02722872, -0.14733537, 0.00778122,
0.04838159, -0.02825393, 0.05928315, 0.04499508, 0.04773756,
0.13125402, 0.02051211, 0.04656222, -0.13015896, 0.02048054,
-0.0410991 , 0.03584395, -0.13226216, 0.07527869, -0.01961054,
-0.10862765, -0.01835945, -0.12883478, 0.15704925, 0.02321076,
0.07481612, 0.17096774, 0.08363564, -0.10153782, -0.10840791,
-0.05216334, 0.09671908, -0.095112 , -0.03652416, 0.03384859,
0.05217567, -0.00217138, -0.00643286, 0.05762821, -0.00864278,
0.04756632, -0.00133506, -0.00612536, -0.01285149, -0.15864955,
-0.18558753, 0.09342843, -0.07439137, 0.01981138, 0.04021319,
-0.07530849, 0.14233962, 0.11560833, -0.13797502, -0.00453281,
0.07350065, 0.03441432, 0.00892615, -0.03657585, -0.14386094,
-0.04293197, -0.01732244, -0.01450928, 0.15298541, 0.09860764,
0.10952055, 0.04029295, 0.05935812, 0.00297962, -0.03085456,
0.02290575, -0.16223161, 0.12269519, -0.09299587, 0.02675633,
-0.00872823, -0.10711332, 0.03065852, -0.12486337, -0.0568596 ,
-0.05951165, -0.10609692, -0.07511573, 0.08333633, 0.10548152,
0.00358416, 0.0876025 , 0.03041236, -0.06139905, 0.14561273,
0.04919021, -0.131199 , -0.07457729, -0.03186804, 0.17030741,
0.13237403, -0.02780811, -0.04373698, -0.06634644, 0.03168115,
0.02843279, 0.11120784, 0.10006683, -0.1341773 , -0.02113805,
0.0307855 , 0.03658466, 0.00587917, 0.06980389, -0.19905613,
0.09925103, 0.05313172, 0.14222124, 0.07472827, 0.04448896,
0.05950623, -0.08323666, 0.12535642, 0.16735706, 0.12376454,
-0.05550757, -0.10454179, 0.00200881, 0.06014672, 0.10423885,
-0.10418036, 0.18808626, 0.04668036]], dtype=float32), ‘bertrand’: array([[-0.04406277, -0.09991594, -0.17541924, 0.00884627, 0.00139015,
-0.0560196 , -0.03749742, -0.02655345, -0.00549273, -0.03132788,
-0.01300288, -0.00312655, 0.06499422, -0.13311657, -0.05788453,
-0.02045213, 0.0504348 , -0.09690144, 0.11986563, -0.09023168,
-0.11012732, 0.02360174, -0.01833834, 0.04195596, -0.00776893,
-0.00591097, 0.10236909, 0.03562343, -0.0722625 , -0.05196084,
-0.07913106, -0.00384938, -0.04090372, 0.05786882, 0.02822854,
0.05881929, -0.01537442, -0.00952912, -0.04323059, -0.01780873,
0.0312974 , 0.17407066, -0.05839569, 0.00907124, -0.0797059 ,
-0.2016899 , 0.00116305, 0.03254491, 0.06147147, 0.04040254,
-0.1486799 , -0.01969034, 0.02149205, 0.04873421, -0.0885966 ,
0.09032571, 0.10679492, -0.00833845, -0.15984282, -0.22180374,
-0.13561276, -0.04054846, 0.03205662, 0.15252998, -0.04633876,
0.1403383 , 0.04607177, 0.03405432, -0.04159412, -0.00281094,
0.10094895, -0.02836642, 0.04099729, -0.09139693, 0.08819026,
-0.06955504, -0.04564932, 0.16070193, -0.05934967, -0.124067 ,
-0.05894531, -0.09310829, -0.12248926, -0.0157904 , 0.08049046,
0.05135417, 0.0324495 , -0.03969604, -0.09981931, 0.13931525,
0.18854171, -0.06641424, -0.03206449, 0.02634673, 0.03520786,
0.11779223, -0.03789611, -0.06508259, -0.1053802 , 0.01327223,
-0.00422343, 0.1757682 , 0.19137251, -0.10286348, 0.1499218 ,
0.00786012, -0.04568745, -0.04810745, -0.10565564, -0.18133403,
0.07418664, 0.07417072, -0.00292485, 0.23189364, -0.05675378,
0.04873154, -0.12965092, 0.0009549 , 0.07125025, 0.12093812,
-0.09342162, -0.10786173, 0.01777314, -0.01017172, 0.13276277,
-0.1319007 , 0.12519999, 0.02784575]], dtype=float32), ‘kevin’: array([[-0.06626899, 0.03357454, 0.01250082, 0.00783624, -0.01341957,
0.11659899, -0.00954863, 0.10003734, 0.06780113, -0.09479357,
0.20691328, -0.13448487, 0.18004881, 0.07887718, 0.19370438,
0.05421494, 0.09545937, -0.01353605, -0.13358457, 0.14419185,
0.02507979, 0.04509082, 0.07863329, 0.04081323, -0.00755109,
0.01667297, -0.11744751, 0.03507825, 0.0509377 , -0.02458524,
-0.04227764, 0.01221071, -0.12042102, 0.01784124, 0.21965912,
0.11035632, -0.06066176, 0.06232093, -0.06988606, 0.15476263,
0.08558859, 0.04269659, 0.14008474, -0.15009005, 0.04903273,
-0.06848938, 0.0878689 , -0.06991136, 0.22938214, -0.00166246,
0.04769572, -0.00528237, -0.01512629, -0.04561129, -0.21170986,
-0.07464848, -0.07177012, -0.00228645, 0.04670578, -0.02361434,
0.07454803, 0.15522398, 0.0346489 , 0.05437357, -0.03156533,
-0.13070396, 0.14804374, 0.03770741, 0.15658092, 0.03187696,
0.00468581, 0.06206955, 0.08873637, -0.0260235 , -0.06574947,
-0.06243967, 0.1347235 , -0.06758296, -0.22196676, 0.00510232,
-0.00596295, -0.06494207, -0.0861914 , 0.00360648, -0.0133773 ,
-0.04683632, 0.10855975, -0.15998049, -0.07269411, -0.10722185,
0.10169974, 0.06968915, -0.0048902 , 0.05523903, -0.12709777,
0.16767257, 0.04196915, 0.08975038, -0.04359968, 0.07745527,
-0.00338385, 0.02609506, -0.00418746, 0.03194413, 0.03047907,
0.13923438, 0.00246212, -0.06495963, 0.02502174, 0.11272714,
0.05968186, 0.03807542, 0.04747554, 0.02099542, 0.03994487,
-0.03477348, 0.03726505, -0.13592713, -0.09389587, -0.04335792,
-0.04162599, 0.00522338, 0.06761469, -0.08119798, -0.03997991,
-0.01952435, -0.03047688, -0.03578057]], dtype=float32), ‘felix’: array([[ 0.03794138, -0.07441651, 0.05898187, -0.04262532, -0.03250086,
0.22337067, 0.08936028, -0.05059571, 0.02616985, 0.03514591,
0.10602068, -0.08258365, 0.11335879, -0.09368918, 0.02523446,
-0.02179008, 0.010652 , 0.00259017, 0.09402127, 0.01127281,
0.00385029, -0.00876871, -0.0851144 , -0.1894953 , -0.05559519,
-0.04146904, -0.00225054, 0.03426963, -0.18467881, 0.09259336,
-0.18379572, 0.06047271, -0.10250745, -0.144672 , 0.06020485,
-0.00943344, 0.09979429, 0.14274383, -0.00355561, 0.04421661,
0.12152427, 0.0365852 , 0.02444568, -0.11992756, -0.07277519,
-0.13333952, 0.016611 , 0.07741666, 0.19864994, 0.00073094,
-0.03689597, -0.08667103, 0.03413266, 0.05228047, -0.05930266,
-0.15259887, -0.06896666, 0.02849578, -0.01457085, -0.01005947,
-0.02537481, -0.01035619, 0.12024683, 0.06210614, 0.03419522,
0.00212919, 0.04142082, 0.05363516, 0.08457141, 0.08673119,
-0.01595192, 0.02508869, 0.0156716 , -0.04733955, -0.02466489,
-0.01229395, -0.01082059, 0.0650531 , -0.02019332, 0.16551872,
-0.04802328, -0.15994821, -0.09652402, -0.00216954, -0.10134336,
0.03496887, 0.0914497 , -0.09943675, -0.06894737, -0.01701355,
0.16583134, -0.00231151, 0.02950327, 0.01047863, -0.04296748,
0.12053002, 0.00676356, 0.00475085, -0.08407124, 0.03728944,
0.10151437, 0.0074395 , 0.0353408 , -0.03800585, -0.04046328,
0.07119777, -0.08968325, -0.2506259 , 0.0479795 , 0.06413267,
0.07478318, -0.13571697, -0.09123368, 0.14013454, -0.06478342,
-0.10693415, -0.19176674, 0.00891862, -0.00625042, 0.15866931,
-0.20662695, -0.00725386, 0.02218224, 0.03890789, -0.10025732,
0.1763384 , 0.12161972, 0.06077629]], dtype=float32), ‘benoit’: array([[-0.07223049, -0.12198298, -0.0116326 , -0.12701416, 0.05224727,
0.03213697, -0.00712622, -0.00971564, -0.01946496, 0.06354417,
0.05136754, 0.00272358, 0.08230245, -0.12211172, 0.01920784,
0.03177586, 0.07353088, -0.05080687, 0.12844746, -0.09414757,
-0.06693541, 0.00238555, -0.05388086, 0.08634068, 0.00157014,
0.0213549 , 0.20049903, 0.08174701, -0.08057004, -0.07139491,
-0.09003238, 0.06681324, -0.02032831, -0.02113923, 0.13112403,
-0.04049392, -0.01817156, 0.01379353, 0.04687251, 0.0216395 ,
0.06893375, -0.03743702, -0.00571033, 0.02666494, -0.10522803,
-0.22554082, 0.04933494, -0.05306847, 0.1048182 , -0.0252785 ,
-0.15767454, 0.0831875 , 0.07460874, -0.04800053, 0.02914048,
0.03781685, 0.09929631, 0.04301883, -0.07068972, -0.24902907,
-0.08507373, -0.00433446, -0.03429541, 0.19108786, 0.00407321,
0.13352436, 0.06096206, 0.05969165, 0.00947402, -0.01725451,
-0.034239 , -0.1066402 , 0.13818283, -0.05680086, -0.02007155,
-0.04252889, -0.06620093, 0.04505728, -0.0431052 , -0.11879467,
-0.06036772, -0.09448311, -0.0886449 , 0.0533295 , 0.14452305,
0.02300012, 0.11677667, -0.03248592, -0.15251252, 0.17783803,
0.08544848, 0.0018958 , -0.05411756, -0.07533021, 0.13968489,
0.06613399, -0.00083454, -0.06971588, -0.10230779, -0.0152876 ,
-0.05380423, 0.17327042, 0.07198269, -0.08118825, 0.06942352,
0.06119908, -0.00584387, -0.02999446, 0.00079101, -0.19084808,
0.045936 , 0.07590806, 0.08944414, 0.12534131, -0.06021832,
0.06757245, -0.05043872, 0.09929698, 0.17905389, 0.10207713,
-0.09347024, -0.01570105, 0.04132798, 0.05063044, 0.16906899,
-0.10572224, 0.20154934, 0.04696878]], dtype=float32), ‘arnaud’: array([[-0.11108436, -0.0282702 , -0.14907223, -0.08167499, 0.08493245,
-0.01484627, 0.00981762, 0.11010327, 0.09339161, -0.00652465,
0.10350671, -0.00958226, -0.03457233, -0.09191829, 0.0559453 ,
0.00345909, -0.0277004 , -0.06088139, 0.02916092, -0.11856917,
-0.10351887, -0.06335926, -0.1195286 , 0.09866504, 0.01092979,
-0.01232402, 0.20556849, 0.05915269, -0.2336626 , -0.03676535,
-0.15363555, 0.08148178, -0.05960998, 0.02939212, 0.07072981,
0.03154788, 0.06158185, -0.0624219 , 0.13962881, -0.00424437,
0.00277323, 0.04715865, -0.05318868, -0.00804499, -0.15510605,
-0.13487086, 0.0692684 , -0.06693438, 0.02098464, 0.05950471,
-0.07338398, 0.19208853, 0.14026964, -0.04954357, 0.06165136,
0.07461743, 0.01024334, -0.03139988, -0.04713462, -0.05583085,
0.01144142, 0.04606025, -0.03422326, 0.09651557, 0.2325456 ,
0.10673428, -0.05146305, 0.15674052, -0.04895039, -0.03867432,
0.06919964, -0.04451271, 0.03824795, -0.11672962, 0.05448535,
0.04109896, -0.02220032, 0.1106854 , -0.09248734, -0.05600565,
-0.12804832, -0.02148611, -0.0350766 , 0.0824839 , 0.09834189,
0.046677 , 0.04043039, -0.00410496, -0.07549237, 0.07752363,
0.06430267, -0.02310442, -0.08672149, 0.00191177, 0.0558965 ,
0.13914083, -0.07725447, -0.10141092, -0.13107514, 0.11909161,
-0.00194307, 0.12715748, 0.02268375, -0.18740274, -0.01820453,
-0.03760309, -0.06258325, -0.02011937, 0.01009541, -0.07553953,
0.07765365, -0.01423582, 0.08170144, 0.04094566, -0.02666017,
0.11456447, -0.09951849, 0.16305615, 0.14782427, 0.189152 ,
-0.08733996, -0.06570892, 0.07471074, -0.01273053, 0.05114362,
-0.09056339, 0.17219096, -0.00971146]], dtype=float32)}) with an unsupported type (<class ‘dict’>) to a Tensor.

Hey! Yeah you’ll have to do that. Also remember, this is L2 norm and not L1 norm. The code you’ve posted here just passes the dictionary so that does not work at all. (I’ll also be removing it)

I subtracted the database and encoding.
If this is not working, I don’t know how to access the corresponding dataset from the database using identity?

So, the database is a dictionary right? Identity is the key to that dictionary.

Yeah
I did it
Thank you