Extract info (Class, Location, Etc.) from Segnet.py with custom model and live video feed

Hello! I’m currently trying to extract the class info and its location from the output mask that segnet.py provides using jetson-inference/python/examples/segnet.py at master · dusty-nv/jetson-inference · GitHub
Is this something that glDisplay could be used for, or would I need to display the video stream from my camera via opencv and go from there?
EDIT: This looks to be more of a Segnet_Utils.py problem, in there it computes the stats by creating a histogram of the classID’s within the mask per frame, my question is now how to get the location of each individual class pixel in the 10x10 Grid?

@cjw9009 you can just index the class mask directly using the subscript operator like this: https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-image.md#accessing-image-data-in-python

If you want to look it up by pixel coordinate, you would just need to scale the coordinates down to the 10x10 grid. Or if you pass the original-size image into segNet.Mask(), that function will do the interpolation for you and give you the mask scaled-up to the original image size.

Okay, thank you for this info! I may have more questions so if you don’t mind I’d like to keep the thread open for a minute

Another question! Would it be possible to return the confidence interval of the pixels as well?

The confidence scores of each class are the raw output of the model, and from C++ you can get that buffer with segNet::GetOutputPtr(0). However there isn’t a Python binding for this (partly because these higher-dimensional buffers don’t fit into the cudaImage object). I will make a note to investigate this further though.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.