__parameters_type__=Parametersdef__init__(self,**kwargs)->None:"""Assign parameters. Args: rotation_shift (int = 15): rotation allowed in matching, converted to columns. Defaults to 15. """self.params=self.__parameters_type__(**kwargs)
[docs]defload_weights(self,weights_path:str)->List[np.array]:"""Load weights from a file. Args: weights_path (str): Path to the weights file. Returns: List[Any]: Loaded weights. """withopen(weights_path,'rb')asf:try:weights=np.load(f,allow_pickle=True)ifisinstance(weights,np.ndarray):return[weights]elifisinstance(weights,list):returnweightselse:raiseValueError("Weights file does not contain a valid format.")exceptExceptionase:print(f"Error loading weights: {e}")return[]
[docs]@abc.abstractmethoddefrun(self,template_probe:IrisTemplate,template_gallery:IrisTemplate)->float:"""Match iris templates using Hamming distance. Args: template_probe (IrisTemplate): Iris template from probe. template_gallery (IrisTemplate): Iris template from gallery. Returns: float: matching distance. """pass
[docs]classBatchMatcher(abc.ABC):"""Parent Abstract class for 1-to-N matchers."""