In order to perform face, person or liveness detection, SAFR must generate model files.  SAFR does this as a one time action upon first run.  On subsequent runs, SAFR will detect the presence of a model file and only generate if not present or no longer valid for the installed hardware and required analytics.


SAFR SDK performs the generation of a model file automatically upon attempting recognition.  


The default location for the model files is in the user-specific TEMP directory (C:\Users\<USER>\AppData\Local\Temp).  But this directory is automatically cleaned up by Windows and so it is strongly advised that the SettingsPath be set on the SDK to ensure the file is written to a permanent location.


To set the SDK Location to a permanent folder do the following:

/ Create the object tracker configuration
            var config = ObjectTrackerConfiguration.ConfigurationForPreset(ConfigurationPreset.Recognition);
            config.Detector.Face.SettingsPath = “<settings file path>”

To allow SAFR to generate a model, the application must allow sufficient time.  If the application times out and the SDK process is not allowed to complete, then the model will not be crated.  For example, the application being written may be under a web service and timeouts may prevent the model from ever being created.  In these cases, you can copy model files generated for the same version of SAFR Desktop or Virgo and place them into your application's directory.


Following describes the process for how to acqyire a SAFR model file and place it into your application folder.

  1. Set the SDK Location to a folder where you copied the models as described above. 
  2. Run console application one time. 
  3. Confirm files with .serial are added to the application settings directory.


You must run SAFR for each analytic you want to use (face detection, person detection, RGB or 3D liveness detection, contrast enhancement) so that the respective model files are generated.  So for example, if you are doing Face recognition, person detection and RGB liveness, then you will need ensure all three processes are performed and hat three files with ".serial" file extension are crated.


From then on the models will exist on the machine.  This process should be performed again if you upgrade safr or change GPU.