tensorflow / java-models Goto Github PK
View Code? Open in Web Editor NEWModels in Java
Models in Java
Hi, trying to run next examples, but have troubles with loading of native library.
OS: Windows 10
P.S. I see this library in the Maven Tree in IDEA
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnitensorflow in java.library.path: [C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.3\jbr\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0, C:\Windows\System32\OpenSSH, C:\Program Files\NVIDIA Corporation\NVIDIA NGX, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0, C:\WINDOWS\System32\OpenSSH, C:\Program Files\Git\cmd, C:\Users\zaleslaw\AppData\Local\Microsoft\WindowsApps, ., .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
at java.base/java.lang.System.loadLibrary(System.java:1870)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1631)
at org.bytedeco.javacpp.Loader.load(Loader.java:1265)
at org.bytedeco.javacpp.Loader.load(Loader.java:1109)
at org.tensorflow.internal.c_api.global.tensorflow.(tensorflow.java:12)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at org.bytedeco.javacpp.Loader.load(Loader.java:1176)
at org.bytedeco.javacpp.Loader.load(Loader.java:1125)
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:48)
at org.tensorflow.TensorFlow.init(TensorFlow.java:111)
at org.tensorflow.TensorFlow.(TensorFlow.java:126)
at org.tensorflow.Graph.(Graph.java:730)
at org.tensorflow.model.examples.mnist.SimpleMnist.main(SimpleMnist.java:27)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\zaleslaw.javacpp\cache\tensorflow-core-api-0.1.0-SNAPSHOT-windows-x86_64.jar\org\tensorflow\internal\c_api\windows-x86_64\jnitensorflow.dll: Can't find dependent libraries
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
at java.base/java.lang.Runtime.load0(Runtime.java:767)
at java.base/java.lang.System.load(System.java:1834)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1581)
... 12 more
Need to switch on release 0.2 and update all examples
HI :
I want to use some time series model ,I know we have // LSTMBlockCell.create()
// GRUBlockCell.create()
// BlockLSTM.create(), but I don't know how to use it,
would you like supply some example about these ?
thanks
How to create Tensor and populate with data
How to copy to/from tensor
Cover basic operations on one or two tensors
Export/import tensor to file
https://tensorflow.google.cn/api_docs/java/org/tensorflow/package-summary?authuser=1
This API about old release is deprecated and will be removed in a future version, but I can't find the API about new release.
And my TensorFlow version is 2.2.0, can I use old release(latest version is 1.15) to load model then use model to predict?
Let's generate text in William style close to this tutorial
import org.tensorflow.tools.Shape;
import org.tensorflow.tools.ndarray.ByteNdArray;
import org.tensorflow.tools.ndarray.FloatNdArray;
import org.tensorflow.tools.ndarray.index.Indices;
these imports are not found, I'd suggest the simplest solution via addition of missed dependency
In the TF1.x use the "org.tensorflow.Tensor#create(java.lang.Object)" can conveniently construct various types.
Which method in TF2 is equivalent to org.tensorflow.Tensor#create(java.lang.Object) in TF1?
There is a page here showing how to setup Tensorflow on Python for M1 ARM Macs:
https://developer.apple.com/metal/tensorflow-plugin/
It seems we could adapt this example for the M1 ARM Macs.
My question is - what is required?
Running the CNNMnist or SimpleMnist I catch the next error on my Windows 10 machine.
Looks like incorrect protobuf version in Graph creation: the exception thrown in the next row of code Graph graph = new Graph();
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/protobuf/InvalidProtocolBufferException
at org.tensorflow.model.examples.mnist.CnnMnist.build(CnnMnist.java:80)
at org.tensorflow.model.examples.mnist.CnnMnist.main(CnnMnist.java:304)
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.InvalidProtocolBufferException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
Simple Graph building
Print out graph meta-information
Graph serialization/deserialization
LeNet 5 classic model on MNIST
LeNet 5 modification with another hyper-parameters on MNIST and Fashion MNIST
VGG'11 on FashionMnist
ResNet on Cifar 100
AlexNet on Cifar 100 or another subset of ImageNet
I have been using TensorFlow in Java recently to do some work. I browsed the official website and found that there are some gaps in the new TensorFlow version of the document. Then, I redirected to Github.
I am a novice, but I have seen some examples that are old version. I think we can do some updated tasks.
I am happy to help improve these doc works, with the aim of quickly understanding and learning, and then sharing them with my colleague for use.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.