There is a new module that has been developed to simplify computer vision and face recognition using USB cameras on the Raspberry Pi 400. There is a video tutorial here, but there are parts that are hard to follow due to the fuzzy screen resolution on the video. The following instructions will help you install it on your system.
Step 1. There are three python files that you'll need to use. Download them and save them in the directory with your other python files.
(a) face_shot.py
(b) train_model.py
(c) face_rec.py
Next, you'll have to run the following scripts from the command line:
Step 2. pip3 install imutils
Step 3. pip3 install face-recognition
Step 4. The steps to install OpenCV are detailed and must be followed exactly! The entire process will take about 90 minutes, but most of it can execute in the background while you use your computer for other things. The details an be found here
Once all files are installed, you'll run the programs that you downloaded above. First, run face_shot.py to capture about twenty differennt images of your face looking into the camera. You'll press the space key on the keyboard to take each picture,
Next, train your model by running train_model.py. This needs no interaction from the user, and will use the pictures you shot to train the model for your (and others' if you want) faces.
Finally, run face_rec.py to identify the faces of people who look into your camera. It will only recognize people who you've trained the system for, but you can add more people to your database by following the previous two steps.
Face recognition is a fascinating topic. There is a very detailed discussion of techniques and history on the subject here. Highly recommended!