Age Detection from Human Face Images using Python Open-CV | deep learning | Age Detection | python

Published: 01 January 1970
on channel: Green Light Coding
36
2

Green Light Coding presents a new video which shows how to make an application for Age Detection using OpenCV-Python and dlib in python language. Tkinter GUI is required to make it user friendly.

-- Scroll below to get the code --


Watch the full video and code it yourself .

people searches for:

person detection opencv python, python programming, cat face detection, face recognition python, object detection using opencv python, face detection using python, opencv-python, tkinter python tutorial, face detection, haarcascade xml, 🐱, 🐱 cat, cat, image recognition python, object detection, python face recognition, face detection python, image recognition python, age detection,
python age detection, python dlib,

Facial Recognition attendance system using python
_____________________________________________________________
Stay connected to us for more necessary coding tricks like these.
_____________________________________________________________

code:
import cv2
import dlib
import numpy as np
import tkinter as tk
from tkinter.filedialog import askopenfilename as aof
from tkinter import PhotoImage


t=tk.Tk()
t.geometry('500x300')
t.title('AGE DETECTOR')
t.config(bg="grey")
def openfile():
img=cv2.imread(aof())
img = cv2.resize(img, (600, 600))
frame = img.copy()

age_weights = "age_net.caffemodel"
age_config = "age_deploy.prototxt"
age_Net = cv2.dnn.readNet(age_config, age_weights)

ageList = ['(0-2)', '(4-6)', '(8-12)', '(15-20)', '(25-32)', '(38-43)', '(48-53)', '(60-75)','(80-100)']
model_mean = (78.4263377603, 87.7689143744, 114.895847746)

fH = img.shape[0]
fW = img.shape[1]

Boxes = []
mssg = 'Face Detected'

face_detector = dlib.get_frontal_face_detector()
img_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

faces = face_detector(img_gray)

if not faces:
mssg = 'No face detected'
cv2.putText(img, f'{mssg}', (40, 40), cv2.FONT_HERSHEY_SIMPLEX, 2, (200), 2)
cv2.imshow('Age detected', img)
cv2.waitKey(0)
else:
for face in faces:
x = face.left()
y = face.top()
x2 = face.right()
y2 = face.bottom()

box = [x, y, x2, y2]
Boxes.append(box)
cv2.rectangle(frame, (x, y), (x2, y2), (255, 100, 0), 2)

for box in Boxes:
face = frame[box[1]:box[3], box[0]:box[2]]
blob = cv2.dnn.blobFromImage(face, 1.0, (227, 227), model_mean, swapRB=False)
age_Net.setInput(blob)
age_preds = age_Net.forward()
age = ageList[age_preds[0].argmax()]
cv2.putText(frame, f'{mssg}:{age}', (box[0]-40, box[1] - 20), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 100, 0), 2, cv2.LINE_AA)
cv2.imshow("Detecting Age", frame)
cv2.waitKey(0)

bt=tk.Button(t, text="Browse For Age-Detection", bd=10, font=("cambria", 12, "bold"), fg="black", bg='white', height=3, width=25,command = openfile)
bt.place(x=120,y=100)
h=tk.Label(t,text="CLICK THE BUTTON TO PROCEED", font=("century",12,"bold"), fg="white", bg='grey')
h.place(x=80,y=30)






________________________________________________________
#coding #codinglife #python #batchfile #scripting #pythonprogramming #pythontutorial #pythonforbeginners #commandprompt #primenumber
#fontsize #cmd #functions #console #programming #programminglife
#opencvpython #cv2 #catface #facedetection #machinelearning #artificialintelligence #visualstudio


LINK FOR BATCH SERIES PLAYLIST :
   / @greenlightcoding613  
_______________________________________________________________

SUBSCRIBE FOR MORE UPDATES LIKE THESE
_______________________________________________________________
CHANNEL LINK :    / @greenlightcoding613  
_______________________________________________________________


On this page of the site you can watch the video online Age Detection from Human Face Images using Python Open-CV | deep learning | Age Detection | python with a duration of hours minute second in good quality, which was uploaded by the user Green Light Coding 01 January 1970, share the link with friends and acquaintances, this video has already been watched 36 times on youtube and it was liked by 2 viewers. Enjoy your viewing!