【发布时间】:2021-01-21 01:41:53
【问题描述】:
我正在尝试使用 YOLO 来检测 Android 应用程序中的车牌。
所以我在 Google Colab 中训练了一个 YOLOv3 和一个 YOLOv4 模型。我使用wonderfull project of Hunglc007 将这两个模型转换为 TensorFlow Lite,我还验证了它们是否正常工作并得到以下结果:
但是当我尝试了解模型的输出以在我的应用中调整它时,我使用netron 得到了这个:
当模型被训练为只检测一个对象时,为什么我有 2 个输出?
为什么输出的格式是这样的,这个[1,1,4]代表什么?
编辑
bbox的代码可以在here找到
boxes, scores, classes, valid_detections = tf.image.combined_non_max_suppression(
boxes=tf.reshape(boxes, (tf.shape(boxes)[0], -1, 1, 4)),
scores=tf.reshape(
pred_conf, (tf.shape(pred_conf)[0], -1, tf.shape(pred_conf)[-1])),
max_output_size_per_class=50,
max_total_size=50,
iou_threshold=FLAGS.iou,
score_threshold=FLAGS.score
)
pred_bbox = [boxes.numpy(), scores.numpy(), classes.numpy(), valid_detections.numpy()]
image = utils.draw_bbox(original_image, pred_bbox)
# image = utils.draw_bbox(image_data*255, pred_bbox)
image = Image.fromarray(image.astype(np.uint8))
image.show()
image = cv2.cvtColor(np.array(image), cv2.COLOR_BGR2RGB)
cv2.imwrite(FLAGS.output + 'detection' + str(count) + '.png', image)
【问题讨论】:
-
您能否提供有关您自己的代码的更多信息,例如显示最后一个数字的部分。
-
带有 bbox 的图像的代码或输入和输出信息的代码?
-
生成这个的代码。 i.stack.imgur.com/hYtkT.png
-
它是lutzroeder.github.io/netron 我在编辑中添加它。它是一个了解模型输入和输出的工具。您只需将
.tflite放入其中,它就会为您提供所需的所有信息
标签: tensorflow-lite yolo