0

I have a neural network in a jupyter notebook which I am usting as a black box for my program. The network takes an image in, makes some changes and returns an image back. I am trying to find a way to send the image and an int value from the winform into the jupyternotebook (probably as a path to it) and then return the result back to the windows forms with the ability to save it on the computer. If it would help, the neural network is based on Keras.

I tried some guides that i have found on the internet, i will link them below, and asked a couple of teachers for help but I didn't have any results.

Here are the things I have found:

https://ndres.me/post/jupyter-notebook-rest-api/

How do you put an image file in a json object?

Call and consume Web API in winform using C#.net

https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/bb412179(v=vs.100)

Alex Drob
  • 1
  • 1
  • What exactly have you tried and what exactly didn't work about it. It's hard to answer your question unless we know exactly what the problem is. – Matthew Barlowe Jun 01 '19 at 18:18

1 Answers1

0

You can choose an alternative way:

Using your jupyter notebook, save the Keras model, and then build a python server that listens for calls from your WinForms program.

You can start off with a few more relevant tutorials:

  1. Training and serving ML models with tf keras
  2. Deploying Keras models using TensorFlow Serving and Flask

Basically, what you want to do is:

  1. Save your model's weights and graph.
  2. Serve as server that listens for incoming requests via some protocol(HTTPRequests or RPC for instance)
  3. Make you WinForms program call it and get the answer.

Depending on your application, you can:

  1. Return the image as lists of lists (for instance as in RBG, you can specify the exact value of each pixel and channel)
  2. Return a binary stream of the image (encode it and decode it)
  3. Encode to Base64 string.

You can also explore for more options. Eventually, now you have a service that runs in background and awaits from WinForms to call it with an image. You can also serve it over the internet if you choose web-based protocol (Flask for instance).

mr_mo
  • 1,401
  • 6
  • 10