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

TypeError when running the codes #68

Open
henrych4 opened this issue Oct 17, 2017 · 12 comments
Open

TypeError when running the codes #68

henrych4 opened this issue Oct 17, 2017 · 12 comments

Comments

@henrych4
Copy link

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. (/Users/hhhung/Desktop/face_feature/node_modules/flash-store/bundles/flash-store.umd.js:43:2)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)

flash-store version: 0.1.2
How could I fix the problem? Thanks

@huan
Copy link
Owner

huan commented Oct 18, 2017

Which node version did you use?
Did you tired node v8? I believe it would work with problem under the latest version of node.

@henrych4
Copy link
Author

I used node v8 at first and I changed to v7.0.0 but same error appears.

@huan
Copy link
Owner

huan commented Oct 18, 2017

Could you please post your code which can reproduce this issue?

@henrych4
Copy link
Author

henrych4 commented Oct 18, 2017

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.

@huan
Copy link
Owner

huan commented Oct 18, 2017

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?

@henrych4
Copy link
Author

henrych4 commented Oct 18, 2017

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

@huan
Copy link
Owner

huan commented Oct 18, 2017

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.

@henrych4
Copy link
Author

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.

@huan
Copy link
Owner

huan commented Oct 18, 2017

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.

@henrych4
Copy link
Author

Just tried embedding function with size 256x256, 128x128 and 96x96 face photos. Only the one with size 256x256 returns a feature vector.

@huan
Copy link
Owner

huan commented Oct 20, 2017

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.

@henrych4
Copy link
Author

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.

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

2 participants