Search code examples
image-processingclassificationkerasconv-neural-networkpixel

How to apply CNN for multi-channel pixel data based weights to each channel?


I have an image with 8 channels.I have a conventional algorithm where weights are added to each of these channels to get an output as '0' or '1'.This works fine with several samples and complex scenarios. I would like implement the same in Machine Learning using CNN method.

I am new to ML and started looking out the tutorials which seem to be exclusively dealing with image processing problems- Hand writing recognition,Feature extraction etc.

http://cv-tricks.com/tensorflow-tutorial/training-convolutional-neural-network-for-image-classification/

https://leonardoaraujosantos.gitbooks.io/artificial-inteligence/content/neural_networks.html

I have setup the Keras with Theano as background.Basic Keras samples are working without problem.

What steps do I require to follow in order achieve the same result using CNN ? I do not comprehend the use of filters,kernels,stride in my use case.How do we provide Training data to Keras if the pixel channel values and output are in the below form?

Pixel#1 f(C1,C2...C8)=1

Pixel#2 f(C1,C2...C8)=1

Pixel#3 f(C1,C2...C8)=0 .

.

Pixel#N f(C1,C2...C8)=1


Solution

  • Since the input is in the form of channel values,that too in sequence.I would suggest you to use Convolution1D. Here,you are taking each pixel's channel values as the input and you need to predict for each pixel.Try this eg :

     Conv1D(filters, kernel_size, strides=1, padding='valid')
     Conv1D()
     MaxPooling1D(pool_size)
     ......
     (Add many layers as you want)
     ......
     Dense(1) 
    

    use binary_crossentropy as the loss function.