# How to understand this schematic?

Hello,

I’m a pytorch beginner and also new to CNNs. I’m trying to apply a model from a paper to my problem, however I get very poor results (R² = 0.1 for regression). I think I don’t understand the schematic drawing of the CNN used in the paper. Could you please help me understand it?

This is the schematic of what the authors call convp-20(1x2x2). As input they are using an image with several channels, that represent the principal components. Is my implementation correct?

``````step1 = nn.Sequential(                                                 # in_dim = (n, n_components, 15, 15)
nn.Conv2d(n_components, n_components*20, 2, groups=n_components),  # dim = (n, n_components*20, 14, 14)
nn.BatchNorm2d(n_components*20),
nn.ReLU(),
nn.MaxPool2d(2),                                                   # dim = (n, n_components, 7, 7)
)
``````

The next step in the paper is called convp-20(20x2x2). This comes immediately after convp-20(1x2x2) and is repeated 3 times. Is my Implementation correct? I’m very unsure about this step.

``````step2 = nn.Sequential(
nn.Conv2d(n_components*20, n_components, 2, groups=n_components),  # dim = (n, n_components, 6, 6)
nn.BatchNorm2d(n_components),
nn.ReLU(),
nn.MaxPool2d(2),                                                   # dim = (n, n_components, 3, 3)
)
``````

As final layer they use this. I think my code should be correct?

``````step_final = nn.Sequential(
nn.Flatten(),
nn.Linear(20*3*3, 1)  # I want to use regression instead of classification
)
``````

If you want to read the paper, you can find it here and look under the section “4. 2D-CNN with Principal Components”