super-gradients icon indicating copy to clipboard operation
super-gradients copied to clipboard

No output on console

Open Chandrakapure opened this issue 2 years ago • 5 comments

💡 Your Question

I am trying to print the bounding box cordinates , labels and confidence , everything is working fine but it is not printing the output.

Code snippet

import cv2 from super_gradients.common.object_names import Models from super_gradients.training import models image = cv2.imread('Videos/test3.jpg') image = cv2.resize(image,(1000,500)) img = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) model = models.get(Models.YOLO_NAS_L, pretrained_weights="coco") results = list(model.predict(img)) box = list(results[0].prediction.bboxes_xyxy) lab = list(results[0].prediction.labels) conf_list = list(results[0].prediction.confidence) print(box) print(lab) print(conf_list)

Versions

No response

Chandrakapure avatar Jul 18 '23 10:07 Chandrakapure

Any chance you are using 'silent_mode' in training hyperparameters?

BloodAxe avatar Jul 22 '23 15:07 BloodAxe

Any chance you are using 'silent_mode' in training hyperparameters?

Silent_mode is set False, still no output getting printed.

Chandrakapure avatar Jul 26 '23 07:07 Chandrakapure

I can confirm this happens to me as well when using Colab.

BloodAxe avatar Aug 10 '23 08:08 BloodAxe

ah, I'm also experiencing this issue. It looks like something in the super_gradients library is redirecting stdout.

print("a")
from super_gradients.training import models
print("b")
print("c", flush=True)
crash=crash
print("d")
print("e", flush=True)

will only print "a" and then correctly crash at the crash=crash line

ichu-apl avatar Mar 06 '24 21:03 ichu-apl

You can wrap the import with a stored stdout to undo the redirect.

import sys
stdout = sys.stdout
from super_gradients.training import models
sys.stdout = stdout

ichu-apl avatar Mar 08 '24 14:03 ichu-apl