normyx / MMM-Facial-Recognition-OCV3

MIT License
51 stars 18 forks source link

Problem with Training / tools.train.py #25

Open 666Necrom opened 5 years ago

666Necrom commented 5 years ago

Once again me ... another problem:

When i start training i get the following result: python tools.train.py

Pictures and names are recognized .. but then this follows:

Training model with threshold 80 Traceback (most recent call last): File "tools.train.py", line 14, in <module> ToolsTrain().train() File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/train.py", line 71, in train model = ToolsConfig.model() File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/config.py", line 99, in model return CommonConfig.model(cls.POSITIVE_THRESHOLD) File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/common/commonconfig.py", line 51, in model model = cv2.face.LBPHFaceRecognizer_create(threshold=thresh) AttributeError: 'module' object has no attribute 'face'

Blauenfeldt commented 5 years ago

Still nobody have found a way to this problem? I have it myself, and it's kinda annoying, after that i have been using multiple days to figure out the cv2 can't be found problem.

Blauenfeldt commented 5 years ago

I fixed the issue by replacing: cv2.face.LBPHFaceRecognizer_create(threshold=thresh) with: cv2.face.createLBPHFaceRecognizer(threshold=thresh) in the file: MMM-Facial-Recognition-OCV3/lib/common/commonconfig.py

JahFyahh commented 4 years ago

@Blauenfeldt your fix helped, but then I ended up with the following. Is there a solution for this one?

Training model with threshold 80 Traceback (most recent call last): File "tools.train.py", line 14, in ToolsTrain().train() File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/train.py", line 74, in train model.write(ToolsConfig.TRAINING_FILE) AttributeError: 'cv2.face_LBPHFaceRecognizer' object has no attribute 'write'

EDIT: Replacing model.write with model.save in the file /home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/train.py helped

Blauenfeldt commented 4 years ago

I got it all working that time. the problem is, as I can remember, that from Python, as it was programmed in, to Python3.1 there was some changes to got things are spelled. Like @JahFyahh said, "write" was used in Python, and in Python3.1 "save" is used instead. @666Necrom I think you can mark this as solved.