Home > other >  Opencv return to face data can only identify the existing face data identifies with strangers into t
Opencv return to face data can only identify the existing face data identifies with strangers into t

Time:09-26

If len (faceRects) & gt; 0:

For faceRect faceRects in:
X, y, w, h=faceRect
Facial image # submitted to model to identify who is this
L=len (faceRects) # (change) l is the number of recognize faces
Image=frame [y, y + h, x: x + w]
Cv2. PutText (f, face "count", (20, 20), cv2. FONT_HERSHEY_PLAIN, 2.0, (255, 255, 255), 2, 1) # (change) shows face count
Cv2. PutText (f, STR (l), (230, 20), cv2. FONT_HERSHEY_PLAIN, 2.0, (255, 255, 255), 2, 1) # (change) in the face after the cout is others face several
FaceID=model. Face_predict (image) # return forecast to faceID
Cv2. A rectangle (frame, (10 x -, y - 10), (+ w + 10 x, y + h + 10), color, thickness=2)
# face_id judgment (change)
For I in range (len (OS) listdir ('/face_data/'))) : # I was face_data file and label each face data under
If I==faceID:
# who is the tooltip
Cv2. PutText (frame, OS. Listdir ('/face_data/') [I],
(30, x + y + 30), # coordinates
Cv2 FONT_HERSHEY_SIMPLEX, # font
# 1, size
(255, 0, 255), # color
2) # line width
# is not equal to write a stranger
# the else:
# cv2. PutText (frame, 'stranger',
# (30, x + y + 30), # coordinates
# # cv2 FONT_HERSHEY_SIMPLEX, font
# 1, # size
# # (255, 0, 0), color
# 2) the line width of #
# pass
Cv2. Imshow (" login ", frame)

Existing weights trained face data file this is the last the main program I met problem of face recognition is facedata folder face data can identify but if you meet a stranger to identify will appear to identify the sample concentration face the situation of my idea is that if I value namely facedata folder face data labels is equal to the faceID face to predict the return value is then shows the label corresponding names but if I cancel the else comments will appear the phenomenon of each frame will have a stanger including identification of my own success cases will appear on the my name stanger this is how one and the same is a great god please guide if we can solve for a contact can be paid,

CodePudding user response:

Video is dynamic, there will be a motion blur lead to the recognition rate is not stable, with tracking, occasionally a few frames to identify less than not
  • Related