Admin Panel
Role-based Management Console for face registration and database training in VisionLog - AI Attendance
The VisionLog Admin Panel (/admin) is a protected management console accessible only to users with the admin role. It provides a centralized interface for registering new identities into the face database and managing the recognition engine's training databases.
Access Control
The /admin route is role-protected. Attempting to access it without admin privileges redirects to an Unauthorized Access page.
| Role | Access to /admin | Description |
|---|---|---|
admin | ✅ Allowed | Full access to Management Console |
user | ❌ Blocked | Redirected to /unauthorized |
Roles are defined per user in the backend authorized_users.json configuration file. Each user entry specifies a role, a realm (organization), and a list of resources (face databases) they have access to.
{
"email": "example@domain.com",
"role": "admin",
"realm": "Organization_Name",
"resources": ["org_employees"],
"active_resources": ["org_employees"]
}Management Console Overview
Once inside, the admin sees the Management Console header with a live status pill showing:
- Active Databases — currently loaded
.pklface database names - Registered Face Count — total number of enrolled identities
A Refresh Cache button is also available in the header to instantly clear the recognizer's in-memory cache and reload it from disk — useful after manual file changes or new enrollments.
The console is divided into two tabs:
| Tab | Icon | Purpose |
|---|---|---|
| Face Registration | UserPlus | Register new persons into the face image store |
| Database Training | Database | Build or rebuild recognition .pkl databases |
Tab 1: Face Registration
The Face Registration tab walks the admin through a 3-step wizard to register a new person into the system.
Step 1 — Select Folder
The admin selects a category folder (top-level organizational directory on the server) from a card grid. Each card shows:
- 📁 Folder name
- Number of people already in that folder
The admin can also create a new sub-folder inside the selected category directly from this step, without leaving the wizard.
| Action | Description |
|---|---|
| Select category card | Chooses the parent directory for the new person |
| Create Sub-Folder | Creates a nested subdirectory inside the selected category |
Step 2 — Enter Identity Details
| Field | Description |
|---|---|
| Optional Sub-Folder | An optional nested section inside the selected category (e.g., a department code like ABC) |
| Identity / Name | The person's identifier — used as the folder name and recognition label (e.g., John_Doe) |
Note: Use underscores instead of spaces (e.g.,
John_Doe). Names are case-sensitive and must be consistent with other enrolled identities.
Step 3 — Upload Images
The admin uploads one or more face images for the new person via a drag-and-drop / file-browse area.
| Option | Description |
|---|---|
| Browse Files | Select multiple face images (JPG, PNG, WEBP, etc.) |
| Save images only checkbox | If checked, images are saved to disk but the active recognition database is not updated immediately. Useful for batch enrollment before a scheduled retrain. |
Once confirmed, the system calls the /api/faces/register endpoint, which:
- Saves the uploaded images to the correct folder path:
<category>/<sub_folder?>/<name>/ - Extracts 512-dimensional ArcFace embeddings from each image
- Averages embeddings across all samples for robustness
- Updates the active face database (unless Save images only was checked)
Result messages:
- ✅
Success— Person registered with confirmation message - ❌
Error— Displays reason (e.g., no face detected, duplicate name)
Tab 2: Database Training
The Database Training tab allows admins to build or rebuild face recognition databases (.pkl files) from the stored image folders. This is necessary when:
- New persons have been registered with Save images only
- Bulk image changes have been made directly on the server
- A completely fresh database needs to be created
Configuration Options
| Setting | Options | Description |
|---|---|---|
| Target Database | Existing .pkl files or ➕ Create New Database... | The database file to write into |
| New Database Name | Free text | Only shown when "Create New" is selected. Saved as <name>.pkl |
| Source Images Folder | Category dropdown | The folder of person images to train from |
| Mapping Strategy | Individual / Grouped | Controls how folder structure maps to identities |
| Full Rebuild checkbox | On/Off | If checked, wipes the target database before training (clean slate) |
Mapping Strategies
| Strategy | Folder Structure Expected | Result |
|---|---|---|
| Individual | category/PersonName/ (sub-folders as people) | Each sub-folder → one identity |
| Grouped | category/ (folder name = person) | The category folder itself is treated as one identity |
Training Process
Clicking Start Rebuild triggers a POST to /api/admin/train with the selected configuration. The backend:
- Scans the source folder for person images
- Detects and extracts ArcFace embeddings for each face
- Writes the averaged embeddings into the target
.pkldatabase - Returns a result summary
Training result output:
| Field | Description |
|---|---|
processed_people | Number of unique identities enrolled |
database | Name of the .pkl file written |
total_registered | Total embedding count in the database |
Database Management
After training, all available .pkl databases are listed. Each entry shows:
- Database file name (
<name>.pkl) - Whether it is currently ACTIVE (highlighted)
- An ACTIVATE button to switch the live recognition engine to a different database
Activating a database calls
/api/admin/databases/activeand triggers a global state refresh across the application — the recognition engine immediately begins using the newly activated database for all subsequent operations.
Admin API Endpoints
The following backend API routes power the Admin Panel:
| Method | Endpoint | Description |
|---|---|---|
GET | /api/admin/status | Returns active databases, registered face count |
GET | /api/admin/categories | Lists all category folders available on the server |
GET | /api/admin/databases | Lists all .pkl database files |
POST | /api/admin/categories | Creates a new sub-folder inside a category |
POST | /api/faces/register | Registers a new person with uploaded face images |
POST | /api/admin/train | Builds or rebuilds a recognition database |
POST | /api/admin/databases/active | Sets a specific database as the active one |
POST | /api/admin/cache/clear | Clears in-memory recognizer cache and reloads from disk |
Workflow Example
Scenario: A new employee joins the organization and needs to be added to the attendance system.
- Navigate to
/admin(requires admin login) - Go to the Face Registration tab
- Step 1 — Select the organization's category folder (e.g.,
Citrus_Informatics) - Step 2 — Enter the person's name (e.g.,
Alice_Sharma) - Step 3 — Upload 3–5 clear face photos → click Confirm Registration
- Switch to the Database Training tab
- Select the existing database (e.g.,
Citrus_employees) and the same source folder - Choose Individual mapping strategy
- Click Start Rebuild — training completes and the database is updated
- The new employee is immediately recognized in live attendance sessions
Troubleshooting
"Redirected to Unauthorized Access"
- Confirm your account has
"role": "admin"inauthorized_users.json - Log out and log back in to refresh your session token
"No face detected" during registration
- Ensure the uploaded image has a clearly visible, front-facing face
- Minimum face size: 50 pixels
- Avoid dark, blurry, or heavily occluded images
Training returns 0 processed people
- Verify the source folder contains correctly organized sub-folders
- Ensure person sub-folders each contain at least one valid image
- Check that the selected Mapping Strategy matches your folder structure
Cache not updating after new enrollment
- Click Refresh Cache in the Management Console header
- This forces the recognition engine to reload the database from disk
.png)