【发布时间】:2020-09-18 16:59:27
【问题描述】:
好的,我正在研究对象检测模型。我可以成功探测到飞机。但我想将有关这些检测的信息发送给用户。
我有一本空字典:
planes= dict()
我有一个二维数组:
array1 = ([[ 20.2765, 20.2508, 545.9968, 51.9848],
[ 56.2883, 1240.3577, 385.5900, 1268.1694],
[ 502.5009, 1194.2896, 799.5756, 1221.9590],
[ 54.8439, 669.2018, 305.1923, 735.8934],
[ 502.3042, 424.8962, 735.9933, 712.6230]])
还有另一个数组:
array2 = [1, 3, 3, 3, 3]
第一个数组是平面的坐标,第二个数组是平面的类型。
我想形成一个 JSON(或 Python 字典),在该 JSON(或 Python 字典)上,每个检测到的平面的这些坐标和类型都相互连接。
planes= {
"plane1" : {
"plane_coordinates" : [20.2765, 20.2508, 545.9968, 51.9848],
"plane_type" : 1
},
"plane2" : {
"plane_coordinates" : [56.2883, 1240.3577, 385.5900, 1268.1694],
"plane_type" : 3
},
"plane3" : {
"plane_coordinates" : [502.5009, 1194.2896, 799.5756, 1221.9590],
"plane_type" : 3
},
"plane4" : {
"plane_coordinates" : [54.8439, 669.2018, 305.1923, 735.8934],
"plane_type" : 3
},
"plane" : {
"plane_coordinates" : [502.3042, 424.8962, 735.9933, 712.6230],
"plane_type" : 3
}
}
我已经为此苦苦挣扎了一个小时,但我的新手头脑无法想出一个可行的解决方案。
如果有人可以帮助我,我将不胜感激。
【问题讨论】:
标签: arrays json python-3.x numpy object-detection