Code Monkey home page Code Monkey logo

Comments (17)

ShivaKothuru avatar ShivaKothuru commented on July 24, 2024 1

Thank you @zldrobit , it works now.

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

It seems that the problem is because 418 is not a mutiple of 32.
Could you change your tensor dimension from 418 to 416?

from onnx_tflite_yolov3.

shahidammer avatar shahidammer commented on July 24, 2024
Traceback (most recent call last):
  File "/home/asd/dev/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1607, in _create_c_op
    c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (418) is not a multiple of input depth of filter (3) for 'convolution_new' (op: 'Conv2D') with input shapes: [1,418,3,418], [3,3,3,32].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "prep.py", line 45, in <module>
    op = sess.graph.create_op(op_type=n_org.type, inputs=op_inputs, name=n_org.name+'_new', attrs=atts) 
  File "/home/asd/dev/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/home/asd/dev/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op
    attrs, op_def, compute_device)
  File "/home/asd/dev/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
    op_def=op_def)
  File "/home/asd/dev/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1770, in __init__
    control_input_ops)
  File "/home/asd/dev/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1610, in _create_c_op
    raise ValueError(str(e))
ValueError: Depth of input (418) is not a multiple of input depth of filter (3) for 'convolution_new' (op: 'Conv2D') with input shapes: [1,418,3,418], [3,3,3,32].

Where do I change the Depth of input from 418 > 416?
I am using yolov3.weights files

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

@shahidammer It seems the problem is not relevant with the input size.
Which version of TensorFlow are you using?
This repo is only tested with TF 1.15

from onnx_tflite_yolov3.

shahidammer avatar shahidammer commented on July 24, 2024

@zldrobit yes.

absl-py==0.9.0
asn1crypto==0.24.0
astor==0.8.1
cffi==1.14.1
cryptography==2.1.4
cycler==0.10.0
flatbuffers==1.11
gast==0.2.2
google-pasta==0.1.8
grpcio==1.26.0
h5py==2.10.0
idna==2.6
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
keyring==10.6.0
keyrings.alt==3.0
kiwisolver==1.1.0
Markdown==3.1.1
matplotlib==3.1.2
numpy==1.17.4
onnx==1.6.0
onnx-tf==1.5.0
onnxruntime-gpu==1.0.0
opencv-python==4.1.2.30
opt-einsum==3.1.0
Pillow==6.2.1
protobuf==3.11.1
pycparser==2.20
pycrypto==2.6.1
pyparsing==2.4.5
python-dateutil==2.8.1
pyxdg==0.25
PyYAML==5.2
SecretStorage==2.3.1
six==1.11.0
tensorboard==1.15.0
tensorflow-estimator==1.15.1
tensorflow-gpu==1.15.0
termcolor==1.1.0
tflite==1.15.0.post1
torch==1.3.1
torchvision==0.4.2
tqdm==4.40.2
typing-extensions==3.7.4.1
Werkzeug==0.16.0
wrapt==1.11.2

Python 3,7,8

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

@shahidammer I cannot reproduce the error using docker zldrobit/onnx:10.0-cudnn7-devel, even after I install Python 3.7.5.
Could you try using the docker zldrobit/onnx:10.0-cudnn7-devel to test the code?

from onnx_tflite_yolov3.

OfirBalassiano avatar OfirBalassiano commented on July 24, 2024

Hey @shahidammer I got this error too,
Do you have any idea how to solve it?
image

I am using the docker file (pulled the image, run it and cloned the git into it)
I use costume YOLOV3 weights

Thanks !

from onnx_tflite_yolov3.

ShivaKothuru avatar ShivaKothuru commented on July 24, 2024

@zldrobit @OfirBalassiano @shahidammer

I am facing the same issue.
Do you have any idea to solve it?

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

@ShivaKothuru Plz provide a minimal producible code, so we can check which lines of code introducing the error.
Moreover, could you provide information about your enviroment, such as Python verison, TF version, PyTorch version, etc.
My suggestion is try using the docker image zldrobit/onnx:10.0-cudnn7-devel to resolve enviroment issues.

from onnx_tflite_yolov3.

ShivaKothuru avatar ShivaKothuru commented on July 24, 2024

@zldrobit
Please find below details:
Python version: 3.8
TF: tensorflow-gpu==1.15.0
PyTorch: torch==1.3.1

Also, I tried with the docker image zldrobit/onnx:10.0-cudnn7-devel, It still gives same error.
The error is at "prep.py" line 45: "op = sess.graph.create_op(op_type=n_org.type, inputs=op_inputs, name=n_org.name+'_new', attrs=atts)"
ValueError: Depth of input (418) is not a multiple of input depth of filter (3) for 'convolution_new' (op: 'Conv2D') with input shapes: [1,418,3,418], [3,3,3,32].

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

@ShivaKothuru It is hard to determine which part causes the error.
Could you provide a minimal reproducible example including command line operations you executed?

from onnx_tflite_yolov3.

x1aoo avatar x1aoo commented on July 24, 2024

Same problem

from onnx_tflite_yolov3.

ShivaKothuru avatar ShivaKothuru commented on July 24, 2024

@zldrobit Thank you for your response.
Please find the implementation and error. link gist

Also, Same error when implemented with docker.
kindly check.

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

@ShivaKothuru Thanks to your example, I found out that it's onnx-tensorflow causing the issue.
onnx-tensorflow determines channel order by whether there's a cuda device: https://github.com/onnx/onnx-tensorflow/blob/e048c0a69b870d661143f561511329dae4acfcfa/onnx_tf/common/__init__.py#L147-L150.
By linking a CUDA device to colab notebook, the pipeline can be run flawlessly:
https://colab.research.google.com/drive/184AEez0RE_fQ7tQEY8fGwMroJgWDkUni?usp=sharing

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

@sakthigeek @shahidammer @OfirBalassiano @x1aoo Plz try running python onnx2tf.py with CUDA devices.
For exmaple, add --gpus all in docker run command.
This should resolve the problem.

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

onnx-tensorflow 1.7.0-tf-1.x changes the logic for choosing devices:
https://github.com/onnx/onnx-tensorflow/blob/0e4f4836f5c3027918950034640c75d36464be86/onnx_tf/handlers/backend/conv_mixin.py#L97-L103
https://github.com/onnx/onnx-tensorflow/blob/0e4f4836f5c3027918950034640c75d36464be86/onnx_tf/handlers/backend/conv_mixin.py#L236-L242

With onnx-tensorflow 1.7.0-tf-1.x, one can set device=CUDA in

output = prepare(onnx_model, strict=False)

to avoid this issue.

from onnx_tflite_yolov3.

zldrobit avatar zldrobit commented on July 24, 2024

Close the issue since the root cause has been founded.

from onnx_tflite_yolov3.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.