How to increase frame Rate in the inference script

I am trying example. The frame rate is very slow, how to increase it?

Hi, the code originally stems from here, with a few updates: roboflow-api-snippets/Python/webcam at main · roboflow/roboflow-api-snippets · GitHub

You can try resizing the images prior to sending them for inference to increase the inference speed. A “smaller” image means less data being transferred, so the overall prediction can process faster.

I’ve already added this to the, just be sure you’ve set the ROBOFLOW_SIZE parameter in your roboflow_config.json file - roboflow-computer-vision-utilities/roboflow_config.json at main · roboflow/roboflow-computer-vision-utilities · GitHub

  • line 14 of contains ROBOFLOW_SIZE = config["ROBOFLOW_SIZE"]
  • lines 43-46 of contains:
# Resize (while maintaining the aspect ratio) to improve speed and save bandwidth
height, width, channels = img.shape
scale = ROBOFLOW_SIZE / max(height, width)
img = cv2.resize(img, (round(scale * width), round(scale * height)))

ROBOFLOW_SIZE would come from the value you resized your images to with the Resize preprocessing step during version generation.