Skip to content

Commit

Permalink
Raise an exception if cv2 fails to read an image path
Browse files Browse the repository at this point in the history
  • Loading branch information
Purg committed Dec 18, 2024
1 parent 75d3d27 commit f857f8f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions angel_system/object_detection/yolov11_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ def yolo_v11_inference_objects(
):
img_path: Path = dset.get_image_fpath(img_id)
img0 = cv2.imread(img_path.as_posix())
if img0 is None:
raise RuntimeError(f"Failed to read image file: {img_path}")

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

0 comments on commit f857f8f

Please sign in to comment.