MPolaris

Results 24 comments of MPolaris

Hello, after the conversion is completed, the tool will compare the output of onnx and tflite for the same set of data. If the maximum element error exceeds 1e-2, an...

因为pytorch和onnx数据格式基本都是channel first的,而tensorflow是channel last的。因此你只需要对输出做一个tranpose。

hello, it's seems `onnx_model_path` args of onnx_converter function is not same to torch.onnx.export. more, can you share `mnist.onnx`?

你只需要新加入算子映射就好,你可以参照readme里面的添加HardSigmoid算子流程,在layers/conv_layers.py文件中加入相关实现即可。 另外在ONNX中,所有类型的卷积均被称为`Conv`,是通过`weight.shape`来区分Conv1d、Conv2d,通过`group`来区分是否是分组卷积(或者深度可分离卷积)。具体实现请查看[这里的代码](https://github.com/MPolaris/onnx2tflite/blob/main/layers/conv_layers.py#L95-L102)。 最后,非常欢迎提交PR。

depthwiseconv3d就是3d可分离卷积,目前tensorflow似乎没有支持3d可分离卷积,你可以使用group卷积来代替,请参考`TFGroupConv`和`TFDepthwiseConv`类。 你开发测试完成欢迎提交一个PR。

目前你可以自行修改`builder.py` `converter.optimizations = [tf.lite.Optimize.DEFAULT]` `converter.target_spec.supported_types = [tf.float16]`

你现在可以更新onnx2tflite,在转换的时候设置`fp16_model=ture`

onnx2tflite has not implement `NonMaxSuppression` op yet. there are currently no relevant plans, PR is very welcome.

I think it's completely feasible, you should make some change at file(utils/graph_tools.py#35, function `build_tf_inputs`), make input's layout to `FORCE_CHANNEL_FIRST_OP`.

这倒是一个不常用的奇葩姿势哈。 不过应该也比较好解决,你可以尝试解决一下,提交一个PR~