# How to increase frame Rate in the inference script

**URL:** <https://discuss.roboflow.com/t/how-to-increase-frame-rate-in-the-inference-script/1179>\
**Category:** 🤝  Community Help\
**Created:** [December 14, 2022, 8:47am UTC](https://discuss.roboflow.com/t/how-to-increase-frame-rate-in-the-inference-script/1179 "2022-12-14T08:47:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_Malche](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/timothy_malche/32/745_2.png) [@Timothy\_Malche](https://discuss.roboflow.com/u/Timothy_Malche)\
**Post date:** [December 14, 2022, 8:47am UTC](https://discuss.roboflow.com/t/how-to-increase-frame-rate-in-the-inference-script/1179/1 "2022-12-14T08:47:43Z")

</div>

I am trying [webcam\_od.py](https://github.com/roboflow-ai/roboflow-computer-vision-utilities/blob/main/webcam/webcam_od.py) example. The frame rate is very slow, how to increase it?

---

<div class="post-metadata">

**Author:** ![Mohamed](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mohamed/32/62_2.png) [@Mohamed](https://discuss.roboflow.com/u/Mohamed)\
**Post date:** [December 21, 2022, 4:43pm UTC](https://discuss.roboflow.com/t/how-to-increase-frame-rate-in-the-inference-script/1179/2 "2022-12-21T16:43:20Z")

</div>

Hi, the code originally stems from here, with a few updates: [roboflow-api-snippets/Python/webcam at main · roboflow/roboflow-api-snippets · GitHub](https://github.com/roboflow/roboflow-api-snippets/tree/main/Python/webcam)

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/1X/247044982623b39758aa013fd1ed30bbd69fc8ae.png)

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 `webcam_od.py`, 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](https://github.com/roboflow/roboflow-computer-vision-utilities/blob/main/roboflow_config.json)

- line 14 of `webcam_od.py` contains `ROBOFLOW_SIZE = config["ROBOFLOW_SIZE"]`
- lines 43-46 of `webcam_od.py` contains:

```auto
# 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.

- More on image preprocessing and the Resize preprocessing feature: [Image Preprocessing - Roboflow](https://docs.roboflow.com/image-transformations/image-preprocessing#resize)
- More on Resizing images for training of computer vision models: [You Might Be Resizing Your Images Incorrectly](https://blog.roboflow.com/you-might-be-resizing-your-images-incorrectly/)
