Dear All,
I have followed the tutorial from Nvidia and launched my jetson nano to do streaming recognition. However, I also want to catch the label which was showing on the screen. For example, there is a person on the screen and the model will tell me a person label. My question is how can get the label information for reference?
I saw someone use
“net.GetClassDesc(detections.classID)”, but it does not work for me.
The system gave a message as following.
AttributeError: ‘list’ object has no attribute ‘classID’
Thanks for help
Hi,
Just confirm that you can get the label information like this:
# load the object detection network
net = jetson.inference.detectNet(opt.network, sys.argv, opt.threshold)
# detect objects in the image (with overlay)
detections = net.Detect(img, width, height, opt.overlay)
...
for detection in detections:
print(net.GetClassDesc(detection.ClassID))
It should be detection.ClassID.
Thanks.
Dear AasraLLL,
Actually, I was following the 10 lines tutorial.
Here is my code. I am not quite sure where should I put the label command.
Thanks,
load the object detection model
net = jetson.inference.detectNet(“SSD-Mobilenet-v2”, threshold=0.5)
#threthold < 1
camera = jetson.utils.gstCamera(1280, 720, “/dev/video0”)
display = jetson.utils.glDisplay()
while display.IsOpen():
img, width, height = camera.CaptureRGBA()
detections = net.Detect(img, width, height, opt.overlay)
display.RenderOnce(img, width, height)
display.SetTitle(“Object Detection | Network {:.0f}FPS”.format(net.GetNetworkFPS()))
# find the object description
class_desc = net.GetClassDesc(detections.ClassID)
for a in detections:
print(a) #extract the detection results
print(class_desc)
1 Like
Hi,
It should work like this:
net = jetson.inference.detectNet(“SSD-Mobilenet-v2”, threshold=0.5)
#threthold < 1
camera = jetson.utils.gstCamera(1280, 720, “/dev/video0”)
display = jetson.utils.glDisplay()
while display.IsOpen():
img, width, height = camera.CaptureRGBA()
detections = net.Detect(img, width, height, opt.overlay)
for detection in detections:
print(net.GetClassDesc(detection.ClassID))
display.RenderOnce(img, width, height)
display.SetTitle(“Object Detection | Network {:.0f}FPS”.format(net.GetNetworkFPS()))
Thanks.
1 Like
Dear AastaLLL,
thanks for your help. It works and I could keep explore the new world.