e-candeloro / Driver-State-Detection

A real time, webcam based, driver attention state detection/monitoring system in Python3 using OpenCV and Mediapipe
MIT License
123 stars 28 forks source link

MediaPipe: Select only a few points to improve FPS #8

Closed VieiraJardel closed 10 months ago

VieiraJardel commented 1 year ago

I am trying to develop a system similar to this one using MediaPipe on a Jetson Nano. The problem is the availability of current versions of MediaPipe that do not provide support for this platform, (I'm using 0.8.9).

One of the challenges I encounter is processing; 368 points impact the FPS. My FPS rate is around 5. Is it possible to select only a few points? It seems that your program does not use or process the 378 points from the latest version of MediaPipe.

WhatsApp Image 2023-10-10 at 09 18 04

MustafaLotfi commented 12 months ago

Hello @VieiraJardel I think you are talking about 468 points of the face, not 368. I used to use the version 0.8.9 before and I didn't have any problem with that. Mediapipe uses a neural network model to predict all the landmarks together. So you can't ignore some points to improve FPS.

There are some suggestions that I can give you to enhance your frame rate:

  1. Change the parameters like min_detection_confidence and min_tracking_confidence when you are making the model.
  2. Set the parameter refine_landmarks to False when you are making the model.
  3. Receive the frames from your camera using another thread (do parallelism).
  4. Install tensorflow-gpu on your Getson Nano, so in this way you can do the prediction process so faster.