DeDuplication of Faces

I’m having the difficulty in extracting the unique faces from a folder. and save them in a seperate folder. Flow should go like this :
At first, uniquefaces folder will be empty and xyz folder is full of faces with multiple people and each person’s face may or may not be repeated. now while processing the faces from xyz folder, we check the face from xyz folder and any faces in the uniquefaces folder, if there is a match we skip the face and move to next face and if it is not present [or recognised] then we have to add it to the uniquefaces folder. so we’ll have only unique faces in the uniquefaces folder.
Now for the recognition task I’ve tried all most all open source face recognition libraries. But I got no good results. Here are the Libraries I have tried by manipulating and adjusting distance metrics and thresholds:
insightface ai
I haven’t tried TFace Got stuck at how to implement it. Probably will work it out that one too.
And these libraries are either giving false positives {having duplicates} or removing the data[loss of some unique faces while comapring]. How can i solve this one. Thank you.