Very low FPS in tensorflow lite example on Windows 10

Hi, i succesfully build and run the code example from here: GitHub - Qengineering/TensorFlow_Lite_Face_Mask_RPi_64-bits: Face mask detection on a bare Raspberry P

I am using Windows 10 PC (32 gb RAM, core i7, nvidia GEForce 1080TI), but FPS is only 5-6.

Could anybody please help me to find out why is so low fps? What should i change in code to increase fps to 20-30?

Thank you!!!

I suppose that you want to run this on a Raspberry.

Have you explored the option to use an accelerator like this one:

Here you can find the performance of some reference models for the object detection on Google Coral TPU:

1 Like

If you are instead executing the inference on Windows with the Nvidia GPU please use the standard TensorFlow version.

1 Like

Thank you very much for reply and your help! Yes i building my project on windows using Visual Studio 2019 and C++., and I can’t find out how to build and link the standard tensorflow version for Windows., could you please guide me to any fresh tutorial how to use standard tensorflow with C++ and Windows? I want to learn the whole pipeline (building tensorflow from source., link it to VS, make my own model and train it and so on). Also I don’t use a python in my project.

I don’t suggest you to train your model in C++ on Windows as we don’t have an official low level interfaces guide for this.

I think that you can still create your model in python then you will have some solutions to make a relative easy C++ inference on Desktop. E.g. see


1 Like

I really appreciate you help!!! Thank you for a tips., I will go through the links and come back with a results.

I succesfully build and run the cppflow example (load_model)!!! Could you please help me to run a simple model of face mask detection (.pb) with cppflow and understand how to predict or classify?

I tried to feed the “ssd_mobilenet_v2_fpnlite.tflite” from the example of Raspberry, but it seems like this format doesnt supported?

Finally i want to get something the same as Raspberry code example and run it with opencv and cppflow in Windows PC.

Thank you !!!

Cppflow Is a third party project that uses Tensorflow C API you can try to open a issue there to ask for a more complete example.
I think that it currently support only the save_model format not TFLite.

1 Like

Ok I will open an issue in the cppflow branch!
Could you please guide me to any examples how to create and train models in save_model format or maybe is there any pre-trained for a face mask detection one?

It doesn’t matter for me what kind of model format to use I just want to learn the steps:

  1. Create and train model or download pretrained;
  2. Use a model with OpenCV in C++ project.

Thank you

Just to show you an example pipeline see:

For opencv and cppflow data exchange see:

1 Like

Thank you for replies!!! Pipeline is not very easy to understand(( I will try to do it on my best…