# How to set confidence and overlap threshold in Hosted Image Inference

**URL:** <https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184>\
**Category:** 🤝  Community Help\
**Created:** [June 14, 2024, 11:22am UTC](https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184 "2024-06-14T11:22:44Z")\
**Posts on this page:** 6\
**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:** [June 14, 2024, 11:22am UTC](https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184/1 "2024-06-14T11:22:44Z")

</div>

I am using following code from hosted image inference. How to set/specify confidence and overlap threshold?

from inference\_sdk import InferenceHTTPClient

```auto
CLIENT = InferenceHTTPClient(
    api_url="https://detect.roboflow.com",
    api_key="API_KEY"
)

# infer on a local image
result = CLIENT.infer("YOUR_IMAGE.jpg", model_id="hand-control-vyoij/1")

```

---

<div class="post-metadata">

**Author:** ![linas](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/linas/32/4519_2.png) [@linas](https://discuss.roboflow.com/u/linas)\
**Post date:** [June 14, 2024, 12:59pm UTC](https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184/2 "2024-06-14T12:59:38Z")

</div>

Hi @Timothy_Malche 👋

The `infer` method can accept arguments controlling the behaviour of the Model. In this case, you can try the following:

```python
CLIENT.infer(
    "YOUR_IMAGE.jpg",
    model_id="hand-control-vyoij/1",
    confidence=0.4,
    iou_threshold=0.3
)

```

I believe the full list is here: [Inference SDK - Roboflow Inference](https://inference.roboflow.com/inference_helpers/inference_sdk/#object-detection-model-in-v1-mode)

---

<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:** [June 19, 2024, 5:25am UTC](https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184/3 "2024-06-19T05:25:45Z")

</div>

@linas I am getting error

```auto
TypeError: InferenceHTTPClient.infer() got an unexpected keyword argument 'confidence'

```

---

<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:** [June 20, 2024, 6:35am UTC](https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184/4 "2024-06-20T06:35:07Z")

</div>

@linas since the above code giving error, I used following code following the tutorial on the page you shared. here’s my code.

```auto
from inference_sdk import InferenceHTTPClient, InferenceConfiguration

    custom_configuration = InferenceConfiguration(confidence_threshold=0.5, iou_threshold=0.5)

    with CLIENT.use_configuration(custom_configuration):
        result = CLIENT.infer(image_path, model_id="hand-control-vyoij/1")

```

---

<div class="post-metadata">

**Author:** ![linas](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/linas/32/4519_2.png) [@linas](https://discuss.roboflow.com/u/linas)\
**Post date:** [June 20, 2024, 7:33am UTC](https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184/5 "2024-06-20T07:33:43Z")

</div>

Indeed, `confidence_threshold` seems like the correct parameter. Apologies for the confusion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/1X/bb6edbfa56d0cf2ee603f061e9e09103502cc8cc.png) [@system](https://discuss.roboflow.com/u/system)\
**Post date:** [July 11, 2024, 7:34am UTC](https://discuss.roboflow.com/t/how-to-set-confidence-and-overlap-threshold-in-hosted-image-inference/6184/6 "2024-07-11T07:34:33Z")

</div>

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