ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.28k stars 13.48k forks source link

Error when using the trainer script #969

Open MiguelAlatorre0145 opened 4 years ago

MiguelAlatorre0145 commented 4 years ago

Hello all, I want to start off by saying I'm still fairly new to python so I apologize if I don't fully understand things. I plan to have a Khadas VIM3 (single board computer) run facial recognition on some recordings from a local server. The thing is, not many faces are seen / correctly identified, so I decided to try and train it. The problem arises when I run the actual script. For what ever reason, the clf.fit(encodings, names) section always returns an error, saying that it expects a number, not a string. I'm really not sure what the error here is. Here is the actual output :

Traceback (most recent call last):
  File "Training.py", line 65, in <module>
    clf.fit(encodings,names)
  File "/usr/lib/python3/dist-packages/sklearn/svm/base.py", line 187, in fit
    fit(X, y, sample_weight, solver_type, kernel, random_seed=seed)
  File "/usr/lib/python3/dist-packages/sklearn/svm/base.py", line 254, in _dense_fit
    max_iter=self.max_iter, random_seed=random_seed)
  File "sklearn/svm/libsvm.pyx", line 58, in sklearn.svm.libsvm.fit
TypeError: must be real number, not str

Any and all help is much appreciated!

SaddamBInSyed commented 4 years ago

Hi there, Did you solve this? if so what causes this pbm?

please advise @ageitgey @AnandBaburajan

lanzani commented 4 years ago

Hi! I swear you are doing great with your python projects! Have you made any changes to the exemple code? If so, can you share it?

Anyway: Try to change the "gamma="scale"" parameter when initializing the SVC from "scale" to 0.001: clf = svm.SVC(gamma=0.001)`

If this doesn't work try to share the code.

Bye 👋