Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model.predict fails when running segmentation model on numpy images #346

Open
LinasKo opened this issue Dec 2, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@LinasKo
Copy link
Contributor

LinasKo commented Dec 2, 2024

import cv2

version = rf.workspace("model-examples").project("car-parts-instance-segmentation").version(3)
dataset = version.download("yolov8")
seg_model = version.model

first_image_path = os.listdir(f"{dataset.location}/train/images")[0]
first_image_path = f"{dataset.location}/train/images/{first_image_path}"
seg_image = cv2.imread(first_image_path)
assert seg_image is not None
# Path
result = seg_model.predict(first_image_path).json()
detections = sv.Detections.from_inference(result)
assert len(detections) > 0
# Succeeds

# Np img
result = seg_model.predict(seg_image).json()
detections = sv.Detections.from_inference(result)
assert len(detections) > 0
# Fails!

# Empty np img
result = seg_model.predict(black_image).json()
detections = sv.Detections.from_inference(result)
assert len(detections) == 0
# Fails!
@LinasKo LinasKo added the bug Something isn't working label Dec 2, 2024
@Anirudh2112
Copy link

Hi @LinasKo, I would like to contribute to this. Can you assign it to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants