<p>If i understood the article, they are building an autoencoder to <strong>denoise</strong> the data in order to classify it later by adding some layers on top of it. In your case, i'm not sure the autoencoder structure is necessary as you just want to classify your texture.</p>

<p>If you want to keep your idea of using a metric to choose the textures that are the most similar to the one provided, you can for example use a strategy similar as <a href="https://arxiv.org/pdf/1511.05879.pdf" rel="nofollow noreferrer">this</a> (R-MAC method).</p>
Is this the adequate topology for my neural network?
<p>I'm trying to develop a CBIR (Content Based Image Retrieval) system for textures. My approach right now, due to the huge numer of clases and the unlabeled data, is to use an autoencoder in order to extract the features and and then use cosine similarity in order to choose the textures that are the most similar to the one provided. I have made some test and the idea seems to work fine but I'm having lots of problems with the design of the NN. I'm using a convulational autoencoder that right now looks like this: </p>

<pre><code>_________________________________________________________________
Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
e_conv1 (Conv2D)             (None, 128, 128, 32)      320       
_________________________________________________________________
e_pool1 (MaxPooling2D)       (None, 64, 64, 32)        0         
_________________________________________________________________
e_conv2 (Conv2D)             (None, 64, 64, 16)        4624      
_________________________________________________________________
e_pool2 (MaxPooling2D)       (None, 32, 32, 16)        0         
_________________________________________________________________
e_conv3 (Conv2D)             (None, 32, 32, 16)        2320      
_________________________________________________________________
e_pool3 (MaxPooling2D)       (None, 16, 16, 16)        0         
_________________________________________________________________
e_conv41 (Conv2D)            (None, 16, 16, 8)         1160      
_________________________________________________________________
e_pool4 (MaxPooling2D)       (None, 8, 8, 8)           0         
_________________________________________________________________
e_conv42 (Conv2D)            (None, 8, 8, 8)           584       
_________________________________________________________________
e_pool42 (MaxPooling2D)      (None, 4, 4, 8)           0         
_________________________________________________________________
e_conv43 (Conv2D)            (None, 4, 4, 8)           584       
_________________________________________________________________
flatten (Flatten)            (None, 128)               0         
_________________________________________________________________
reshape (Reshape)            (None, 4, 4, 8)           0         
_________________________________________________________________
d_conv00 (Conv2D)            (None, 4, 4, 8)           584       
_________________________________________________________________
d_pool01 (UpSampling2D)      (None, 8, 8, 8)           0         
_________________________________________________________________
d_conv01 (Conv2D)            (None, 8, 8, 8)           584       
_________________________________________________________________
d_pool0 (UpSampling2D)       (None, 16, 16, 8)         0         
_________________________________________________________________
d_conv02 (Conv2D)            (None, 16, 16, 8)         584       
_________________________________________________________________
d_pool1 (UpSampling2D)       (None, 32, 32, 8)         0         
_________________________________________________________________
d_conv1 (Conv2D)             (None, 32, 32, 16)        1168      
_________________________________________________________________
d_pool2 (UpSampling2D)       (None, 64, 64, 16)        0         
_________________________________________________________________
d_conv2 (Conv2D)             (None, 64, 64, 16)        2320      
_________________________________________________________________
d_pool3 (UpSampling2D)       (None, 128, 128, 16)      0         
_________________________________________________________________
d_conv3 (Conv2D)             (None, 128, 128, 32)      4640      
_________________________________________________________________
logits (Conv2D)              (None, 128, 128, 1)       289       
=================================================================
Total params: 19,761
Trainable params: 19,761
Non-trainable params: 0
_________________________________________________________________
</code></pre>

<p>The optimizer is adam and the loss function mse. The images that I'm using right now are in gray scale in order to be able to make test faster. I'm using the keras api for making tests. The input images size is 128x128 but the original images are between 500x500 and 1700x1700.</p>

<p>The biggest problem I'm facing right now is that the network is not learning high level features, it just learn positions and it's gray value. The texture details are really small and the result (the decoded image) seems a blurred version of the input one that do not seem to work for it's clasification. I'm not sure how I should design the NN because I have not found any guide that explains how to combine multiple layers to reach the desired result (but I have found lots of tutorials that explain how does each individual layer work).
<a href="https://i.stack.imgur.com/WGOdX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WGOdX.png" alt=""></a>
This image is in color and 32x32 because it is from first tests, but in gray scale and with more than 1000 textures this won't work due to it's blurriness.</p>

<p>Another doubt that I have is that I'm not sure if for the training I should use the same image for the input and output or if I should use diferent images of the same texture. I think that this should force the NN to learn high level features but I'm not sure if this will work.</p>

<p>Other problem I'm having is that right now I do not have an adequate computer that allows me to make test with a well trained NN (soon I will have one, right now I'm using a free k80 on google colaboratory) so I'm not sure if the bads results are due to a bad design or to a lack of training. The neural network learns first low level features and the it learns slowly the high level ones or should learn directly the high level ones? I also have found that at the end of the encoding about a third of it's features have a value of 0 (in all the textures in the same position) and this does not seem right to me. Is this normal? Should more training allow this features to get a value? May this be related wit the problem with dying relu nodes?</p>

<p><strong>EDIT1:</strong>
If you want to know what I'm trying to do with more detail I found <a href="https://hackernoon.com/a-deep-convolutional-denoising-autoencoder-for-image-classification-26c777d3b88e" rel="nofollow noreferrer">this</a>
article some days ago in which the author has the same probles as me and take the same aproach to solve them. The only thing you have to do is to substitute "magic card" by texture. My data is composed of 20000 images of different sizes and between 1000 and 5000 different types of textures.</p>