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
How to get values from type "jetson.inference.detectNet.Detection" #2214
Comments
I have the same problem and I still didn't find how to get these values, I want to use these information to create a map. |
Hi, I jus found out how to capture these values, after creating an object, you access the values on the list calling [0]` and then you grab the variable that you want, see bellow the example:
the options that you have are: ClassID, Confidence, Left, Right, Width, Height, Bottom, Area and Center. Leandro. |
Thank you so much for sharing! It's working for me 👍 |
please can you help me to find this classId lable ? |
After creating an object like ids = [] If you have many detections in the same images it will show a list of the IDs |
The coco dataset classIDs are here: [https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/] 1 = person, 3 = car etc. This directly corresponds to the ClassID you get in detection[0].ClassID |
First, thanks for your answer, but when I tried this it told me ' |
@Jason-xy could you put all the steps of your code? |
Thanks for your reply, the following is my code: net = jetson.inference.detectNet("ssd-mobilenet-v2", threshold=0.5)
camera = jetson.utils.videoSource("csi://0")
display = jetson.utils.videoOutput("display://0")
info = jetson.utils.cudaFont()
speed=0.0
while display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img)
for i in detections:
info.OverlayText(img, 5, 5,"speed:{:.2f}".format(speed), detections[i].Bottom, detections[i].Right, info.White, info.Gray40)
display.Render(img)
display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS())) |
Thanks for your reply, I have successfully solved this problem. Because I am not familiar with the syntax of python and made this stupid mistake, the modified code is as follows: net = jetson.inference.detectNet("ssd-mobilenet-v2", threshold=0.5)
camera = jetson.utils.videoSource("csi://0")
display = jetson.utils.videoOutput("display://0")
info = jetson.utils.cudaFont()
speed=0.0
while display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img)
for detection in detections:
info.OverlayText(img, 5, 5,"speed:{:.2f}".format(speed),int(detection.Left)+5, int(detection.Top)+35, info.White, info.Gray40)
display.Render(img)
display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS())) |
hi, |
Hi, you can print out the individual items of the list returned by
|
thanks you so much |
This is code for get Class ID and Class Lable from Jetson Infecrence detectNet. This will show class label -
|
I use DetectNet on my Jetson Nano which works well. The
net.Detect()
funcion gives back a list where each object is from type "jetson.inference.detectNet.Detection". When I print it:Now my question is: How can I access these values separately (e.g. only the ClassID which, in this case, would be 1)? Lines like detection[0][0] don't work, since it is not an array. I want to count how many objects of each class were detected. Thanks!
The text was updated successfully, but these errors were encountered: