【发布时间】:2019-06-21 13:27:06
【问题描述】:
我们可以在 Tensorflow 对象检测 API 类中计算检测到的对象吗?假设您有两个类汽车和自行车,我想明智地计算每个对象类; ,车数:5 自行车数:3。
【问题讨论】:
标签: python tensorflow object-detection-api
我们可以在 Tensorflow 对象检测 API 类中计算检测到的对象吗?假设您有两个类汽车和自行车,我想明智地计算每个对象类; ,车数:5 自行车数:3。
【问题讨论】:
标签: python tensorflow object-detection-api
实现此目的的一种方法是执行以下操作
boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
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')
(boxes, scores, classes, num_detections) = sess.run([boxes, scores, classes, num_detections],feed_dict={image_tensor: image_np_expanded})
final_score = np.squeeze(scores)
car_count = 0
for i in range(100):
if final_score[i] > 0.5:
detected_class = int(classes[0][i])
if detected_class == 1:
car_count += 1
在这里,类名和编号根据您在label_map.pbtxt 文件中指定的值进行映射。我希望这能够帮到你。如果您遇到任何问题,请告诉我
【讨论】: