[Bug]: InferenceSlicer ValueError: Conflicting metadata for key: 'source_image': <class 'numpy.ndarray'>, <class 'numpy.ndarray'>
Search before asking
- I have searched the issues and discussions and found no similar bug report.
Bug
Bug: InferenceSlicer reporting ValueError when running on an image even though the code is from the "Detect Small Objects" tutorial on Supervision Docs. Just the code itself, all from the tutorial.
Expected: InferenceSlicer should run without reporting any error
What Happened: Value Error reported: Conflicting metadata for key: 'source_image': <class 'numpy.ndarray'>, <class 'numpy.ndarray'>.
Notes:
Another problem I also encounter when trying to run the code fresh from the tutorial was that if I didn't pass the image as a copy into the model.predict() or slicer() it would prompt a: "ValueError: At least one stride in the given numpy array is negative, and tensors with negative strides are not currently supported. (You can probably work around this by making a copy of your array with array.copy().)"
Traceback:
[2026-09-18 00:19:13] [INFO] rf-detr - File /Users/bendang/.roboflow/models/rf-detr-medium.pth already exists with correct MD5 hash.
[2026-09-18 00:19:13] [WARNING] rf-detr - Using a different number of positional encodings than DINOv2, which means we're not loading DINOv2 backbone weights. This is not a problem if finetuning a pretrained RF-DETR model.
[2026-09-18 00:19:13] [WARNING] rf-detr - Using patch size 16 instead of 14, which means we're not loading DINOv2 backbone weights. This is not a problem if finetuning a pretrained RF-DETR model.
[2026-09-18 00:19:14] [INFO] rf-detr - File /Users/bendang/.roboflow/models/rf-detr-medium.pth already exists with correct MD5 hash.
[2026-09-18 00:19:16] [WARNING] rf-detr - Model is not optimized for inference. Latency may be higher than expected. For full GPU throughput (e.g. ~8x on T4 via FP16 Tensor Cores), call model.inference(dtype=torch.float16).
Traceback (most recent call last):
File "/Users/bendang/UoA/ICT-Capstone-Project-1/Benny/InferenceSlicerTest.py", line 13, in <module>
detections = slicer(image)
File "/Users/bendang/UoA/ICT-Capstone-Project-1/.venv/lib/python3.13/site-packages/supervision/detection/tools/inference_slicer.py", line 435, in __call__
merged = Detections.merge(detections_list=detections_list)
File "/Users/bendang/UoA/ICT-Capstone-Project-1/.venv/lib/python3.13/site-packages/supervision/detection/core.py", line 2520, in merge
metadata = merge_metadata(metadata_list)
File "/Users/bendang/UoA/ICT-Capstone-Project-1/.venv/lib/python3.13/site-packages/supervision/detection/utils/internal.py", line 636, in merge_metadata
raise ValueError(
...<2 lines>...
)
ValueError: Conflicting metadata for key: 'source_image': <class 'numpy.ndarray'>, <class 'numpy.ndarray'>.
Environment
- Supervision: 0.30.3
- Python: 3.13.6 via pipenv
- OS: macOS 15.9
Minimal Reproducible Example
import cv2
import numpy as np
import supervision as sv
from rfdetr import RFDETRMedium
model = RFDETRMedium()
image = cv2.imread("Photos/img_1.png")
def callback(image_slice: np.ndarray) -> sv.Detections:
return model.predict(image_slice[:,:,::-1].copy())
slicer = sv.InferenceSlicer(callback = callback,slice_wh=640, overlap_wh=100)
detections = slicer(image)
box_annotator = sv.BoxAnnotator()
label_annotator = sv.LabelAnnotator()
annotated_image = box_annotator.annotate(
scene=image, detections=detections)
annotated_image = label_annotator.annotate(
scene=annotated_image, detections=detections)
Are you willing to submit a PR?
- Yes I'd like to help by submitting a PR!
Source: roboflow/supervision