loretoparisi / tensorflow-java

Tensorflow Java examples
MIT License
61 stars 31 forks source link

Examples #1

Closed arianaa30 closed 6 years ago

arianaa30 commented 6 years ago

Hi, Thanks for your work. I assume you are providing examples on top of TensorFlow's Java API. Right?

I'm new to ML, and I am trying to use the TensorFlow's Java API. But apparently they have only one example.

loretoparisi commented 6 years ago

@arianaa30 hello, yes this is built on top of the official TF Java API, so it works with the latest TF and it supports all TF "bindings" to Java. In the latest commit I have updated to the latest TF 1.4.0, so the example should work as it is:

[loretoparisi@:mbploreto ~]$ cd Documents/Projects/AI/tensorflow-java/
[loretoparisi@:mbploreto tensorflow-java]$ javac -cp lib/libtensorflow-1.4.0.jar TensorFlowExample.java
[loretoparisi@:mbploreto tensorflow-java]$ java -cp lib/libtensorflow-1.4.0.jar:. -Djava.library.path=./jni TensorFlowExample
TensorFlowExample using TensorFlow version: 1.4.0

and for the LabelImage image tagging example:

[loretoparisi@:mbploreto tensorflow-java]$ javac -cp lib/libtensorflow-1.4.0.jar LabelImage.java 
[loretoparisi@:mbploreto tensorflow-java]$ java -cp lib/libtensorflow-1.4.0.jar:. -Djava.library.path=./jni LabelImage models/ images/example-400x288.jpg 
2017-11-22 14:27:25.447961: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA
BEST MATCH: lakeside (19,00% likely)

Also I have recently asked to the TF authors more tutorials for the Java API in https://github.com/tensorflow/tensorflow/issues/14295.

As soon as I have any other example I will add it to this repository.

loretoparisi commented 6 years ago

I'm closing this issue, please feel free to open it again if need more assistance.