0

I ran into an error which i do not know where and what is causing it. Please i need help.

def train(self,images,lables, recogType=0):
        self.images = images
        self.lables = np.array(lables)

        'arg = recogType:[cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()'
        recogs = cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()
        self.recognizer = recogs[recogType]()    
        self.recognizer.train(self.images,self.lables)
Barrow
  • 29
  • 6
  • I'd guess change `self.recognizer = recogs[recogType]()` to `self.recognizer = recogs[recogType]` – doctorlove Apr 30 '19 at 09:30
  • @doctorlove i appreciate your quick reply to help, after changing self.recognizer = recogs[recogType]() to self.recognizer=recogs[recogType], this is the new error thrown: error: (-5:Bad argument) Empty training data was given. You'll need more than one sample to learn a model. in function 'train' – Barrow Apr 30 '19 at 09:41

1 Answers1

0

The specific problem is with this line:

self.recognizer = recogs[recogType]() 

By placing braces () on the end, you are trying to call the recognizer, as the error says. Change this to

self.recognizer = recogs[recogType]

//Disclaimer - there may be other problems.

doctorlove
  • 18,872
  • 2
  • 46
  • 62