Accessing Label Classifications in

Hello Everyone!

I am currently running the file that runs the ssd-mobilenet-v2 for a captstone project.

I want to add logic to run a seperate function when a human is detected.

Is their any way to access the labels in real time while inside the:

while display.IsStreaming():
    img = camera.Capture()
    detections = net.Detect(img)
    ### Here is where I would like to have logic to run a function if detections==human   


as the code above shows, I want to acess the Human label and be able to run a separate function while inside of that loop.

More info:

This is the same code that is found under the jetson-inference repository.

Hi @resendizor17! Yes, you can do it like this:

detections = net.Detect(img)

for detection in detections:
    if net.GetClassDesc(detection.ClassID) == "Human":
        # do something

(you can find the detection members in the jetson.inference.detectNet.Detection section of the docs here:

You might also be interested in this sample that saves a snapshot of the detected objects.

This is fantastic thanks dusty!
I appreciate the suggestion as well, this will work great for my project.

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