【发布时间】:2021-04-20 14:08:11
【问题描述】:
这里的第一个问题。不是等待答案,而是关于如何解决它或阅读文档的一些指导
我正在学习 Tensorflow,我正在处理实时相机对象检测的基本示例,并希望在其他软件 (GIS) 中输入输出
我可以更改来自相机的最终图像吗?或者甚至关闭来自相机的图像并只留下正方形和标签
这是绘制矩形的代码
input_tensor = tf.convert_to_tensor(np.expand_dims(image_np, 0), dtype=tf.float32)
detections, predictions_dict, shapes = detect_fn(input_tensor)
label_id_offset = 1
image_np_with_detections = image_np.copy()
viz_utils.visualize_boxes_and_labels_on_image_array(
image_np_with_detections,
detections['detection_boxes'][0].numpy(),
(detections['detection_classes'][0].numpy() + label_id_offset).astype(int),
detections['detection_scores'][0].numpy(),
category_index,
use_normalized_coordinates=True,
max_boxes_to_draw=200,
min_score_thresh=.30,
agnostic_mode=False)
# Display output
cv2.imshow('object detection', cv2.resize(image_np_with_detections, (800, 600)))
函数visualize_boxes_and_labels_on_image_array是Tensorflow models/research/object_detection/utils/visualization_utils.py的一部分
我的第一个猜测是将 image_np_with_detections 修改为空白图像,但它不起作用。我曾尝试直接修改可视化工具,但它会在使用图像处理检测时产生错误。
另一种选择是深入研究 opencv 文档
有什么线索吗?
提前致谢
【问题讨论】:
标签: python tensorflow opencv computer-vision