Video Inference API in my app is limited by 2FPS, but when I test it on roboflow site i have 6FPS

The Video Inference API can’t process more than 2FPS (ReactNative App), but when I check Roboflow Visualize, it has 6FPS—the same model and project. So I do something wrong

I use intervals and try to analyze more than one image simultaneously. But when I reduce the interval and try to get at least 3FPS in a minute, I start getting errors from the Roboflow API, which becomes overloaded.

Thank you for help

useEffect(() => {
const id = setInterval(async () => {
if (!camera.current) return;

  const photo: PhotoFile = await camera.current.takePhoto({
    enableShutterSound: false,
  });

  //const croppedPhoto = (await cropImage(withImagePath(photo.path))).path;

  scanningRepository
    .recognizeCategories(photo.path, String(modelVersion), modelName)
    .then((data) => {
      console.log('Recognized data: ' + JSON.stringify(data));
      setLastPhoto(photo.path);
      const text = data
        .map((item: Category) => {
          'worklet';
          return item.name + ' ' + item.probability.toFixed(2);
        })
        .join(' ');


Some code

        }
      }
    });
}, 500);
return () => {
  clearTimeout(id);
};

}, [camera, itemsForLook.length]);

Hey looks like you didn’t post enough of your code for me to give a certain answer (how are you calling your model? What’s the implementation of scanningRepository.recognizeCategories?) but a large source of your latency looks like it’s coming from how you’re accessing the camera and the react event management.

We have an in-browser react example here GitHub - roboflow/inferencejs-react-example

Thank you for the quick response. It looks different than calling https://detect.roboflow.com. Could you tell me if I can use the proposed approach instead?

Recognizing categories runs the Roboflow API under the hood.

The problem is that I tested it with Postman, which takes 1.5 seconds. It seems that trying to send 3 images per second overloads the queue.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.