MediaPipe TensorflowLite Iris模型

时间:2020-08-22 20:55:32

标签: computer-vision tensorflow-lite mediapipe

我试图了解Mediapipe提供的tflite Iris landmarks model的输出。

model card 将输出描述为71个2D界标和5个2D界标。检查模型时,如下所示:

interpreter = tf.lite.Interpreter(model_path='iris_landmark.tflite')
interpreter.allocate_tensors()
output_details = interpreter.get_output_details()

print(output_details)
[{'dtype': numpy.float32,
  'index': 384,
  'name': 'output_eyes_contours_and_brows',
  'quantization': (0.0, 0),
  'quantization_parameters': {'quantized_dimension': 0,
   'scales': array([], dtype=float32),
   'zero_points': array([], dtype=int32)},
  'shape': array([  1, 213], dtype=int32),
  'shape_signature': array([  1, 213], dtype=int32),
  'sparsity_parameters': {}},
 {'dtype': numpy.float32,
  'index': 385,
  'name': 'output_iris',
  'quantization': (0.0, 0),
  'quantization_parameters': {'quantized_dimension': 0,
   'scales': array([], dtype=float32),
   'zero_points': array([], dtype=int32)},
  'shape': array([ 1, 15], dtype=int32),
  'shape_signature': array([ 1, 15], dtype=int32),
  'sparsity_parameters': {}}]

我在模型输出中看到213个值和15个值-因此,我假设每个点都获得了x / y / z坐标。在图像上运行模型后,我得到的值在-7000到+7000范围内。我输入的是64x64的图片,您知道这些点如何与原始图片相对应吗?

我想获得在mediapipe示例中呈现的眼睛关键点的像素坐标。

1 个答案:

答案 0 :(得分:1)

模型卡好像是错的,其实输出的是3D坐标,模型输入输出也有一些归一化不清楚,但是用来绘制2d地标。

我用我的发现打开了一个 github 问题 here。我没有看到任何与模型卡相关的变化。

我创建了一个 colab,展示了正确的用法,here。您可以忽略 z 坐标并将 x/y 坐标绘制到图像上以查看地标。

我可能应该用虹膜图片示例更新 colab。