Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notadirectoryerror: [winerror 267] the directory name is invalid: 'd:\\python\\training imagelabel\\trainer.yml' #186

Open
kyomyboo opened this issue May 14, 2020 · 0 comments

Comments

@kyomyboo
Copy link

hi,
can you help me with this?. i was trying to set th Path with (D:\Phyton\TrainingImageLabel\Trainner.yml) but it was getting error

def TrainImages():
recognizer = cv2.face_LBPHFaceRecognizer.create()
detector=cv2.CascadeClassifier('D:\opencv\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml')
Path = r"D:\Phyton\TrainingImageLabel\Trainner.yml"
face,Id= getImagesAndLabels(Path)
recognizer.train(faces,np,array(Id))
recognizer.save("TrainingImageLabel\Trainner.yml")
res = "Image Trained"#+','.join(str(f) for f in Id)
message.configure(text=res)

def getImagesAndLabels(path):
imagePaths=[os.path.join(path,f) for f in os.listdir(path)]
faces = []
Ids = []
for imagePath in imagePaths:
pilImage=Image.open(imagePath).convert('L')
imageNp=np.array(pilImage,'uint8')
Id=int(os.path.split(imagePath)[-1].split(".")[1])
faces.append(imageNp)
Ids.append(Id)
return faces,Ids

stack
stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant