however, I'm not sure the proper way use StdArrays or equivalent to take an existing byte[][] and turn it into a TString
@killeent , try TString.tensorOfBytes(StdArrays.ndCopyOf(byte[][]))
TFRecord
are basically just protos that coule be read/written directly. You can use these pregenerated bindings to do so
Example
, Features
and Feature
protos . I am actually looking if there is an API in tensorflow/java
that does this particular job (TFRecord)
TFRecordDataset
in tensorflow/java
was available in org.tensorflow.framework. However, it expects a Ops
param. That's why I meant "I am looking to avoid the introduction of elements/concepts related to the computation graph".
tensorflow/java
soon.
Mat
object from OpenCV
(a preprocessed image of a symbol to be "detected") and a loaded model with session and stuff. Maybe there are some open-source examples.
Mat
object to be a representation of Tensor<Float32>
and use session runner, like explained in StackOverflow answer. Am I missing something?
TFloat32
is a subtype of Tensor
so you need to make one of those. The SavedModelBundle
exposes a call entry point which executes the requested function in the model (e.g. https://github.com/tensorflow/java/blob/35b73ce43cb821e5462ffc9ece51d6528dad224d/tensorflow-core/tensorflow-core-api/src/test/java/org/tensorflow/SavedModelBundleTest.java#L131).
TFloat32
object from my image and pass it to function.call(..)
. API says I need 4 dimensional tensor. How it can be made from 2-dimensional array like image?
NDarray.slice(Indices.newaxis(), Indices.ellipse(), Indices.newaxis())
on your ndarray. Make sure the width/height order matches your model though. In gneral, if you need to do ndarray operations your best bet is usually to load it into an eager session (Ops.constantOf
) and do it there.