General HUSKYLENS

facial recognition

userHead Pascal.FRANCOIS 2025-01-21 01:56:53 1164 Views1 Replies

Hello, when you do facial recognition of several people, must we absolutely do the learning one after the other, or can we do it at different times to add people?

2025-08-18 13:28:44

This is possible , but a bit tricky to execute. There is no straight-forward single step to do it. But here is a workflow that will allow you to update your trained files in stages.

 

You will need an SD card to store interim trained model data.

 

First thing to remember is that LEARNED objects get object id's assigned in the order of the learning. Each new person has to be assigned a different number in sequential manner.

 

Start with:

*learn multiple set to Yes,

*“forget all learned objects”: https://github.com/HuskyLens/HUSKYLENSArduino/blob/master/HUSKYLENS%20Protocol.md#command_request_forget-0x37

 

When HL returns block info, you can optionally request it using the INFO details sent before the detected blocks:

https://github.com/HuskyLens/HUSKYLENSArduino/blob/master/HUSKYLENS%20Protocol.md#command_return_info-0x29

 

First pieces of data in this INFO result is “number of blocks detected” and “number of learned blocks”.

Then for each block detected, there will be a result data with coordinates. And at the end of each entry there will be an “object ID”. If this number is 0 (zero), object is NOT learned; and if it greater than 0 (zero), it is the LEARNED object number.

https://github.com/HuskyLens/HUSKYLENSArduino/blob/master/HUSKYLENS%20Protocol.md#command_return_block0x2a

 

When you start training in stages, it is MOST crucial to keep track of this LEARNED object number and make sure you assign it incrementally for each learned object.

 

For a simple exercise, follow the workflow:
* forget all learned objects.
* learn a face and assign a LEARNED object number (1) to it.
* save this 1 object model data to the SD card as model #1.
* clear all learned object info in the program. Or for a drastic but fast method, factory reset the camera.
* load the model #1 from SD card. This will restore all LEARNED info into Face Recognition.
* learn an ADDITIONAL face and assign a LEARNED object number (2) to it.
* save this 2 object model to the SD card as model #1, overwriting the previous one.

At this point, you should have a saved model #1 on SD card with two LEARNED faces; and you did not have to do the learning back to back. Also, while in this exercise, you trained the camera first on one face and then created the backup file, you can actually train it on as many faces as you want, before creating the interim backup.

Then when you reset everything and reload the backup file, you will restore all the previously saved faces. The thing to be cautious about when you start the second round of training is, to make sure you monitor the LEARNED count and start incrementing from it, rather than back to one.

Due to the nature of the environment, you may find it hard to implement this flow in an Arduino environment.
I use MicroBlocks (https://microblocks.fun/) for the camera coding and its real-time interactive nature allows much more flexibility to achieve this result. Check out the WIKI: https://wiki.microblocks.fun/en/extension_libraries/huskylens .
 

userHeadPic tguneysu