Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sophisticated example for JavaCPP - Tensorflow #409

Closed
szingerpeter opened this issue Apr 18, 2017 · 9 comments
Closed

Sophisticated example for JavaCPP - Tensorflow #409

szingerpeter opened this issue Apr 18, 2017 · 9 comments

Comments

@szingerpeter
Copy link

szingerpeter commented Apr 18, 2017

Dear All,

I have seen the example for using Tensorflow with Java. I did not really manage to understand what was going on in the code. Would it be possible to have some more documentation on it?
Moreover, I would be interested in a bit more sophisticated example or at least some guidance how I should / could use Tensorflow in Java. I think it is a great initiative, but I feel a bit lost on how I could implement for example a feed-forward neural network with for example 2 hidden layers and 5 classes by using Tensorflow JavaCPP bindings.
Thank you for any help!

Cheers,
Peter

@saudet
Copy link
Member

saudet commented Apr 21, 2017

It basically maps the C++ API, so for example we could easily port this example to Java:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/label_image
That should be pretty easy to do! Sounds good?

@szingerpeter
Copy link
Author

Thank you for your reply.
Unfortunately, I am not familiar with C++, but will try to make sense out of the example you sent me!

@saudet
Copy link
Member

saudet commented Apr 25, 2017

It shouldn't be too hard. If you have any questions, please post to the mailing list or ask on Gitter! Thanks

@allenjack
Copy link

I agree with @szingerpeter. It is better to provide an example about how to train a simple neural network. I am also facing this problem that how to start from scratch with Java API. There are few materials can be referred to.

@saudet
Copy link
Member

saudet commented Apr 28, 2017

@allenjack That's cool, contributions are welcome!

@saudet
Copy link
Member

saudet commented Mar 18, 2018

@allenjack FYI, here is a complete training example using only the C++ API:
https://matrices.io/training-a-deep-neural-network-using-only-tensorflow-c/
It should be pretty straightforward to translate this to Java, but please let me know if you encounter any issues. Thanks for your interest!

@allenjack
Copy link

allenjack commented Mar 19, 2018 via email

@saudet
Copy link
Member

saudet commented May 26, 2018

@saudet saudet closed this as completed May 26, 2018
@saudet
Copy link
Member

saudet commented Jul 10, 2019

BTW, it's now also possible to train using Keras:
https://github.com/bytedeco/javacpp-presets/blob/master/tensorflow/samples/KerasMNIST.java
This works with an embedded version of CPython, so there is no need to install anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants