2

I am pretty new to Artificial Intelligence programming, however i do understand the basic concept. I have an idea in my mind:

Import a JPEG Image, Convert this Image into a 2D Array (x,y values + r g b values). Then create a second array with same (xy) values wit rgb all set to 0,0,0. Now i want to build an AI Layer which will try to lower the error factor between the arrays until they are equal (the rgb values in the second array are equal to the first array (error factor 0) ). I would prefer to do it in Java. Any suggestions to librarys or example that can help me get started? Thanks for any help.

videokate
  • 31
  • 3
  • 1
    To just copy image pixel values between arrays as you suggest you don't need any AI "layer". However, this kind of thing is strongly related to various image generating, classifying or compression work. It may help to explain where you want to take this. A very simply "toy" example might be for an AI to learn the function `pixel(x,y)` which given a co-ordinate in the image generates the right RGB colour array `[r,g,b]` - it's a simple, fun and informative task to use a neural network on, and you can animate the results. Would that sort of thing be what you had in mind? – Neil Slater Oct 25 '19 at 11:17
  • Yes that sounds like a cool idea too. Do you have a framework or sdk or something in mind? – videokate Oct 25 '19 at 11:20
  • Not for Java. Someone else would need to suggest that. I wanted to clarify what kind of thing would count, since your description of your idea is a bit vague, and does not naturally lead to an AI solution. So it would be helpful to know your goals - e.g. are you learning about neural networks, or want to explore computational creativity? With this one idea it is only going to be a single small step towards any goal. – Neil Slater Oct 25 '19 at 11:23
  • 1
    My idea is to recreate a given image by using ai, maybe you could add a twist like only lines are allowed etc. Im just messing around with ai because it seems really interesting to me. – videokate Oct 25 '19 at 11:26
  • 1
    That sounds more like a genetic algorthm approach e.g. https://www.youtube.com/watch?v=rGt3iMAJVT8 - I think you need to settle on a more specific goal than "just mess with AI" for this question (it's fine as a personal goal, but too broad for anyone to answer). This site cannot really give you the ideas for your project as answers because that is too open-ended. But we can answer more specific questions such as how to use neural networks or how to use genetic algorithms to solve a given problem. – Neil Slater Oct 25 '19 at 11:38

1 Answers1

0

For recreating an image exactly the same as the original, you can use an autoencoder. This basically use AI Layers to encode the image raw pixel values to a vector of floats, drastically decreasing the representing vector. Afterwards another AI Layer increases the dimensions back to the original image. The method does not required labels, as it only refer to teh image to encode it to a vector of features. For implementing in java, there is not a lot 9f resources. However, you can check this library out: https://deeplearning4j.org/ For the implementation, see this: https://github.com/eclipse/deeplearning4j-examples/blob/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/unsupervised/variational/VariationalAutoEncoderExample.java For the method, you can see this python tutorial and implement it in java. https://towardsdatascience.com/autoencoders-in-keras-c1f57b9a2fd7

For generating completely new image, you can try GAN(Generative Adverserial Network). This generates completely new images from a random noise image. The noise image is passed through a generator which is a CNN(convolutional neural network) and get a result image. The result image is then feed to a discriminator(CNN as well) to classify if that image is fake or real. The generator and discriminator compete and slowly gets better. For java implementation, see this: https://github.com/wmeddie/dl4j-gans

Hope I can help you and have a nice day!

Clement
  • 1,725
  • 7
  • 24