LogoVisionLog

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.

RoleAccess to /adminDescription
admin✅ AllowedFull access to Management Console
user❌ BlockedRedirected 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 .pkl face 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:

TabIconPurpose
Face RegistrationUserPlusRegister new persons into the face image store
Database TrainingDatabaseBuild 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.

ActionDescription
Select category cardChooses the parent directory for the new person
Create Sub-FolderCreates a nested subdirectory inside the selected category

Step 2 — Enter Identity Details

FieldDescription
Optional Sub-FolderAn optional nested section inside the selected category (e.g., a department code like ABC)
Identity / NameThe 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.

OptionDescription
Browse FilesSelect multiple face images (JPG, PNG, WEBP, etc.)
Save images only checkboxIf 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:

  1. Saves the uploaded images to the correct folder path: <category>/<sub_folder?>/<name>/
  2. Extracts 512-dimensional ArcFace embeddings from each image
  3. Averages embeddings across all samples for robustness
  4. 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

SettingOptionsDescription
Target DatabaseExisting .pkl files or ➕ Create New Database...The database file to write into
New Database NameFree textOnly shown when "Create New" is selected. Saved as <name>.pkl
Source Images FolderCategory dropdownThe folder of person images to train from
Mapping StrategyIndividual / GroupedControls how folder structure maps to identities
Full Rebuild checkboxOn/OffIf checked, wipes the target database before training (clean slate)

Mapping Strategies

StrategyFolder Structure ExpectedResult
Individualcategory/PersonName/ (sub-folders as people)Each sub-folder → one identity
Groupedcategory/ (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:

  1. Scans the source folder for person images
  2. Detects and extracts ArcFace embeddings for each face
  3. Writes the averaged embeddings into the target .pkl database
  4. Returns a result summary

Training result output:

FieldDescription
processed_peopleNumber of unique identities enrolled
databaseName of the .pkl file written
total_registeredTotal 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/active and 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:

MethodEndpointDescription
GET/api/admin/statusReturns active databases, registered face count
GET/api/admin/categoriesLists all category folders available on the server
GET/api/admin/databasesLists all .pkl database files
POST/api/admin/categoriesCreates a new sub-folder inside a category
POST/api/faces/registerRegisters a new person with uploaded face images
POST/api/admin/trainBuilds or rebuilds a recognition database
POST/api/admin/databases/activeSets a specific database as the active one
POST/api/admin/cache/clearClears 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.

  1. Navigate to /admin (requires admin login)
  2. Go to the Face Registration tab
  3. Step 1 — Select the organization's category folder (e.g., Citrus_Informatics)
  4. Step 2 — Enter the person's name (e.g., Alice_Sharma)
  5. Step 3 — Upload 3–5 clear face photos → click Confirm Registration
  6. Switch to the Database Training tab
  7. Select the existing database (e.g., Citrus_employees) and the same source folder
  8. Choose Individual mapping strategy
  9. Click Start Rebuild — training completes and the database is updated
  10. The new employee is immediately recognized in live attendance sessions

Troubleshooting

"Redirected to Unauthorized Access"

  • Confirm your account has "role": "admin" in authorized_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

On this page

Admin Panel