Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSaving and Loading Descriptors for future use #231
Comments
|
I see what you mean, currently there is no way other than what you suggested. The FaceMatcher class could be extended with a toJSON method for serializing and a fromJSON method for deserializing the state. Contributions are highly appreciated. :) |
|
This is not the bestway but it's working. Set faceMatcher as global variable then you can call faceMatcher.findBestMatch(newdata) to compare new data with your saved dataset.
|
|
I will try to create it, but I am thinking to serialize the resultsRef : So we can detect faces in a batch process, store the information in a database (as json) and after recreate the objects from the information stored to run a specific comparation and so on. |
|
It is working for the descriptor object.
code I used to test the serialization to JSon and back ` const jsonStr = JSON.stringify(resultsRef.map(res => res.descriptor )) fs.writeFileSync('./descriptor.json',jsonStr) let obj = new Array(Object.values(JSON.parse(str.toString()))) let arrayDescriptor = new Array(obj[0].length) let i = 0 //const faceMatcher = new faceapi.FaceMatcher(resultsRef) |
|
I also got it working with this |
|
const labeledFaceDescriptors = await loadLabeledImages() // Load json file and parse for (var x = 0; x < Object.keys(content.parent).length; x++) { function loadLabeledImages() { // Create Face Matcher |
|
Check out #397. I added
|
fadiabdeen
mentioned this issue
Mactacs
mentioned this issue
This code throwing me that exception:
Someone can explain to me why ? |


With ref https://github.com/justadudewhohacks/face-api.js#face-recognition-by-matching-descriptors
I've managed to train the faces and and saving the dataset with
JSON.stringify(labelledDescriptors)to a static JSON.Is there a way to quickly load this dataset, or do I have to load the raw JSON and reinit the dataset with each
new faceapi.LabeledFaceDescriptors(name, descriptors)?Is there method such as
Pardon, if I didn't explain myself well. But the objective is to quickly loaded a saved labeledDescriptors for usage.