当前位置: 代码迷 >> 综合 >> mask rcnn测试(demo)中选取指定目标代码
  详细解决方案

mask rcnn测试(demo)中选取指定目标代码

热度:6   发布时间:2023-12-05 12:14:37.0

如果想识别哪个class_name,替换掉实列代码中的person即可!

r = results[0]
if class_names.index('person') in r['class_ids']:k = list(np.where(r['class_ids'] == class_names.index('person'))[0])r['scores'] = np.array([r['scores'][i]for i in k])r['rois'] = np.array([r['rois'][i]for i in k])r['masks'] = np.transpose(r['masks'])r['masks'] = np.array([r['masks'][i]for i in k])r['masks'] = np.transpose(r['masks'])r['class_ids'] = np.array([r['class_ids'][i]for i in k])
visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'],class_names, r['scores'])
  相关解决方案