Beispiel #1
0
def train(img_generator):
    # clean up the images with the standard menpo pre-processing
    images = [menpo_img_process(img) for img in img_generator]
    fitter = SDMTrainer(normalization_diagonal=150,
                        downscale=1.1,
                        n_perturbations=15).train(images, group='gt',
                                                  verbose=True)

    # return a callable that wraps the menpo fitter in order to integrate with
    # menpobench
    return MenpoFitWrapper(fitter)
Beispiel #2
0
def train(img_generator):
    # clean up the images with the standard menpo pre-processing
    images = [menpo_img_process(img) for img in img_generator]
    fitter = SDMTrainer(normalization_diagonal=150,
                        downscale=1.1,
                        n_perturbations=15).train(images,
                                                  group='gt',
                                                  verbose=True)

    # return a callable that wraps the menpo fitter in order to integrate with
    # menpobench
    return MenpoFitWrapper(fitter)
Beispiel #3
0
def train(img_generator):
    # clean up the images with the standard menpo pre-processing
    images = [menpo_img_process(img) for img in img_generator]
    # build the AAM
    # TODO implement settings for strongest AAM we can for menpofit
    aam = AAMBuilder(features=fast_dsift,
                     normalization_diagonal=120).build(images, verbose=True,
                                                       group='gt')
    fitter = LucasKanadeAAMFitter(aam, n_shape=[3, 6, 12],
                                  n_appearance=0.9)

    # return a callable that wraps the menpo fitter in order to integrate with
    # menpobench
    return MenpoFitWrapper(fitter)
Beispiel #4
0
 def __call__(self, img_generator):
     from menpo.transform import AlignmentSimilarity
     results = []
     ref_shape = self.fitter.reference_shape
     for img in img_generator:
         # note that we don't want to crop the image in our preprocessing
         # that's because the gt on the image we are passed is what will
         # be used for assessment - we will introduce large errors if this
         # is modified in size.
         img = menpo_img_process(img, crop=False)
         bbox = img.landmarks['bbox'].lms
         shape_bb = ref_shape.bounding_box()
         init_shape = AlignmentSimilarity(shape_bb, bbox).apply(ref_shape)
         menpofit_fr = self.fitter.fit(img, init_shape)
         results.append(menpofit_to_result(menpofit_fr))
     return results
Beispiel #5
0
 def __call__(self, img_generator):
     from menpo.transform import AlignmentSimilarity
     results = []
     ref_shape = self.fitter.reference_shape
     for img in img_generator:
         # note that we don't want to crop the image in our preprocessing
         # that's because the gt on the image we are passed is what will
         # be used for assessment - we will introduce large errors if this
         # is modified in size.
         img = menpo_img_process(img, crop=False)
         bbox = img.landmarks['bbox'].lms
         shape_bb = ref_shape.bounding_box()
         init_shape = AlignmentSimilarity(shape_bb, bbox).apply(ref_shape)
         menpofit_fr = self.fitter.fit(img, init_shape)
         results.append(menpofit_to_result(menpofit_fr))
     return results