Tensorflow 对象检测 API 框坐标

我使用了Tensorflow对象检测API来检测自定义对象。模型运行得很完美,但现在我想知道这些框的坐标。有没有办法知道每个检测到的对象的框坐标?


回答:

请查看教程的IPython笔记本,里面有他们用于检测的代码(链接到GitHub):

with detection_graph.as_default():  with tf.Session(graph=detection_graph) as sess:    # 定义检测图的输入和输出张量    image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')    # 每个框代表图像中检测到特定对象的部分。    detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')    # 每个分数表示对每个对象的置信度。    # 分数显示在结果图像上,并与类别标签一起显示。    detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')    detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')    num_detections = detection_graph.get_tensor_by_name('num_detections:0')    for image_path in TEST_IMAGE_PATHS:      image = Image.open(image_path)      # 图像的数组表示将在后面用于准备带有框和标签的结果图像。      image_np = load_image_into_numpy_array(image)      # 扩展维度,因为模型期望图像的形状为:[1, None, None, 3]      image_np_expanded = np.expand_dims(image_np, axis=0)      # 实际检测。      (boxes, scores, classes, num) = sess.run(          [detection_boxes, detection_scores, detection_classes, num_detections],          feed_dict={image_tensor: image_np_expanded})

他们将坐标存储在boxes变量中。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注