ShiqiYu / libfacedetection

An open source library for face detection in images. The face detection speed can reach 1000FPS.
Other
12.27k stars 3.05k forks source link

Add gstreamer example / test code #105

Closed mistralol closed 5 years ago

mistralol commented 5 years ago

This adds a gstreamer wrapper which will opens the facedetection to run on all types of media rather than just jpeg images.

Example for playing any video file

After installing most of gstreamer.

export LD_LIBRARY_PATH=pwd export GST_PLUGIN_PATH=pwd

make && GST_DEBUG=3 gst-launch-1.0 filesrc location=somefile.mp4 ! decodebin \ ! videorate ! video/x-raw, framerate=8/1 \ ! videoscale ! video/x-raw, width=640, height=480 \ ! videoconvert ! identity sync=true \ ! queue max-size-buffers=3 leaky=1 \ ! libfacedetect ! videoconvert ! xvimagesink sync=false

Note: The above will reduce frame rate to 8fps and scale the image down to something more sensible.

Interestingly. On various media files it tends to have a lot of false positives. I assume "neighbors" is somewhat like a threshold value. So I defaulted this to 75 in the gstreamer element. I also see plenty of misses. Though I do like the performance.

It may be worth pointing out that with additional functionality like this. You can play other face detection methods off against each other for building more complex and less biased data sets for training.

So this may help you improve things more!