更改tensorflow object_detection教程

时间:2017-08-02 07:24:08

标签: python machine-learning tensorflow

我一直在研究tensorflow的object_detection教程: https://github.com/tensorflow/models/blob/master/object_detection/object_detection_tutorial.ipynb

实际检测发生的部分是:

  # Each box represents a part of the image where a particular object was detected.
  boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
  # Each score represent how level of confidence for each of the objects.
  # Score is shown on the result image, together with the class label.
  scores = detection_graph.get_tensor_by_name('detection_scores:0')
  classes = detection_graph.get_tensor_by_name('detection_classes:0')
  num_detections = detection_graph.get_tensor_by_name('num_detections:0')
  # Actual detection.
  (boxes, scores, classes, num_detections) = sess.run(
      [boxes, scores, classes, num_detections],
      feed_dict={image_tensor: image_np_expanded})

然而,每个结果 - 张量,即盒子,分数和类正好是100个条目长,我找不到最细微的线索,这个数字可能被定义,但我想改变它。

任何人都可以请我提供这些信息或提示,在哪里查看?

致以最诚挚的问候,

G.Brown

1 个答案:

答案 0 :(得分:1)

由于您使用的是冻结图形,因此您无法通过控制来更改图形执行预测的方式。要获得所需的结果,可以使用硬阈值来减少边界框和误报的数量。

Suppose you want the predictions to be 80% sure than use thresholding to remove all prediction with `scores < 0.8`

注意:你可以用另一种方式控制;为此,您需要获取原始检查点文件并使用export_inference_graph文件。您需要更改行号132-133。同样的概念适用于其他模型配置文件。    mobile ssd config file