Add real time recognition

how to add real time (from webcam) recognition to facenet-pytorch library ?
i working on facenet ?

You need to do this (using OpenCV):

import cv2 as cv

cap = cv.VideoCapture(0)
while True:
    ret, frame =
    frame = cv.resize(frame, None, fx=0.5, fy=0.5, interpolation=cv2.INTER_AREA)
    image = predict_draw_bounding_box(frame)
    cv.imshow('Output', image)
    c = cv.waitKey(1)
    if c == 27:

You need to create the predict_draw_bounding_box function to receive the frame and return the frame processed.

1 Like

can guide me to create predict function please , i should complete my final year projects in these days please