python - 如何从“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] 这样的行不起作用,因为它不是数组。我想计算检测到每个类的对象数量。谢谢!
解决方案
拥有检测对象后,您可以按名称访问其成员,例如:
top = detection.Top # with capital letters, just as they are shown by the print() statement.
希望能帮助到你。
推荐阅读
- android - 使用 Glide 库显示模糊图像
- maven - Maven pom配置文件激活忽略大小写
- abap - ABAP CDS 中参数映射前的计算
- excel - Excel VBA 用户窗体:如何将数据从列表框传输到工作表单元格?
- postgresql - Visual Studio 2017 中的 PostgreSQL 语法高亮显示
- internet-explorer - 无法在 Blue Prism 中加载 shdocvw.dll 或 ieframe.dll
- azure - AzCopy 登录失败
- angular - 关于 ng-content 的异常行为
- tensorflow - 在 TensorFlow 中重新训练冻结的 *.pb 模型
- c# - 反序列化 Microsoft.OData.Edm.Date