def __init__(self, aam, lk_algorithm_cls=WibergInverseCompositional, n_shape=None, n_appearance=None, sampling=None): self._model = aam self._check_n_shape(n_shape) self._check_n_appearance(n_appearance) self._sampling = checks.check_sampling(sampling, aam.n_scales) self._set_up(lk_algorithm_cls)
def __init__(self, images, aam, group=None, bounding_box_group_glob=None, n_shape=None, n_appearance=None, sampling=None, sd_algorithm_cls=ProjectOutNewton, n_iterations=6, n_perturbations=30, perturb_from_gt_bounding_box=noisy_shape_from_bounding_box, batch_size=None, verbose=False): self.aam = aam # Check parameters checks.set_models_components(aam.shape_models, n_shape) checks.set_models_components(aam.appearance_models, n_appearance) self._sampling = checks.check_sampling(sampling, aam.n_scales) # patch_feature and patch_shape are not actually # used because they are fully defined by the AAM already. Therefore, # we just leave them as their 'defaults' because they won't be used. super(SupervisedDescentAAMFitter, self).__init__( images, group=group, bounding_box_group_glob=bounding_box_group_glob, reference_shape=self.aam.reference_shape, sd_algorithm_cls=sd_algorithm_cls, holistic_features=self.aam.holistic_features, diagonal=self.aam.diagonal, scales=self.aam.scales, n_iterations=n_iterations, n_perturbations=n_perturbations, perturb_from_gt_bounding_box=perturb_from_gt_bounding_box, batch_size=batch_size, verbose=verbose)
def __init__(self, aps, gn_algorithm_cls=Inverse, n_shape=None, weight=200., sampling=None): # Check parameters checks.set_models_components(aps.shape_models, n_shape) self._sampling = checks.check_sampling(sampling, aps.n_scales) self.weight = checks.check_multi_scale_param(aps.n_scales, (float, int), 'weight', weight) # Get list of algorithm objects per scale algorithms = [] for j in list(range(aps.n_scales)): # create the interface object interface = GaussNewtonBaseInterface( appearance_model=aps.appearance_models[j], deformation_model=aps.deformation_models[j], transform=aps.shape_models[j], weight=self.weight[j], use_procrustes=aps.use_procrustes, template=aps.appearance_models[j].mean(), sampling=self._sampling[j], patch_shape=aps.patch_shape[j], patch_normalisation=aps.patch_normalisation[j]) # create the algorithm object and append it algorithms.append(gn_algorithm_cls(interface)) # Call superclass super(GaussNewtonAPSFitter, self).__init__(aps=aps, algorithms=algorithms)
def __init__(self, aps, gn_algorithm_cls=Inverse, n_shape=None, weight=200., sampling=None): # Check parameters checks.set_models_components(aps.shape_models, n_shape) self._sampling = checks.check_sampling(sampling, aps.n_scales) self.weight = checks.check_multi_scale_param( aps.n_scales, (float, int), 'weight', weight) # Get list of algorithm objects per scale algorithms = [] for j in list(range(aps.n_scales)): # create the interface object interface = GaussNewtonBaseInterface( appearance_model=aps.appearance_models[j], deformation_model=aps.deformation_models[j], transform=aps.shape_models[j], weight=self.weight[j], use_procrustes=aps.use_procrustes, template=aps.appearance_models[j].mean(), sampling=self._sampling[j], patch_shape=aps.patch_shape[j], patch_normalisation=aps.patch_normalisation[j]) # create the algorithm object and append it algorithms.append(gn_algorithm_cls(interface)) # Call superclass super(GaussNewtonAPSFitter, self).__init__(aps=aps, algorithms=algorithms)
def __init__(self, atm, lk_algorithm_cls=InverseCompositional, n_shape=None, sampling=None): self._model = atm # Check parameters checks.set_models_components(atm.shape_models, n_shape) self._sampling = checks.check_sampling(sampling, atm.n_scales) # Set up algorithm self._set_up(lk_algorithm_cls)
def __init__(self, atm, lk_algorithm_cls=InverseCompositional, n_shape=None, sampling=None): self._model = atm checks.set_models_components(atm.shape_models, n_shape) self._sampling = checks.check_sampling(sampling, atm.n_scales) self._set_up(lk_algorithm_cls)
def __init__(self, aam, lk_algorithm_cls=WibergInverseCompositional, n_shape=None, n_appearance=None, sampling=None): # Check parameters checks.set_models_components(aam.shape_models, n_shape) checks.set_models_components(aam.appearance_models, n_appearance) self._sampling = checks.check_sampling(sampling, aam.n_scales) # Get list of algorithm objects per scale interfaces = aam.build_fitter_interfaces(self._sampling) algorithms = [lk_algorithm_cls(interface) for interface in interfaces] # Call superclass super(LucasKanadeAAMFitter, self).__init__(aam=aam, algorithms=algorithms)
def __init__(self, atm, lk_algorithm_cls=InverseCompositional, n_shape=None, sampling=None): # Store model self._model = atm # Check parameters checks.set_models_components(atm.shape_models, n_shape) self._sampling = checks.check_sampling(sampling, atm.n_scales) # Get list of algorithm objects per scale interfaces = atm.build_fitter_interfaces(self._sampling) algorithms = [lk_algorithm_cls(interface) for interface in interfaces] # Call superclass super(LucasKanadeATMFitter, self).__init__( scales=atm.scales, reference_shape=atm.reference_shape, holistic_features=atm.holistic_features, algorithms=algorithms)
def __init__(self, atm, lk_algorithm_cls=InverseCompositional, n_shape=None, sampling=None): # Store model self._model = atm # Check parameters checks.set_models_components(atm.shape_models, n_shape) self._sampling = checks.check_sampling(sampling, atm.n_scales) # Get list of algorithm objects per scale interfaces = atm.build_fitter_interfaces(self._sampling) algorithms = [lk_algorithm_cls(interface) for interface in interfaces] # Call superclass super(LucasKanadeATMFitter, self).__init__(scales=atm.scales, reference_shape=atm.reference_shape, holistic_features=atm.holistic_features, algorithms=algorithms)
def __init__(self, unified_aam_clm, algorithm_cls=AlternatingRegularisedLandmarkMeanShift, n_shape=None, n_appearance=None, sampling=None): self._model = unified_aam_clm # Check parameters checks.set_models_components(self._model.shape_models, n_shape) checks.set_models_components(self._model.appearance_models, n_appearance) self._sampling = checks.check_sampling(sampling, self._model.n_scales) # Get list of algorithm objects per scale interfaces = unified_aam_clm.build_fitter_interfaces(self._sampling) algorithms = [algorithm_cls(interface, self._model.expert_ensembles[k], self._model.patch_shape[k], self._model.response_covariance) for k, interface in enumerate(interfaces)] # Call superclass super(UnifiedAAMCLMFitter, self).__init__( scales=self._model.scales, reference_shape=self._model.reference_shape, holistic_features=self._model.holistic_features, algorithms=algorithms)
def __init__(self, atm, algorithm_cls=InverseCompositional, n_shape=None, sampling=None): self._model = atm checks.set_models_components(atm.shape_models, n_shape) self._sampling = checks.check_sampling(sampling, atm.n_scales) self._set_up(algorithm_cls)