Get Color of Bounding Box - Jetson Nano detectNet

I want to get the colors of the bounding boxes for the different classes that are detected.

Based on this generic code, how can I do that?

How can I get the default colors for the bounding boxes of each class that I would see in the video display?

import jetson.inference
import jetson.utils

net = jetson.inference.detectNet(“ssd-mobilenet-v2”, threshold=0.5)
camera = jetson.utils.videoSource(“csi://0”) # ‘/dev/video0’ for V4L2
display = jetson.utils.videoOutput(“display://0”) # ‘my_video.mp4’ for file

while display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img)
display.SetStatus(“Object Detection | Network {:.0f} FPS”.format(net.GetNetworkFPS()))


You can find the color information in the below source:


1 Like