Items with no label
3335 Discussions

Reloading database from file through SetDatabaseBuffer not working in Face recognition.

DL2
Novice
2,427 Views

Hello,

I need to save the recognized user in a database, so the app can load the data later for the camera to recognize the user as a registered user. I downloaded a sample application and it works well. it detects users and register the user but when i close the application and restart then it never recognizes the user if the user is loaded from the database file.

 

I saved the data in database with the following code:

private void SaveDatabaseToFile()

{

// Allocate the buffer to save the database

PXCMFaceData.RecognitionModuleData recognitionModuleData = faceData.QueryRecognitionModule();

Int32 nBytes = recognitionModuleData.QueryDatabaseSize();

Byte[] buffer = new Byte[nBytes];

// Retrieve the database buffer

recognitionModuleData.QueryDatabaseBuffer(buffer);

// Save the buffer to a file

// (NOTE: production software should use file encryption for privacy protection)

File.WriteAllBytes(DatabaseFilename, buffer);

dbState = "Saved";

}

For reloading the saved database file i used this code.

private void LoadDatabaseFromFile()

{

if (File.Exists(DatabaseFilename))

{

Byte[] buffer = File.ReadAllBytes(DatabaseFilename);

recognitionConfig.SetDatabaseBuffer(buffer);

dbState = "Loaded";

}

else

{

dbState = "Not Found";

}

}

Thanks

11 Replies
MartyG
Honored Contributor III
484 Views

Are you using the '2016 R3' RealSense SDK, also know as 'Essentials'? If so, there is a known issue with facial recognition databases in it.

You should use the '2016 R2' SDK version instead.

If you have R3 installed, I recommend uninstalling it and then installing R2 using the link below, which launches immediately in your browser as a 1.8 gb download. Version R2 is an all-in-one package, so you do not need to install it as multiple modules like with the R3 version.

http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/9078/intel_rs_sdk_offline_package_10.0.26.0396.exe http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/9078/intel_rs_sdk_offline_package_10.0.26.0396.exe

0 Kudos
DL2
Novice
484 Views

Thanks MartyG,

Actually i downloaded this sample application https://software.intel.com/en-us/articles/code-sample-facial-recognition-using-intel-realsense-sdk Code Sample: Facial Recognition Using Intel® RealSense™ SDK | Intel® Software and libpxcclr.cs.dll

from https://registrationcenter.intel.com/en/products/postregistration/?sn=CM4Z-WKGMDWB3&EmailID=sujeet.sng999%40gmail.com&Sequence=2057632&dnld=t Download Intel® RealSense™ SDK Face Tracking & Recognition for Windows* - Intel® Products project bin. I am very new to this so i don't know about SDK version.

Thanks

0 Kudos
MartyG
Honored Contributor III
484 Views

Welcome to RealSense! You have downloaded the optional module of '2016 R3' for face tracking. The correct order for installing R3 is actually to download and install the core 'Essentials' module first, and then the 'Face Tracking' module secondly after that. However, as I said, if you are developing a face database application then your best option is to uninstall this face tracking module and install the '2016 R2' RealSense SDK using the link provided above.

Please also do not be discouraged about your initial problems with facial recognition. It has actually been one of the most troublesome aspects of RealSense to get working over the years, and many seasoned developers have been reduced to tears over it. However, these days there is now far more accumulated knowledge and reference material about it, so hopefully you should be able to get your program working successfully soon!

0 Kudos
DL2
Novice
484 Views

Thanks MartyG,

I am going to try with the above link

0 Kudos
MartyG
Honored Contributor III
484 Views

Good luck! Please let us know how you get on.

0 Kudos
DL2
Novice
484 Views

Hi MartyG,

Is there any maximum limit for user registration?

0 Kudos
MartyG
Honored Contributor III
484 Views

Intel support staff member David Lu said to another person asking this in January 2015 that the maximum number of faces that could be stored in the facial recognition database is 33.

DL2
Novice
484 Views

So if we want to save more than 33 users then we have to create multiple database and somehow manage accordingly. Actually we need to store and match these users with our database in Sql server and it may be more than 33 users.

0 Kudos
MartyG
Honored Contributor III
484 Views

An article on RealSense face recognition databases said that "it is possible to save and open multiple recognition database files with any valid filename". Somebody added to this, "It's possible to swap databases around though, so you can cycle through them if you need to."

A script for swapping databases is offered by a user in this discussion:

https://software.intel.com/en-us/forums/realsense/topic/602096 Using multiple Face Recognition databases

Further research found that after that initial figure of 33 was given in Jan 2015, it was reduced to 20 storable faces per database in the Dec 2015 SDK update..

0 Kudos
DL2
Novice
484 Views

Hi MartyG,

Don't you think creating multiple databases and reloading them one by one may cause performance issue? And if a face missed to recognize in specific database then no user will be found.

Is there any possible way to increase the database size?

0 Kudos
MartyG
Honored Contributor III
484 Views

Yes, others too thought that swapping between databases in this way would cause delays.

Development has apparently ceased on the Windows version of the RealSense face module, so an update by Intel to add support to the Windows RealSense SDK for additional faces is unlikely.

I couldn't find any way to increase the number of faces that can be stored in a database. I would expect that the limit is hard-wired into the RealSense face module and is not editable. The usual way that the checking of files can be sped up is to load them all into memory on the PC so that there is not a delay in accessing the files on the hard drive.

0 Kudos
Reply