Deci-AI / super-gradients

Easily train or fine-tune SOTA computer vision models with one open source training library. The home of Yolo-NAS.
https://www.supergradients.com
Apache License 2.0
4.59k stars 510 forks source link

How to access predictions? #1058

Closed mexicantexan closed 1 year ago

mexicantexan commented 1 year ago

💡 Your Question

I have this code:

image = cv2.imread(image_path, cv2.IMREAD_UNCHANGED)
if image.shape[0] != 640 or image.shape[1] != 640:
    image = cv2.resize(image, (640, 640))

# make sure that the image is 3 channel rgb
if len(image.shape) == 2:
    image = cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)
elif image.shape[2] == 4:
    image = cv2.cvtColor(image, cv2.COLOR_RGBA2RGB)
detect_net = models.get(Models.YOLO_NAS_M, pretrained_weights="coco")
detect_net.eval()
pred = detect_net.predict(image)

I can't seem to access the prediction in the variable pred, but if I substitute that line with: detect_human_net.predict(image).show() the output is shown. I'm just trying to access the predictions, nothing too dramatic. I've tried using draw() but that doesn't seem to be an option for the class that is returned from the predict call.

Versions

No response

dagshub[bot] commented 1 year ago

Join the discussion on DagsHub!

Louis-Dupont commented 1 year ago

Hi @mexicantexan , if I understood correctly, you should find what you are looking for in this page. Is it what you were looking for?

Notes

mexicantexan commented 1 year ago

Yes, that worked perfectly! Sorry, just saw this :)