Experience the power of deep learning with our Kaggle repository! We present a comprehensive implementation of a brain tumor detection model using Convolutional Neural Networks (CNNs) in TensorFlow. Achieving an impressive accuracy of 96%, our code showcases the following steps:🔥🧠
Start by importing necessary libraries for data manipulation, visualization, and model construction with TensorFlow.
Define the dataset path and training/testing directories, and establish the categories for brain tumor types.
Read images from each category in the training directory, create a DataFrame to store image data, and visualize the distribution of tumor types.
Display sample images for each tumor type in a grid of subplots.
Define image dimensions, batch size for training, and the number of training epochs.
Augment the training dataset to improve model generalization using techniques like rotation, shifting, zooming, etc.
Construct a CNN model with convolutional, max pooling, dense, and dropout layers. Compile the model using the Adam optimizer and categorical cross-entropy loss.
Train the model using the training generator, tracking accuracy and loss over epochs. Validate on the test generator as well.
Plot training and validation accuracy/loss curves over epochs to monitor the model's learning progress.
Evaluate the model's performance on the test dataset, calculating test loss and accuracy.
Visualize a confusion matrix to analyze the model's classification performance for each class. Display sample images along with their predicted and true labels.
Calculate precision, recall, and F1-score for each class from the confusion matrix.
Save the trained model to a file for future use or deployment.
Unlock the potential of CNNs for brain tumor detection through our meticulous implementation, demonstrating the remarkable capabilities of deep learning in the medical field. Detect with confidence, predict with precision! 🧠🔍🤖