Qengineering / Face-Recognition-Jetson-Nano

Recognize 2000+ faces on your Jetson Nano with database auto-fill and anti-spoofing
https://qengineering.eu/deep-learning-examples-on-raspberry-32-64-os.html
BSD 3-Clause "New" or "Revised" License
110 stars 31 forks source link

How to make it work with IP network camera?? #17

Open starlord263 opened 2 years ago

starlord263 commented 2 years ago

HI, i tried using it with IP camera RTSP stream but latency is too high, How i can make it work with it??

Qengineering commented 2 years ago

I'm afraid you have a common OpenCV problem. First, determine the cause of your latency. Do you have a fluid video (with a constant -low- latency) when you're showing the frames and not analysing the faces? In that case, face recognition is slowing down your pipeline, meaning that VideoCapture() cannot read frames as fast as they are being produced over the network. They are gradually queuing up to build in increased latency. The only solution here is grabbing some frames without recognition after one with face detection. You get a sequence like | Face - No Face - No Face | Face - No Face - No Face | The overall process time of the pipeline needs to be at least in sync with the frame rate.

starlord263 commented 2 years ago

Hii @Qengineering I tried working with Gstream but still it is unable to detect face on rtsp stream

using this gst-launch-1.0 rtspsrc location=rtsp://root:admin@192.168.1.204/axis-media/media.amp latency=200 ! rtph264depay ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw, width=640, height=480, format=BGRx ! videoconvert ! appsink drop=true

Qengineering commented 2 years ago

@starlord263 Start debugging. Do you have live video when the whole analyse algorithm is commented out? Once you have a video working, try to detect only the faces. Still comment out the person recognition, blur detecting etc. Because the code works fine with a Rpi camera, the interaction with the IP camera is causing your problem. Tip: see https://github.com/Qengineering/GStreamer-1.18.4-RPi_64-bits or https://github.com/Qengineering/Libcamera-OpenCV-RPi-Bullseye-64OS if you can get your camera working without any deep learning.