π 5 Mistakes I Made in My First CNN Project
machinelearning #deeplearning #cnn #ai
π I Thought My Model Was Working... Until I Looked Closer
When I built my first CNN model for brain tumor classification using MRI images, I initially felt pretty confident.
The code was running.
The model was training.
The accuracy looked reasonable.
And predictions were being generated.
The model was classifying images into:
- Glioma
- Meningioma
- Pituitary
- No Tumor
So I assumed everything was working.
Then I started looking beyond the overall accuracy.
That's when I realized:
A model can appear to work while still having important problems underneath.
Here are five mistakes that taught me more than simply getting the model to train.
β Mistake 1: Not Understanding Class Distribution
One of the first things I should have checked more carefully was the distribution of images across the four classes.
I should have asked:
- How many images are available for each class?
- Are the classes reasonably balanced?
- Are some classes significantly underrepresented?
- Could class distribution affect the metrics I'm seeing?
Instead, I focused on getting the CNN running.
What I learned
If one class has substantially more samples than another, overall accuracy may not tell the complete story.
A model can perform well overall while performing poorly on a less represented class.
Lesson
Understand the distribution of your data before interpreting your model's performance.
β Mistake 2: Increasing Model Complexity Without a Clear Reason
I initially had a simple assumption:
"More layers should give the model more ability to distinguish all four classes."
So I experimented with increasing the model's complexity.
The problem wasn't experimenting.
The problem was adding complexity without a clear hypothesis about what I was trying to improve.
What I observed
- Training performance improved
- Validation performance did not improve accordingly
- The gap between training and validation became more noticeable
That was a sign that the model could fit the training data better without necessarily generalizing better.
Lesson
A more complex model isn't automatically a better model.
Architecture changes should have a reason behind them.
β Mistake 3: Trusting Overall Accuracy Too Much
This was probably one of my biggest mistakes.
When I saw a decent overall accuracy, my first reaction was:
"The model is working well."
But I wasn't asking enough questions about how that accuracy was achieved.
I needed to look at things such as:
- Class-wise performance
- Confusion matrix
- Precision
- Recall
- F1-score
- Which classes were being confused
For example, the model showed confusion between some of the tumor categories.
That made me realize that:
Overall accuracy is only one view of model performance.
Lesson
For a multi-class classification problem, don't stop at:
"What percentage did the model get correct?"
Also ask:
"Which classes is the model getting wrong, and how often?"
β Mistake 4: Choosing Hyperparameters Without Understanding Them
Another mistake was treating hyperparameters almost like fixed values that could simply be copied from another implementation.
I experimented with things such as:
- Learning rate
- Batch size
- Number of epochs
- Model architecture
But initially, I didn't understand enough about why I was choosing those values.
What changed
I started treating each experiment as something I should be able to explain.
Instead of:
"This configuration worked for someone else, so I'll use it."
I started thinking:
"What am I changing, why am I changing it, and what effect should I expect?"
Lesson
Don't copy hyperparameters blindly. Understand what you're changing and evaluate the result.
There isn't one universally correct learning rate, batch size, or number of epochs for every CNN project.
β Mistake 5: Not Visualizing the MRI Data Early Enough
This sounds simple, but it was one of the most useful lessons.
I should have spent more time looking at the actual images before focusing on the model.
I wanted the CNN to discover the patterns.
But first, I needed to understand the data myself.
I started looking more closely at:
- Differences between classes
- Image quality
- Visual patterns
- Tumor locations
- Similarities between categories
π§ What I Should Have Observed Earlier
Some categories can contain visually similar patterns.
That doesn't mean a human can simply look at an MRI and make the correct classification.
It means that the visual characteristics of the dataset matter when you're trying to understand where a model may struggle.
Lesson
Visualize your data before asking your model to learn from it.
π§ What Changed After These Mistakes
The biggest change wasn't one particular model architecture.
It was my approach to experimentation.
I started doing more of this:
Understand β Experiment β Evaluate β Question β Improve
Instead of:
Build β Train β Check Accuracy β Done
I became more interested in questions like:
- Why did validation performance change?
- Which class is causing the problem?
- Is the model overfitting?
- Did the preprocessing actually help?
- Did the architectural change improve generalization?
- What does the confusion matrix tell me that accuracy doesn't?
π― My Biggest Takeaway
Multi-class classification isn't simply:
"Binary classification + more classes."
Each additional class introduces more opportunities for confusion and makes evaluation more important.
And perhaps the most useful lesson from this project was:
A model doesn't become reliable just because it trains successfully.
Training is only the beginning.
π Part of My CNN Learning Series
This is the second post in my CNN learning series.
π§ Part 1 β What My First CNN Project Taught Me
β οΈ Part 2 β 5 Mistakes I Made in My First CNN Project
You're reading this one.
βοΈ Part 3 β How I Built the CNN Model
Coming next.
π Part 4 β Understanding Model Predictions with Grad-CAM
Coming later.
π Project Reference
The project discussed in this article is part of my brain tumor detection and classification project.
π GitHub Repository
The project includes:
- MRI image preprocessing
- CNN-based classification
- Binary and multi-class experiments
- Model evaluation
- Grad-CAM explainability
- Streamlit interface
Note: This project is an academic/learning project and is not intended to replace professional medical diagnosis.
π Let's Connect
I'm continuing to learn machine learning by building practical projects and documenting what I learn along the way.
If you're also working with CNNs, computer vision, or deep learning, I'd be interested to hear about your experience.
π Portfolio
π» GitHub
πΌ LinkedIn
Thanks for Reading!




Top comments (0)