0

I'm using MySQL db and Python. I running some face recognition queries such as below:

for encodeFace, faceLoc in zip(encodesCurFrame, facesCurFrame):
    matches = face_recognition.compare_faces(encodeListKnown, encodeFace)
    face_Dis = face_recognition.face_distance(encodeListKnown, encodeFace)
    # print(face_Dis)
    matchIndex = np.argmin(faceDis)

I need to store the matchIndex numpy array into MySQL db and retrieve it to compare it with the real-time result coming from video stream.

As example for one face array as below:

[array([-0.03982568,  0.0466256 ,  0.10839709, -0.04618508, -0.18365356,
        0.01487046, -0.02441945, -0.11297068,  0.17233874, -0.04669763,
        0.29686055, -0.03716658, -0.26820186,  0.00475622, -0.03315876,
        0.11188678, -0.17055775, -0.11814106, -0.04149977, -0.12335332,
        0.10478698,  0.07871094, -0.0245239 , -0.05221708, -0.11528996,
       -0.29134476, -0.11530365, -0.05149739,  0.1486412 , -0.07742441,
        0.03924546,  0.08309049, -0.18108843, -0.07448926,  0.0588475 ,
       -0.00206966, -0.07270631, -0.09870195,  0.19136742, -0.01333379,
       -0.16585402, -0.06306425,  0.03135228,  0.15242851,  0.12671986,
        0.06151334,  0.02930382, -0.10507341,  0.05431183, -0.21889399,
        0.0982563 ,  0.19636418,  0.08638678,  0.04246487,  0.10104641,
       -0.21091488, -0.00053184,  0.19133894, -0.15123004,  0.09692279,
        0.10679097, -0.0997081 , -0.02019324, -0.05096144,  0.129476  ,
        0.02539396, -0.04582587, -0.19065364,  0.21564247, -0.07370852,
       -0.11738002,  0.13342284, -0.12635913, -0.16233116, -0.27765995,
       -0.00732662,  0.50213826,  0.02980643, -0.2086312 ,  0.01042579,
       -0.00930636, -0.02900947,  0.14645986,  0.0320985 , -0.03112174,
       -0.09587738, -0.15909459, -0.0389645 ,  0.19932204, -0.03060728,
       -0.05045725,  0.2260851 , -0.00543171,  0.05067419,  0.07360222,
        0.09129907, -0.04530992, -0.00215137, -0.0877424 , -0.06189177,
        0.05106816, -0.06142666, -0.08767837,  0.14337413, -0.12626182,
        0.15789033, -0.00425556,  0.01465969, -0.06580043, -0.11303413,
       -0.06203099,  0.03172189,  0.20761757, -0.2837159 ,  0.16302592,
        0.16049571, -0.01303555,  0.14014119,  0.03616813,  0.04973216,
        0.00611662, -0.11366641, -0.26029304, -0.10216802, -0.00345476,
       -0.0911523 , -0.042996  ,  0.04715518])
4
  • One way is to store the array as a blob dtype. Essentially, you’ll convert the array to a binary string and store. On retrieval, decode the binary string into a numpy array. Commented Sep 19, 2020 at 18:35
  • thanks dear, appreciate if you can you show me an example to the save load python code, so I will start from there. Commented Sep 19, 2020 at 21:22
  • 1
    Dear? No. That aside, have a look here at this answer. Commented Sep 19, 2020 at 21:26
  • I see, thanks very much for your update, I'll try it tomorrow Commented Sep 19, 2020 at 22:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.