Skip to content

Commit f857f8f

Browse files
committed
Raise an exception if cv2 fails to read an image path
1 parent 75d3d27 commit f857f8f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

angel_system/object_detection/yolov11_detect.py

+2
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ def yolo_v11_inference_objects(
337337
):
338338
img_path: Path = dset.get_image_fpath(img_id)
339339
img0 = cv2.imread(img_path.as_posix())
340+
if img0 is None:
341+
raise RuntimeError(f"Failed to read image file: {img_path}")
340342

341343
# returns list of length=num images, which is always 1 here.
342344
object_preds = object_model.predict(source=img0, **object_predict_kwargs)[0]

0 commit comments

Comments
 (0)