weixin_42818906
2021/01/22 00:52
- python
blackguru
2021/01/21 23:19
- 神经网络
- python
- tensorflow
初学者,正在使用maskrcnn检测一些长条状柱状物品,想要完成抓取作业。
物品检测可以顺利完成,现在想求出各个mask的中心坐标和两端的坐标,应该怎么做?利用像素点?还是转多边形再求中心和两端坐标?
以下是检测的部分代码
def detect_image(self, image):
image = [np.array(image)]
molded_images, image_metas, windows = mold_inputs(self.config,image)
image_shape = molded_images[0].shape
anchors = get_anchors(self.config,image_shape)
anchors = np.broadcast_to(anchors, (1,) + anchors.shape)
detections, _, _, mrcnn_mask, _, _, _ =\
self.model.predict([molded_images, image_metas, anchors], verbose=0)
final_rois, final_class_ids, final_scores, final_masks =\
unmold_detections(detections[0], mrcnn_mask[0],
image[0].shape, molded_images[0].shape,
windows[0])
r = {
"rois": final_rois,
"class_ids": final_class_ids,
"scores": final_scores,
"masks": final_masks,
}
drawed_image = visualize.display_instances(image[0], r['rois'], r['masks'],
r['class_ids'], self.class_names, r['scores'])
0个回复
奈陌real
2021/01/21 22:45
- python
- list
json = {
"test": [
{
"num": "0",
"char": "a"
},
{
"num": "1",
"char": "b"
},
{
"num": "3",
"char": "c"
}
]
}
num_list = char_list = []
for i in json['test']:
num_list.append(i['num'])
char_list.append(i['char'])
print(num_list)
print(char_list)
按照我的思路,应该是num_list中只有num元素,char_list中只有char元素
但实际上,两个列表输出是一样的
['0', 'a', '1', 'b', '3', 'c']
['0', 'a', '1', 'b', '3', 'c']
请问为什么?
1个回复
浮若年华
2021/01/21 22:15
- python