Skip to content

shruthikha/brain_tumor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Image Classification using VGG16 (Transfer Learning)

This project implements an image classification pipeline using PyTorch and a pre-trained VGG16 model. The code uses transfer learning to classify grayscale images into multiple classes, based on a custom dataset structured in folders.


πŸ“ Dataset Structure

The dataset should follow the format:

πŸ“‚ dataset_root/ β”œβ”€β”€ πŸ“‚ Training/ β”‚ β”œβ”€β”€ πŸ“‚ Class1/ β”‚ β”œβ”€β”€ πŸ“‚ Class2/ β”‚ └── ... └── πŸ“‚ Testing/ β”œβ”€β”€ πŸ“‚ Class1/ β”œβ”€β”€ πŸ“‚ Class2/ └── ...

Each class folder should contain the respective images.

βš™οΈ Requirements

Install the required libraries using:

pip install torch torchvision scikit-learn matplotlib seaborn

πŸš€ How to Run Set the dataset paths in the script:

train_folder_path = "path/to/Training" test_folder_path = "path/to/Testing"

Run the script:

python main.py

The script will:

Preprocess the data (resize, convert to 3 channels, normalize)

Train a VGG16 model for 10 epochs

Save and reload the trained model

Predict on the test set

Display a confusion matrix

Print the classification report

Model Details Backbone: VGG16 (pre-trained on ImageNet)

Modification: Final classifier layer adapted to number of classes

Input: Grayscale images resized to 224x224 and converted to 3-channel

Loss Function: CrossEntropyLoss

Optimizer: Adam

Output Loss per epoch

Confusion matrix (displayed using Seaborn)

Classification report (precision, recall, F1-score for each class)

✨ Author Shruthikha Suresh Feel free to reach out for collaboration or questions!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages