what is best way to use trained tensorflow in java [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am coding UI by javaFx in eclipse
because I can only use java, no python, no c.
Now I try to use trained tensorflow file in this UI. (this tensorflow file is under python)
I am looking for several ways (API, jython, TCP/IP) but I am not sure which one is best.
Please write your opinion which has more advantages or fewer disadvantages.

I think there are two ways for that,
tensorflow-serving which uses grpc to connect from java to the serving server, making it independent of any language. Look here for details.
Use tensorflow java API. Here and Here is an example of using object detection model in native java program.
Now, tensorflow-serving is the preferred way to go, as there are several advantages. Serving is heavily optimized for speed and resource management like GPU. It also stacks multiple requests (if there is too many) and then processes them in a batch which utilizes the GPU efficiently.

Related

What are the advantages of using java cloudant client? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
What are the main advantages of using java cloudant client api instead of directly using the cloudant REST API?
thanks
A lot of effort has been made to ensure that the Cloudant Java library is slick to use, and hiding both some of the rough edges of the API, encoding some best practices and saving you from tedious boiler plating.
It also gives you a lot of extra functionality "for free", for example automatic retrying of requests that generated a "429: Too Many Requests" response in the rate-limited environment on IBM Cloud.
The Java library is of course also officially supported, with a regular release cadence, meaning that you can raise tickets against it, and have an expectation that issues will be fixed. As these libraries are developed in conjunction with the service, you can also expect that new features in the service will be reflected in the client libraries.
Saying all that, it's good to reflect on when to use a library that someone else wrote, and when to "roll your own". All languages and platforms tend to have good support for HTTP, and speaking directly to the API can mean that you know exactly what you have, and you can avoid any bloat, especially if you only need a fraction of what the library provides.
Here's an example I wrote (in Python, but the ideas hold for any language) to show how simple it can be to write a "micro" library yourself to target the API directly:
https://github.com/xpqz/microcdt

Good practices for Data Scientists that work in R and engineers who work in Java and C++ collaborating [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My company has a production application being built in Java and C++. We have recently added Data Scientists who are skilled at and using R. I am wondering what best practices people have for making sure that work done in R is best leveraged. For instance is our best option to call R code from Java or C++? I have located http://www.renjin.org/about.html.
Or is there a good way to convert code from R to Java or C++?
I am not a big fan of Renjin as its Java-based interpreter will only cover a subset of CRAN, and at that the subset that does not involve calls to C++.
I am a bigger fan of either
separation of concern:
use something like Rserve for headless connection from anything (including Java), or
use something like OpenCPU to turn everything into web-based access
for heavier-duty work, interface C++ directly via Rcpp which well over 400 CRAN packages do.

Integration of different parts of code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am working on a small project on metadata extraction from documents and have run into, eh a dilemma. I have some libraries in Java which work well with document-handling for information retrieval, like Apache Tika, POI etc and some more tools in other languages like Ruby(pdf-extract) and a script in bash to fetch data from a RESTful API using wget.
AFAIK, Code reuse is a good thing, right? But then, if its not possible (natively, I mean) to reuse all this code, What approach has to be taken?
Using Java to run terminal-commands is a solution but I don't think it is good programming practice.
Integrating multiple technologies is something that is very common in real world applications. In order for it to scale properly, you probably want to use some methodology to keep things consistent. To me, the weakest part is probably fetching using wget, but that's my opinion.
In order to integrate and for everything to scale nicely you may want to look at some message passing protocols and have some sort of handling of queues where individual workers run in different programming languages and environments. Look at:
https://www.amqp.org/ (message passing standard)
https://www.rabbitmq.com/ (Java, .NET, Ruby, Python, PHP, JavaScript...

Java: SQL and Statistics/Machine Learning [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a question for you concerning Java. I am basically a Java user and did most of my work with it. However, in the machine learning classes I took in college, we used mostly python with the scikit-learn and numpy packages.
Now I want to do a project where I crawl data from the web, store it in SQL databases, and then do machine learning on this data. Maybe some of you have experience with those things and share some of it? I mean, of course it is possible to do these things with java, but maybe you have had some particular experiences on why I should use something else or what to consider?
I am happy for all your thoughts :-)
Have a great weekend!
It turns out that programming language and database implementation are secondary problems. Think first about the machine learning you want to do. Review the existing packages (in any language) and pick one according to how well it fits the needs of the business problem you are trying to solve. Then work with whatever language is most convenient for that package. You will probably find that no single language is suitable for all parts of the problem; you will end up gluing together Java, Python, R, shell scripts, etc, to make a complete solution, and there's nothing wrong with that. Consider that your job is problem solving instead of programming in a specific language and go from there.

Porting an app from Java to Python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have written an RTMPS client a while back and needed it for my Django application but since Java and Python don't play well without using system calls (I don't want to use Jython) I wanted to rewrite the application in Python.
Would it work if I ported it as if to Python from Java? Of course we have to take into account the obvious things like multiple constructors have to be done differently in Python. Are there any other things that would not make it work in Python?
I am doing this because Java is so memory heavy and hoping that moving in into Python would reduce memory footprint and thus allow my web app to use it.
I would suggest rewriting it completely but there are a lot of differences to take into account. Here's a starter for recognizing some of the common differences/mistakes: http://dirtsimple.org/2004/12/python-is-not-java.html
Also if you are too lazy to rewrite the code (like me) there is an other option: java2python

Categories