zye1996 / Mobilefacenet-TF2-coral_tpu

57 stars 13 forks source link

ValueError: shapes (3,128) and (2,1) not aligned: 128 (dim 1) != 2 (dim 0) #5

Closed kumargopal closed 3 years ago

kumargopal commented 3 years ago

While running inference_video.py without coral_tpu it runs fine(It predicts false label on Steve Jobs Pic, although I haven't trained the model it should work with his pic I think).

But while running inference_video.py with coral_tpu on, it gives Value error. Looks like the egetpu model is returning wrong output. I am running on my laptop.

Note : I did nothing before running inference_video.py. Please help me if I need to run any other scripts first.

kumargopal commented 3 years ago

Running inference_video.py with --coral_tpu==true --mask==true doesn't have issue but the prediction is pretty bad. I didn't train any model but even on a public figure, the prediction is either steve or xyz. Please let me know how do I train the model.

zye1996 commented 3 years ago

Running inference_video.py with --coral_tpu==true --mask==true doesn't have issue but the prediction is pretty bad. I didn't train any model but even on a public figure, the prediction is either steve or xyz. Please let me know how do I train the model.

Because I did not set a threshold for filter out unmatched faces. You do not need to train the model for recognition, all you need is to collect the output from the recognition model and keep it in the database. When you need to inference, compare the output of the recognition model to those outputs in your database to find the most similar match.

zye1996 commented 3 years ago

While running inference_video.py without coral_tpu it runs fine(It predicts false label on Steve Jobs Pic, although I haven't trained the model it should work with his pic I think).

But while running inference_video.py with coral_tpu on, it gives Value error. Looks like the egetpu model is returning wrong output. I am running on my laptop.

Note : I did nothing before running inference_video.py. Please help me if I need to run any other scripts first.

If you enabled mask detection, you then have 2 different outputs from recognition model. Check with both of these ouputs to find the matching ones. The face vector would be of size (1, 128)

wibimaster commented 3 years ago

I'm sorry but I got the same problems ; can you please update the README with "how to use without mask" ? Same error thrown for me, same case as @kumargopal ...

Maybe you can just write what we have to modify (in my case, maybe it's my beard, but it detects a mask on my face... So I didn't want toi use this feature ;) ) to run it without mask detection, and a little example on how to train / add new faces ?

Thanks !

zye1996 commented 3 years ago

I'm sorry but I got the same problems ; can you please update the README with "how to use without mask" ? Same error thrown for me, same case as @kumargopal ...

Maybe you can just write what we have to modify (in my case, maybe it's my beard, but it detects a mask on my face... So I didn't want toi use this feature ;) ) to run it without mask detection, and a little example on how to train / add new faces ?

Thanks !

Sorry for the inconvenience, I fixed a small error and it should work now. Please just use command python inference_video.py --coral_tpu in inference folder.

wibimaster commented 3 years ago

Sorry for the inconvenience, I fixed a small error and it should work now. Please just use command python inference_video.py --coral_tpu in inference folder.

Thanks, it works !

But the issue remains for the lack of documentation, on how to train new faces ; do you want another Github issue for that ?

zye1996 commented 3 years ago

Sorry for the inconvenience, I fixed a small error and it should work now. Please just use command python inference_video.py --coral_tpu in inference folder.

Thanks, it works !

But the issue remains for the lack of documentation, on how to train new faces ; do you want another Github issue for that ?

Yes please open up another issue, I will update README and script for automatic face registering then and please star the project if you like it!

wibimaster commented 3 years ago

Of course, I'll star it ;) Thanks, I'll open another issue