TypeError when running the codes
I tried to run the library with nodejs and error occured.
Symbol.asyncIterator = Symbol.asyncIterator || Symbol.for('Symbol.asyncIterator');
^
TypeError: Cannot assign to read only property 'asyncIterator' of function 'function Symbol() { [native code] }'
at /Users/hhhung/Desktop/face_feature/node_modules/flash-store/bundles/flash-store.umd.js:101:26
at rimrafProxy__default (/Users/hhhung/Desktop/face_feature/node_modules/flash-store/bundles/flash-store.umd.js:40:68)
at Object.
flash-store version: 0.1.2 How could I fix the problem? Thanks
Which node version did you use? Did you tired node v8? I believe it would work with problem under the latest version of node.
I used node v8 at first and I changed to v7.0.0 but same error appears.
Could you please post your code which can reproduce this issue?
import 'babel-polyfill'
import { tmp } from './module'
tmp()
import { Facenet } from 'facenet'
export async function tmp(){
const facenet = new Facenet()
const imageFile = `./test.png`
const faceList = await facenet.align(imageFile)
for (const face of faceList) {
const embedding = await facenet.embedding(face)
console.log('embedding: ', embedding)
}
}
Then I use babel to convert the two codes into es5.
Thank you for providing the re-produce code.
Could try to run them by babel-node and see if it will produce the same result?
Errors occur when running by babel-node
For index.js(upper one): throw new Error("only one instance of babel-polyfill is allowed"); ^ Error: only one instance of babel-polyfill is allowed
For test.js(lower one): throw err; ^ SyntaxError: /Users/hhhung/Desktop/face_feature/test.js: await is a reserved word (6:17)
Update: Same result is produced after fixing the codes
Could you be able to run the demo from this repository?
It uses ts-node and should work without any problem.
Try run npm run demo
I have never tried babel, will try it when I have time.
Thanks for your advices. Now I am able to run the codes and I have one more question. Is there any requirement for the input photo? I use some face photos as input but no face feature vector is returned.
There's two steps: alignment and embedding.
Which one did you tried, alignment or embedding?
I suggest you to read the source code to get to know the reason.
If you still has problem, please provide the reproduce procedure for your issue.
Just tried embedding function with size 256x256, 128x128 and 96x96 face photos. Only the one with size 256x256 returns a feature vector.
Actually, I believe all the input image will be resized to 160x160 before feed to the neural network.
So the facenet.embedding() should return the 128 dim vector no matter than what size the image is.
You can check the source code, and let me know your result.
Thanks.
I ran the demo with replacing the input,
const imageFile = ${__dirname}/../tests/fixtures/two-faces.jpg
with a 96x96 jpg.
No result is returned.
But when the photo is enlarged to higher dimension, like 256x256, an embedding vector is returned.