Closed taisuke-tomida closed 2 years ago
https://www.tensorflow.org/api_docs/python/tf/keras/layers/SeparableConv2D
I was having problems with a particular layer, so I used SeparableConv2D in keras.
Added on line 2818.
python openvino2tensorflow.py --model_path model_512x1024_opt.xml --model_output_path model --output_saved_model --output_no_quant_float32_tflite --output_integer_quant_tflite --weight_replacement_config replace.json
Successful output of tflite.
Comparing the output (masked images) of Pytorch, onnx, and tflite, they were almost identical.
I would appreciate any guidance you could give me on this operation.
thanks.
Thanks for the suggestion. Your suggestion seems to work. However, under limited conditions.
[N, C, H, W]
[GROUPS, C_OUT, C_IN, Z, Y, X]
I am wondering how I should determine the conditions for using SeparableConv2D
.
C_OUT == 1 AND C == GROUPS * C_IN -> SeparableConv2D
Furthermore, I can't think of a good idea how to implement the case of [N, C, D, H, W]
in 5D. Very distressed.
It is a difficult problem.
In DepthWiseConv2d, the number of output channels is the number of input channels, right?
Only in 4D, but how about looking at the number of channels in the output and if it is reduced, we can adopt your example?
I am not familiar with it and I am sorry I cannot make a good suggestion.
Only in 4D, but how about looking at the number of channels in the output and if it is reduced, we can adopt your example?
That is correct.
I will attempt to implement this with limited conditions.
I am glad we had a good discussion. Thank you!
@PINTO0309 Is JSON correct weight_replacement_config.json?
I noticed this attached to the reply above.
LGTM
I am amazed at the speed of response....
I think it is good too!
Released v1.31.5 . https://github.com/PINTO0309/openvino2tensorflow/releases/tag/v1.31.5
Thanks for the quick response!
Issue Type
Bug
OS
Windows
OS architecture
x86_64
Programming Language
Python
Framework
PyTorch
Download URL for ONNX / OpenVINO IR
ONNX (onnxsimplifier done)
https://drive.google.com/file/d/19ZkP4gJTx8DXBEFBOUuqYYV5jw3mOg_8/view?usp=sharing
OpenVINO IR
https://drive.google.com/file/d/1KHg0mu64E-1mLBFTFPgZ__67N2_ueIf2/view?usp=sharing
Convert Script
Description
current
GroupConvolution is determined to be DepthWiseConvolution, and the number of input channels has become the number of output channels.
Then, the number of dimensions do not match in the Add immediately following, resulting in an error.
expected
Ideally, the number of output channels should be halved.
Relevant Log Output
Source code for simple inference testing code
The goal is to convert to tflite.