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

Face detection #43

Closed
zmajew opened this issue Feb 28, 2022 · 10 comments
Closed

Face detection #43

zmajew opened this issue Feb 28, 2022 · 10 comments

Comments

@zmajew
Copy link

zmajew commented Feb 28, 2022

Hi, can come of the examples be used for face detection (not recognition) to crop the face from the image, like in TensorFlow mtcnn?

@mattn
Copy link
Owner

mattn commented Feb 28, 2022

@zmajew
Copy link
Author

zmajew commented Feb 28, 2022

Thank you for your prompt reply!
Can it work without gocv, but with the image from the file? So, if I replace "ff, err := resized.DataPtrFloat32()" from line 71 with image converted into []float32 slice, will it return face coordinates? Please, excuse me if I missed something major since I am entering tflite field

@mattn
Copy link
Owner

mattn commented Feb 28, 2022

You can refer label_image.

col := resized.At(x, y)

@zmajew
Copy link
Author

zmajew commented Feb 28, 2022

I want to detect and then crop the human face from the image. label_image example recognizes the images?

@mattn
Copy link
Owner

mattn commented Feb 28, 2022

Do you have experience doing that in Python?

@zmajew
Copy link
Author

zmajew commented Feb 28, 2022

We want to switch from python to the golang. I did face detection with dlib and TensorFlow, but I want to do that with tflite if it is possible.

@mattn
Copy link
Owner

mattn commented Feb 28, 2022

If you have experience using tflite in Python and a little knowledge of Go, you should be able to do that.

@zmajew
Copy link
Author

zmajew commented Feb 28, 2022

I have inherited the project from python, and it uses ultraface python for face detection.
Your blazeface example looks promising but I do not know now if the face detection is done with tflite or with gocv there? And if it is, what format of image I should send to the model

@mattn
Copy link
Owner

mattn commented Feb 28, 2022

blazeface example is using tflite to recognize faces. gocv (OpenCV) is used only for getting real-time video.

@zmajew
Copy link
Author

zmajew commented Mar 1, 2022

I got the cropped image. First, convert image.Image to [][][3]float32, than plain rearrange it to the []float32 and copy it input.Float32s(). Thank you for the help!

@zmajew zmajew closed this as completed Mar 2, 2022
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