onnx / onnx-tensorflow

Tensorflow Backend for ONNX
Other
1.29k stars 296 forks source link

NotImplementedError: StridedSlice version 1 is not implemented. #328

Open yjcn opened 6 years ago

yjcn commented 6 years ago

While I try to export a tensorflow model to onnx based on the suggestions in page: https://github.com/onnx/tutorials/blob/master/tutorials/OnnxTensorflowExport.ipynb I use onnx-tf convert -t onnx -i textdetection.pb -o txtd.onnx However there is an error NotImplementedError: StridedSlice version 1 is not implemented. And I install onnx-tf from source image Does anyone know how to solve it?

tjingrant commented 6 years ago

Would you care to share your tf model with us?

tjingrant commented 6 years ago

One other piece of information that would be helpful to us is your onnx version. You can run this script for us to collect version information about your working environment : https://github.com/onnx/onnx-tensorflow/blob/master/util/get_version.py .

StridedSlice is implemented, but it is implemented for version 9 and onward. So somehow your version of onnx-tf was restricted to use a low opset or fails to find the proper handler. Either way, the solution should be rather straightforward.

yjcn commented 6 years ago

Would you care to share your tf model with us?

Of course, This is my tf model. The output node name is "feature_fusion/Conv_7/Sigmoid" and "feature_fusion/concat_3", the input node name is "input_images" This is the version info.

Python version:
3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
ONNX version:
1.3.0
ONNX-TF version:
1.2.0
Tensorflow version:
1.10.0
tjingrant commented 6 years ago

Hi @yjcn thanks for your response, so it turns out that to support strided slice, we used an experimental onnx op (DynamicSlice), which requires you to install onnx from source as well. You must have installed a release version of onnx (likely you used pip install).

I also ran our model checker on your model and here's the result:

onnx-tf check -i textdetection.pb
INFO:root:Checking for unsupported operators...
INFO:root:There are 18 unique operators in the model file.
INFO:root:There are 1 operators currently not supported by the ONNX-Tensorflow frontend for your model.
INFO:root:set([u'ResizeBilinear'])
INFO:root:Checking for required node arguments...
INFO:root:We checked 549 supported nodes for required arguments.
INFO:root:  # of nodes passed the args check: 549
INFO:root:  # of nodes failed the args check: 0
INFO:root:Some work is needed before we can export your model to ONNX.

Some work is required, but definitely very promising to get it fully working. Do you think you can get rid of this resize bilinear op? Or represent it using existing onnx ops? We can help you out by updating our frontend if you let us know how would you map this resize bilinear op.

yjcn commented 6 years ago

@tjingrant The ResizeBilinear op is from tf.image.resize_bilinear.And I use it to accomplish the Unpooling op. image

tjingrant commented 6 years ago

@yjcn sounds like we could map it to onnx Upsample op. I'll get back to you tomorrow, possibly with a patch to do so.

dolmens commented 6 years ago

Still suffering this problem

tjingrant commented 6 years ago

@dolmens please install onnx from source if your onnx-tf doesn't find StridedSlice.

Otherwise, I'm working on the patch (https://github.com/onnx/onnx-tensorflow/pull/333/files).

pxEkin commented 5 years ago

While I try to export a tensorflow model to onnx based on the suggestions in page: https://github.com/onnx/tutorials/blob/master/tutorials/OnnxTensorflowExport.ipynb I use onnx-tf convert -t onnx -i textdetection.pb -o txtd.onnx However there is an error NotImplementedError: StridedSlice version 1 is not implemented. And I install onnx-tf from source image Does anyone know how to solve it?

@yjcn
Hi,yjcn, Is the problem solved? How deal with it?

iamshri8 commented 5 years ago

I have converted my Keras model to .pb file and trying to export to onnx, while i am getting the following error.

screen shot 2019-01-08 at 3 20 08 pm

Could someone help in resolving this?

I installed onnx from pip.

NicolasHorMann commented 5 years ago

Would you care to share your tf model with us?

Of course, This is my tf model. The output node name is "feature_fusion/Conv_7/Sigmoid" and "feature_fusion/concat_3", the input node name is "input_images" This is the version info.

Python version:
3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
ONNX version:
1.3.0
ONNX-TF version:
1.2.0
Tensorflow version:
1.10.0

Same. I tried with that model.pb and I got this: captura de pantalla 2019-01-10 a la s 13 50 15

I installed all from pip.

fumihwh commented 5 years ago

@NicolasHorMann from source or PyPi?

NicolasHorMann commented 5 years ago

@fumihwh PyPi. I'm using jupyterlab

fumihwh commented 5 years ago

@NicolasHorMann @iamshri8 StridedSlice (DynamicSlice) is added from opset 9, which is 8 in ONNX 1.3.0 (from PyPi). So, currently, StridedSlice does't work with ONNX installed from PyPi. You could press them to release a new version.

dingzeyuli commented 5 years ago

@fumihwh On my mac, I complied ONNX from source and installed tensorflow and onnx-tf from pip3.

Python version:
3.7.1 (default, Nov  6 2018, 18:45:35) 
[Clang 10.0.0 (clang-1000.11.45.5)]
ONNX version:
1.4.1
ONNX-TF version:
1.2.1
Tensorflow version:
1.13.1

I still get the error: NotImplementedError: StridedSlice version 1 is not implemented.

Do you know possible reasons? Thank you.