mchuca's picture
Add files using upload-large-folder tool
5a26b95 verified
|
Raw History Blame Contribute Delete
6.35 kB

FaceAttend for Windows

FaceAttend is a face-recognition attendance system for RTSP cameras. It records check-in and check-out automatically when people walk past a camera.

  • Runs on Windows 10/11 64-bit with a normal CPU; no graphics card needed.
  • Python 3.9.9 with PyQt5.
  • Five face-recognition models to choose from, each as ONNX or the PyTorch model.

Install

  1. Download this repository from https://huggingface.co/mchuca/AttendanceSystem. You need these three folders, in the same layout:

    AttendanceSystem(window)\   this project
    packages\windows\          Python 3.9.9 installer, Visual C++ runtime, all Python packages
    models\                    face recognition models
    
  2. Double-click AttendanceSystem(window)\setup.bat. It needs no internet when packages\windows is present. It does four things:

    • uses Python 3.9.9 if it is already installed; otherwise it installs 3.9.9 for your user into its own folder, %LOCALAPPDATA%\Programs\Python\Python399. The app runs on exactly this version, so another Python 3.9.x is not used;
    • installs the Microsoft Visual C++ runtime, which PyTorch and ONNX Runtime need;
    • creates .venv and installs the Python packages from packages\windows;
    • copies the models into the project's models folder.
  3. Start the app with run.bat. run_console.bat does the same but keeps a console open with log messages, which helps when something goes wrong.

On the first start you create the admin login.

First steps

  1. Cameras β†’ Add camera β†’ enter the RTSP address and pick a role, then press Test connection.
    • Hikvision: rtsp://user:pass@192.168.1.64:554/Streaming/Channels/101
    • Dahua: rtsp://user:pass@IP:554/cam/realmonitor?channel=1&subtype=0
    • A USB webcam: 0. A video file: its path.
  2. Employees β†’ Add employee β†’ Enroll (camera) (the person turns their head slowly) or Enroll (photos).
  3. Live monitor β†’ Start monitoring.
  4. Attendance β†’ daily records with absent people, the recognition log, the monthly summary, manual corrections, and CSV / Excel export.
Camera role Behaviour
Entry the first sighting of the day is the check-in
Exit every sighting updates the check-out; the last one of the day counts
Both the first sighting is the check-in; a sighting at least Check-out min gap later is the check-out

A check-in after Work starts plus the Late after grace minutes is marked Late.

Recognition models (Models page)

Model Accuracy Speed on CPU Size License
FaceNet Β· VGGFace2 (default) β˜…β˜…β˜…β˜…β˜† β˜…β˜…β˜…β˜†β˜† 90 MB MIT
FaceNet Β· CASIA-WebFace β˜…β˜…β˜…β˜†β˜† β˜…β˜…β˜…β˜†β˜† 90 MB MIT
ArcFace Β· ResNet-50 (InsightFace) β˜…β˜…β˜…β˜…β˜… β˜…β˜†β˜†β˜†β˜† 166 MB non-commercial research only
ArcFace Β· MobileFaceNet (InsightFace) β˜…β˜…β˜…β˜…β˜† β˜…β˜…β˜…β˜…β˜… 13 MB non-commercial research only
SFace (OpenCV Zoo) β˜…β˜…β˜…β˜†β˜† β˜…β˜…β˜…β˜…β˜† 37 MB Apache-2.0
  • Formats: each model can run with ONNX Runtime (faster on CPU) or as the PyTorch .pt model.
    • For FaceNet the .pt file is the original release, and the ONNX version is converted from it.
    • ArcFace and SFace were released as ONNX. Their .pt files are TorchScript conversions.
    • Both formats give the same results.
  • Switching models: enrolled faces are converted automatically, so nobody has to enroll again.
  • Missing files: a model that isn't on the PC is downloaded from its official source when you select it, and its checksum is checked. prepare_models.bat fetches every model in both formats in advance.
  • Commercial use: the ArcFace models are licensed for non-commercial research only. For commercial use, choose FaceNet or SFace.
  • Thresholds: each model has its own match threshold, track gate and same-person similarity, under Settings β†’ Recognition.

Tuning

Setting Default Notes
Match threshold per model Raise it if strangers get recognized; lower it if staff stay "Unknown".
Votes needed to confirm 3 of 7 More votes means fewer false marks but slightly slower confirmation.
Recognition passes / s / camera 5 On a typical CPU, one camera gets about 2–5 passes per second. ArcFace MobileFaceNet is the lightest model for several cameras.
Detection image max side 960 px Lower it for speed, raise it when faces are small in the picture.
CPU threads 0 (auto) Limit it if other programs need CPU time.

Troubleshooting

  • The app doesn't start: run run_console.bat and read the message. Also check logs\app.log.
  • Setup says another Python 3.9.x is installed: Windows keeps only one Python 3.9 per user, so the 3.9.9 installer would replace that version. Setup stops instead of doing that. Uninstall the other version yourself if you agree, then run setup.bat again.
  • "DLL load failed" for torch or onnxruntime: install the Visual C++ runtime (packages\windows\vc_redist.x64.exe).
  • A camera doesn't connect: check the address in VLC first, and allow the app through Windows Firewall. Settings β†’ RTSP transport can be switched to udp.
  • A USB webcam opens slowly or not at all: close other programs that use the camera.

Files

Path What it is
main.py start-up: logging, login, window
core.py everything except the GUI: settings, SQLite database, RTSP capture, face detection (MTCNN), the recognition models (ONNX / PyTorch), matching, tracking, attendance rules, reports
gui.py the PyQt5 window and its pages
convert.py model conversion: FaceNet .pt β†’ ONNX and ONNX β†’ TorchScript .pt, each checked against its source
setup.bat, run.bat, run_console.bat, prepare_models.bat install and start
tests\ unit tests (.venv\Scripts\python -m pytest tests)

The app creates these at runtime:

  • config\settings.json;
  • data\attendance.db;
  • data\snapshots\, data\unknown\ and data\faces\ for face pictures;
  • logs\app.log.

Face pictures and face embeddings are personal (biometric) data. Restrict access to the data folder, and inform the people concerned and ask for their consent as your local law requires.