worldcoin / open-iris

Open Iris Recognition Inference System (IRIS)
MIT License
213 stars 38 forks source link

What is the gallery format temlates? #42

Open DimIsaev opened 1 month ago

DimIsaev commented 1 month ago

in docs

https://worldcoin.github.io/open-iris/_code_subpages/iris.nodes.matcher.html

template_gallery (IrisTemplate) – Iris template from gallery.

what is the gallery format?

I also need an example of storing templates in a gallery or another database

thanks

DimIsaev commented 1 month ago

Is there a chance that someone will answer?

wiktorlazarski commented 1 month ago

Hey @DimIsaev,

thanks for raising the issue.

Regarding

what is the gallery format?

The implementation of the gallery is outside of the score of the open-iris project. You may implement templates' gallery that works best for your needs. It can be any kind of database, as long as you are able to serialise and deserialise saved templates to the required by the matcher IrisTemplate object.

Best regards, Wiktor

DimIsaev commented 1 month ago

The implementation of the gallery is outside of the score of the open-iris project

I asked about the format, not the implementation!

I'll ask you a different question: how to submit a list of frames for input, and not just one

thanks for future attentive answers

DimIsaev commented 1 month ago

code this

https://github.com/worldcoin/open-iris/blob/6b2fa096f7f196fc7e48d27bbb5e803c2b80e5bd/src/iris/nodes/matcher/hamming_distance_matcher_interface.py#L72

"Call `run` method and provide two `IrisTemplate`s to compute distances.
def run(self, template_probe: IrisTemplate, template_gallery: IrisTemplate) -> float:\n",

how format this list template_gallery ? Simple list images_pixel not work

DimIsaev commented 2 weeks ago

Can I hope for an answer?

Maybe we should close the Issues section?

wiktorlazarski commented 1 week ago

@DimIsaev

It's still vague to me what you try to achieve. Hence let me directly answer this question you asked

how to submit a list of frames for input, and not just one

What you can do is to load all your images, loop over them calling IRISPipeline and saving generated by the pipeline IRISTemplate. Source code may look something like that.

f_img = cv2.imread("/path/to/f_img", cv2.IMREAD_GRAYSCALE)
s_img = cv2.imread("/path/to/s_img", cv2.IMREAD_GRAYSCALE)

iris_templates: List[IrisTemplate] = []
for img in [f_img, s_img]:
    output = iris_pipeline(f_img, eye_side="left")
    iris_templates.append(output["iris_template"})

Regarding your second question

code this https://github.com/worldcoin/open-iris/blob/6b2fa096f7f196fc7e48d27bbb5e803c2b80e5bd/src/iris/nodes/matcher/hamming_distance_matcher_interface.py#L72 how format this list template_gallery ?

If you already have IrisTemplates computed then list of templates can be formatted in many ways. You can loop over your computed iris templates and append them to list or do Python's list comprehension to create a List[IrisTemplate] expected by classes that implements cited by you interface.

As you also saw open-iris doesn't have N-N matcher interface implemented yet. Please, feel free and more then welcome to make your first contributions and implement first concrete class that provides this functionality.

Best regards, Wiktor