Giter Club home page Giter Club logo

Comments (5)

yuslepukhin avatar yuslepukhin commented on June 24, 2024 1

There are no special capabilities for bulk predictions. If you model is constructed in a way that it would accept the shapes in your example, then you feed that data. C# is just a thin layer on top of the native library.

There is no difference between python, C# in terms of the capabilities.

from onnxruntime.

yuslepukhin avatar yuslepukhin commented on June 24, 2024

The input/output dimensions of your model dictate what you can process.
This does not change with the API you choose to use, the model remains the same so is the implementation behind the API.

You also need to stop leaking memory in a loop. Please, read https://onnxruntime.ai/docs/tutorials/csharp/basic_csharp.html

from onnxruntime.

roushrsh avatar roushrsh commented on June 24, 2024

I guess I'm asking how to predict in batches, rather than one at a time in a loop. Thanks.

from onnxruntime.

roushrsh avatar roushrsh commented on June 24, 2024

I currently save the model

that has a last layer:
model4 = keras.models.Model(inputs=[spectra1, spectra2, ratioAProtS,ratioBProtS,isoS,hitA,hitB,sizeS], outputs=output)

as so:

import tf2onnx
import tensorflow as tf
import onnx
input_signature = ([tf.TensorSpec((1, (1001)), tf.float32) ,tf.TensorSpec((1, (1001)), tf.float32)
,tf.TensorSpec((1, (1001)), tf.float32) ,tf.TensorSpec((1),
tf.float32),tf.TensorSpec((1), tf.float32) ,
tf.TensorSpec((1), tf.float32) ,
tf.TensorSpec((1), tf.float32) ,
tf.TensorSpec((1), tf.float32) ,tf.TensorSpec((1), tf.float32) ])

onnx_model, _ = tf2onnx.convert.from_keras(model4 , input_signature, opset=18)
onnx.save(onnx_model, "../../Desktop/testModel.onnx")

how could I change it for multibatch? thanks

from onnxruntime.

roushrsh avatar roushrsh commented on June 24, 2024

Beautiful, @yuslepukhin . Thanks. I figured it out.

For future people, what yuslepukhin says is key. There's no difference.

You need a mix of these two threads:

#9867
onnx/onnx#2182

Just need to change to N, and then provide what you need.

Got it working in python, should be able to in C# now. Will report back if not, but otherwise closed.

from onnxruntime.

Related Issues (20)

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.