如何在Android上设置tflite模型的输入张量和输出张量?

我有一个模特,

public string Decrypt(string cipher)
{
   if (cipher == null) throw new ArgumentNullException("cipher");

   //parse base64 string
   byte[] data = Convert.FromBase64String(cipher);
   //decrypt data
   byte[] decrypted = ProtectedData.Unprotect(data,null,Scope);
   return Encoding.Unicode.GetString(decrypted);
}

我想将此模型转换为tflite模型,并在android上运行。

tflite的官方示例显示输入张量为input shape: (batch_size,3,48,64,18) output shape: (batch_size,512) ,输出张量为float数组。

如何将形状为(batch_size,3,48,64,18)的输入数据存储到ByteBuffer?

在我的项目中,我设置one-dimensional ByteBuffer是因为原始输入数据的形状为(54,48,64,18),并且我使用batch_size = 3将数据重塑为(3,3, 48、64、18)。

真的需要先进行重塑吗?

我可以将形状为(54、48、64、18)的数据直接存储到ByteBuffer吗?

FWBOOO 回答:如何在Android上设置tflite模型的输入张量和输出张量?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2854778.html

大家都在问