A Telegram bot that recognizes faces from a live webcam feed and checks them against a list of known people — built as a simple attendance/presence tool.
It combines two models:
- A face detector (OpenCV DNN, Caffe-based) that finds where faces are in a frame.
- ArcFace (ONNX) that turns each detected face into a numeric "fingerprint" and compares it against known faces to identify who it is.
Once the bot is running and you open a chat with it on Telegram:
- Send
/start— you'll see three buttons:- List registered students — shows everyone the bot currently knows, by name.
- Check attendance (list) — takes a snapshot from the webcam and sends back a list marking each known person present (
+) or absent (-), plus a count of unrecognized faces. - Photo of the class — takes a snapshot, draws a labeled box around every face it finds (name + confidence, or "Unknown"), and sends you the annotated photo.
- Send
/aboutat any time for a short description of how the bot works.
Note: the bot only recognizes people whose photos were added before it was started — see Known limitations.
- Clone the repo and install dependencies:
pip install -r requirements.txt- Download
arcface.onnx— see MODEL_SETUP.md for instructions. (deploy.prototxtand the.caffemodelface detector are already included in this repo.) - Add a Telegram bot token: open
face_reco.pyand replacetoken = "YOUR TOKEN"with your own from @BotFather. - Add known faces: inside
known_faces/, create one folder per person, named after them, with one or more clear face photos inside: known_faces/ ├── John Smith/ │ └── photo1.jpg └── Bob Red/ └── photo1.jpg - Run it:
python face_reco.py- Known faces are loaded once, when the bot starts. Adding or removing photos in
known_faces/while it's running has no effect — restart to pick up changes. - Uses the machine's default webcam (
cv2.VideoCapture(0)), so it needs a device with a camera attached — not usable as-is on a headless/cloud server.
MIT — see LICENSE.