# How to flush Results object prior to a run?

**URL:** <https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494>\
**Category:** Support\
**Tags:** question\
**Created:** [November 10, 2024, 2:40pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494 "2024-11-10T14:40:37Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![baqwas](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@baqwas](https://community.ultralytics.com/u/baqwas)\
**Post date:** [November 10, 2024, 2:40pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/1 "2024-11-10T14:40:37Z")

</div>

In **Predict**  **Mode** , I have _save_ enabled. Since I run my Python scripts in an IDE, I often encounter result displays from prior runs. I’ve quickly glanced at the _Results_ object, but I could not understand which attribute will enable me to get a fresh object without the images of the previous runs. I’m probably not understanding a simple setting. Please advise. Thanks.

Regards.

---

<div class="post-metadata">

**Author:** ![pderrenger](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/pderrenger/32/73_2.png) [@pderrenger](https://community.ultralytics.com/u/pderrenger)\
**Post date:** [November 10, 2024, 4:27pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/2 "2024-11-10T16:27:11Z")

</div>

Hello!

It sounds like you’re having a bit of trouble with residual data from previous runs in your `Results` object. To ensure you’re working with fresh results each time, you can clear any stored results by reinitializing the `Results` object or simply ensuring that your script does not retain any references to old results between runs.

Here’s a quick tip: make sure to reinitialize your model or results variable at the start of each run. For example:

```python
from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n.pt")

# Run inference on a new source
results = model.predict(source="new_image.jpg", save=True)

```

This approach ensures that each run starts with a clean slate. If you are using an IDE, consider restarting the kernel or clearing variables to prevent any carryover from previous executions.

For more detailed information, you might find the [Predict Mode documentation](https://docs.ultralytics.com/modes/predict/) helpful. It provides insights into managing results and other useful settings.

If you have any more questions, feel free to ask. Happy coding! 😊

---

<div class="post-metadata">

**Author:** ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)\
**Post date:** [November 10, 2024, 10:08pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/3 "2024-11-10T22:08:32Z")

</div>

Please share the code you’re using to run inference.

---

<div class="post-metadata">

**Author:** ![ekaakurniawan](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/ekaakurniawan/32/955_2.png) [@ekaakurniawan](https://community.ultralytics.com/u/ekaakurniawan)\
**Post date:** [September 5, 2025, 5:40pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/4 "2025-09-05T17:40:39Z")

</div>

Dear All, I have similar issue. If the next inference has no object, the result will be the previous bounding boxes with the same location and confidence, but different label. This happens when running on Intel GPU but the CPU is fine.

The result for the first and second inference are as follow.

 ![wwo_object](https://us1.discourse-cdn.com/flex001/uploads/ultralytics1/original/1X/11d6d7515c5d58d807298761cffc12c63eb5b2dd.jpeg)

Following is my code.

```python
from pathlib import Path
from ultralytics import YOLO
import openvino as ov

IMAGE_PATH = "./data/coco_bike.jpg"
IMAGE_BLANK_PATH = "./data/blank.jpg"

def compile_model(det_model_path, device):
    core = ov.Core()
    
    det_ov_model = core.read_model(det_model_path)
    
    ov_config = {}
    #if device != "CPU":
    # det_ov_model.reshape({0: [1, 3, 640, 640]})
    if "GPU" in device or ("AUTO" in device and "GPU" in core.available_devices):
        ov_config = {"GPU_DISABLE_WINOGRAD_CONVOLUTION": "YES"}
    det_compiled_model = core.compile_model(det_ov_model, device, ov_config)
    det_model = YOLO(det_model_path.parent, task="detect")
    
    if det_model.predictor is None:
        custom = {"conf": 0.25, "batch": 1, "save": False, "mode": "predict"} # method defaults
        args = { **det_model.overrides,** custom}
        det_model.predictor = det_model._smart_load("predictor")(overrides=args, _callbacks=det_model.callbacks)
        det_model.predictor.setup_model(model=det_model.model)
    
    det_model.predictor.model.ov_compiled_model = det_compiled_model
    return det_model

def run_e2e(det_model, image_path):
    res = det_model(image_path)

det_model_path = Path("yolo11s_openvino_model/yolo11s.xml")
for device in ["CPU", "GPU.0", "GPU.1"]:
    det_model = compile_model(det_model_path, device)
    for x in range(10):
        print("\n\n###", device, " - object:")
        run_e2e(det_model, IMAGE_PATH)
        print("\n\n###", device, " - blank:")
        run_e2e(det_model, IMAGE_BLANK_PATH)

```

```auto
>python inference.py
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

### CPU - object:

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\coco_bike.jpg: 480x640 1 bicycle, 2 cars, 1 parking meter, 1 dog, 61.5ms
Speed: 2.2ms preprocess, 61.5ms inference, 0.4ms postprocess per image at shape (1, 3, 480, 640)

### CPU - blank:

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\blank.jpg: 480x640 (no detections), 19.7ms
Speed: 1.3ms preprocess, 19.7ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.0 - object:

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\coco_bike.jpg: 480x640 1 bicycle, 2 cars, 1 parking meter, 1 dog, 490.1ms
Speed: 1.7ms preprocess, 490.1ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.0 - blank:

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\blank.jpg: 480x640 1 car, 1 bus, 1 truck, 1 giraffe, 1 baseball bat, 19.9ms
Speed: 1.4ms preprocess, 19.9ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.1 - object:

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\coco_bike.jpg: 480x640 1 bicycle, 2 cars, 1 parking meter, 1 dog, 2759.1ms
Speed: 1.8ms preprocess, 2759.1ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.1 - blank:

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\blank.jpg: 480x640 1 car, 1 bus, 1 truck, 1 giraffe, 1 baseball bat, 6.9ms
Speed: 1.7ms preprocess, 6.9ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

```

But if I re-setup the model before each inference, the GPU result is as expected. This method increases total inference time form 6ms to 40ms.

```python
det_model.predictor.setup_model(model=det_model.model)

```

New code is as follow.

```python
from pathlib import Path
from ultralytics import YOLO
import openvino as ov

IMAGE_PATH = "./data/coco_bike.jpg"
IMAGE_BLANK_PATH = "./data/blank.jpg"

def compile_model(det_model_path, device):
    core = ov.Core()
    
    det_ov_model = core.read_model(det_model_path)
    
    ov_config = {}
    #if device != "CPU":
    # det_ov_model.reshape({0: [1, 3, 640, 640]})
    if "GPU" in device or ("AUTO" in device and "GPU" in core.available_devices):
        ov_config = {"GPU_DISABLE_WINOGRAD_CONVOLUTION": "YES"}
    det_compiled_model = core.compile_model(det_ov_model, device, ov_config)
    det_model = YOLO(det_model_path.parent, task="detect")
    
    if det_model.predictor is None:
        custom = {"conf": 0.25, "batch": 1, "save": False, "mode": "predict"} # method defaults
        args = { **det_model.overrides,** custom}
        det_model.predictor = det_model._smart_load("predictor")(overrides=args, _callbacks=det_model.callbacks)
        det_model.predictor.setup_model(model=det_model.model)
    
    det_model.predictor.model.ov_compiled_model = det_compiled_model
    return det_model

def run_e2e(det_model, image_path):
    results = det_model(image_path)

det_model_path = Path("yolo11s_openvino_model/yolo11s.xml")
for device in ["CPU", "GPU.0", "GPU.1"]:
    det_model = compile_model(det_model_path, device)
    for x in range(10):
        print("\n\n###", device, " - object:")
        det_model.predictor.setup_model(model=det_model.model)
        run_e2e(det_model, IMAGE_PATH)
        print("\n\n###", device, " - blank:")
        det_model.predictor.setup_model(model=det_model.model)
        run_e2e(det_model, IMAGE_BLANK_PATH)

```

```auto
>python inference.py
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

### CPU - object:
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\coco_bike.jpg: 480x640 1 bicycle, 2 cars, 1 parking meter, 1 dog, 2459.3ms
Speed: 4.0ms preprocess, 2459.3ms inference, 0.4ms postprocess per image at shape (1, 3, 480, 640)

### CPU - blank:
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\blank.jpg: 480x640 (no detections), 67.8ms
Speed: 1.5ms preprocess, 67.8ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.0 - object:
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\coco_bike.jpg: 480x640 1 bicycle, 2 cars, 1 parking meter, 1 dog, 43.8ms
Speed: 1.6ms preprocess, 43.8ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.0 - blank:
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\blank.jpg: 480x640 (no detections), 45.5ms
Speed: 1.6ms preprocess, 45.5ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.1 - object:
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\coco_bike.jpg: 480x640 1 bicycle, 2 cars, 1 parking meter, 1 dog, 38.8ms
Speed: 1.6ms preprocess, 38.8ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

### GPU.1 - blank:
Ultralytics 8.3.142 Python-3.12.10 torch-2.8.0+cpu CPU (Intel Core(TM) Ultra 9 285K)
Loading yolo11s_openvino_model for OpenVINO inference...
Using OpenVINO LATENCY mode for batch=1 inference...

image 1/1 C:\Users\ekaak\Workspace\yolov11_blank\data\blank.jpg: 480x640 (no detections), 45.5ms
Speed: 1.7ms preprocess, 45.5ms inference, 0.2ms postprocess per image at shape (1, 3, 480, 640)

```

Is there a method to reset just the output especially the one in GPU?

Thanks.

---

<div class="post-metadata">

**Author:** ![ekaakurniawan](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/ekaakurniawan/32/955_2.png) [@ekaakurniawan](https://community.ultralytics.com/u/ekaakurniawan)\
**Post date:** [September 5, 2025, 10:49pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/5 "2025-09-05T22:49:35Z")

</div>

Additional information: I use Windows 11, converted the model to OpenVINO with dynamic input and NMS. Is it possible to reset the confidence result before NMS?

---

<div class="post-metadata">

**Author:** ![Toxite](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/toxite/32/123_2.png) [@Toxite](https://community.ultralytics.com/u/Toxite)\
**Post date:** [September 6, 2025, 4:50am UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/6 "2025-09-06T04:50:38Z")

</div>

Does the issue occur if you run prediction normally as described in the docs?

Ultralytics already supports passing the specific device for inference for OpenVINO. You don’t need to perform all these monkey-patching.

> **[OpenVINO](https://docs.ultralytics.com/integrations/openvino/#__tabbed_1_1)**
>
> Learn to export YOLO11 models to OpenVINO format for up to 3x CPU speedup and hardware acceleration on Intel GPU and NPU.

---

<div class="post-metadata">

**Author:** ![ekaakurniawan](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/ekaakurniawan/32/955_2.png) [@ekaakurniawan](https://community.ultralytics.com/u/ekaakurniawan)\
**Post date:** [September 6, 2025, 1:45pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/7 "2025-09-06T13:45:57Z")

</div>

@Toxite , it works as expected if the model is exported without NMS as follow.

```python
model.export(format="openvino")

```

The issue occurs if the model is exported with NMS.

```python
model.export(format="openvino", nms=True)

```

---

<div class="post-metadata">

**Author:** ![Toxite](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/toxite/32/123_2.png) [@Toxite](https://community.ultralytics.com/u/Toxite)\
**Post date:** [September 6, 2025, 6:19pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/8 "2025-09-06T18:19:45Z")

</div>

And it only occurs on GPU?

---

<div class="post-metadata">

**Author:** ![ekaakurniawan](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/ekaakurniawan/32/955_2.png) [@ekaakurniawan](https://community.ultralytics.com/u/ekaakurniawan)\
**Post date:** [September 7, 2025, 6:07pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/9 "2025-09-07T18:07:36Z")

</div>

@Toxite , yes only on GPU (iGPU/dGPU), with NMS head in the model, as well as static/dynamic input.

---

<div class="post-metadata">

**Author:** ![Toxite](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/toxite/32/123_2.png) [@Toxite](https://community.ultralytics.com/u/Toxite)\
**Post date:** [September 7, 2025, 8:28pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/10 "2025-09-07T20:28:30Z")

</div>

If that’s the case, then it seems like OpenVINO bug. You cna open an issue in their GitHub Ultralytics doesn’t have different handling for CPU and GPU OpenVINO inference, so there shouldn’t be any difference unless it’s due to OpenVINO bug.

---

<div class="post-metadata">

**Author:** ![ekaakurniawan](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/ekaakurniawan/32/955_2.png) [@ekaakurniawan](https://community.ultralytics.com/u/ekaakurniawan)\
**Post date:** [September 18, 2025, 3:13pm UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/11 "2025-09-18T15:13:25Z")

</div>

This issue happens on OpenVINO 2025.2 and 2025.3. The fix has already in place ([PR-32067](https://github.com/openvinotoolkit/openvino/pull/32067)). I have tested successfully on both iGPU and dGPU using OpenVINO nightly 20250917 targeting for OpenVINO 2025.4 release. Thanks.

---

<div class="post-metadata">

**Author:** ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)\
**Post date:** [September 19, 2025, 11:49am UTC](https://community.ultralytics.com/t/how-to-flush-results-object-prior-to-a-run/494/12 "2025-09-19T11:49:08Z")

</div>

Thanks for the update, great to see there’s a fix in the works!
