[home] [coding projects] [research projects]
Depth, architecture, and optimizer experiments on CIFAR-10.
This project moves the same experimental style to image classification on CIFAR-10. A custom convolutional network is compared across depth, against ResNet-18, and under SGD versus Adam. Training augmentation is deliberately kept separate from validation/test preprocessing.
The code computes channel means and standard deviations from the selected training subset, then uses random horizontal flips, rotations, and padded random crops only for training. Validation and test data receive normalization but no augmentation.
class SimpleCNN(nn.Module):
def __init__(self, depth=2):
super().__init__()
self.module1 = ConvBlock(
3, 32, depth, stride=1
)
self.module2 = ConvBlock(
32, 64, depth, stride=2
)
self.module3 = ConvBlock(
64, 128, depth, stride=2
)
self.global_pool = nn.AdaptiveAvgPool2d((1, 1))
self.fc = nn.Linear(128, 10)
def forward(self, x):
x = self.module1(x)
x = self.module2(x)
x = self.module3(x)
x = self.global_pool(x)
x = x.view(x.size(0), -1)
return self.fc(x)
Each convolutional block is a configurable number of Conv2d → BatchNorm → ReLU layers. Downsampling happens by stride rather than an explicit pooling layer, and the classifier uses global average pooling before the final ten-way linear layer.
Experiment A changes the number of convolutional layers per module. Experiment B compares the deeper custom CNN with a randomly initialized ResNet-18. Experiment C keeps the architecture fixed and changes the optimizer. In the accompanying report, depth improves accuracy with some added instability, ResNet mainly improves early optimization smoothness, and Adam converges faster within the limited training budget.






These pages are selective technical manuals: enough source to expose the mechanism, not a mirror of the entire repository.
Last updated: September 14, 2026.