onnx2keras icon indicating copy to clipboard operation
onnx2keras copied to clipboard

About Slice Layer

Open weiyichang opened this issue 5 years ago • 1 comments

Hello,

I have a problem related to slice layer .

My model is like this (I want to slice the ch dimension, and then concatenate them, i.e., I set axis attribute as 1 in slice layer in an onnx file)

截圖 2019-12-04 下午3 36 40

I add a slice layer after the first conv layer but while converting this model to tflite model, it will show that the input of concat layer is mismatch

I print the shape of slice layer like this:

截圖 2019-12-04 下午3 35 10

For the upper part, it is normal (slice input to two tensors with 4 channels and 12 channels),

but for lower part, it slices the wrong dimension

I use the setting of change_ordering=True with onnx2keras==0.0.17

Do you have any suggestion ? Thanks a lot :)

weiyichang avatar Dec 04 '19 07:12 weiyichang

Hello.

I encountered a same issue, and the cause seems to be in tf.nn.strided_slice() according to my test. I fixed it and you can refer to the PR #55 . (In my repository forked from here, I changed onnx2keras/reshape_layers.py/convert_slice()) Best regards.

krtbb avatar Mar 24 '20 08:03 krtbb