如何从类型 "jetson.inference.detectNet.Detection" 中获取单独的值?
How to get separate values from type "jetson.inference.detectNet.Detection"?
我在我的 Jetson Nano 上使用 DetectNet,效果很好。 net.Detect()
函数返回一个列表,其中每个对象都来自类型 "jetson.inference.detectNet.Detection"。当我打印它时:
<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)
现在我的问题是:如何分别访问这些值(例如,仅访问 ClassID,在本例中为 1)? detection[0][0] 之类的行不起作用,因为它不是数组。我想计算每个 class 中检测到的对象数量。谢谢!
获得检测对象后,您可以按名称访问其成员,例如:
top = detection.Top # with capital letters, just as they are shown by the print() statement.
希望对您有所帮助。
我在我的 Jetson Nano 上使用 DetectNet,效果很好。 net.Detect()
函数返回一个列表,其中每个对象都来自类型 "jetson.inference.detectNet.Detection"。当我打印它时:
<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)
现在我的问题是:如何分别访问这些值(例如,仅访问 ClassID,在本例中为 1)? detection[0][0] 之类的行不起作用,因为它不是数组。我想计算每个 class 中检测到的对象数量。谢谢!
获得检测对象后,您可以按名称访问其成员,例如:
top = detection.Top # with capital letters, just as they are shown by the print() statement.
希望对您有所帮助。