huan / node-facenet

Solve face verification, recognition and clustering problems: A TensorFlow backed FaceNet implementation for Node.js.
https://zixia.github.io/node-facenet/
Apache License 2.0
405 stars 77 forks source link

How long does it take to generate an embedding for a picture with size 750 * 937 ? #128

Open bobwei opened 6 years ago

bobwei commented 6 years ago

Hi,

Thanks for building such an amazing project. However, I was wondering how long it takes to generate an embedding in average ? On my laptop, it takes around 15 secs to generate an embedding for a picture with size 750 * 937. Not sure if it's normal or there are any ways that I can speed up. Thanks~

huan commented 6 years ago

Hi,

Short Answer

Should be less than 1 seconds.

Method Time
Facenet.init() 15 - 100 seconds
Facenet.embedding() less than 1 seconds
Facenet.align() less than 1 seconds

Long Answer

In order to get the facenet be able to work, it must be initialized before using. there's a Facenet.init() method in charge of doing that job, and if you call Facenet.align() or Facenet.embedding() before init(), the init() will be called automatically.

That's the reason you feel the facenet is very SLOW because you just had run align() or embedding() for one time, and then quit the program.

If you want to know the exact speed on your server, I'd like to suggest you try to process 100 pictures and count the processing time between each picture.

I had just added a comment to the demo example source code at here:

https://github.com/zixia/node-facenet/blob/3441181a0c643f2febd30aa2587c75da2c0f52ca/examples/demo.ts#L15-L20

bobwei commented 6 years ago

Hi @zixia , I just found the reason and it's because what you said. It's init() function that takes a long time. Thank you~

huan commented 6 years ago

Glad to hear that.

As you said you want to know how long it takes to generate an embedding in average, did you measured that? And if you did, could you please share the result with us, because I believe many users will be interested in.

Thanks.

bobwei commented 6 years ago

Hi @zixia ,

I just create an experimental project to measure the performance. Please check it out here. Hope it will be beneficial for everybody. Any suggestions are welcome. Thank you ~

https://github.com/bobwei/faces-lab