You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the Supervision issues and found no similar bug report.
Bug
The detections show a clear repeat pattern:
There are 720 detections, but when I check the confidence values, there are only 6 unique confidence values - i.e. appears detections are somehow mirrored to other locations on the image
Environment
sv = 0.25.1
Minimal Reproducible Example
importosimportcv2importnumpyasnpimportpandasaspdfromglobimportglobfromdotenvimportload_dotenvimportsupervisionassvfrominferenceimportget_model# Load environment variables (e.g., from .env file)load_dotenv()
api_key=os.getenv("ROBOFLOW_API_KEY")
# Load the Roboflow modelmodel=get_model(model_id="your-model-id", api_key=api_key) # anonymized model ID# ConstantsPATCH_SIZE=640image_dir="your-image-dir"# replace with actual directory pathimages=glob(f"{image_dir}/*.png")
# Read an imageimage_file=images[1] # change index as neededimage=cv2.imread(image_file)
# Define inference callbackdefcallback(image_slice: np.ndarray) ->sv.Detections:
result=model.infer(image)[0]
returnsv.Detections.from_inference(result)
# Set up slicerslicer=sv.InferenceSlicer(
callback=callback,
overlap_filter=sv.OverlapFilter.NON_MAX_SUPPRESSION,
slice_wh=(PATCH_SIZE, PATCH_SIZE),
thread_workers=1,
)
# Run inference with slicingdetections=slicer(image)
print(f"Number of detections: {len(detections)}")
# Annotate resultsbounding_box_annotator=sv.BoxAnnotator(
color=sv.ColorPalette.DEFAULT.colors[8],
thickness=2
)
label_annotator=sv.LabelAnnotator()
labels= [
f"{confidence:.2f}"forclass_id, confidenceinzip(detections.class_id, detections.confidence)
]
annotated_image=bounding_box_annotator.annotate(scene=image, detections=detections)
annotated_image=label_annotator.annotate(
annotated_image, detections=detections, labels=labels
)
# Save results to CSVcsv_sink=sv.CSVSink("out.csv")
withcsv_sinkassink:
sink.append(detections, {})
# Load CSV into DataFrame for inspectiondf=pd.read_csv("out.csv")
print(f"Detections saved: {len(df)}")
print(df.sort_values(by="confidence", ascending=False).head())
Additional
No response
Are you willing to submit a PR?
Yes I'd like to help by submitting a PR!
The text was updated successfully, but these errors were encountered:
Search before asking
Bug
The detections show a clear repeat pattern:
There are 720 detections, but when I check the
confidence
values, there are only 6 unique confidence values - i.e. appears detections are somehow mirrored to other locations on the imageEnvironment
Minimal Reproducible Example
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: