CNN in result CNN

randinoo: <p>it’s possible  to work with patches (5,5) with 8 conv layer ?</p>
<p>yes or no? plzz</p>

ptrblck: <p>I’m not sure what the <code>5x5</code> patches mean exactly, but if this would be the input shape then no, it won’t be possible, since you are reducing the spatial size via the max pooling layers, which would create an empty tensor at one point or fail in a conv layer, since the activation shape would be smaller than the conv kernel.</p>

randinoo: <p>it’s correct or no <a class="mention" href="/u/ptrblck">@ptrblck</a>???</p>

ptrblck: <p>The screenshot seems to show another model, as the initial one had 3 pooling layers, while the current one would work and use an activation of a single pixel for the majority of the layers.<br>
If the training, validation, and test accuracy is sufficiently high, I would claim that your model works.</p>
<aside class="quote no-group quote-post-not-found" data-username="randinoo" data-post="3" data-topic="121437">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/r/c5a1d2/48.png" class="avatar"> randinoo:</div>
<blockquote>
<p>if the code does not work, gives a result 100% no?</p>
</blockquote>
</aside>
<p>Not necessarily. If the training accuracy is at 100%, while the validation accuracy is going down or generally shows a gap, your model would be overfitting. If the train, val, and test accuracies are all at 100%, I would be concerned about a data leak and would try to increase the dataset, since your are not getting a valid signal from the training.</p>

ptrblck: <p>I don’t understand the last question. Could you explain a bit more what the concern about the kernel and activation shapes is as well as what the <code>feature</code> would mean?</p>

ptrblck: <p>The kernel size and number of kernels are defined by the user, so you can change it to whatever works for your use case. The posted shapes are described in a variety of papers, which often claim superior performance using e.g. a kernel size of <code>3x3</code>.</p>

randinoo: <p>hi <a class="mention" href="/u/ptrblck">@ptrblck</a> , when i increase the kernel size, the performance increases?</p>
<p>concerning the number of fealter, when I increase the number of fealter gives more precise characteristics of fealter??</p>

ptrblck: <p>Changing the hyperparameters such as the kernel size and number of kernels can increase or decrease the performance and depends on the model architecture as well as your use case, so I don’t think you can generalize it via your statements.<br>
You could try to derive some insights about the number of filters, thus number of parameters, and the related “capacity” of the model.</p>

ptrblck: <p>I’m not sure what the exact question is.<br>
As mentioned before, the channels as well as the kernel size can be picked by the user and is one step of defining the model architecture. I would not claim that one approach is superior to another one, as model architectures change a lot and these kind of general claims might be bogus after a while.<br>
If you are not sure which setup to use, I would recommend to start with a known architecture such as a ResNet and use it’s setup.</p>

randinoo: <p><a class="mention" href="/u/ptrblck">@ptrblck</a> how  I chose the number of kernel size and number of feature of the entry?</p>

ptrblck: <p>The <code>in_channels</code> are defined by the number of channels in the input tensor for the first conv layer and can be picked for the <code>out_channels</code> as well as the following layers.<br>
The kernel size can be picked by the user as long as it’s larger than the spatial size of the input.</p>

randinoo: <p>thank you <a class="mention" href="/u/ptrblck">@ptrblck</a>  <img src="https://discuss.pytorch.org/images/emoji/apple/blush.png?v=9" title=":blush:" class="emoji" alt=":blush:"> <img src="https://discuss.pytorch.org/images/emoji/apple/blush.png?v=9" title=":blush:" class="emoji" alt=":blush:"> <img src="https://discuss.pytorch.org/images/emoji/apple/blush.png?v=9" title=":blush:" class="emoji" alt=":blush:"></p>

ptrblck: <p>Both can improve or reduce the performance.<br>
As described before, the model performance depends on the general architecture and you, as the researcher, would have to run experiments to see which kernel sizes, number or kernels, and other hyperparamters work well for your use case.<br>
If there would be a general rule such as: the larger the filter, the better the model performance, one could simply use the max. size and would get the best model (which is of course not the case).</p>
<p>I would recommend to start with an online course such as <a href="https://www.fast.ai/">FastAI</a> or any other course which gives a good introduction to ML/DL.</p>

randinoo: <p>But <a class="mention" href="/u/ptrblck">@ptrblck</a>  if image is hperspectral with channel =3 so the number of feature must be big to present the data well?</p>

ptrblck: <p>The number of channels and size of the input image doesn’t necessarily reflect the data domain.<br>
E.g. you could create input images in the shape <code>[3, 224, 224]</code>, which would be completely black for class0 and white for class1. Even though these images have a high dimensionality, the use case is really simple and you could create a perfect “model” by just using:</p>
<pre><code class="lang-python">if input_pixel_value &gt; 0:
    return 1
else:
    return 0
</code></pre>
<p>As you can see, the necessary model architecture depends on the use case and I would be careful in claiming general statements.</p>

randinoo: <p><a class="mention" href="/u/ptrblck">@ptrblck</a>  thank you very much</p>

randinoo: <p><a class="mention" href="/u/ptrblck">@ptrblck</a> just anather question, the kernel size is must be less  or the same as the size of the patch?</p>

ptrblck: <p>Yes, the patches are created based on the kernel size.<br>
Take a look at <a href="https://cs231n.github.io/convolutional-networks/">CS231n</a> for a general overview of DL operations.</p>

randinoo: <p>thank you <a class="mention" href="/u/ptrblck">@ptrblck</a>  <img src="https://discuss.pytorch.org/images/emoji/apple/slightly_smiling_face.png?v=9" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:"> <img src="https://discuss.pytorch.org/images/emoji/apple/slightly_smiling_face.png?v=9" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:"> <img src="https://discuss.pytorch.org/images/emoji/apple/slightly_smiling_face.png?v=9" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:"></p>

randinoo: <p>hi <a class="mention" href="/u/ptrblck">@ptrblck</a> the train percentage is 70% is sufficient??</p>