synaptic icon indicating copy to clipboard operation
synaptic copied to clipboard

Image as an input

Open ZauChoco opened this issue 6 years ago • 3 comments

Hello,

How to send an image as an input to make a prediciton ?

For example: If I want to make a neural network to know if an image is red, how to send the image ? In this case, it would be a buffer.

Thank you

ZauChoco avatar May 26 '19 19:05 ZauChoco

Read the RGB value of each pixel and feed each pixel as your input. Doing this with Javascript is very slow, so you should learn Tensorflow/Keras in combination with a top Nvidia card which has Tensorcores.

ghost avatar May 27 '19 13:05 ghost

I tried, but each images don't have the same number of pixels, because of compression. I could send everything in one input? Prgb+P²rgb+P³rgb.......

For instant, I try with Javascript, but I will certainly change with another language.

ZauChoco avatar May 27 '19 15:05 ZauChoco

You can create Javascript code with Javascript to adopt your inputs to different pixel size, but that's more of a hack. You need to optimize and tune your neural network, for that you need static input size. Maybe define 3 models, small pix, medium and large pix and optimize each network. But that still will be slow in Javascript. Using Tensorflow you can be 100-1000x faster, limit ist just your hardware budget.

I recommend to read study this blog daily: https://machinelearningmastery.com/blog/

ghost avatar May 28 '19 15:05 ghost