1
$\begingroup$

My current project has to do with modeling the effects of blurring/convolution of objects in various imaging processes. Right now, I am starting off with a preliminary, artificial model. I am using Keras to accomplish this.

I create artificial ideal data as a set of circles in random locations in a 128 x 128 image. I then have a routine that takes the coordinates and sizes of these circles as input and replaces the circles with ellipses at the same locations.

I am trying to train a convolutional neural network to perform the inverse of this function, i.e. read the images with ellipses as input and replace them with circles. I create training pairs by grouping these two image types together with the images with ellipses as inputs and the images with circles as outputs.

How can I design a neural network which accomplishes this? Right now, the one that I am using merely returns distorted copies of the images of ellipses instead of outputting images with circles.

I have played around with multiple different CNN structures, as you can see in the commented-out code:

model = Sequential()

#model.add(Dense(10, activation = 'relu', input_shape = (80, 128, 128, )))
model.add(Conv2D(nb_classes, kernel_size=3, padding = 'same',
                 activation='relu',
                 input_shape=(128,128,1)))
#model.add(MaxPooling2D(pool_size=(2, 2), padding='same'))
model.add(Conv2D(32, kernel_size = 3, activation='relu', padding = 'same'))
#model.add(MaxPooling2D(pool_size=(2, 2), padding='same'))
#model.add(Dropout(0.25))
#model.add(Flatten())
#model.add(Dense(128, activation='relu'))
#model.add(Dropout(0.5))
#model.add(Conv2D(32, (3, 3), activation='relu', padding='same'))

#model.add(UpSampling2D((4,4)))

model.add(Conv2D(nb_classes, (3, 3), activation = 'relu', padding='same'))
#model.add(Dense(10, activation = 'relu', input_shape = (128, 128,)))
model.add(Activation('softmax'))
$\endgroup$
  • $\begingroup$ You should rather use classical methods to transform the ellipses. I my opinion it makes no sense to do something like this with neural networks. But it is an interesting task if you want to play around with neural networks. $\endgroup$ – MachineLearner Aug 9 '19 at 8:02
0
$\begingroup$

Use your generated images to train an encoder-decoder that attempts to rebuild the input image. We'll call these pieces the input encoder and ellipse decoder. In parallel, train a second decoder that takes the input encoder (i.e. embedding representation) as input and attempts to rebuild the original circle image. The input encoder + circle decoder can then be used together for scoring out-of-sample observations.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Thank you! I will try to learn what encoders and decoders are and then implement this as a solution. $\endgroup$ – 2017Algebraist Jul 10 '19 at 7:52
0
$\begingroup$

The principle of your model would be analogous to the one of a Denoising Autoencoder. In this kind of Autoencoders, you train a Network to reconstruct an image from a deteriorated version of it.

You need something similar to that: training a convolutional Autoencoder to "get a circle out of an input ellipse".

You can take a look at this implementation of a Denoising Autoencoder on the Keras website. I think that's a good start.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.