Generalize faces error on Verilook 10.0

General information about Neurotechnology and its software

Generalize faces error on Verilook 10.0

Postby Latchuk » Jun 21, 2018 18:25

Hi,

I"m trying to generalize many faces to create just one template to represent a person. The idea is use this template after to identify this person.
The problem is that I have 700 faces of this person and the CreateTemplate method is going to out of memory error.

How can i proceed without this error?

This is my code:

Code: Select all
async Task<byte[]> ReturbTemplateFaces(List<Face> faces)
        {
            NeurotecUtils.RegistrarNeurotec();

            byte[] bytesTemplateTodasFacesMontinho;

            using (NBiometricClient nBiometricClient = new NBiometricClient())
            using (NSubject nSubject = new NSubject())
            {
                nBiometricClient.BiometricTypes = NBiometricType.Face;
                nBiometricClient.FacesQualityThreshold = 0;
                nBiometricClient.FacesMaximalRoll = 35;
                nBiometricClient.FacesMinimalInterOcularDistance = 8;
                nBiometricClient.UseDeviceManager = true;
                nBiometricClient.FacesTemplateSize = NTemplateSize.Large;
                nBiometricClient.FacesMaximalYaw = 45;

                foreach (var face in faces)
                {
                    var imageBytes = await ReturnImageBytesAsync(face);

                    var nFace = new NFace()
                    {
                        SessionId = 1,
                        Image = NImage.FromMemory(bytesFaceImage),
                    };

                    nSubject.Faces.Add(nFace);
                }

                var status = nBiometricClient.CreateTemplate(nSubject);

                if (nSubject.Status != NBiometricStatus.Ok)
                    throw nSubject.Error;

                using (var templateBuffer = nSubject.GetTemplateBuffer())
                {
                    bytesTemplateTodasFacesMontinho = templateBuffer.ToArray();
                }

                return bytesTemplateTodasFacesMontinho;
            }
        }
Latchuk
 
Posts: 1
Joined: Jun 21, 2018 18:06

Re: Generalize faces error on Verilook 10.0

Postby MartynasV » Jun 22, 2018 13:34

Latchuk wrote:Hi,

I"m trying to generalize many faces to create just one template to represent a person. The idea is use this template after to identify this person.
The problem is that I have 700 faces of this person and the CreateTemplate method is going to out of memory error.

How can i proceed without this error?

This is my code:

Code: Select all
async Task<byte[]> ReturbTemplateFaces(List<Face> faces)
        {
            NeurotecUtils.RegistrarNeurotec();

            byte[] bytesTemplateTodasFacesMontinho;

            using (NBiometricClient nBiometricClient = new NBiometricClient())
            using (NSubject nSubject = new NSubject())
            {
                nBiometricClient.BiometricTypes = NBiometricType.Face;
                nBiometricClient.FacesQualityThreshold = 0;
                nBiometricClient.FacesMaximalRoll = 35;
                nBiometricClient.FacesMinimalInterOcularDistance = 8;
                nBiometricClient.UseDeviceManager = true;
                nBiometricClient.FacesTemplateSize = NTemplateSize.Large;
                nBiometricClient.FacesMaximalYaw = 45;

                foreach (var face in faces)
                {
                    var imageBytes = await ReturnImageBytesAsync(face);

                    var nFace = new NFace()
                    {
                        SessionId = 1,
                        Image = NImage.FromMemory(bytesFaceImage),
                    };

                    nSubject.Faces.Add(nFace);
                }

                var status = nBiometricClient.CreateTemplate(nSubject);

                if (nSubject.Status != NBiometricStatus.Ok)
                    throw nSubject.Error;

                using (var templateBuffer = nSubject.GetTemplateBuffer())
                {
                    bytesTemplateTodasFacesMontinho = templateBuffer.ToArray();
                }

                return bytesTemplateTodasFacesMontinho;
            }
        }

Hello Latchuk,

"Out of memory" exception means that there is no more memory available. This could be caused by memory leak, check all our disposable objects and make sure that they are disposed after you no longer need them. Also you should debug your application and track where memory grows and see if you can lower memory consumption.
You might also want to try and run application as 64bit application.

Additionally some information about faces generalization:
The purpose of generalization is to improve accuracy. But there one important thing – you always need to use the same amount of images for templates that you want to enroll to database and the same amount of images for template that you will use for matching. For example, if you always use 20 images to generalize template and enroll it to database and you always use 10 faces to generalize template for matching then the accuracy will be better. But if there could be any number of images for generalization either for enrollment or matching then it is better to create template with multiple faces in it and use either for enrollment or matching. Such template could contain a lot of NFRecords (1 NFRecord represents template extracted from 1 face) in it.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 370
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania


Return to Public

Who is online

Users browsing this forum: No registered users and 2 guests

cron