Facial Recognition With Raspberry Pi and OpenCV

i tried it too but instead it save’s a log file then print on terminal the name it detect including the date and time.

add these line to the top.
from datetime import datetime
import logging as log

log.basicConfig(filename='FILNAME.log',level=log.INFO)


#try to find these block of code and paste this

if True in matches:
			# find the indexes of all matched faces then initialize a
			# dictionary to count the total number of times each face
			# was matched
			matchedIdxs = [i for (i, b) in enumerate(matches) if b]
			counts = {}

			# loop over the matched indexes and maintain a count for
			# each recognized face face
			for i in matchedIdxs:
				name = data["names"][i]
				counts[name] = counts.get(name, 0) + 1

			# determine the recognized face with the largest number
			# of votes (note: in the event of an unlikely tie Python
			# will select first entry in the dictionary)
			name = max(counts, key=counts.get)
			#print ("*********************************")
			#log.info('*********************************')
			print(counts)
			log.info(counts)
			log.info('Recognize Current Time') 		
			print(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
			log.info(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
			print ("*********************************")
			log.info('*********************************')	
			#If someone in your dataset is identified, print their name on the
2 Likes