To get this script, please contact your Manager in TRASSIR

The script is designed to record the working hours of employees based on the Face Recognition module. It also works with Face Recognition 2.0.

For the script to work correctly, you need 2 separate cameras (entrance/exit).

The main differences from the previous version

  • It has a web interface and is available as a module in Trassir
  • Can build reports for any date.
  • Can build summary reports for any period.
  • It can work with multiple folders.

Installation

The script must be added in the Automation section. → New script → Load exampleFrom file… 

After downloading the script, click on the "Save, run" button and configure it.

Setup

When configuring the script for the first time, go to the settings and specify the number of folders of people for which you need to take into account working hours.
There are 3 folders created in the persons database, but you need to take into account the working hours for the VIP List and Employees folders, in this case we set the parameter value to 2.

Enable Debug mode for debugging mode (disabled by default).

Save, run.

Further settings and work with the script takes place in the web interface.

Open the monitor → Modules → FaceWorkTime

In the interface, go to the settings tab:

  1. Specify the channels that are located at the input and output (channels with face recognition enabled are available for selection)

2. For each person folder, specify:

  • Folder Name
  • Start time of the working day
  • Working day length

3. Configuring reports. The following options are available:

  • The export folder is the way to save reports.
  • On/Off export of daily reports
  • Daily export time
  • On/Off sending the report to the mail
  • On/Off sending a report to Telegram

4. If the previous settings include mailing by mail/Telegram, fill in the mailing options:

5. After completing the setup, click Save.


The Main page displays statistics for the current day for all selected person folders.

Let's take a closer look:

  1. Selecting a date for generating statistics. The available date range depends on the face recognition settings, the "Storage depth, days" parameter
  2. The name of the persons folder.
  3. The beginning of the working day is set in the script settings.
  4. The length of the working day is set in the script settings.
  5. The total number of person's tracks - when clicked, additional information for each track is revealed.

  6. The first input is the time of the first recognition on the channel that is working on the input

    If the time of the first recognition is later than the start of the working day, the information in the cell will be highlighted in red.

  7. Status - displays the current status, depending on which channel the last track of the person was recognized on.
  8. Working time is the total amount of time spent at the workplace.
  9. To save the report, click Save Report.

When you switch to the Report tab, the report for the current month opens by default.:

  1. Selecting a Person folder
  2. Selecting a date range
  3. Search
  4. Saving the report

The report contains information:

  • The number of working days when the employee was present at work
  • The total number of hours for these days
  • Daily report on the time of presence at the workplace

An example of a report in the format .xlsx:

Helpful info

Suppose the script has the following settings:
WORKTIME_DELTA_HOURS = 1 hour

Input Channels: Input
Output Channels: Output
Min. % similarity: 80

Employee Person folder: DSSL
Start time of the working day: 08:00:00
Working day: 08:00:00

When querying the Database, tracks from 7:00 to 17:00 will be processed with a similarity percentage from 80% to 100%.

When calculating working time, paired input-output tracks are summed up, for example:

IN 7:55

8:40 - 7:55 = 00:45

0:45 + 2:51 = 3:36

OUT 8:40
IN 8:49

11:40 - 8:49 = 2:51

OUT 11:40


Let's assume a situation where a face was recognized at entry, then the person exited without recognition (or the recognition percentage was less than the specified one) and re-entered, in this case the time will be calculated between the last recognized track at entry and exit:

IN 7:558:40 - 8:05 = 00:3500:35 + 00:25 = 01:00

IN 7:59
IN 8:05
OUT 8:40
IN 9:109:35 - 9:10 = 00:25


If the working day is from 08:00 to 17:00, the script searches for tracks in the range from 07:00 to 18:00 by default +/- 1 hour.
This is done in order not to go through unnecessary records in the database, but also to take into account that an employee can come to work 15, 20, ...,59 minutes earlier.


This parameter depends on the global variable WORKTIME_DELTA_HOURS. which is 1 by default.
The variable can be changed if you specify your own value in the script after the parameters, before the resources, for example, WORKTIME_DELTA_HOURS = 2



To get this script, please contact your Manager in TRASSIR