serengil / tensorflow-101

TensorFlow 101: Introduction to Deep Learning

Home Page:https://www.youtube.com/watch?v=YjYIMs5ZOfc&list=PLsS_1RYmYQQGxpKV44jsxXNgjEpRoW61w&index=2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xml not found

Visioweb opened this issue · comments

Where is C:/ProgramData/Anaconda3/envs/tensorflow/Library/etc/haarcascades/haarcascade_frontalface_default.xml????

It is where opencv installed. You can find it as illustrated below.

import cv2
def get_opencv_path():
	opencv_home = cv2.__file__
	folders = opencv_home.split(os.path.sep)[0:-1]
	
	path = folders[0]
	for folder in folders[1:]:
		path = path + "/" + folder

	face_detector_path = path+"/data/haarcascade_frontalface_default.xml"
	eye_detector_path = path+"/data/haarcascade_eye.xml"
	
	if os.path.isfile(face_detector_path) != True:
		raise ValueError("Confirm that opencv is installed on your environment! Expected path ",face_detector_path," violated.")
	
	return path+"/data/"
print("your haarcascade xml is here: ", get_opencv_path())