Questions tagged [onnx]

ONNX is an open format to represent deep learning models and enable interoperability between different frameworks.

ONNX

The Open Neural Network Exchange (ONNX) is an open-source artificial intelligence ecosystem. With ONNX, AI developers can more easily move models between state-of-the-art tools and choose the combination that is best for them. ONNX is widely supported and can be found in many frameworks, tools, and hardware. It is developed and supported by a community of partners.

Official resources

809 questions
2
votes
1 answer

Import operators from ai.onnx.ml with Python

I read the ONNX ML documentation at https://github.com/onnx/onnx/blob/master/docs/Operators-ml.md but do not see how to import these functions into my project. I have several upstream nodes generated to do some data splitting & scaling, and I'd…
Douglas Daly
  • 85
  • 10
2
votes
1 answer

C onnx header can't find OrtEnv definition

I am trying to wrap the ONNX header for use in another language. To be clear it uses the C dll and requires the C header however I'm having issues compiling using the C header due to the ONNX header seemingly missing the definition of the OrtEnv…
D3181
  • 2,037
  • 5
  • 19
  • 44
2
votes
2 answers

Why ONNX model reading is failing?

I'm working on model inference using opencv cuda dnn module. While reading my onnx file using cv::dnn:: readNetFromONNX, I'm getting below message. Opencv(4.4.0-dev) Error: Unspecified error (> (expected: 'shape.depth() == CV_32S') where…
2
votes
0 answers

Onnx is not working. AttributeProto is not a name error

I am trying to use onnx in c++ code. But when I try to use onnx/proto_utils.h I am getting error: 'AttributeProto' does not a name type. I am not sure is it some issue with my installation or what. I installed onnx from source, using readme.md…
Bearnardd
  • 37
  • 5
2
votes
0 answers

AttributeError: 'UgatitSadalinHourglass' object has no attribute 'training'

trying to export https://github.com/minivision-ai/photo2cartoon to onnx using the steps from https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html args = parse_args() torch_model =…
0101
  • 1,036
  • 2
  • 14
  • 24
2
votes
3 answers

Inference of onnx model (opset11) in Windows 10 c++?

In order to use my custom TF model through WinML, I converted it to onnx using the tf2onnx converter. The conversion finally worked using opset 11. Unfortunately I cannot load the model in the WinRT c++ library, therefore I am confused about the…
2
votes
0 answers

RuntimeError: Resize coordinate_transformation_mode=pytorch_half_pixel is not supported in Tensorflow

I covert onnxmodel to pb, and get this problem: Traceback (most recent call last): File "/home/fffan/fffan_files/Experiment/Example/onnx2pb/onnx2pb.py", line 45, in onnx2pb_2(onnx_input_path) File…
Frank.Fan
  • 929
  • 3
  • 14
  • 23
2
votes
1 answer

Onnx-to-keras and Keras2onnx alter ONNX model input layers to Nx1x200x200 instead of the original 1x1x200x200

Currently, I am trying to import an ONNX model to Keras in order to run training on datasets of grayscale images of size 1x1x200x200. However, when I convert my onnx model to Keras using onnx-to-keras() the model's input layer is changed to…
ApluUAlberta
  • 105
  • 1
  • 9
2
votes
1 answer

Change pre-trained model to expect channel first in TensorFlow

I have images of shape (batch, channel, height, width) = (1, 3, 224, 224) that need to be fed to a pretrained TensorFlow model. However, by default, TensorFlow expects its pretrained model input to have shape (1, 224, 224, 3). For example: import…
Joseph Konan
  • 666
  • 2
  • 8
  • 18
2
votes
1 answer

Tensorflow 2.x: How to assign convolution weights manually using numpy

In tensorflow 1.x this can be done using a graph and a session, which is quite tedious. Is there an easier way to manually assign pretrained weights to a specific convolution in tensorflow 2.x?
mcExchange
  • 6,154
  • 12
  • 57
  • 103
2
votes
2 answers

Pytorch: Convert 2D-CNN model to tflite

I'd like to convert a model (eg Mobilenet V2) from pytorch to tflite in order to run it on a mobile device. Has anyone managed to do so? All I found, was a method that uses ONNX to convert the model into an inbetween state. However, this seems not…
mcExchange
  • 6,154
  • 12
  • 57
  • 103
2
votes
2 answers

How do you run a half float ONNX model using ONNXRuntime C API?

Since the C language doesn't have a half float implementation, how do you send data to the ONNXRuntime C API?
katrasnikj
  • 3,151
  • 3
  • 16
  • 27
2
votes
0 answers

How to convert pytorch tensor to onnx tensor in custom layer?

I'm trying to make onnx realization of pytorch block. I made custom block with custom forward function. class MyConvBlockFunction(Function): @staticmethod def symbolic(g, input, conv1): from torch.onnx.symbolic_opset9 import…
Vasilyev Eugene
  • 117
  • 1
  • 7
2
votes
0 answers

Unexpected Group Tag error while deserializing protobuf file

While deserializing onnx binary I am getting following error: Traceback (most recent call last): from model.ParseFromString(f.read()) File "~/protobuf-3.3.0-py2.7.egg/google/protobuf/message.py", line 185, in ParseFromString …
2
votes
1 answer

How to get weights from another ONNX models

I have 2 ONNX model, the model1 is like: (conv1-pooling1), the model2 is like: (conv2-pooling2-fc2). How can I generate a new model3, which is (conv1-pooling1-fc2), weights of conv1-pooling1 are from model1 and weights of fc2 are from model2.
Philokey
  • 491
  • 2
  • 5
  • 14