One-To-Many Search¶
One-to-many search is the process in which a probe template is searched against the reference templates of more than one subject. It returns a candidate list.
The FingerMatcher module provides a search method that performs a one-to-many search of a biometric probe against a previously initialized dictionary of biometric references. This method is generally used when the database size is relatively small (up to 1000 templates).
For large databases (over 1000 templates), the FingerIndexer module offers a more efficient way of performing a one-to-many search. From an index file created from a list of finger templates, it uses modern indexing techniques for fast, lossless searching.
Constructing a finger index¶
The example below demonstrates how to construct a finger index:
# maximum user number to size the indexer
count = 100
# create indexer with data format FINGER_EMBEDDING_V1_A
# currently, this is the only format supported for the 1:N indexer
indexer = FingerIndexer.create(count, FingerDataFormat.FINGER_EMBEDDING_V1_A)
for user_index in range(10):
# load or create a TemplateRecord for the user
record = FingerTemplateRecord.from_file(
FingerTemplateFormat.ISO19794_2_2005,
"data/template_record_user{}.bin".format(user_index)
)
# add record to indexer with a chosen user identifier
indexer.add_template_record(record, "user_{}".format(user_index))
# save the index to a file
indexer.to_file("data/finger_indexer.db")
Searching in the index¶
The example below demonstrates how to search for a fingerprint using the index:
# load database
indexer = FingerIndexer.from_file("data/finger_indexer.db")
# load or create a TemplateRecord for the user
probe_record = FingerTemplateRecord.from_file(
FingerTemplateFormat.ISO19794_2_2005,
"data/template_record_user5.bin"
)
# search user in indexer
candidate_list = indexer.search_template_record(probe_record, 1, trust_filled_positions=True)
if candidate_list:
print("Found match with : " + candidate_list[0].id)