The code of v_0.0 only allows you to recognize faces from a webcam
The code of v_1.0 allows you to find and recognize faces in a video conference, as well as count the time of presence on the video using facenet_pytorch (MTCNN, InceptionResnetV1) and OpenCV.
- Added YoloV5_face for face recognition
-
Cloning a repository:
git clone https://github.com/mkgs210/face_recognition
-
Installing the required libraries:
#facenet-pytorch==2.5.2 #opencv-python==4.6.0.66 #pandas==1.5.1 #matplotlib==3.6.2 pip install -r requirements.txt
-
Running the program with default options:
python main.py
Passed parameters:
-hor--helpDisplays description of all passed parameters-pcpor--photo_catalog_pathThe path to the photo folder. Inside this directory there should be signed folders with photos of people who will be present in the video (default=photos)-udor--update_dataUpdates/Creates a file data.pt (call when updating photos). This file contains encoded faces of people (embeddings)(default=True)-dpor--data_pathPath to the directory where the data.pt file is located (default=- the folder where the program is located)-wcor--web_camReading video from a webcam. Time log files will not be created (default=False)-ivpor--input_video_pathFull path to input video (default=video.mp4)-dvor--do_videoTrue - create a video in which all found and recognized faces will be marked. False - do not create (default=False)-ovpor--output_video_pathFull path of output video with tagged faces (default=new_video.mp4)
An example of calling a program with parameters: python main.py -pcp photos -ud True -ivp video.mp4 -dv True -ovp new_video.mp4
At the first start, the InceptionResnetV1_VGGFace2 folder will be created and the InceptionResnetV1-vggface2 model will be loaded into it
At the end of the program, 4 files will be created:
- Time_{
--input_video_path}.csv - file with calculated presence time on video
- Time_drop0_{
--input_video_path}.csv - file with calculated time of presence on the video (values with zero time are discarded)
- barh_{
--input_video_path}.jpg - a bar graph showing the percentage of time each person is present
- pie_{
--input_video_path}.jpg - a pie chart showing the presence time of video participants relative to each other
Also, --do_video True will create a video called --output_video_path (default=new_video.mp4)



