{"id":20433465,"url":"https://github.com/wijez/face_recognition_tool","last_synced_at":"2026-06-06T00:31:46.956Z","repository":{"id":245260817,"uuid":"816909137","full_name":"wijez/Face_Recognition_Tool","owner":"wijez","description":" Timekeeping","archived":false,"fork":false,"pushed_at":"2024-06-21T03:00:58.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-07T12:27:28.551Z","etag":null,"topics":["computer-vision"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wijez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-18T16:19:47.000Z","updated_at":"2024-06-25T08:50:42.000Z","dependencies_parsed_at":"2024-06-21T00:44:56.007Z","dependency_job_id":"58ae0d76-cd28-407b-9bc9-596b90a83b8b","html_url":"https://github.com/wijez/Face_Recognition_Tool","commit_stats":null,"previous_names":["viet-gitl/face_recognition_tool","wijez/face_recognition_tool"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wijez/Face_Recognition_Tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wijez%2FFace_Recognition_Tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wijez%2FFace_Recognition_Tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wijez%2FFace_Recognition_Tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wijez%2FFace_Recognition_Tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wijez","download_url":"https://codeload.github.com/wijez/Face_Recognition_Tool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wijez%2FFace_Recognition_Tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33965591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision"],"created_at":"2024-11-15T08:19:17.382Z","updated_at":"2026-06-06T00:31:46.949Z","avatar_url":"https://github.com/wijez.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face_Recognition_Tool\n\nMột công cụ đơn giản bằng Python để nhận dạng khuôn mặt và điểm danh sử dụng thư viện `face_recognition` (dựa trên dlib) và OpenCV.\n\nNội dung\n- main.py — so sánh hai ảnh tĩnh, hiển thị khung khuôn mặt và khoảng cách giữa 2 encoding\n- attendance.py — mở webcam, nhận diện theo ảnh mẫu trong thư mục `training/` và ghi thời gian điểm danh vào `output/data.csv`\n\nYêu cầu\n- Python 3.7+\n- CPU có khả năng build C/C++ (nếu cần build dlib từ nguồn) hoặc dùng wheel/channels phù hợp\n- Thư viện Python:\n  - numpy\n  - opencv-python\n  - face_recognition (cần dlib)\n\nCài đặt (khuyến nghị dùng virtualenv hoặc conda)\n1. Tạo môi trường ảo (ví dụ với venv)\n   - python -m venv .venv\n   - source .venv/bin/activate  (Linux/macOS) hoặc .venv\\Scripts\\activate (Windows)\n\n2. Cài dependencies cơ bản\n   - pip install --upgrade pip\n   - pip install numpy opencv-python\n\n3. Cài dlib / face_recognition\n   - Thử cài trực tiếp (nếu hệ thống có build tools):\n     - pip install dlib\n     - pip install face_recognition\n   - Nếu gặp lỗi khi build dlib:\n     - Trên Windows: cài Visual Studio Build Tools hoặc dùng wheel sẵn (tìm từ các nguồn wheel tương thích với phiên bản Python).\n     - Hoặc dùng conda: conda install -c conda-forge dlib face_recognition\n   - Lưu ý: face_recognition phụ thuộc nặng vào dlib; nếu bạn chỉ thử nghiệm, tìm wheel phù hợp thường nhanh hơn.\n\nCấu trúc thư mục mẫu\n- training/\n  - alice.jpg\n  - bob.jpg\n  (Tên file không chứa phần mở rộng chính là tên đối tượng được sử dụng để ghi điểm danh)\n- output/\n  - data.csv  (script sẽ mở file này để ghi; tốt nhất tạo trước hoặc script sẽ ghi nếu file tồn tại)\n- main.py\n- attendance.py\n- README.md\n\nChuẩn bị dữ liệu\n- Đặt ảnh mẫu vào `training/`. Mỗi ảnh tương ứng 1 người (hiện tại code lấy encoding[0] — giả định mỗi ảnh chứa đúng 1 khuôn mặt).\n- Tên file (không bao gồm phần mở rộng) sẽ là tên được hiển thị và ghi vào file CSV.\n\nCách chạy\n- So sánh 2 ảnh tĩnh (main.py)\n  - python main.py\n  - main.py hiện tại sử dụng đường dẫn hardcode:\n    - \"training/lizkimcuong.jpg\" và \"training/bichphuong2.jpg\"\n  - Kết quả: hiển thị 2 cửa sổ ảnh với khung khuôn mặt và in kết quả so sánh + khoảng cách (face distance)\n\n- Điểm danh realtime từ webcam (attendance.py)\n  - Đảm bảo có thư mục `training/` với ảnh mẫu và thư mục `output/` (với file data.csv)\n  - python attendance.py\n  - Mở webcam (device 0), nhận diện các khuôn mặt trên khung hình, nếu trùng khớp sẽ:\n    - Vẽ khung và tên lên khung hình\n    - Ghi một dòng mới vào `output/data.csv` theo định dạng: `Name,HH:MM:SS`\n  - Nhấn `q` để thoát\n\nGiải thích kỹ thuật ngắn gọn\n- face_recognition.face_locations: tìm vị trí khuôn mặt trong ảnh\n- face_recognition.face_encodings: chuyển khuôn mặt thành vector đặc trưng (encoding)\n- face_recognition.compare_faces: so sánh encoding để trả True/False\n- face_recognition.face_distance: trả khoảng cách (số càng nhỏ =\u003e càng giống)\n- attendance.py giảm kích thước khung hình xuống 0.25 trước khi xử lý để cải thiện tốc độ\n\nVấn đề thường gặp \u0026 khắc phục\n- Lỗi cài đặt dlib: cần cài build tools (Windows: Visual C++ Build Tools; Linux: build-essential, cmake); hoặc dùng conda/ prebuilt wheel.\n- Webcam không mở: kiểm tra device index (thay `cv2.VideoCapture(0)` thành `1` hoặc khác), kiểm tra quyền truy cập camera.\n- Ảnh mẫu không có face =\u003e face_encodings trả rỗng. Kiểm tra ảnh, ánh sáng, góc chụp.\n- Nhiều khuôn mặt trong ảnh mẫu: hiện tại code chỉ lấy encoding[0]; nếu ảnh có nhiều khuôn mặt, nên tách ảnh hoặc chọn chính xác khuôn mặt mẫu.\n- Hiệu năng chậm: giảm kích thước ảnh, chạy trên máy có GPU/DNN hoặc dùng model nhẹ hơn.\n\nGợi ý cải tiến (nên làm)\n- Chuyển đường dẫn ảnh sang tham số CLI hoặc config file (ví dụ argparse).\n- Tự động tạo thư mục `output/` và file `data.csv` nếu chưa tồn tại.\n- Thêm ngưỡng (threshold) cho face_distance để điều chỉnh độ chính xác.\n- Thêm logging thay vì print.\n- Hỗ trợ nhiều ảnh mẫu / đa encoding cho từng người để tăng độ chính xác.\n- Xử lý trường hợp nhiều khuôn mặt trong 1 ảnh mẫu.\n- Thêm unit tests và hướng dẫn deploy lên Raspberry Pi (nếu muốn dùng offline).\n\nMẫu file CSV (output/data.csv)\nName,Time\nALICE,08:45:12\nBOB,08:47:02\n\nGiấy phép\n- Không có file LICENSE trong repo gốc. Nếu bạn muốn công khai/ sử dụng lại, hãy thêm file LICENSE phù hợp (ví dụ MIT).\n\nĐóng góp\n- Bạn có thể mở issue hoặc gửi PR để thêm tính năng: cấu hình, cải thiện cài đặt dlib, hỗ trợ nhiều khuôn mặt/multi-encoding, v.v.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwijez%2Fface_recognition_tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwijez%2Fface_recognition_tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwijez%2Fface_recognition_tool/lists"}