|
4 | 4 | Multi-layer perceptron model for image classification. |
5 | 5 | """ |
6 | 6 |
|
7 | | -# class NeuronLayer(nn.Module): |
8 | | -# def __init__(self, in_features, out_features): |
9 | | -# super().__init__() |
10 | | - |
11 | | -# self.fc = nn.Linear(in_features, out_features) |
12 | | -# self.relu = nn.ReLU() |
13 | | - |
14 | | -# def forward(self, x): |
15 | | -# x = self.fc(x) |
16 | | -# x = self.relu(x) |
17 | | -# return x |
18 | | - |
19 | 7 |
|
20 | 8 | class JohanModel(nn.Module): |
21 | 9 | """Small MLP model for image classification. |
22 | 10 |
|
23 | 11 | Parameters |
24 | 12 | ---------- |
25 | | - in_features : int |
26 | | - Numer of input features. |
| 13 | + image_shape : tuple(int, int, int) |
| 14 | + Shape of the input image (C, H, W). |
27 | 15 | num_classes : int |
28 | 16 | Number of classes in the dataset. |
| 17 | + |
| 18 | + Processing Images |
| 19 | + ----------------- |
| 20 | + Input: (N, C, H, W) |
| 21 | + N: Batch size |
| 22 | + C: Number of input channels |
| 23 | + H: Height of the input image |
| 24 | + W: Width of the input image |
| 25 | + |
| 26 | + Example: |
| 27 | + Grayscale images (like MNIST) have C = 1. |
| 28 | + Input shape: (N, 1, 28, 28) |
| 29 | + fc1 Output shape: (N, 77) |
| 30 | + fc2 Output shape: (N, 77) |
| 31 | + fc3 Output shape: (N, 77) |
| 32 | + fc4 Output shape: (N, num_classes) |
29 | 33 | """ |
30 | 34 |
|
31 | 35 | def __init__(self, image_shape, num_classes): |
|
0 commit comments