コード例 #1
0
ファイル: lbp.py プロジェクト: heynemann/frec
class Recognizer(object):
    def __init__(self, size=(50, 50)):
        feature = ChainOperator(TanTriggsPreProcessing(), LBP())
        classifier = NearestNeighbor(dist_metric=ChiSquareDistance())

        self.predictor = PredictableModel(feature, classifier)

        self.dataSet = DataSet(size=size)
        self.compute()

    def compute(self):
        people = []
        photos = []

        for person in self.dataSet.data.keys():
            people.append(person)
            photos.append(self.dataSet.data[person])

        self.predictor.compute(photos, np.array(people))

    def recognize(self, image):
        return self.predictor.predict(image.grayscale().to_array())

    def train(self, person, images):
        self.dataSet.train(person, images)
コード例 #2
0
ファイル: lbp.py プロジェクト: heynemann/frec
    def __init__(self, size=(50, 50)):
        feature = ChainOperator(TanTriggsPreProcessing(), LBP())
        classifier = NearestNeighbor(dist_metric=ChiSquareDistance())

        self.predictor = PredictableModel(feature, classifier)

        self.dataSet = DataSet(size=size)
        self.compute()