1
$\begingroup$

I want to implement a convolutional neural network using the tiny-cnn implmentation for c++. I have downloaded it and tried the MNIST example in there, but I'm having trouble implementing it for my own use.

My input is a gray image, just line the MNIST. But unlike the MNIST problem, in which the output of the network is 10 numbers (probability for each digit), I want my output to be a gray level image in the size of the original image (I want to use it for detection certain objects in the image). I already have the desired output images (so I can use them to train the network), but I'm not sure how to construct the network. For example, the MNIST network in the git example was contructed like this:

nn << convolutional_layer<tan_h>(32, 32, 5, 1, 6) // 32x32 in, 5x5 kernel, 1-6 fmaps conv
   << average_pooling_layer<tan_h>(28, 28, 6, 2) // 28x28 in, 6 fmaps, 2x2 subsampling
   << convolutional_layer<tan_h>(14, 14, 5, 6, 16,
                                 connection_table(connection, 6, 16)) // with connection-table
   << average_pooling_layer<tan_h>(10, 10, 16, 2)
   << convolutional_layer<tan_h>(5, 5, 5, 16, 120)
   << fully_connected_layer<tan_h>(120, 10);

What layers should I have in my network? How should I know? Does someone have an example for what I am looking for?

$\endgroup$

1 Answer 1

1
$\begingroup$

I think you expect that the network outputs 1 to the region of specific object and 0 to the other areas. Or maybe you think it will put a single 1 to the input image where it is center (or someting similar) of desired object. If you are on object detection problem, I suggest you to use bounding box method. This method iteratively slide on input image and search for specific object.

I'm explaining the problem as you are only searcing for a specific object rather than annotating $ n$ objects, but you can generalize it.

1-) From input images, crop patches which includes specific object you want to find, and label them as 1. Also crop many other parts of the images and label them as 0. If you have ground truth of these objects it will be easy to do this part.

2-) As you are using NN, inputs feed to it should be the same size, so resize each cropped pacthes to the same size.

3-) Learn a model with NN which classifies input images whether it has a specific object or not. Now, the problem is similar to MNIST. You only need 2 outputs which indicates presence of an object.

4-) In order to test an image, crop $ mxm $ sections from the image and resize it to the network's input, and collect outputs. Iteratively do this step for all possible $ mxm$ sections. This method known as bounding box and it provides a map of the object presence.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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