Object Name associated with ClassID in net.detect

Playing around with the Hello AI World demo program, detectnet-console.py, I am able to detect items in a picture, and access the found items by printing the results:

The net.Detect() funcion gives back a list. When I print it:

<detectNet.Detection object>
– ClassID: 1
– Confidence: 0.808974
– Left: 416.31
– Top: 218.694
– Right: 593.188
– Bottom: 703.127
– Width: 176.878
– Height: 484.433
– Area: 85685.7
– Center: (504.749, 460.91)
The command detections[0].ClassID gives me a number ID, 1 in the case above, but I need the name that goes with that ID, like cat or banana or whatever. This actual name is superimposed over the image, and shown on the image when .RenderOnce(img, width, height) is called, but I want to determine the actual name for use in the other parts of my python program. I hope this question makes sense. Appreciate any help or point me in the right direction.
Paul McWhorter


You should be able to find the corresponding class name with this function:


Thanks! Exactly what I needed.