Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read models weight as string #2

Open
prestashopy opened this issue Nov 5, 2019 · 0 comments
Open

Read models weight as string #2

prestashopy opened this issue Nov 5, 2019 · 0 comments

Comments

@prestashopy
Copy link

prestashopy commented Nov 5, 2019

Hello!,

I have saved the uncompressed model as a string in my code, with raw-loader:

https://github.com/justadudewhohacks/face-api.js-models/blob/master/uncompressed/tiny_face_detector_model.weights

Now I would like to read and get the indexes of the model string like Float32Array.

If making a fecth to a public folder works correctly:

const res = await fetch ('/ models / tiny_face_detector_model.weights');
const abuffer = await res.arrayBuffer ();
console.info ("abuffer", new Float32Array (abuffer));

But if I try to read the var string I can't decode it to get the array correctly, something like this:

import tiny_face_detector_weights from './models/tiny_face_detector_model.weights';
const abuffer = Buffer.from (tiny_face_detector_weights , 'utf-8');
console.info ("abuffer", new Float32Array (abuffer));

What encoding is the file, and how should I do it to read it correctly?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant