H
H
HexUserHex2020-05-13 21:10:12
Python
HexUserHex, 2020-05-13 21:10:12

The most technically simple method of searching in the database by photo?

Greetings,
I want to try to make a miserable semblance of a face search in my database (which is not at all normalized, and rubo speaking, I have it like a temporary shed) using a pre-calculated hash / checksum based on the characteristics of the face, as many have already done in their time) in general, I found an interesting and very simple face-recognition module ( https://pypi.org/project/face-recognition/) but I could not find if it can calculate for faces something like a hash / checksum that I can use for further quick search in the database?

The database currently stores photos in base64 (I agree that the option is far from the best :) ) the size of the database is 40gb, the question was how to add face search to it (even if in the most primitive and crutch form), what solution do I see so far:

1. upload each photo in base64 in a loop
2. collect photos from base64
3. use the face-recognition module to compare with the reference photo.

The only thing is that it won’t be fast (although it’s like a powerful PC and the speed will not be so terrible) since the photo is more lama ... but I think it will work as the most crutch option .. On the other hand, I won’t do a search often. Tell me a technically more correct and most importantly quick solution, ideally I would like to get a miracle checksum for each found face in the photo and just use it in the database with the usual SELECT to make a selection.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Mirilaczvili, 2020-05-13
@2ord

How would you do it yourself:

  1. using OpenCV, you need to implement a module that has a path to the image at the input, and at the output a vector of weights with a length of 64, on the basis of which the hash sum is calculated. This is the hardest part.
  2. indexer program
    Scans directories recursively, passing the module the path to the image and entering the hash sum in the database of each of them
  3. a user interface program
    that takes as input an image from which a hash sum is computed. A query is made to the DBMS, in which the hash sum of the images is compared with the desired one.

X
xmoonlight, 2020-05-13
@xmoonlight

You can do this:
1. The average color of the pixels of all horizontal lines.
2. Average pixel color of all vertical lines.
We get 2 arrays: average colors horizontally, average colors vertically.
If the photo size is 100x100, we get the data size 100+100.
We compare these 2 arrays with the photo to be checked and balance, we minimize the difference of discrepancies when comparing, shifting one of the arrays to the left or right.
After balancing the two arrays from the database to the two arrays from the compared photo, we will get the percentage of the overall match of the images.
This is not a neuron, but the result is similar.

V
Victor P., 2020-05-26
@Jeer

At one time I did it according to this algorithm, everything is extremely simple
https://habr.com/ru/post/120562/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question