
Weekend Showcase Challenge: Exploring Convolutional Layers
This is a CNN project exploring how convolutional layers and kernel size affect image classification, followed by training and deployment with Amazon SageMaker.
Weekend Showcase Challenge: Exploring Convolutional Layers
From CNN Experiments to AWS Deployment
This project started with a simple question: how much do convolutional architecture choices actually matter for image classification?
Instead of treating a Convolutional Neural Network (CNN) as a black box, I wanted to understand how its architecture affects learning, model complexity, and generalization. I used the EuroSAT RGB satellite imagery dataset to compare a fully connected neural network against CNN architectures and then experimented with different convolutional kernel sizes.
After identifying the best-performing configuration, I took the experiment beyond a local notebook by training and deploying the model using Amazon SageMaker, with data stored in Amazon S3.
The Problem
Image classification is not only about choosing a neural network and training it. The architecture itself introduces assumptions about the structure of the data.
A fully connected network can process an image after flattening its pixels, but this removes much of the spatial structure of the original image. CNNs introduce a spatial inductive bias by learning local patterns such as edges, textures, and shapes.
The goal of this project was therefore to experimentally investigate:
- How much does a CNN improve over a fully connected baseline?
- Does increasing convolutional kernel size improve performance?
- How does additional model complexity affect generalization?
- Can the resulting ML workflow be trained and deployed using AWS?
Dataset
I used EuroSAT RGB, a dataset containing 27,000 satellite images across 10 land-use and land-cover classes.
Each image is 64×64 pixels with three RGB channels. The dataset includes classes such as Forest, AnnualCrop, Residential, Highway, River, and SeaLake.
The images were normalized from the
[0, 255] range to [0, 1] before training.The dataset was a good fit for this experiment because satellite imagery contains spatial patterns and textures that convolutional layers are designed to capture.
Experimenting with CNN Architecture
I first created a fully connected baseline using flattened 64×64×3 images.
The baseline achieved 56.37% validation accuracy with 1,581,898 parameters.
I then introduced a CNN consisting of two convolutional layers, max-pooling layers, and fully connected classification layers.
The CNN with 3×3 kernels achieved:
- 81.11% validation accuracy
- 96.82% final training accuracy
- 1,068,682 parameters
This represented a 24.74 percentage-point improvement in validation accuracy over the fully connected baseline, while using fewer parameters.
The results demonstrated the importance of convolutional inductive bias. Instead of treating pixels as independent features, the CNN could learn spatially meaningful representations.
Kernel Size Experiment
The next step was to investigate whether larger convolutional kernels would improve the model.
I tested 3×3, 5×5, and 7×7 kernels while keeping the rest of the architecture consistent.
Kernel | Parameters | Validation Accuracy |
|---|---|---|
3×3 | 1,068,682 | 81.11% |
5×5 | 1,102,986 | 78.87% |
7×7 | 1,154,442 | 76.85% |
The result was not what simply increasing the receptive field might suggest.
The 3×3 configuration performed best, despite having the fewest parameters.
The larger kernels increased model complexity but did not improve validation performance. The 7×7 model also showed a larger gap between training and validation performance, suggesting increased overfitting.
For this dataset and architecture, the 3×3 kernel provided the best balance between model complexity and generalization.
Taking the Experiment to AWS
Once the experiments were complete, I wanted to move beyond local experimentation and run the ML workflow using AWS infrastructure.
The workflow was:
EuroSAT → TFRecord → Amazon S3 → Amazon SageMaker Training Job → Model Artifact → SageMaker Endpoint → Inference
I used Amazon S3 to store the prepared TFRecord datasets and model artifacts.
Amazon SageMaker was used to train the TensorFlow model and deploy the resulting model to an inference endpoint.
The training workflow uses the SageMaker TensorFlow Estimator in Script Mode with TensorFlow 2.14.
The project contains separate scripts for preparing the dataset and executing the training job, making the cloud workflow easier to reproduce.
Architecture
The overall architecture can be summarized as:
EuroSAT Dataset | vDataset Preparation | vTFRecord Files | vAmazon S3 | vAmazon SageMakerTraining Job | vTrained Model | vSageMaker Endpoint | vImage Inference
This was an important part of the project because it connected the experimentation side of machine learning with the infrastructure required to train and serve a model in the cloud.
What I Learned
The biggest lesson from this project was that more complexity does not automatically mean better performance.
The kernel experiment showed that the 3×3 configuration outperformed the larger kernels while using fewer parameters. This reinforced the importance of understanding the inductive biases introduced by different architectures instead of simply increasing model capacity.
I also gained experience moving an ML project through several stages:
Experimentation → Data Preparation → Cloud Training → Model Deployment → Inference
Using SageMaker helped me understand how a model developed in a notebook can be connected to cloud infrastructure for training and deployment.
More broadly, this project changed the way I approach neural network architectures. Instead of asking only "Which model should I use?", I started asking "Why should this architecture work for this type of data?"
What's Next
There are several directions I would like to explore next, including data augmentation, batch normalization, dropout, transfer learning, confusion matrix analysis, and comparison with pretrained models.
These experiments could help determine whether the observations from the current architecture generalize to more advanced approaches.
Project
The complete implementation, experiments, and SageMaker scripts are available on GitHub:
Thanks to @benfowleraws for organizing the Summer Builds Showcase and for inspiring builders to take their projects further.
This project was my way of turning a question about CNN architecture into an experiment, and then taking that experiment one step further into AWS.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article